Home arrow Support arrow Forums

Luminary Micro Forums

orinem

Expert Boarder

2006/10/19 02:09

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

      Topics Author Date
    thread link
Another GPIO question
orinem 2006/10/18 13:09
    thread link
thread linkthread link Re:Another GPIO question
LMI Eric 2006/10/18 13:35
    thread link
thread linkthread linkthread link Re:Another GPIO question
orinem 2006/10/18 14:27
    thread link
thread linkthread linkthread linkthread link Re:Another GPIO question
LMI Eric 2006/10/18 15:41
    thread link
thread linkthread linkthread linkthread linkthread link Re:Another GPIO question
orinem 2006/10/19 02:09