EmbeddedRelated.com
Forums
The 2024 Embedded Online Conference

LPC21XX and FreeRTOS - Debug, Timing, or Stack (?) Problem?

Started by lawzaz January 21, 2013
On 24.1.13 7:41 , lawzaz wrote:
> Simon, > > I took a look at the assembly and couldn't figure out where my problem was > (though I'm trying to learn), but it gave me some insight into some of the > other problematic behavior. For example, when I set an mfence for > DEBUG_printf and DEBUG_putc, I didn't realize that that was actually > creating > new functions as the original definitions were aliases anyway. Only > DEBUG_printByte needed the asm code. > > The failing code is below: > > CAN_Packet is set in an ISR, which is disabled when this code runs. The > "IF" > that fails is > "if ((CAN_Packet & POWER_SAVE_MASK) < (POWER_SAVE_STOP_COND & > POWER_SAVE_MASK))"
Is CAN_Packet declared volatile? -- Tauno Voipio
On 2013-01-24, Tauno Voipio <tauno.voipio@notused.fi.invalid> wrote:
> On 24.1.13 7:41 , lawzaz wrote: >> Simon, >> >> I took a look at the assembly and couldn't figure out where my problem was >> (though I'm trying to learn), but it gave me some insight into some of the >> other problematic behavior. For example, when I set an mfence for >> DEBUG_printf and DEBUG_putc, I didn't realize that that was actually >> creating >> new functions as the original definitions were aliases anyway. Only >> DEBUG_printByte needed the asm code. >> >> The failing code is below: >> >> CAN_Packet is set in an ISR, which is disabled when this code runs. The >> "IF" >> that fails is >> "if ((CAN_Packet & POWER_SAVE_MASK) < (POWER_SAVE_STOP_COND & >> POWER_SAVE_MASK))" > > > Is CAN_Packet declared volatile? >
If CAN_Packet is declared as volatile, your next check is to make sure this ISR really _is_ disabled. Declare a _volatile_ unsigned long integer and increment it from within your ISR _every_ time your ISR is called (ie: make it the first statement executed in the ISR). Save the current value, but do not print it yet, of this counter just before the block of code you posted. Save the value again into another variable after the block of code. Print both values when it's convenient to do so from within your code. If they are not the same, your ISR is not disabled. Simon. -- Simon Clubley, clubley@remove_me.eisner.decus.org-Earth.UFP Microsoft: Bringing you 1980s technology to a 21st century world

The 2024 Embedded Online Conference