hope I can find someone here who can help me. I found a lot according to free GPIO12 in GOOGLE but it does not work for me.
Until now everthing went well with programming my esp32-cam with esp32-cam-mb. Now I want to free GPIO12 from sdcard. It was said that I should switch to 1-line-mode in my program in this way:
SD_MMC.begin("/sdcard", true)
Next I should attach 10k Ohm pullup resistors.
CMD to VCC
CLK to VCC
DATA0 to VCC
For a first step I soldered them to corresponding pins of my esp32-cam-mb. Then I plugged in my esp32-cam. But after that upload with platformio fails.
What am I doing wrong?
Excuse me that I didn’t mention before, that I have a AI-Thinker. I don’t know whether this makes a difference. Sorry, I am new.
I think the pullup resistor makes it level high.
But I think the problem is before boot. It refuses to connect before upload:
Uploading .pio\build\esp32dev\firmware.bin
esptool.py v3.1
Serial port COM6
Connecting…………………_____
A fatal error occurred: Failed to connect to ESP32: Timed out waiting for packet header
*** [upload] Error 2
========================================================================== [FAILED] Took 27.80 seconds ==========================================================================
“Before boot” the device is off / no power
The sequence is: Power on / reset → first stage bootloader → second stage bootloader → running application or entering download mode (dependent to GPIO0 is HIGH or LOW)
If GPIO12 is pulled HIGH when the ESP32 is turned on or resets it will not boot and therefore never reach the download mode.
Don’t use GPIO 12 as Input / Don’t connect anything to GPIO 12 which pulls it HIGH at boot. Use another GPIO. See the green GPIO’s on the Input column in the above mentioned Pinout Reference.
I changed from GPIO12 to GPIO13 and upload is working again successfully.
Now again I am at the point where I am looking for a solution for freeing a pin from sd card slot.
They say it is done by 1 bit mode.
1 bit mode frees GPIO12, GPIO13 and GPIO4.
When I call this in my source
SD_MMC.begin(“/sdcard”, true) // true means 1 bit mode is active
the result is:
E (916) sdmmc_common: sdmmc_init_ocr: send_op_cond (1) returned 0x107
E (916) vfs_fat_sdmmc: sdmmc_card_init failed (0x107).
[ 927][E][SD_MMC.cpp:138] begin(): Failed to initialize the card (0x107). Make sure SD card lines have pull-up resistors in place.
SD Card Mount Failed
I attached pullup resistors now
CMD to VCC
CLK to VCC
GPIO13 to VCC
Aha. Thanks again. So my three 10K resistors I soldered
from CMD to VCC
from CLK to VCC
from GPIO13 to VCC
are redundant and/or obsolete.
I did this because of the message I allways get when reset my esp32-cam:
E (916) sdmmc_common: sdmmc_init_ocr: send_op_cond (1) returned 0x107
E (916) vfs_fat_sdmmc: sdmmc_card_init failed (0x107).
[ 927][E][SD_MMC.cpp:138] begin(): Failed to initialize the card (0x107). Make sure SD card lines have pull-up resistors in place.
SD Card Mount Failed
I also got this message before I soldered the 10K resistors. So I thaught it would be better to attach them.
That’s an error message that just points you into (one possible) direction what the root cause may be. It doesn’t check if the resistors are present.
I only have very little experience with SD cards on the ESP32. The most recent was: it didn’t work with newer SD cards but with older - See the github issue I mentioned before. And that was using Espressif Arduino 2.0.17. I have no clue if this was finally fixed on the newer Arduino 3.2 core.
Did you ever get your SD card working on the ESPcam before you started to “free GPIOs” ?
Until now I did not try to get sd card working. I want to save photos or videos on a different server. So I don’t need a sd card. My aim is to connect a battery to esp32-cam and want to monitor the capacity. This is why I want to free a sd card pin.
Sorry, I am very new here. I cannot find a github issue you mentioned before.
I always suggest to do things step by step. Try to get the sd card working first. Then try the one bit mode. Now you have free GPIOs to do the next steps…