SAM7P256 Eclipse/Yagarto Build of USART and SD/MMC tests

Two things:

  1. Awhile back I posted about not being able to get the USART code to work on the P256 board and found a constant was off in the baud-rate clock gen setup. After that fix, I got the Olimex supplied USART code working under Eclipse/Yagarto. I exported the project from Eclipse and posted it to my web site in hopes it might help someone else get started:

[http://sawdust.see-do.org/sam7/sam7.html

  1. I wanted to do the same thing with the SD/MMC test code, that is, port the SD/MMC test code to the Eclipse/Yagarto IDE for the P256 dev board. I got it ported over to the Yagarto environment and compiled, but am having some problems with the code itself.

1st - the code supplied by Olimex won’t compile since it’s written for a P64 and the constants don’t work with the P256 headers. The main area of problems was in the SPI register definitions…the P64 code just had SPI constants and the P256 headers have both SPI0 and SPI1 constants. If I change the various instances of (xyz)SPI to either (xyz)SPI0 or (xyz)SPI1 (where xyz is whatever prefix there is on the SPI constant name), then I can get the code to compile.

2nd - As I step through it with the JTAG/OCD, it will step all the way up to the point of spiSendByte() and then it will hang in an infinite loop waiting for the transfer to complete. The line of code it’s hanging in is:

    while ( s_pSpi->SPI_SR & AT91C_SPI_TDRE) == 0 );

This is the first line of code in the method spiSendByte() and spiSendByte() is called from initMMC().

I have a Lexar 128MB SD card plugged into the SD socket of the board, so I know a physical device is present.

Questions I have are:

Which SPI (0 or 1) should I be using for this board? When I looked at the schematics, the schematics linked for this board are for the SAM7P64, not SAM7P256. The p64 and p256 headers are substantially different.

Has anyone been able to get the Olimex p64 SD/MMC code to work on their P256 dev board? If so, would mind sharing your code or insights into making it work?

I have put an Eclipse/Yagarto export of the SD/MMC project up on my web site at: [<LINK_TEXT text=“http://sawdust.see-do.org/downloads/fil … agarto.zip”>http://sawdust.see-do.org/downloads/files/sam7-p256-mmc-sd-test-yagarto.zip</LINK_TEXT> This project will compile fine but the runtime hangs at the line I mentioned above.](http://sawdust.see-do.org/downloads/files/sam7-p256-mmc-sd-test-yagarto.zip)](http://sawdust.see-do.org/sam7/sam7.html)