Reply by ksdoubleshooter March 16, 20092009-03-16
An understanding of what happens when an interrupt is serviced will certainly help -- as will peeking into the startup file.

Jeff

--- In l..., "WadeA & RebeccaM Smith" wrote:
>
> As Martin said, "if you use ctl_set_isr, ctl_unmask_isr etc"...
>
> I took the bare bones examples from Rowley and put them all together and the Rowley magic in "ctl_*()" works as advertised.
>
> Now, why didn't *MY* version with VIC calls and "__attrribute..." work?
> I dunno. THAT was my original question. *I* thought what I had should have worked. It didn't, so I came crying to this wonderful, helpful group for help. And after many vain attempts, I threw it all out and started over.
>
> I got the 2 uarts working, added the two timers and added RTC and then added my Serial Motor driver. It works!
>
> Maybe some day when I feel real morbid I may try to get the "manual" version of setting up the VIC, etc working. Which would be nice it I wanted to abandon Rowley libraries and go GCC all the way.
>
> But that would lead me to Eclipse and I have "issues" with the current version that I downloaded. (I can set up a new project but I cannot find how to modify it nor add to it. But I'll look through the archives before I ask THAT question.)
>
> wade
>
> --- In l..., "J.C. Wren" wrote:
> >
> > So what's different? Why does it work?
> >
> > --jc
> >
> > On Thu, Mar 12, 2009 at 7:50 AM, WadeA & RebeccaM Smith
> > wrote:
> >
> > > SUCCESS!
> > >
> > > I took the Crossfire2138 UART example and got both UARTs running.
> > > I added the Crossfire2138 timer example (sets up both timers) and then
> > > added the RTC. No muss, no fuss.
> > >
> > > It works just like you said. All this AND I haven't even reached retirement
> > > age yet! 8-)
> > >
> > > wade
> > >
> > >
> > > --- In l... ,
> > > "mjames_doveridge" wrote:
> > > >
> > > > --- In l... , "WadeA &
> > > RebeccaM Smith" wrote:
> > > > >
> > > > > My sediments (or is that sentiments) exactly.
> > > > >
> > > > > Do you have a suggestion?
> > > > >
> > > > > Initially I want:
> > > > > Timer0
> > > > > RTC
> > > > > Uart0 Comm to outside world
> > > > > Uart1 Comm to Pololu Low Voltage Dual Serial Motor Controller
> > > > >
> > > > > Later I want
> > > > > i2c i/o
> > > > > spi i/o
> > > > >
> > > > > Possibly AD and PWM later, but there arent too many pins avaiable on
> > > the 24 or 48 pins coming out (NewMicros Tini2138 has 24 pins Pluga2138 has
> > > 48 pins).
> > > >
> > > > IME, if you use ctl_set_isr, ctl_unmask_isr etc then, as others have
> > > said, you should not get bogged down in these stroppy interrupts.
> > > >
> > > > I have had no problem with the interrupts on my Crossworks/LPC2129
> > > system. To my great relief, the interrupt handlers for UARTs, CAN, timers,
> > > capture/match all worked just about straightaway. Sure, there were crashes
> > > afterwards due to my bugs, but the actual entry/exit from the handlers just
> > > worked. Even my FIQ interrupt for the SPI/SD card worked, (OK, with help
> > > from the experienced engineers in this group:). I do not use the A/D at the
> > > moment.
> > > >
> > > > I do use the ctl OS, but from others' posts, the above 'ctl' calls work
> > > fine without the ctl kernel, (not really surprising, since they just set up
> > > the interrupts).
> > > >
> > > > If you are not too old, you *should* be able to get the interrupts going
> > > reliably before you snuff it
> > > >
> > > > Be sure to make a will and leave all your bugs to the taxman.
> > > >
> > > > Rgds,
> > > > Martin
> > > >
> > >
> > >
> > >
> >
> >
> >
>

An Engineer's Guide to the LPC2100 Series

Reply by WadeA & RebeccaM Smith March 12, 20092009-03-12
As Martin said, "if you use ctl_set_isr, ctl_unmask_isr etc"...

I took the bare bones examples from Rowley and put them all together and the Rowley magic in "ctl_*()" works as advertised.

Now, why didn't *MY* version with VIC calls and "__attrribute..." work?
I dunno. THAT was my original question. *I* thought what I had should have worked. It didn't, so I came crying to this wonderful, helpful group for help. And after many vain attempts, I threw it all out and started over.

I got the 2 uarts working, added the two timers and added RTC and then added my Serial Motor driver. It works!

Maybe some day when I feel real morbid I may try to get the "manual" version of setting up the VIC, etc working. Which would be nice it I wanted to abandon Rowley libraries and go GCC all the way.

But that would lead me to Eclipse and I have "issues" with the current version that I downloaded. (I can set up a new project but I cannot find how to modify it nor add to it. But I'll look through the archives before I ask THAT question.)

wade

--- In l..., "J.C. Wren" wrote:
>
> So what's different? Why does it work?
>
> --jc
>
> On Thu, Mar 12, 2009 at 7:50 AM, WadeA & RebeccaM Smith
> wrote:
>
> > SUCCESS!
> >
> > I took the Crossfire2138 UART example and got both UARTs running.
> > I added the Crossfire2138 timer example (sets up both timers) and then
> > added the RTC. No muss, no fuss.
> >
> > It works just like you said. All this AND I haven't even reached retirement
> > age yet! 8-)
> >
> > wade
> >
> >
> > --- In l... ,
> > "mjames_doveridge" wrote:
> > >
> > > --- In l... , "WadeA &
> > RebeccaM Smith" wrote:
> > > >
> > > > My sediments (or is that sentiments) exactly.
> > > >
> > > > Do you have a suggestion?
> > > >
> > > > Initially I want:
> > > > Timer0
> > > > RTC
> > > > Uart0 Comm to outside world
> > > > Uart1 Comm to Pololu Low Voltage Dual Serial Motor Controller
> > > >
> > > > Later I want
> > > > i2c i/o
> > > > spi i/o
> > > >
> > > > Possibly AD and PWM later, but there arent too many pins avaiable on
> > the 24 or 48 pins coming out (NewMicros Tini2138 has 24 pins Pluga2138 has
> > 48 pins).
> > >
> > > IME, if you use ctl_set_isr, ctl_unmask_isr etc then, as others have
> > said, you should not get bogged down in these stroppy interrupts.
> > >
> > > I have had no problem with the interrupts on my Crossworks/LPC2129
> > system. To my great relief, the interrupt handlers for UARTs, CAN, timers,
> > capture/match all worked just about straightaway. Sure, there were crashes
> > afterwards due to my bugs, but the actual entry/exit from the handlers just
> > worked. Even my FIQ interrupt for the SPI/SD card worked, (OK, with help
> > from the experienced engineers in this group:). I do not use the A/D at the
> > moment.
> > >
> > > I do use the ctl OS, but from others' posts, the above 'ctl' calls work
> > fine without the ctl kernel, (not really surprising, since they just set up
> > the interrupts).
> > >
> > > If you are not too old, you *should* be able to get the interrupts going
> > reliably before you snuff it
> > >
> > > Be sure to make a will and leave all your bugs to the taxman.
> > >
> > > Rgds,
> > > Martin
> > >
> >
> >
> >
>
>

Reply by "J.C. Wren" March 12, 20092009-03-12
So what's different? Why does it work?

--jc

On Thu, Mar 12, 2009 at 7:50 AM, WadeA & RebeccaM Smith
wrote:

> SUCCESS!
>
> I took the Crossfire2138 UART example and got both UARTs running.
> I added the Crossfire2138 timer example (sets up both timers) and then
> added the RTC. No muss, no fuss.
>
> It works just like you said. All this AND I haven't even reached retirement
> age yet! 8-)
>
> wade
> --- In l... ,
> "mjames_doveridge" wrote:
> >
> > --- In l... , "WadeA &
> RebeccaM Smith" wrote:
> > >
> > > My sediments (or is that sentiments) exactly.
> > >
> > > Do you have a suggestion?
> > >
> > > Initially I want:
> > > Timer0
> > > RTC
> > > Uart0 Comm to outside world
> > > Uart1 Comm to Pololu Low Voltage Dual Serial Motor Controller
> > >
> > > Later I want
> > > i2c i/o
> > > spi i/o
> > >
> > > Possibly AD and PWM later, but there arent too many pins avaiable on
> the 24 or 48 pins coming out (NewMicros Tini2138 has 24 pins Pluga2138 has
> 48 pins).
> >
> > IME, if you use ctl_set_isr, ctl_unmask_isr etc then, as others have
> said, you should not get bogged down in these stroppy interrupts.
> >
> > I have had no problem with the interrupts on my Crossworks/LPC2129
> system. To my great relief, the interrupt handlers for UARTs, CAN, timers,
> capture/match all worked just about straightaway. Sure, there were crashes
> afterwards due to my bugs, but the actual entry/exit from the handlers just
> worked. Even my FIQ interrupt for the SPI/SD card worked, (OK, with help
> from the experienced engineers in this group:). I do not use the A/D at the
> moment.
> >
> > I do use the ctl OS, but from others' posts, the above 'ctl' calls work
> fine without the ctl kernel, (not really surprising, since they just set up
> the interrupts).
> >
> > If you are not too old, you *should* be able to get the interrupts going
> reliably before you snuff it
> >
> > Be sure to make a will and leave all your bugs to the taxman.
> >
> > Rgds,
> > Martin
> >
>


Reply by WadeA & RebeccaM Smith March 12, 20092009-03-12
SUCCESS!

I took the Crossfire2138 UART example and got both UARTs running.
I added the Crossfire2138 timer example (sets up both timers) and then added the RTC. No muss, no fuss.

It works just like you said. All this AND I haven't even reached retirement age yet! 8-)

wade

--- In l..., "mjames_doveridge" wrote:
>
> --- In l..., "WadeA & RebeccaM Smith" wrote:
> >
> > My sediments (or is that sentiments) exactly.
> >
> > Do you have a suggestion?
> >
> > Initially I want:
> > Timer0
> > RTC
> > Uart0 Comm to outside world
> > Uart1 Comm to Pololu Low Voltage Dual Serial Motor Controller
> >
> > Later I want
> > i2c i/o
> > spi i/o
> >
> > Possibly AD and PWM later, but there arent too many pins avaiable on the 24 or 48 pins coming out (NewMicros Tini2138 has 24 pins Pluga2138 has 48 pins).
>
> IME, if you use ctl_set_isr, ctl_unmask_isr etc then, as others have said, you should not get bogged down in these stroppy interrupts.
>
> I have had no problem with the interrupts on my Crossworks/LPC2129 system. To my great relief, the interrupt handlers for UARTs, CAN, timers, capture/match all worked just about straightaway. Sure, there were crashes afterwards due to my bugs, but the actual entry/exit from the handlers just worked. Even my FIQ interrupt for the SPI/SD card worked, (OK, with help from the experienced engineers in this group:). I do not use the A/D at the moment.
>
> I do use the ctl OS, but from others' posts, the above 'ctl' calls work fine without the ctl kernel, (not really surprising, since they just set up the interrupts).
>
> If you are not too old, you *should* be able to get the interrupts going reliably before you snuff it Be sure to make a will and leave all your bugs to the taxman.
>
> Rgds,
> Martin
>

Reply by mjames_doveridge March 12, 20092009-03-12
--- In l..., "WadeA & RebeccaM Smith" wrote:
>
> My sediments (or is that sentiments) exactly.
>
> Do you have a suggestion?
>
> Initially I want:
> Timer0
> RTC
> Uart0 Comm to outside world
> Uart1 Comm to Pololu Low Voltage Dual Serial Motor Controller
>
> Later I want
> i2c i/o
> spi i/o
>
> Possibly AD and PWM later, but there arent too many pins avaiable on the 24 or 48 pins coming out (NewMicros Tini2138 has 24 pins Pluga2138 has 48 pins).

IME, if you use ctl_set_isr, ctl_unmask_isr etc then, as others have said, you should not get bogged down in these stroppy interrupts.

I have had no problem with the interrupts on my Crossworks/LPC2129 system. To my great relief, the interrupt handlers for UARTs, CAN, timers, capture/match all worked just about straightaway. Sure, there were crashes afterwards due to my bugs, but the actual entry/exit from the handlers just worked. Even my FIQ interrupt for the SPI/SD card worked, (OK, with help from the experienced engineers in this group:). I do not use the A/D at the moment.

I do use the ctl OS, but from others' posts, the above 'ctl' calls work fine without the ctl kernel, (not really surprising, since they just set up the interrupts).

If you are not too old, you *should* be able to get the interrupts going reliably before you snuff it

Be sure to make a will and leave all your bugs to the taxman.

Rgds,
Martin

Reply by WadeA & RebeccaM Smith March 12, 20092009-03-12
My sediments (or is that sentiments) exactly.

Do you have a suggestion?

Initially I want:
Timer0
RTC
Uart0 Comm to outside world
Uart1 Comm to Pololu Low Voltage Dual Serial Motor Controller

Later I want
i2c i/o
spi i/o

Possibly AD and PWM later, but there arent too many pins avaiable on the 24 or 48 pins coming out (NewMicros Tini2138 has 24 pins Pluga2138 has 48 pins).

I plan on taking the Rowley Crossfire2138 Uart example (again) and getting that to work for both uarts. Then I'll add timer0 and RTC. Then the problem will be moot since I'll probably be dead by the time that happens 30 years from now...at the rate I'm making progress.

(sigh) Making a living in ignorance is a tough job, but somebody's gotta do it and I'm the most qualified. ;-)

But I am still open to suggestions, after all:

"Ignorance is cureable, but stupidity is terminal." -- author unknown

wade

--- In l..., dave@... wrote:
> Lost cause.....time to start over!!!!
>

Reply by dave...@dgtech.com March 11, 20092009-03-11
Lost cause.....time to start over!!!!

> How about I kill off the "__attribute__ ((interrupt ("IRQ")))" and kill
> off the "VECTORED_IRQ_INTERRUPTS"?
>
> Now timer0, RTC and UART0 have no "__attribute__ ((interrupt ("IRQ")))".
>
> UART1 is NOT initialized.
> // ctl_unmask_isr(VIC_CTRL_UART1);
>
> Oh, drat. Now, even with no UART1, dabort!
> From
>
> (breakpoint) initSerMot();
> 1A9C EB0003A6 bl 0x000293C
> timerSleepMS(500); // wait for initSerMot printing to stop
> 1AA0 E3A00F7D mov r0, #0x00001F4
> 1AA4 EB0008E3 bl 0x0003E38
> __ARMLIB_enableIRQ();
> 1AA8 EB000AF8 bl 0x0004690 <__ARMLIB_enableIRQ>
> (breakpoint NEVER REACHED) moveCase = 15;
> 1AAC E59F3160 ldr r3, [pc, #+0x160]
> 1AB0 E3A0200F mov r2, #0x000000F
> 1AB4 E5C32000 strb r2, [r3]
> /* ===================== MAIN LOOP ===================== */
> //esp_printf(&U0OutChar,"\r\nENTERING ROBOT MAIN LOOP\r\n");
> esp_printf(U0OutChar,"\r\nENTERING ROBOT MAIN LOOP\r\n");
> 1AB8 E59F0158 ldr r0, [pc, #+0x158]
> 1ABC E59F1158 ldr r1, [pc, #+0x158]
> 1AC0 EB000258 bl 0x0002428
> 1AC4 EAFFFFFF b 0x0001AC8
>
> --- REGISTERS ---
> CPU - Current Mode
> r0 0x6000005f (really invalid)
> ...
> lr(r14) 0x00001abc
>
> lr contains an address BEYOND the breakpoint set at "movecase = 15;"
> (which is NEVER hit) and esp_printf (from rprintf.c from the web) loads
> 0x6000005f no matter if I put &fnName or just fnName as the first
> parameter.
>
> In other words, things get royally screwed up as soon as IRQ are enabled.
>
> This is all very confusing. I think I'll go back to the way that at least
> allowed UART0 to work...
>
> So, any new ideas?
>
> wade
> --- In l..., "WadeA & RebeccaM Smith"
> wrote:
>>
>> As a matter of fact, I do have VECTORED_IRQ_INTERRUPTS set in Properties
>> (common) Preprocessor Options -> Preprocessor definitions.
>>
>> However, for UART0 it does not matter how I set that. ???
>> I tried it both ways and no problem with UART0. UART1 dies if it
>> exists. Oh, well, I didn't need my sanity anyway.
>>
>> --- In l..., "Paul Curtis" wrote:
>> >
>> > Wade,
>> >
>> > > "Common misconception is that using ctl_set_isr is somehow related
>> to
>> > using
>> > > the CTL library". Actually, that is EXACTLY what I thought. And
>> since I
>> > > wasn't using the CTaskingLibrary, I went and modified the Rowley
>> uart
>> > > example code and "manually" set up the VIC.
>> > >
>> > > OK. The results are in. No change. As long as I do not call
>> > > "ctl_unmask_isr(VIC_CTRL_UART1);" everything works as normal. If I
>> call
>> > > that and unmask UART1 ISR, la la land, i.e., abort, as soon as I
>> enable
>> > > IRQs.
>> > >
>> > > Ideas? What should I change in the Rowley uart example to make
>> uart1
>> > > happy? Is it THAT much different than uart0?
>> > > Timer:
>> > > ------------ start of code ------------
>> > > void timer0_isr(void) __attribute__ ((interrupt ("IRQ")));
>> > > void tmr1_ISR(void) __attribute__ ((interrupt ("IRQ")));
>> > > void RTC_ISR(void) __attribute__ ((interrupt ("IRQ")));
>> >
>> > By default the function you pass into ctl_set_isr must not have the
>> IRQ
>> > attribute on them, in general.
>> >
>> > Exception: if you have set VECTORED_IRQ_INTERRUPTS in the LPC2k
>> startup code
>> > then they *must* have those attributes as the IRQs are processed using
>> the
>> > VIC.
>> >
>> > --
>> > Paul Curtis, Rowley Associates Ltd http://www.rowley.co.uk
>> > CrossWorks for ARM, MSP430, AVR, MAXQ, and now Cortex-M3 processors
>> >
>

Reply by WadeA & RebeccaM Smith March 11, 20092009-03-11
*I* have not set any optimizations. Whatever the default optimizations exist in CrossWorks, are as they are for a new solution and project from scratch (with a few "existing files" of the *.h and *.c variety added).

I haven't done anything with MAM other than what the CrossWorks defaults are. Everything worked on the Rowley Crossfire_2138, so I assume it would be OK on the NewMicros Pluga2138 as well.

Maybe Paul Curtis can shed some light on this when he gets back into the office in the morning (it must be late in England).

My Boss is calling me to supper, so I'll be back in the Florida morning as well.

wade

--- In l..., "Charles R. Grenz" wrote:
>
> WadeA & RebeccaM Smith wrote:
> > Oops. I misspoke. Instead of saying that I copied all of the UART0 functions and made them UART1, I should have said that all of the UART1 functions were copied and changed to UART0.
> >
> > The code I used as a basis for uart.c was the Crossfire_2138 uart example. Recognize it? (see below)
> >
> > It worked fine on the Crossfire_2138. So now I'm trying it with 2 uarts running. Not much success. The irony is that the UART that worked on the Crossfire_2138 won't work elsewhere.
> >
> > suggestions?
> >
> > wade
> >
> I'm not an expert on Crossworks but just a foolish question. What
> optimizations do you have set? Did you check the errata sheet for any
> MAM conditions?
>
> regards,
> Charles
>

Reply by WadeA & RebeccaM Smith March 11, 20092009-03-11
How about I kill off the "__attribute__ ((interrupt ("IRQ")))" and kill off the "VECTORED_IRQ_INTERRUPTS"?

Now timer0, RTC and UART0 have no "__attribute__ ((interrupt ("IRQ")))".

UART1 is NOT initialized.
// ctl_unmask_isr(VIC_CTRL_UART1);

Oh, drat. Now, even with no UART1, dabort!
>From

(breakpoint) initSerMot();
1A9C EB0003A6 bl 0x000293C
timerSleepMS(500); // wait for initSerMot printing to stop
1AA0 E3A00F7D mov r0, #0x00001F4
1AA4 EB0008E3 bl 0x0003E38
__ARMLIB_enableIRQ();
1AA8 EB000AF8 bl 0x0004690 <__ARMLIB_enableIRQ>
(breakpoint NEVER REACHED) moveCase = 15;
1AAC E59F3160 ldr r3, [pc, #+0x160]
1AB0 E3A0200F mov r2, #0x000000F
1AB4 E5C32000 strb r2, [r3]
/* ===================== MAIN LOOP ===================== */
//esp_printf(&U0OutChar,"\r\nENTERING ROBOT MAIN LOOP\r\n");
esp_printf(U0OutChar,"\r\nENTERING ROBOT MAIN LOOP\r\n");
1AB8 E59F0158 ldr r0, [pc, #+0x158]
1ABC E59F1158 ldr r1, [pc, #+0x158]
1AC0 EB000258 bl 0x0002428
1AC4 EAFFFFFF b 0x0001AC8

--- REGISTERS ---
CPU - Current Mode
r0 0x6000005f (really invalid)
...
lr(r14) 0x00001abc

lr contains an address BEYOND the breakpoint set at "movecase = 15;"
(which is NEVER hit) and esp_printf (from rprintf.c from the web) loads 0x6000005f no matter if I put &fnName or just fnName as the first parameter.

In other words, things get royally screwed up as soon as IRQ are enabled.

This is all very confusing. I think I'll go back to the way that at least allowed UART0 to work...

So, any new ideas?

wade
--- In l..., "WadeA & RebeccaM Smith" wrote:
>
> As a matter of fact, I do have VECTORED_IRQ_INTERRUPTS set in Properties (common) Preprocessor Options -> Preprocessor definitions.
>
> However, for UART0 it does not matter how I set that. ???
> I tried it both ways and no problem with UART0. UART1 dies if it exists. Oh, well, I didn't need my sanity anyway.
>
> --- In l..., "Paul Curtis" wrote:
> >
> > Wade,
> >
> > > "Common misconception is that using ctl_set_isr is somehow related to
> > using
> > > the CTL library". Actually, that is EXACTLY what I thought. And since I
> > > wasn't using the CTaskingLibrary, I went and modified the Rowley uart
> > > example code and "manually" set up the VIC.
> > >
> > > OK. The results are in. No change. As long as I do not call
> > > "ctl_unmask_isr(VIC_CTRL_UART1);" everything works as normal. If I call
> > > that and unmask UART1 ISR, la la land, i.e., abort, as soon as I enable
> > > IRQs.
> > >
> > > Ideas? What should I change in the Rowley uart example to make uart1
> > > happy? Is it THAT much different than uart0?
> > > Timer:
> > > ------------ start of code ------------
> > > void timer0_isr(void) __attribute__ ((interrupt ("IRQ")));
> > > void tmr1_ISR(void) __attribute__ ((interrupt ("IRQ")));
> > > void RTC_ISR(void) __attribute__ ((interrupt ("IRQ")));
> >
> > By default the function you pass into ctl_set_isr must not have the IRQ
> > attribute on them, in general.
> >
> > Exception: if you have set VECTORED_IRQ_INTERRUPTS in the LPC2k startup code
> > then they *must* have those attributes as the IRQs are processed using the
> > VIC.
> >
> > --
> > Paul Curtis, Rowley Associates Ltd http://www.rowley.co.uk
> > CrossWorks for ARM, MSP430, AVR, MAXQ, and now Cortex-M3 processors
>

Reply by "Charles R. Grenz" March 11, 20092009-03-11
WadeA & RebeccaM Smith wrote:
> Oops. I misspoke. Instead of saying that I copied all of the UART0 functions and made them UART1, I should have said that all of the UART1 functions were copied and changed to UART0.
>
> The code I used as a basis for uart.c was the Crossfire_2138 uart example. Recognize it? (see below)
>
> It worked fine on the Crossfire_2138. So now I'm trying it with 2 uarts running. Not much success. The irony is that the UART that worked on the Crossfire_2138 won't work elsewhere.
>
> suggestions?
>
> wade
>
I'm not an expert on Crossworks but just a foolish question. What
optimizations do you have set? Did you check the errata sheet for any
MAM conditions?

regards,
Charles