Content originally posted in LPCWare by larryvc on Sat Mar 19 11:29:21 MST 2011
Hi Ajay,
Unfortunately my scope died and is in for repair so I haven't scoped the pins yet. I don't think there is a problem at the pins.
I looked at the disassembly of the code produced with optimizations other than -O0 and it showed a STR immediately followed by a LDR. The read appears to occur before the data has propagated to the register. A small delay longer than a NOP (two instructions, not NOPs, worked) seem to allow enough time for data to propagate to the register and for the read to succeed with correct data.
Is this an illusion maybe caused by the debugger? I don't think so.
I'm still investigating this and will scope the pins as soon as I can get my hands on a scope. Triggering on an instruction may be difficult.
Can anyone suggest a low cost logic analyzer? One with 16 data lines and a reasonable sampling rate would be nice.