configuring SPI- AT91SAM7

i am trying to configure SPI… works fine in loopback mode

not giving results in normal mode.

  • testing using LED

  • MISO n MOSI externally shortd…

plz help…!

Hi

Ensure that you have correctly configured the port pins for their SPI peripheral function. Note also that the port used by the peripheral pins must also be powered up (in PMC_PCSR).

Regards

Mark

[www.uTasker.com](http://www.uTasker.com)

thanks for replying…

bt i hav configured all the pins correctly & the clock is also getting enabled…

still can’t find an answer…!!!

Hi

Maybe the chip is damaged?

Can you measure a clock signal when bytes are transmitted? or the data on MOSI?

Regards

Mark

Hello…!!

i dnt think d chip is damaged as SPI works fine in internal loopback mode.

I didn’t check the clock waveform on a CRO bt hope dat it works fine as previous results were okk.

bt a signal is observed on MOSI pin.

Hi

If you have a short circuit of the CLK signal on the board it will work in internal loop mode but won’t work externally.

It is important to make the measurement since assumptions alone won’t ensure identifying difficulties.

Regards

Mark

[www.uTasker.com](http://www.uTasker.com)

I checked the clock signal & other pins also…the waveforms are coming absolutely fine.

I have started interfacing SPI with real device, SD card (kingston 512MB), bt the problem is on giving the initialization command, no response from the card is observed.

Hi

On the following page there is reference binary to load to either the Olimex or ATMEL SAM7X evaluation boards:

http://www.utasker.com/SW_Demos.html

It includes SD card support for these boards whereby you have a DOS-like interface via UART or TELNET (files can be copied to the card via FTP and web browser content served from the SD card).

This will show you whether you have a HW or SW problem (assuming you are using one of these boards).

SD card user’s guide: http://www.utasker.com/docs/uTasker/uTasker_utFAT.PDF

Regards

Mark

thank u…!

I hav to ask one thing - how can I test the H/W or S/W??? Does it require a simulator??

Also in the pdf it says initially CS should be high & 74 clock pulses should be given to card… bt when I set CS high, TDRE doesn’t become one & so i can’t send data.

I can show you my code if u want…!!! I am using olimex sam7 board

Hi

There is a binary file for the Olimex board at http://www.utasker.com/SW_Demos.html. You can download this to your board to verify that the SD card is working correctly.

When sending clocks to the SD card with the CS line held high you may need to control the CS line in SW (as a GPIO). You can also generate the pulses by toggling the MOSI line as GPIO if you can’t get the SPI to send them.

Regards

Mark

[www.uTasker.com](http://www.uTasker.com)

I have download the file in the board using SAM-BA… what should i do now???

Hi

If the binary is running you should see LCD back-light blinking.

Remove the USB cable and connect again. When the USB cable is connected to the operating board with inserted SD card, the SD card will appear as a disk drive to the PC.

You can also connect to the board via TELNET at 192.168.0.3 or via the serial port (115kBaud). Once connected there are menus to change the IP settings if required.

The following tutorial also guides to loading web pages and using the web browser: http://www.utasker.com/docs/SAM7X/uTaskerV1-4_SAM7X.PDF.

When connected via TELNET or UART you will see messages informing whether the SD card was detected of not. If no SD card is found it will try approx. ever 15s to see whether one has been inserted in the meantime. Assuming that it detected an SD card (SD or HCSD - not MMCs) you can then use the DOS-like menu interface to look at the directories and files, create, rename, etc. according to http://www.utasker.com/docs/uTasker/uTasker_utFAT.PDF

Furthermore it is possible to copy large web sites to the SD card and the web browser on the board will serve these. The SD card is also visible via FTP.

If you can get the SD card to be detected it will verify that your board is working correctly with the interface and give you a reference as to what the SPI signals between the SD card and the ATMEL device do.

Good luck

Regards

Mark

[www.uTasker.com](http://www.uTasker.com)

Hello…!!

I tried my code with a micro SD (San Disk 1GB)

code works fine & I am through with the initialization of the card…(card responds to commands CMD0, CMD55, ACMD41)

wonder why Kingston 512 MB didn’t work…!!!

Have you worked on it???