Allnet Rock Pi 4 Adapter USB 3.0 to EMMC

eMMC, what is it?

Is a chip used in embedded device. A lot of devices like TV, routers, SoC are using such chip to be used as storage.
These chips are very similar with SD/micro SD cards. If you use a passive adapter to convert eMMC to micro SD and then insert it into a normal micro SD card, you will be able to see only the parititon / partitions in “User Data Area” of the eMMC.
Then you will ask: what is “User Data Area”?
The eMMC is a little bit different than SD/micro SD. eMMC contains more than one “area”. Here you can find some more information: https://www.pengutronix.de/en/blog/2020-10-15-anpassen-einer-emmc.html

This is how an eMMC looks like:

When we are using micro SD to boot any SoC devices we have to use some space between sector 1 (512 bytes offset) up 2048 (1MB offset), or even more. In Raspberry Pi they are using a free space up to sector 16383 (8MB offset). Then the first BootFS partition is configured.

In eMMC there is another configuration. As you can see there is a partition named Boot#0, Boot#1 and RPMB, called in Linux /dev/mmcblk0boot0, /dev/mmcblk0boot1 and /dev/mmcblk0rpmb.

We don’t care too much about RPMB, in SoC I didn’t used. But what is important is /dev/mmcblk0boot0. Some devices can have a button / switch to select from which boot partition you want to boot: boot0 or boot1.

Odroid XU4 is booting only from partition boot0.

How do I read a eMMC?

To read an eMMC is similarity how you read a micro SD card. There are compatible, but with some differences.

To read an eMMC chip there are 2 possibilities: PCB adapter with eMMC connector and micro SD connection or a special eMMC reader.

Option 1: PCB adapter from eMMC to micro SD

If you are using a passive adapter like this:

and you connect to a normal micro SD card reader, you will see only partitions on “User Data Area” which normally contains BootFS and RootFS! You will never see partitions Boot#0, Boot#1 and RPMB!

Because I want to build my own U-boot for Odroid XU4 using EFI, I wanted to reprogram Boot#0 partition.
Not knowing this information regarding for normal card reader which are not able to expose Boot#0, Boot#1 and RPMB partitions, I’ve wrote the BL1, BL2, U-boot and TZSW on eMMC.

Guess what happen? 🙂 Yep, the BootFS and RootFS where deleted, because this specific combination wrote these 4 firmware in “User Data Area”. Lucky that I did a backup of full “User Data Area” to an image.
In eMMC these 4 firmware are not residing in “User Data Area”, they are residing in Boot#0 partition!

Even in U-Boot for Odroid XU4 is written: normal card readers will not expose Boot#0, Boot#1 and RPMB partitions to OS.

Then you are asking: how can I expose these partitions to modify my U-Boot? The answer is: you have to use a special eMMC card reader. But the next question is: which one?

Option 2: dedicated eMMC card reader

Then I’ve went on internet and search for “eMMC card readers”. I found this one from the title: Allnet Rock Pi 4 Adapter USB 3.0 to EMMC.
Well, I said, if is specially made for Rock Pi4 and compatible with Odroid XU4, let’s try it.

Then you connect the eMMC on card reader slot, insert into USB port and you will see this:

[191922.401672] usb 8-4.3: new SuperSpeed USB device number 44 using xhci_hcd
[191922.419832] usb 8-4.3: New USB device found, idVendor=05e3, idProduct=0756, bcdDevice=18.55
[191922.419836] usb 8-4.3: New USB device strings: Mfr=3, Product=4, SerialNumber=5
[191922.419838] usb 8-4.3: Product: UFD
[191922.419840] usb 8-4.3: Manufacturer: Genesys
[191922.419841] usb 8-4.3: SerialNumber: 00000000XXXXXXXX
[191922.420471] usb-storage 8-4.3:1.0: USB Mass Storage device detected
[191922.420592] scsi host11: usb-storage 8-4.3:1.0
[191923.443497] scsi 11:0:0:0: Direct-Access Genesys UFD 1855 PQ: 0 ANSI: 6
[191923.443755] sd 11:0:0:0: Attached scsi generic sg0 type 0
[191923.556862] sd 11:0:0:0: [sda] Spinning up disk…
[191924.561510] …not responding…
[191926.939302] sd 11:0:0:0: [sda] 61071360 512-byte logical blocks: (31.3 GB/29.1 GiB)
[191926.939633] sd 11:0:0:0: [sda] Write Protect is off
[191926.939636] sd 11:0:0:0: [sda] Mode Sense: 23 00 00 00
[191926.939968] sd 11:0:0:0: [sda] Write cache: disabled, read cache: enabled, doesn't support DPO or FUA
[191926.994269] sda: sda1 sda2
[191926.994423] sd 11:0:0:0: [sda] Attached SCSI removable disk

$ ls /dev/disk/by-id/usb-Genesys_UFD_0000000090000172-0\:0*
/dev/disk/by-id/usb-Genesys_UFD_0000000090000172-0:0
/dev/disk/by-id/usb-Genesys_UFD_0000000090000172-0:0-part1
/dev/disk/by-id/usb-Genesys_UFD_0000000090000172-0:0-part2

Then you look into /dev directory to check if there is any mmcblk0.. and nothing :(.
As you can see from the output shows the eMMC as “SCSI disk” and it maps it as /dev/sda.

This device is using a chip GL3227E which doesn’t expose hidden partitions like Boot#0, Boot#1 and RPMB.

So, if you want to rewrite your booting firmware, DON’T BUY THIS card reader! Is not useful! I’ve tried to search on internet if this device expose these hidden partitions and I couldn’t find anything. Neither “doesn’t expose hidden partitions” nor “is expose hidden partitions”.

So I had to use the method “trial and error”, because the manufactures are not writing such information into device description.

This one I will return it because is behave exactly like the passive PCB from eMMC to micro SD card.

Is there any alternatives?

Yes, seems there is another alternative. Looking for it I found on GitHub a project based on Realtek RTS5170.

Here is the description for this chip: https://github.com/ignasurba/mmcblkNX .

Seems this chip is one of the chips which can read eMMC and expose /dev/mmcblk0 format of the eMMC.

I’ve ordered one from Aliexpress and I’m waiting for it and I will do a review of that eMMC reader in a separate post.

Info Box

eMMC reader. Allnet Rock Pi 4 Apater USB 3.0 to eMMC

Thalys PBKA 4341 set

Welcome back to my site!

Today I will present another train set. This set was the first train set which I’ve brought it. It is a special set from Mehano because it came with a DCC decoder, 3 pole engine with flywheel. Also is named Mehano Hobby.

The original decoder was an ESU LokSound v3.5 and the sound pack came from an ICE 3 train. For this reason I’ve changed the decoder to an ESU LokSound v5 and I’ve uploaded the Alstom TGV sound pack, because Thalys is a TGV train.

Other modifications I’ve made to this set are:

  • adding lights to the dummy loco (rear/front direction) and pickup contacts.
  • I’ve changed the panto-graphs to metallic ones to be more realistic.
  • adding interior lights in the passenger wagons.
  • adding current pickup contacts to the wagons nearby locos.
  • micro-connectors between all wagons.

SNCF Class 241P

Welcome back to my site!

Today I will present my SNCF 241P Loco made by Jouef. This loco is a French steam loco from era III, build between May 1948 – June 1952, with wheels configuration 4-8-2. More specs and details can be found here on Wikipedia.

This loco I’m using for my new “Orient Express Simplon” set from Trix, for which I will do an unboxing later.

This loco came with an ESU LokSound V4.0 DCC decoder with sounds and lights installed by default. There are front lights and rear lights, turned on depending of the direction of the loco, and also a firebox light which is simulating the fire into firebox.

About my blog

Welcome to my blog!

My name is Adrian and I’ve created this site because I love electronics and railway modeling.

Because I have plenty of projects in which I’m involved, I’ve decided to create this blog where I will add my projects for other people to be able to create by themselves different changes to their train models and create different electronics which can be applied to DCC, Arduino projects or STM32.

Most of the trains models I will show here in this blog will be H0, but of course some of the techniques can be applied to other scales, like OO, N, Z, etc.

Other posts I will present different sets, locomotives or wagons, or for example unboxing.

All movies will be uploaded on my YouTube channel.

I hope you will enjoy my site and my YouTube channel!