varwnos
Posts: 2
Joined: Sat Jul 31, 2021 1:01 pm

Adding a second SD Card using the SD 4-bit Mode (Not SPI)

Sat Jul 31, 2021 1:19 pm

Hello all,

After having a preview of similar posts in this forum I decided to make a new thread.

Facts:
1. Working on a Raspberry Pi 4 Model B development board
2. Creating a commercial product, let's say a network camera
3. Recording a h.264 video stream in a removable storage (similar products use a micro SD card up to 512 GB Class 10 so the user can have access easily)
4. For the commercial product we will use the Raspberry Pi 4 Compute Model and a Carrier board.
5. The most of the tutorials found on the WEB describe how to connect an SD Card using the SPI interface. However, this is not feasible because it will limit the bandwidth up top 1 MB/s.
6. So we want to use the SD 4-bit Mode interface (I believe this is the most we can get given the available GPIOs)
7. There is some kind of HAT here https://thepihut.com/products/mmc-hat-f ... spberry-pi but I cannot find any datasheet
8. SD Card interface pinout in all modes can be found here http://www.interfacebus.com/Secure_Digi ... inout.html
9. Raspberry Pi 4 Model B SDIO pinout can be found here https://pinout.xyz/pinout/sdio
10. After reading many threads it seems people have some issues or difficulty to connect a second SD Card, for example they disable WiFi module, etc.

Questions:
1. Does anyone have used the HAT here https://thepihut.com/products/mmc-hat-f ... spberry-pi ?
2. I was thinking to move forward with a USB2 or USB3 to microSD adapter, however I am not sure if it will be reliable in long term use. Any thoughts?

trejan
Posts: 3589
Joined: Tue Jul 02, 2019 2:28 pm

Re: Adding a second SD Card using the SD 4-bit Mode (Not SPI)

Sat Jul 31, 2021 2:53 pm

The sdhost controller is unused on a Pi 4/Pi 400/CM4 and can be set to the GPIO header on GPIO22-27. The MMC HAT is connected there.

A USB reader will be much faster as the sdhost controller doesn't support any of the higher speed modes.
varwnos wrote:
Sat Jul 31, 2021 1:19 pm
10. After reading many threads it seems people have some issues or difficulty to connect a second SD Card, for example they disable WiFi module, etc.
Older Pi SoCs only had two SD controllers. One was for the onboard card and the other was for WiFi. BCM2711 in the Pi 4/Pi 400/CM4 adds a new faster controller which is used for the card so the old one is now spare.

User avatar
HermannSW
Posts: 4508
Joined: Fri Jul 22, 2016 9:09 pm
Location: Eberbach, Germany
Contact: Website Twitter YouTube

Re: Adding a second SD Card using the SD 4-bit Mode (Not SPI)

Sat Jul 31, 2021 9:20 pm

trejan wrote:
Sat Jul 31, 2021 2:53 pm
A USB reader will be much faster as the sdhost controller doesn't support any of the higher speed modes.
I used this USB card reader a lot recently with Pi4B:
https://www.amazon.de/gp/product/B07KW3 ... UTF8&psc=1

It allowed me to fix a broken installation with a 2nd SD card and only a Pi4B:
viewtopic.php?f=29&t=315970

It is reliable until you accidentially touch it -- then filesystems get unmounted.
For a product I would fixate USB card reader with superglue, or solder to Pi USB.
With that USB reader I would use micro SD card because it snaps in.
https://stamm-wilbrandt.de/2wheel_balancing_robot
https://stamm-wilbrandt.de/en#raspcatbot
https://github.com/Hermann-SW/Raspberry_v1_camera_global_external_shutter
https://github.com/Hermann-SW/raspiraw
https://stamm-wilbrandt.de/en/Raspberry_camera.html

varwnos
Posts: 2
Joined: Sat Jul 31, 2021 1:01 pm

Re: Adding a second SD Card using the SD 4-bit Mode (Not SPI)

Mon Aug 02, 2021 8:55 pm

Thank you all for the answers and advices. I will move forward with a USB to micro SD adapter soldered on the USB pads via a cable.

User avatar
HermannSW
Posts: 4508
Joined: Fri Jul 22, 2016 9:09 pm
Location: Eberbach, Germany
Contact: Website Twitter YouTube

Re: Adding a second SD Card using the SD 4-bit Mode (Not SPI)

Tue Aug 03, 2021 5:53 am

My older son explained to me, that sd cards allow for serial and parallel access only. Using usb micro sd card reader is convenient, but does internally use the parallel interface.
https://stamm-wilbrandt.de/2wheel_balancing_robot
https://stamm-wilbrandt.de/en#raspcatbot
https://github.com/Hermann-SW/Raspberry_v1_camera_global_external_shutter
https://github.com/Hermann-SW/raspiraw
https://stamm-wilbrandt.de/en/Raspberry_camera.html

Return to “HATs and other add-ons”