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
888 stars 209 forks source link

[ISSUE] Programming in VSCode with PlatformIO #399

Closed mateoavalose closed 5 months ago

mateoavalose commented 5 months ago

I'm trying to program the ESP32 using ProgramIO. Although everything seems to work fine, the board isn´t able to recognize the SD card, so when I go to the station IP, it only shows "Startup Failure: Check SD card inserted". Does it have anything to do with me not using the Arduino IDE?

rjsachse commented 5 months ago

What board are you trying to flash? Not a issue with playformio as I use that with my custom board.

mateoavalose commented 5 months ago

I'm using the AI Thinker board. I flashed other projects and they read the SD card just fine

rjsachse commented 5 months ago

Ok you might have to define the pins "SD_MMC_CMD 15, SD_MMC_CLK 14, SD_MMC_DATA 2 in platformio. Either in the platformio.ini or in appGlobals.h around line 133. Or use arduino. Sorry haven't tried Ai Thinker Cam in platformio

mateoavalose commented 5 months ago

I'll give it a try and report back to here

edit: Added the pin definitions in the appGlobals.h and it doesn't work either. Also tried commenting the definitions for the other boards. Thanks for the tip either way

rjsachse commented 5 months ago

Have you tried in arduino?

mateoavalose commented 5 months ago

No. I was just about to download it and try because nothing seems to be solving it

mateoavalose commented 5 months ago

Arduino IDE has the same problem. I really don't know what to do anymore, because other projects do recognize the SD card

rjsachse commented 5 months ago

Is the card formatted right?

mateoavalose commented 5 months ago

Yeah, I can even connect to the IP web page, just to see the text "Startup Failure: Check SD card inserted".

rjsachse commented 5 months ago

Do you have the data folder on the sd card. What is in the logs. Does it say "card mount failed"

mateoavalose commented 5 months ago

Yes, the data folder is in the SD card. And I do get the error "card mount failed" in the logs.

rjsachse commented 5 months ago

Sorry I am stumped on this. I will have a look when I get off work. Have you tried another sd card by any chance

rjsachse commented 5 months ago

Maybe try a fresh install of mjpeg2sd and don't change nothing in the files and select board and partition and flash.

mateoavalose commented 5 months ago

I did that for the Arduino IDE, as the project where I modified the files is a dupped version from the fresh download. Also, that download is 2 weeks old so I dont think much has changed

rjsachse commented 5 months ago

So the SDMMC_TEST under arduino examples works with no issues

rjsachse commented 5 months ago

This issue might be hardware. Alot of cheap clones out there. Might not have pull ups on the lines. The other projects that works are they using sdmmc or spi for sd

mateoavalose commented 5 months ago

I don´t think I'm using a cheap clone, in my understanding the AI Thinked board goes for around 10 USD, and I got mine for around 8 USD, not the 2 or 3 USD people often get. Also, I don't get the 2Mb error some people get when using the clone. Either way I'm not ruling this option out, because it can certanly be a clone board, I don't have a way to be sure. The other project uses SD_MMC.h and FS.h for the SD card stuff. The SDMMC_TEST under Arduino examples runs and recognizes the SD card. At the end it threw an error. Maybe this is it? SDMMC_TEST - Console.txt

rjsachse commented 5 months ago

Seems OK. Beside not able to delete file. The sd card seems small 384mb should not matter. Have you tried a different card

mateoavalose commented 5 months ago

Its not 384MB, its 3840MB: 4GB, what the ESP32CAM is designed for, isn't it? And I haven't tried another one because the other only one I have is 128GB, and I understand the board reads to a max of 32GB.

rjsachse commented 5 months ago

Sorry my mistake.

mateoavalose commented 5 months ago

Anyone else know how to fix it?

s60sc commented 5 months ago

I can only suggest that the pinout of the board you are using does not match the configured board.

mateoavalose commented 5 months ago

I have used, in the Arduino software, the 'ESP32 Dev Module' and the 'AI Thinker ESP32 CAM', I think those are the right ones. Also, in the code I've tried leaving it as it is (AI thinker as the default) and also commenting the '#define' lines and just having a single line '#define CAMERA_MODEL_AI_THINKER ' IMG2 IMG1

Is there any way of knowing if its a clone board by looking at it?

s60sc commented 5 months ago

try downloading a fresh copy of the app in case you have corrupted it

mateoavalose commented 5 months ago

I already tried that. Maybe an older version might work?

s60sc commented 5 months ago

No, the problem is specific to your environment, not the app

mateoavalose commented 5 months ago

I'm not saying the problems is in the app itself, I'm thinking something in my local enviroment is conflicting with something the app. This is why I thought maybe an older version might work with my enviroment

rjsachse commented 5 months ago

Have you changed any settings before uploading? Do you have the right board selected? Do you have the right partition selected? Have you tried latest version 9.7a? Format card to FAT32. Try erasing flash before upload.

I can upload the project straight to a new espcam not changing any settings and just select right board, partition.

Hope you work it out

mateoavalose commented 5 months ago

Didn't change anything different from my Wifi SSID and password. I selected only the partition and the board. Tried it with a freshly formatted SD Card, on FAT32 and version 9.7a. Console ArduinoTools SDCardFormatter