MMC card with spi-sd-card.c

Gene Smith gds at
Tue Dec 23 08:55:14 UTC 2008

Sebastian Huber wrote, On 12/23/2008 03:15 AM:
> Sebastian Huber wrote:
>> Gene Smith wrote:
>>> I have been trying to use an MMC with the "spi/sd" drivers in RTEMS. I 
>>> worked until it tries to send two commands in a loop waiting for idle 
>>> conditon in an init routine:
>>> rv = sd_card_send_command( e, SD_CARD_CMD_APP_CMD, 0);
>>> CLEANUP_RVSC( rv, sc, sd_card_driver_init_cleanup, "Send: 
>>> rv = sd_card_send_command( e, SD_CARD_ACMD_SD_SEND_OP_COND, 0);
>>> CLEANUP_RVSC( rv, sc, sd_card_driver_init_cleanup, "Send: 
>> These commands set the SD Card into SPI mode.
> [...]
> Oh, I guess I misunderstood you.  You want to use a MMC in SPI mode? There are
> several ways to switch from MMC mode to SPI mode.  This one worked for all
> cards I worked with.  We may use the alternatives if one approach fails.

Yes, that's what I mean. Several typos in my original message may have 
caused what I was asking to be confusing.

Did your SD code work for you with actual MMCs?

As Bob G. suggested, I am doing the SPI/SD/MMC init calls in Init() for 
now. I don't have a serial port so your SYSLOG_* macros all do printk or 
printf and I need syslog() calls via UDP instead, which I added. For 
some reason, and I am not sure why, when SYSLOG() calls are made in 
spi-sd-card.c I only see the last one actually go out:

SYSLOG( "Max transfer speed [b/s] : %" PRIu32 "\n", transfer_speed);

It goes out on UDP port 514 (standard syslog port). But no others before 
get transmitted on UDP per wShark.

I think it may have something to do with the locks/mutexes/semaphores in 
the libi2c code but not sure. I can do my own SYSLOG() calls in Init() 
after returning from bsp_register_spi() and they work.  Interrupts don't 
seem to be disabled.

OK, just checked. When it calls LIBUNLOCK() in unlock_bus() 
rtems_libi2c_send_stop() in sd_card_stop() right after calling the 
SYSLOG("Max transfer...) the UDP message finally sends. I guess the 
previous SYSLOG messages get overwritten since they never go out, just 
the last one after the unlock.

I suppose these locks prevent the network daemons from running but not 

Any ideas?


More information about the users mailing list