SPI Setup on AT91SAM7S256

Hi,

I've spent the last few hours trying to set up the SPI port on the SAM7S256 to send single bytes on command. My scope shows me no SCK pulses or data pulses. I suspect that I have messed up something in the setup of the clocks, peripheral pins, or SPI registers. At this point, I'm not too concerned with polarity, delays, or SPI baud Rate. I just want to see pulses on SCK!!!!!

I haven't been able to find a simple example of SPI port setup and usage after a few hours of searching on the net.

Can anyone provide source code (or a link to an example) that shows the proper sequence of steps for setting up the AT91SAM7S256 SPI port clocks, pins, and registers so I can send a byte by storing it in the SPI TDR and waiting for TXEmpty?

Mark Borgerson

Reply to
Mark Borgerson
Loading thread data ...

I am unfamiliar with the SAM7S256, but you *must* be the SPI master to be the source SCK (clock). Have you configured the SAM7S256 as the SPI master?

--
Michael N. Moran           (h) 770 516 7918
5009 Old Field Ct.         (c) 678 521 5460
Kennesaw, GA, USA 30144    http://mnmoran.org

"So often times it happens, that we live our lives in chains
  and we never even know we have the key."
The Eagles, "Already Gone"

The Beatles were wrong: 1 & 1 & 1 is 1
Reply to
Michael N. Moran

I think so---but I'll check to make sure.

Thanks.

Mark Borgerson

Reply to
Mark Borgerson

The question of setting the Master bit prompted me to examine the SPI Mode Register. I was, indeed, in the master mode. However, I also looked at the Status Register---where I found that the SPIENS bit was cleared---indicating that the SPI was disabled! I then found an errant setting of the SWRST (Software SPI Reset) had found its way into the code AFTER all the setup instructions. DOH!

The first hurdle in the SPI steeplechase has been cleared---after a bit of a stumble. Now it's onward to figuring out the difference between fixed and variable chip selects, delays, using the PDC for block transfers, etc., etc. The eventual goal is to port Lewin Edward's DOSFS to my board to use an SD card as data storage.

Mark Borgerson

Reply to
Mark Borgerson

Mark Borgerson schrieb:

You could also use this SD+FAT32 implementation:

formatting link

Reply to
Andreas Schwarz

That certainly looks interesting. I will look through the source code and see whether it will suit my application.

Thanks.

Mark Borgerson

Reply to
Mark Borgerson

ElectronDepot website is not affiliated with any of the manufacturers or service providers discussed here. All logos and trade names are the property of their respective owners.