s60sc / ESP32-CAM_MJPEG2SD

ESP32 Camera motion capture application to record JPEGs to SD card as AVI files and stream to browser as MJPEG. If a microphone is installed then a WAV file is also created. Files can be uploaded via FTP or downloaded to browser.
GNU Affero General Public License v3.0
936 stars 216 forks source link

[Module Support Inquiry] SDMMC MicroSD Card Support for FireBeetle 2 ESP32-S3 #472

Open maximagination1 opened 3 months ago

maximagination1 commented 3 months ago

Hi,

I purchased an SDMMC MicroSD card module as you recommended. It uses pins CD, CS, DI, DO, and CLK. How can it be interfaced with an ESP32 such as the FireBeetle board using your code?

I don't see pin defines for the FireBeetle in your code that indicate an SD card can connect to it. Are there some sort of default pins the ESP32-S3 board has that are designed for an external SDMMC module? If so, which would those be? Thanks.

Best regards,

Max

s60sc commented 3 months ago

Choose any 3 free pins for CLK, CD and D0 and add the code below to the firebeetle entry with the relevant pin numbers, in place of #define NO_SD

#define SD_MMC_CLK CLK pin
#define SD_MMC_CMD CD pin
#define SD_MMC_D0  D0 pin

All 3 pins need 10k pullups which should be on the SD module info

maximagination1 commented 3 months ago

Thanks for your prompt response.

I did as you mentioned, but I'm getting the "Startup Failure: Check SD Card Inserted" error. What could this be?

s60sc commented 3 months ago

Hardware issue, either with pin assignment or lack of pullups

maximagination1 commented 3 months ago

I checked my hardware, connections are firm and short between the 3.3V-powered SD module and my ESP32S3. I've formatted the micro-SD card with FAT32 and 8192 bytes - not sure if these details determine whether the SD card will be read. I've tested the module with pull-up resistors on those 3 pins, still no luck...

Supposedly, this SD card module I am using doesn't seem to need resistors as it has a logic level shifter, according to this page on Adafruit here: https://learn.adafruit.com/adafruit-micro-sd-breakout-board-card-tutorial/look-out

This is the module I'm using: https://www.adafruit.com/product/254

I assume this is SDMMC compatible. If it needs to be connected up some other way or if one or more pins need to be attached, I'd appreciate it if you could let me know.

Thanks.

s60sc commented 3 months ago

Over complicated board, you need to connect 3V3, 5V and GND to power the level shifter.

maximagination1 commented 3 months ago

Yes, it's getting too complicated using this module.

How about using a Micro-SD card adapter instead of the previous module, would it work directly with the ESP32S3? Like one of these: sandisk-micro-sd-to-sd-card

If it can work, would you please tell me to confirm how to correctly connect it? Thanks.

sd-card-pinout

s60sc commented 3 months ago

Best guess

pin 3 CMD pullup pin 4 3V3 pin 5 CLK pin 6 GND pin 7 D0 pullup

for each pullup, connect 10k resistor between pin and 3V3

pins 1, 2, 8 may also benefit from pullups to stop them floating

s60sc commented 3 months ago

pins given for micro sd

maximagination1 commented 3 months ago

Ok, thanks! Will test this out.

maximagination1 commented 3 months ago

I got the SD card adapter working. Quite a fast and cheap solution.

I pulled-up all four data pins and the one command pin with a total of five 10K ohm resistors and adjoined both GNDs (VSS1 & VSS2).

Works perfectly!

Thank you very much for your help as always!

About the Hexapedal Robot code, I still have to build the robot and ensure everything works as expected before merging it with yours.

Cheers.

s60sc commented 3 months ago

Good to hear, interested to see the end result

rjsachse commented 1 month ago

I use a breakout board like this images (9) Just need to make sure it is sd mmc not spi like most on the market