Point to sample SPI for MMC card driver?

Robert S. Grimes rsg at alum.mit.edu
Wed Oct 15 23:52:19 UTC 2008


Gene Smith wrote:
> Robert S. Grimes wrote:
>   
>> Gene Smith wrote:
>>     
>>>> Sorry, can't help you here, but you do want to be fairly current.
>>>> The libi2c SPI support has matured somewhat since I started (around
>>>> 4.8), and if you want to use the spi-sd-card driver, you'll need to
>>>> make sure you're based on at least 4.9 libi2c.  In particular, you'll
>>>> want to support the idle_char field of the transfer parameters
>>>> structure rtems_libi2c_tfr_mode_t.  See my latest posts regarding
>>>> "Card Specific Data".
>>>>         
>
> Yes, I am using 4.9.0 now so no problem. I remember you said something 
> about adding a new field to a struct for some reason. Is this what you 
> are referring to?
>   
Yes.  Your driver will implement a read/write function, which because of 
the strict bidirectional nature of SPI, will always send data, even when 
the client code only wants to read from the wire.  If a write buffer is 
not supplied, then the function sends idle_char's instead.  When 
monitoring for a busy SD card going not busy, you need to  keep the MOSI 
(master out, slave in) line high; hence, the spi-sd-card driver sets 
idle_char to 0xff.

> I need to go back and re-read your threads, print them out, tape them to 
> the wall, whatever it takes. :)
>   
Don't forget coffee and/or beer!  ;-)

> I thought in your first post on this a while back you said you based 
> your SPI driver on "vertex". But when I look under vertex in libbsp I 
> see nothing about SPI. Just curious about that.
>   
Yes.  I haven't submitted what I've done (yet).  As I said earlier, I 
don't have the knowledge or time to package it properly into the virtex 
BSP, but would be happy to let someone else take a whack at it, or to 
use it as I am (essentially, as part of my applications).  I certainly 
hope to submit it properly some day...

> OK, so I will just use these two as my examples and stop looking at 
> others.  They seem like a good starting point.
>   
They worked for me!  ;-)


Good luck, and have fun!
-Bob




More information about the users mailing list