Sign in

username:

password:



Not a member?

Search AT91SAM



Search tips

Subscribe to AT91SAM



Ads

Discussion Groups

Discussion Groups | AT91SAM ARM | AT91SAM7X SPI RDRF Strangeness

For users of the Atmel AT91SAM7 and AT91SAM9 ARM CPU chips. Atmel has taken a new direction by combining on chip flash and ram with the ARM CPU on a single die. This provides low cost devices for small systems using the ARM CPU. This group is to exchange information to help users get started and learn how to use the devices.

AT91SAM7X SPI RDRF Strangeness - Chris DeLise - Jan 31 1:28:59 2008

I've seen notes elsewhere on this forum about RDRF behavior on the '7X, but none exactly describe what I'm seeing.

I'm doing non-interrupt SPI I/O in an ISR that is invoked to respond to a hardware condition. The AT91 is the SPI Master and I need to exchange three words quickly with a CPLD. That's been working for a while, but one in a while the read data was wrong. The odd part is the code wasn't pending on RDRF. It did something like

write word to SPI0
wait for TDRE = 1
read word from SPI0

To deal with occasional bad read data, I started pending on RDRF. I just changed the code to do this now:

write word to SPI0
wait for TDRE=1 and RDRF=1
read word from SPI0

The strangeness is what I see on the 'scope. Before waiting for RDRF, SPI bus cycles would occur back-to-back with an inter-word delay limited only by firmware speed. But now that I wait for RDRF, there is a 1.2uS gap between NSS cycles, a little shorter than the SPI word transfer time (16 bits, MCLK=48 MHz, DLYBS=5, SCBR=4).

So my question is, what is the hardware doing during this time? Is RDRF delayed for some reason, or are the received bits being shifted serially into another register? It cuts my throughput in half - 2.5us per 16b word instead of about 1.5us per word.

Any thoughts? Is this what others are seeing?

Chris


(You need to be a member of AT91SAM -- send a blank email to AT91SAM-subscribe@yahoogroups.com )