Using SD card with other SPI devices question

Discussion to talk about software related topics only.
Post Reply
seulater
Posts: 445
Joined: Fri Apr 25, 2008 5:26 am

Using SD card with other SPI devices question

Post by seulater »

I will be using the EFFS-HTTP example to start my new project. Using the SD card to store my website.
This example works great. However i am curious what would happen with the shared MOSI, MISO & CLK when i also add other SPI devices.
I am sure it sets up the SPI mode and clock rate for using SD cards. But when i need to communicate to my other SPI devices that use a different mode and clock rates what do i do then ?

Does the EFFS file system check the current SPI settings, temporarlly save them, then perform its read/write then restore the settings back, or is this something that i need to do before any read/writes to my devices ?
v8dave
Posts: 333
Joined: Thu Dec 31, 2009 8:31 pm

Re: Using SD card with other SPI devices question

Post by v8dave »

Hi seulater,

Basically, the libraries for the SD card are not setup for shared access.

I ran into this problem with my design where I use the SPI to communicate with a touch screen controller. In hindsight I would have switched to running this from the eTPU but as I already had the hardware built it would have been costly to remake the boards. If I do a new board or a similar design, I will change to the eTPU for my SPI.

I finally got it to work but I had to change the Netburner libraries to use Critical Sections so that only one could be accessing it at one time and I had to write the code to save the bit rate and reset it. The SD card driver changes the speed during operation. I recall getting all the info on this from Paul Breed.

I got it to work but I still had an issue with the SD driver writing and reading garbage. I had to change the way I accessed the data.

You are welcome to the changes I made and if you give me a few days I'll dig out the stuff I did and post it up here. Only the relevant bits of the changes and the names of the files as I assume the licensing of Netburner doesn't permit me to post the actual files?

Cheers,
Dave...
seulater
Posts: 445
Joined: Fri Apr 25, 2008 5:26 am

Re: Using SD card with other SPI devices question

Post by seulater »

Thanks Dave for the info. I will look into doing with the eTPU.
bbracken
Posts: 54
Joined: Mon Jun 23, 2008 11:21 am
Location: Southern California
Contact:

Re: Using SD card with other SPI devices question

Post by bbracken »

Is it the SD librarires or the NetBurner SPI drivers? I have written SPI drivers for ColdFires before that support large transfers (i.e. greater than 256 bytes) where each channel can have it's own clock speed, different CS polarities for active as well as seperate CPHA and CPOL and bit lengths.
Post Reply