kllam
Posts: 2
Joined: Fri Jan 04, 2019 10:29 am

[SOLVED] Crash when adding sd card at sd1

Fri Jan 04, 2019 11:11 am

Hi,
I am using CM3 with internal 4GB flash on CM IO Board V3 and i would like to use an external sd card for data storage through the GPIO pins 22-27.
I have add following config to /boot/config.txt.
dtoverlay=sdio,poll_once=off
Here is the result of "raspi-gpio get"
GPIO 22: level=0 fsel=7 alt=3 func=SD1_CLK
GPIO 23: level=1 fsel=7 alt=3 func=SD1_CMD
GPIO 24: level=1 fsel=7 alt=3 func=SD1_DAT0
GPIO 25: level=1 fsel=7 alt=3 func=SD1_DAT1
GPIO 26: level=1 fsel=7 alt=3 func=SD1_DAT2
GPIO 27: level=1 fsel=7 alt=3 func=SD1_DAT3
I connect the pin as above and get the 3.3V from the the pin next to GPIO 21.
The system crashed when i insert the micro sd card to external SD card slot.
IMG_1062.JPG
IMG_1062.JPG (198.51 KiB) Viewed 719 times
The micro sd card is Kingston SDHC class 4 16GB.
Is there any steps i am missing or doing wrong? Any suggestion to work it out ?
Thanks in advance.
Last edited by kllam on Mon Jan 07, 2019 3:26 am, edited 1 time in total.

PhilE
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 3000
Joined: Mon Sep 29, 2014 1:07 pm
Location: Cambridge

Re: Crash when adding sd card at sd1

Fri Jan 04, 2019 12:35 pm

That's an odd crash - if it is on the instruction I think it is then that suggests there is a race condition in the bcm2835_mmc driver. The start of bcm2835_mmc_transfer_dma checks that host->data is not NULL, but the fault seems to be due to using the host->data pointer by adding 0x30 to the value in r3 and getting 0x30 - an invalid pointer. This means that r3, which is supposed to hold the value of host->data, must be 0 (which the register dump supports). Because there are more variables than registers, the compiler is reading the data pointer from the host structure more than once, so between the first and second reads the field has been zeroed, which shouldn't happen.

This looks to be a niche problem, and diagnosing it could be very difficult; the bcm2835-sdhost driver that is normally used with SD cards has extensive logging, but not this one.

How repeatable is the crash?

kllam
Posts: 2
Joined: Fri Jan 04, 2019 10:29 am

Re: Crash when adding sd card at sd1

Mon Jan 07, 2019 3:25 am

Thank you for your assistance. The problem was solved by changing another micro SD card. For the previous SD card it crashed every time when plugging in.

Return to “Compute Module”