[En-Nut-Discussion] Multiple devices on the SPI BUS
ennut at thezachariasgroup.com
ennut at thezachariasgroup.com
Wed Aug 13 14:16:40 CEST 2008
Jae,
The problem was with the processor.
I have a EEPROM connected to PA12 which is SPI0_NPCS0.
The SD/MMC is connected to PA13 which is SPI0_NPCS1
The chip uses SPI_CSR1 for the SD/MMC card until there is activity on
the EEPROM. Then the chip starts using SPI_CSR0 instead of SPI_CSR1
for the SD/MMC card.
(It took me a while to figure this one out)
My solution:
I put a semaphore that regulates both the SDCARD and EEPROM.
Before a EEPROM operation I execute the following command:
outr(SPI0_CSR0, uwEEPROM_CSR0); //
Where uwEEPROM_CSR0 is the SPI_CSR value for the EEPROM.
After a EEPROM operation is complete I execute the following command:
outr(SPI0_CSR0, uwMMC_CSR1); // This did the trick
Where uwMMC_CSR1 is the SPI_CSR value for the SD/MMC card.
Note that this is written to SPI0_CSR0. This value should only have
to be used for SPI0_CSR1.
I have not tried to see what happens for the other two chip selects.
Hope this helps.
Zack
At 11:40 PM 8/12/2008, you wrote:
>Hi Zack,
>
>The processor is the AT91SAM7X. I have working driver code that can
>communicate with the RTC and the MCU. The code is based on Atmel's
>dataflash sample code. I was planning on porting the code to Nut/OS.
>
>Are you referring to a problem with Nut/OS or with the
>processor? Could you elaborate?
>
>Thanks,
>Jae
>
>On Tue, Aug 12, 2008 at 8:01 PM,
><<mailto:ennut at thezachariasgroup.com>ennut at thezachariasgroup.com> wrote:
> Jae
> Which processor are you using?
>The Atmel AT91SAM7X series has a problem with multiple devices on the SPI bus.
> Zack
>
>
>At 08:23 PM 8/12/2008, you wrote:
>Hi,
>
>My board has three devices connected to SPI0. It has an SD/MMC, Real-time
>clock, and another MCU for interprocessor communication. Both the ftpd and
>httpd example software is running on my board with the PHAT file system and
>an SD card. The SD card driver is functioning and the next step for me is
>to develop code for the RTC and the MCU communication. What is the best way
>to access the SPI interface without interfering with the PHAT/SD card
>interface?
>
>Thanks,
>Jae
>_______________________________________________
><http://lists.egnite.de/mailman/listinfo/en-nut-discussion>http://lists.egnite.de/mailman/listinfo/en-nut-discussion
>
>
More information about the En-Nut-Discussion
mailing list