2009-09-02 15:19:39     MMC/SD Driver for BF536

Document created by Aaronwu Employee on Aug 19, 2013
Version 1Show Document
  • View in full screen mode

2009-09-02 15:19:39     MMC/SD Driver for BF536


Message: 79499   


I am attempting to access a micro SD card on our custom blackfin BF536 board.  The uClinux source is 2007r1-rc3.  Within this source, I have updated mmc folder with the spi_mmc subfolder by extracting the spi_mmc.tar.gz file from the following thread:




After adding the spi_mmc source, the following is configured in the make menuconfig:



                               <M> MMC/SD for SPI support (EXPERIMENTAL)                                                          

                                     SPI driver (Blackfin SPI bus directly)  --->                                                  

                               (10)  SPI chip select signal for MMC/SD card                                                     

                               (20000000) SPI clock limit for MMC/SD transfers (NEW)                                        

                               [ ]   MMC/SD Card detect support (EXPERIMENTAL) (NEW)                          

                               [*]   Print debug text on errors                                                         

                               <M> MMC support                                                                           

                               [ ]   MMC debugging                                                                          

                               <M>   MMC block device driver                                                             

                               < >   TI Flash Media MMC/SD Interface support  (EXPERIMENTAL) (NEW)      



I use a value of 10 for the SPI chip select signal.  This corresponds to PF10.


After the system boots, I ftp the spi_mmc.ko file into the system.  I then execute the following:


insmod /mmc/spi_mmc.ko


At the time the module is loaded, the following appears in the debug:


395745, spi_mmc_bfin_init(): 1273

cs_mask: 0x400, baud=0x15, flag=0xff04, ctrl=0x5529, mux= 0x1, fer=0x3bff, dir=0x1

395745, spi_mmc_dev_setup(): 1118 Major number 36 was ok

395745, spi_mmc_block_setup(): 1214 on version <= 2.6.19



I then execute the following:


cat  /proc/spi_mmc


The following appears:

Driver build date: Sep 2 2009

SPISEL10 as chip select

Driver: Blackfin PIO SPI directly

No MMC/SD card found


If I make an attempt to access the micro SD card, such as using a mount command or fdisk command, an LED turns on to signify that the chip select line is low.  The chip select line goes high when the module is removed using the rmmod command, and the module is installed again.  The installing of the module causes the chip select to go low, and the attempt to execute a mount or fdisk command causes the chip select to go high.  This at least shows that there is some activity in attempting to access the micro SD card.


The size of the micro SD card is 2 GB, and is a PNY micro SD card.


I added a little debug to some of the initialization routines of the spi_mmc.ko module, and when attempting to do a mount command or an fdisk command, the following appears in the debug:


sclk 80000000

baud 100

Clock 0

562059, mmc_spi_init_card(): 781 1

562059, mmc_spi_init_card(): 791 2





resp 31


562059, spi_mmc_open(): 939 speed 0

562059, spi_mmc_open(): 940 card 0

562059, spi_mmc_open(): 942



The micro SD card reports a response of 31 (0x1F) when accessed.  I'm not sure what this error code means, or even if it is an error code.  Sometimes the response is 159 (0x9F).


I'm trying to mount the micro SD card for use as disk space.  The custom BF536 board that I use has only 2 MB of flash space, and so I'm attempting to access this space.  If I execute the following mount command:


mount  /dev/mmc  /mnt


The following message appears:


mount:  mounting /dev/mmc on /mnt failed


I'm not quite sure where to go from here.  I think it's close since I do observe chip select activity.  I'm not sure about the syntax for the mount commands.  I have tried the mkdosfs command, but the following message appears:

mkdosfs 2.10 (22 sep 2003)

/dev/mmc: No such device








2009-09-02 16:33:49     MMC/SD Driver for BF536

Michael Hennerich (GERMANY)

Message: 79500    Please use our 2009R1 release for kernel, uclinux-dist and toolchain.

2007Rx is quite old - And from top of my head I don't know if SD/MMC via

SPI was reliably working that time.


Feel free to let us know if things don't work for you on 2009R1.

I'm sure we can assist you there...