Re:Another GPIO question
LMI Eric wrote:
The number of NOPs you need will depend on your propagation delay. You automatically get 2 system clocks (~334ns at 6MHz) to let the pin settle if you do a STR followed directly by a LDR since the read request has to go through the peripheral bridge. For your example of a 140ns propagation delay, you wouldn't need any NOPs. If you were running at 50MHz (20ns clock period), you would want 5 NOPs to account for the 140ns.
Putting this one to rest...
The 'offending' code:
MOVS r0,#0x04 MOV r1,#0x40004000 STR r0,[r1,#0x10] nop nop MOV r0,r1 LDR r0,[r0,#0x40]
This now works at 6MHz. It needs only one more nop at 20MHz.
I re-ordered my C code to do useful work rather than nops. It's fun trying to get a somewhat square clock bit-banging a not-quite-SSPI protocol with the CPU running at 6MHz. I got up to about 200 KHz.
Thanks again, Orin.
login or register to reply
|