2009-09-22 08:01:27     SD/MMC problem

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

2009-09-22 08:01:27     SD/MMC problem

Wang Mengyin (CHINA)

Message: 80243   

 

Hi Guys! I get a problem when using SPI-MMC driver on my custom blackfin BF532 board.

 

the SPI-MMC driver on 2008R1.5 works well , but when I transfer to 2009R1 Release ,I got a error message "error -84 whilst initialising SD card" when I insert the SD card.

TranslateQuoteReplyEditDelete

 

 

2009-09-22 08:20:04     Re: SD/MMC problem

Wang Mengyin (CHINA)

Message: 80244   

 

Here is kernel information:

 

mmc0: clock 0Hz busmode 2 powermode 1 cs 1 Vdd 21 width 0 timing 0

mmc_spi spi0.5: mmc_spi: power up (21)

mmc0: clock 400000Hz busmode 2 powermode 2 cs 1 Vdd 21 width 0 timing 0

mmc_spi spi0.5: mmc_spi: power on (21)

mmc_spi spi0.5: requested mode not fully supported

mmc_spi spi0.5: can't change chip-select polarity

mmc0: starting CMD0 arg 00000000 flags 000000c0

mmc_spi spi0.5:   mmc_spi: CMD0, resp R1

mmc0: req done (CMD0): 0: 00000001 00000000 00000000 00000000

mmc0: starting CMD8 arg 000001aa flags 000002f5

mmc_spi spi0.5:   mmc_spi: CMD8, resp R3/R4/R7

mmc_spi spi0.5:   ... CMD8 response SPI_R3/R4/R: resp 0005 ffffffff

mmc0: req done (CMD8): -22: 00000005 ffffffff 00000000 00000000

mmc0: starting CMD5 arg 00000000 flags 000002e1

mmc_spi spi0.5:   mmc_spi: CMD5, resp R3/R4/R7

mmc_spi spi0.5:   ... CMD5 response SPI_R3/R4/R: resp 0005 ffffffff

mmc0: req done (CMD5): -22: 00000005 ffffffff 00000000 00000000

mmc0: starting CMD55 arg 00000000 flags 000000f5

mmc_spi spi0.5:   mmc_spi: CMD55, resp R1

mmc0: req done (CMD55): 0: 00000001 00000000 00000000 00000000

mmc0: starting CMD41 arg 00000000 flags 000000e1

mmc_spi spi0.5:   mmc_spi: CMD41, resp R1

mmc0: req done (CMD41): 0: 00000001 00000000 00000000 00000000

mmc0: starting CMD0 arg 00000000 flags 000000c0

mmc_spi spi0.5:   mmc_spi: CMD0, resp R1

mmc0: req done (CMD0): 0: 00000001 00000000 00000000 00000000

mmc0: starting CMD58 arg 00000000 flags 00000280

mmc_spi spi0.5:   mmc_spi: CMD58, resp R3/R4/R7

mmc0: req done (CMD58): 0: 00000001 00ff8000 00000000 00000000

mmc0: clock 400000Hz busmode 2 powermode 2 cs 1 Vdd 20 width 0 timing 0

mmc0: starting CMD0 arg 00000000 flags 000000c0

mmc_spi spi0.5:   mmc_spi: CMD0, resp R1

mmc0: req done (CMD0): 0: 00000001 00000000 00000000 00000000

mmc0: starting CMD8 arg 000001aa flags 000002f5

mmc_spi spi0.5:   mmc_spi: CMD8, resp R3/R4/R7

mmc_spi spi0.5:   ... CMD8 response SPI_R3/R4/R: resp 0005 ffffffff

mmc0: req done (CMD8): -22: 00000005 ffffffff 00000000 00000000

mmc0: starting CMD55 arg 00000000 flags 000000f5

mmc_spi spi0.5:   mmc_spi: CMD55, resp R1

mmc0: req done (CMD55): 0: 00000001 00000000 00000000 00000000

mmc0: starting CMD41 arg 00000000 flags 000000e1

mmc_spi spi0.5:   mmc_spi: CMD41, resp R1

mmc0: req done (CMD41): 0: 00000001 00000000 00000000 00000000

mmc0: starting CMD55 arg 00000000 flags 000000f5

mmc_spi spi0.5:   mmc_spi: CMD55, resp R1

mmc0: req done (CMD55): 0: 00000001 00000000 00000000 00000000

mmc0: starting CMD41 arg 00000000 flags 000000e1

mmc_spi spi0.5:   mmc_spi: CMD41, resp R1

mmc0: req done (CMD41): 0: 00000001 00000000 00000000 00000000

mmc0: starting CMD55 arg 00000000 flags 000000f5

mmc_spi spi0.5:   mmc_spi: CMD55, resp R1

mmc0: req done (CMD55): 0: 00000001 00000000 00000000 00000000

mmc0: starting CMD41 arg 00000000 flags 000000e1

mmc_spi spi0.5:   mmc_spi: CMD41, resp R1

mmc0: req done (CMD41): 0: 00000001 00000000 00000000 00000000

mmc0: starting CMD55 arg 00000000 flags 000000f5

mmc_spi spi0.5:   mmc_spi: CMD55, resp R1

mmc0: req done (CMD55): 0: 00000001 00000000 00000000 00000000

mmc0: starting CMD41 arg 00000000 flags 000000e1

mmc_spi spi0.5:   mmc_spi: CMD41, resp R1

mmc0: req done (CMD41): 0: 00000000 00000000 00000000 00000000

mmc0: starting CMD59 arg 00000001 flags 00000080

mmc_spi spi0.5:   mmc_spi: CMD59, resp R1

mmc0: req done (CMD59): 0: 00000000 00000000 00000000 00000000

mmc0: starting CMD10 arg 00000000 flags 000000b5

mmc0:     blksz 16 blocks 1 flags 00000200 tsac 0 ms nsac 64

mmc_spi spi0.5:   mmc_spi: CMD10, resp R1

mmc_spi spi0.5:     mmc_spi: read block, 16 bytes

mmc_spi spi0.5: read - crc error: crc_val=0x1d81, computed=0x1d80 len=16

mmc_spi spi0.5: read status -84

mmc0: req done (CMD10): 0: 00000000 00000000 00000000 00000000

mmc0:     0 bytes transferred: -84

mmc0: clock 0Hz busmode 2 powermode 0 cs 1 Vdd 0 width 0 timing 0

mmc_spi spi0.5: mmc_spi: power off (0)

mmc0: error -84 whilst initialising SD card

mmc0: clock 0Hz busmode 2 powermode 0 cs 1 Vdd 0 width 0 timing 0

TranslateQuoteReplyEditDelete

 

 

2009-09-22 11:13:52     Re: SD/MMC problem

Wang Mengyin (CHINA)

Message: 80251   

 

When I use 2008R1.5 version, It works fine.

 

root:/> mkdir /mnt/sd

root:/> mount -t vfat /dev/spi_mmc /mnt/sd

[17179637.428000] New MMC/SD card found: 119 MB(125698048 bytes)

[17179637.440000]  spi_mmc:

root:/> cd /mnt/sd

root:/mnt/sd> ls

test.txt  wang.txt

root:/mnt/sd>

TranslateQuoteReplyEditDelete

 

 

2009-09-22 22:04:11     Re: SD/MMC problem

Yi Li (CHINA)

Message: 80265   

 

How about try some other SD/MMC cards? If always fails, there is problem.

 

The mmc_spi driver has been tested with many SD/mmc cards, but it cannot guarantee every SD/MMC card can work well.

 

-Yi

QuoteReplyEditDelete

 

 

2009-09-22 22:20:12     Re: SD/MMC problem

Yi Li (CHINA)

Message: 80266   

 

If most mmc/sd cardscannot work on your board, then read:

 

  docs.blackfin.uclinux.org/doku.php?id=linux-kernel:drivers:spi_mmc

 

As the document says: "In order to operate the SD/MMC Cards in SPI Mode 3 it is recommended to have 10kOhm Pull-Up Resistors to VDD on Blackfin SPI_SSELx, SPI_SCK, SPI_MISO and SPI_MOSI. "

 

-Yi

QuoteReplyEditDelete

 

 

2009-09-22 23:00:23     Re: SD/MMC problem

Wang Mengyin (CHINA)

Message: 80267   

 

Thanks for you reply.

 

I have tried three different SD card: Kingston 128MB Kingston 2GB Adapter 1GB.None of them can work currently. The error code are the same.

 

We have 10k pull-up resistors to VDD on SPI_SSELx,SPI_MOSI. but no resistors on SPI_MISO or SPI_SCK. I will add these two resistors.

 

But the SD card did work on 2008 release. I can mount a vfat patteron ,open a txt file which was created by Notepad on Windows XP.

 

By the way, I have a SPI EEPROM (M25P64) on SPI line. Does it affect the operation of SD card?

TranslateQuoteReplyEditDelete

 

 

2009-09-22 23:30:20     Re: SD/MMC problem

Yi Li (CHINA)

Message: 80269   

 

> We have 10k pull-up resistors to VDD on SPI_SSELx,SPI_MOSI. but no resistors on SPI_MISO or SPI_SCK. I will add these two resistors.

 

For SPI_MODE_3, the pull-ups are required. Another choice is to use GPIO as chip select, this way, you can use SPI_MODE_0. SPI_MODE_0 is better for mmc_spi. See:   docs.blackfin.uclinux.org/doku.php?id=spi

 

> But the SD card did work on 2008 release. I can mount a vfat patteron ,open a txt file which was created by Notepad on Windows XP.

 

I am not clear. 2008R1.5 uses a private spi_mmc driver, 2009R1 uses mmc_spi driver from mainline kernel. Maybe the SPI_MODE is different?

 

> By the way, I have a SPI EEPROM (M25P64) on SPI line. Does it affect the operation of SD card?

 

If the two devices access spi bus concurrently - yes, mmc_spi cannot work well. In 2009R1 we use spi_lock_bus() to protect mmc transaction. You may enable "CONFIG_SPI_BFIN_LOCK " to make it work.

 

-Yi

QuoteReplyEditDelete

 

 

2009-09-23 01:45:14     Re: SD/MMC problem

Wang Mengyin (CHINA)

Message: 80272   

 

I found a mistake in circuit design. The SPI_SCK was pulled down to GND via a 10K resistors . After I disconnect this part, the driver works !

 

Thanks Yi Li.

 

"root:/> modprobe mmc-spi

mmc_spi spi0.5: ASSUMING 3.2-3.4 V slot power

mmc_spi spi0.5: SD/MMC host mmc0, no DMA, no WP, no poweroff

mmc_spi spi0.5: requested mode not fully supported

mmc_spi spi0.5: can't change chip-select polarity

root:/> mmc_spi spi0.5: requested mode not fully supported

mmc_spi spi0.5: can't change chip-select polarity

mmc0: host does not support reading read-only switch. assuming write-enable.

mmc0: new SD card on SPI

mmcblk0: mmc0:0000 128MB 119 MiB

mmcblk0:<7>mmc0: starting CMD18 arg 00000000 flags 000000b5

 

 

root:/> cd dev/

 

root:/dev> ls

console             network_throughput  ram15               stderr

cpu_dma_latency     null                ram2                stdin

fd                  ptmx                ram3                stdout

full                pts                 ram4                tty

kmsg                ram0                ram5                ttyBF0

log                 ram1                ram6                urandom

mem                 ram10               ram7                watchdog

mmcblk0             ram11               ram8                zero

mtdblock0           ram12               ram9

mtdblock1           ram13               random

network_latency     ram14               rtc0

root:/dev> mmc0: SPI card removed

"

Attachments

    Outcomes