Loading Image From SD Card

pacucha42
Posts: 31
Joined: Fri Mar 29, 2019 12:56 pm

Re: Loading Image From SD Card

Postby pacucha42 » Wed Oct 30, 2024 3:13 pm

0x107 means timeout (the card didn't respond in time, in your case to ACMD41 configuration command). There is a bunch of possible reasons, but I'd try another card first (4GB should be safe size). You can also format the card on your PC to see whether it helps, but it's likely unrelated to 0x107 here... you mentioned you managed to run the SDMMC example on your device so I don't assume your PIN setup is wrong - however, you can check your SD PINs based on the board's schematics (eg https://github.com/SeeedDocument/forum_ ... M_V1.6.pdf - Micro SD socket lines must be configured according to the scheme: eg CMD line goes to HS2_CMD link which translates to GPIO15 on the main module, and so on). Also, check for conflicting PIN assignments, ie single PIN being used by multiple peripherals or by the system.

Furthermore, you can enable VERBOSE logging mode (via idf.py menuconfig) and see more details on what's happening inside your code. But if you once saw your example working, it is quite likely you have incidentally changed your app configuration or such. Maybe try to go step by step from the scratch - first connect the card only, then enable the camera, then add image processing, etc etc.

Good luck.

tahseenabbas52
Posts: 11
Joined: Thu Oct 24, 2024 6:24 am

Re: Loading Image From SD Card

Postby tahseenabbas52 » Thu Oct 31, 2024 5:55 am

pacucha42 wrote:
Wed Oct 30, 2024 3:13 pm
0x107 means timeout (the card didn't respond in time, in your case to ACMD41 configuration command). There is a bunch of possible reasons, but I'd try another card first (4GB should be safe size). You can also format the card on your PC to see whether it helps, but it's likely unrelated to 0x107 here... you mentioned you managed to run the SDMMC example on your device so I don't assume your PIN setup is wrong - however, you can check your SD PINs based on the board's schematics (eg https://github.com/SeeedDocument/forum_ ... M_V1.6.pdf - Micro SD socket lines must be configured according to the scheme: eg CMD line goes to HS2_CMD link which translates to GPIO15 on the main module, and so on). Also, check for conflicting PIN assignments, ie single PIN being used by multiple peripherals or by the system.

Furthermore, you can enable VERBOSE logging mode (via idf.py menuconfig) and see more details on what's happening inside your code. But if you once saw your example working, it is quite likely you have incidentally changed your app configuration or such. Maybe try to go step by step from the scratch - first connect the card only, then enable the camera, then add image processing, etc etc.

Good luck.
Actually the same PIN setup and SD Card is working when i run it in SDMMC App that is probably written in C. But Shifting the same commands to C++ program (that i have provided above) this error arises. The only reason i am shifting towards C++ that i want to load image from SD Card using OpenCV as it has examples written in C++ only.
I am also trying to debug the issue but at some point i become clueless to further continue on this.

pacucha42
Posts: 31
Joined: Fri Mar 29, 2019 12:56 pm

Re: Loading Image From SD Card

Postby pacucha42 » Thu Oct 31, 2024 8:18 am

You can share your VERBOSE log here and let me see - can't guarantee I'll find the root cause, though. Again: if you had managed to run the SDMMC example on your ESP32-CAM board, appropriate setup obviously exists. If you start again from that point, you should be able to find a stable configuration, C++ is not the point.

Afaik, we don't have own OpenCV port yet, the library is still under construction (see https://github.com/espressif/idf-extra- ... ts/pull/94). You can try other open-source projects, like https://github.com/joachimBurket/esp32-opencv

Have you tried to replace the SD card, btw?

tahseenabbas52
Posts: 11
Joined: Thu Oct 24, 2024 6:24 am

Re: Loading Image From SD Card

Postby tahseenabbas52 » Thu Oct 31, 2024 10:03 am

pacucha42 wrote:
Thu Oct 31, 2024 8:18 am
You can share your VERBOSE log here and let me see - can't guarantee I'll find the root cause, though. Again: if you had managed to run the SDMMC example on your ESP32-CAM board, appropriate setup obviously exists. If you start again from that point, you should be able to find a stable configuration, C++ is not the point.

Afaik, we don't have own OpenCV port yet, the library is still under construction (see https://github.com/espressif/idf-extra- ... ts/pull/94). You can try other open-source projects, like https://github.com/joachimBurket/esp32-opencv

Have you tried to replace the SD card, btw?
Thanks for your quick response and support, FYI i have successfully mounted the SD Card there was issue with slot_config.width, it was set to 1 and after updating it to 4(Hardcoded) as in C example it started working. There was a condition to check for it but that wasn't working don't know exact reason behind that.
For OpenCV i am using that opensource package you have mentioned but the only issue is i am able to load "png" images only for now, that is causing memory issue if i go with higher resolutions like 480x320 etc but on 320x240 with GrayScale mode it is fine for now.

pacucha42
Posts: 31
Joined: Fri Mar 29, 2019 12:56 pm

Re: Loading Image From SD Card

Postby pacucha42 » Thu Oct 31, 2024 10:43 am

Ok, it sounds like your main trouble is resolved. I cannot provide much help for processing pictures, not my domain. Generally, you can expect troubles with the system resources when processing any larger image data - ESP32* is embedded platform, which naturally brings in quite a few limitations :-) That's why the OpenCV port proposed is simplified and minimised version of the original library... still, you can achieve nice results.

Good luck with your project.

tahseenabbas52
Posts: 11
Joined: Thu Oct 24, 2024 6:24 am

Re: Loading Image From SD Card

Postby tahseenabbas52 » Thu Oct 31, 2024 10:50 am

pacucha42 wrote:
Thu Oct 31, 2024 10:43 am
Ok, it sounds like your main trouble is resolved. I cannot provide much help for processing pictures, not my domain. Generally, you can expect troubles with the system resources when processing any larger image data - ESP32* is embedded platform, which naturally brings in quite a few limitations :-) That's why the OpenCV port proposed is simplified and minimised version of the original library... still, you can achieve nice results.

Good luck with your project.
Thank you so much :)

Who is online

Users browsing this forum: No registered users and 76 guests