raspberrypi / firmware

This repository contains pre-compiled binaries of the current Raspberry Pi kernel and modules, userspace libraries, and bootloader/GPU firmware.
5.15k stars 1.68k forks source link

RPi4B: eMMC emulated SD card doesn't work / different CMD sequences found #1235

Open uugear opened 5 years ago

uugear commented 5 years ago

Describe the bug We have a eMMC->micro SD adapter, which is a PCB with eMMC (16GB) chip soldered and emulate the micro SD interface, so you can insert it into Raspberry Pi and use it as a 16GB SD card, with better read/write speed. It works perfectly in Raspberry Pi Zero, Zero W, 3B and 3B+, but it doesn't work in Raspberry Pi 4B.

To reproduce The eMMC->micro SD adapter does these wirings to emulate an SD card:

eMMC DAT2 (A5) -> microSD DAT2
eMMC DAT3 (B2) -> microSD DAT3
eMMC CMD  (M5) -> microSD CMD
eMMC VDD       -> microSD VDD
eMMC CLK  (M6) -> microSD CLK
eMMC VSS       -> microSD VSS
eMMC DAT0 (A3) -> microSD DAT0
eMMC DAT1 (A4) -> microSD DAT1

Expected behaviour This eMMC emulated SD card work as well in RPi4.

Actual behaviour This eMMC emulated SD card is not recognised by RPi4.

System

Additional context I used a SparkFun microSD Sniffer and a logic analyzer to observe the communication between Raspberry Pi and the emulated SD card. In order to make comparison, I tested these combinations:

I monitored the CMD and CLK lines to figure out the actual command sequence in each case. Below I list the command sequences I got:

Raspberry Pi 3B with Kingston 16GB micro SD card (boot OK)

CMD0
CMD8
CMD8-RESP
CMD55
CMD55-RESP
ACMD41
R3-RESP
(repeat the 4 steps above 3 times)
CMD2
CMD2-RESP
CMD3
CMD3-RESP
...

Raspberry Pi 3B with eMMC emulated SD card (boot OK)

CMD0
CMD8
CMD0
CMD55
CMD1
R3-RESP
(repeat the 2 steps above 2 times)
CMD2
CMD2-RESP
CMD3
CMD3-RESP
...

Raspberry Pi 4B with Kingston 16GB micro SD card (boot OK)

CMD0
CMD8
CMD8-RESP
CMD55
CMD55-RESP
ACMD41
R3-RESP
(repeat the 4 steps above 29 times)
(the clock signal lasts ~50ms without any command)
CMD55
CMD55-RESP
ACMD41
R3-RESP
CMD2
CMD2-RESP
CMD3
CMD3-RESP
...

Raspberry Pi 4B with eMMC emulated SD card (not recognised)

CMD0
CMD8
CMD0
CMD55
CMD0
CMD1
R3-RESP
(repeat the 2 steps above 29 times)
CMD2
CMD0 (drop the process and start over again)
CMD8
…

By comparing the command sequences, I can see some differences between implementations in RPi3 and RPi4.

The first thing is that RPi4 repeats the ACMD41 or CMD1 command so many times, which doesn't seem normal. Although I can't tell if it causes the emulated SD card not recognised, but I guess something could be optimised here?

I also noticed that, when using the eMMC emulated SD card, RPi4 inserts a CMD0 before the CMD1, and RPi3 doesn't do that. I don't know if this behavior is relevant to this issue.

Obviously the command sequence for real micro SD card and that for eMMC emulated SD card are different (in both RPi3 and RPi4). For example the ACMD41 command is used for real SD card, while the CMD1 command is used for eMMC emulated SD card. Maybe those older models of Raspberry Pi are supporting this emulated SD card with some quirks, but it would be nice to let RPi4 has the same compatibility.

timg236 commented 5 years ago

Sorry EMMC hasn’t been tested at all on Pi4 yet. It’s fairly low priority but it’s probably quite simple and could be a “Friday afternoon task”. If you can post details of common hardware configurations then we can order some and give it a go.

uugear commented 5 years ago

Sorry EMMC hasn’t been tested at all on Pi4 yet. It’s fairly low priority but it’s probably quite simple and could be a “Friday afternoon task”. If you can post details of common hardware configurations then we can order some and give it a go.

Thank you for the quick reply, and I am glad to know it is not difficult to solve. I will send you two pieces of this eMMC->microSD adapter for testing. Thank you.

SonoraTechnical commented 4 years ago

Did you all pursue this? It would be neat to find something faster than a microSD Card.

uugear commented 4 years ago

Did you all pursue this? It would be neat to find something faster than a microSD Card.

The latest Raspbian Buster (2019-09-26) includes new firmware and can support eMMC emulated SD card on Pi4. However you will need to upgrade the bootloader beforehand. You can find beta version of bootloader here. The version I tested is "pieeprom-2019-10-16.bin".

If we can wait long enough, eventually the newly manufactured Pi4 might come with the latest bootloader. However the lead time could be very, very long.