AI Thinker ESP32-CAM stuck on “compiling sketch”

I have an AI Thinker ESP32-CAM. I have downloaded ESP32 by espressif and added my edge impulse project to library. I opened my project using file>examples>project name>esp32> esp32_camera and commented #define CAMERA_MODEL_ESP_EYE then I removed the comment for #define CAMERA_MODEL_AI_THINKER.
Whenever I try to upload, it gets stuck on “compiling sketch”. How can I fix this??

Hi @Bluepill

Can you try one of the example sketches, do they run?
If the example doesn’t run make sure you have the board and port selected.

See Troubleshooting for more details:

Best

Eoin

I tried a blink sketch on my ESP32-CAM and it worked but anytime I try uploading the example I downloaded from the deployment tab of edge impulse, It gets stuck on “compiling sketch”.

I left my computer compiling for hours and realized it was actually compiling the whole time. I had certain errors regarding a cpp file(conv.cpp) in the edge impulse inference. I don’t know how to go about it. the error reads: c:\Arduino\libraries\final_battery_sorting_inferencing\src\edge-impulse-sdk\tensorflow\lite\micro\kernels\conv.cpp: In function ‘TfLiteStatus tflite::{anonymous}::Prepare(TfLiteContext*, TfLiteNode*)’:
c:\Arduino\libraries\final_battery_sorting_inferencing\src\edge-impulse-sdk\tensorflow\lite\micro\kernels\conv.cpp:1789:67: error: either all initializer clauses should be designated or none of them should be
1789 | .channels = input->dims->data[3], 1
| ^
c:\Arduino\libraries\final_battery_sorting_inferencing\src\edge-impulse-sdk\tensorflow\lite\micro\kernels\conv.cpp:1793:68: error: either all initializer clauses should be designated or none of them should be
1793 | .channels = output->dims->data[3], 1
| ^
c:\Arduino\libraries\final_battery_sorting_inferencing\src\edge-impulse-sdk\tensorflow\lite\micro\kernels\conv.cpp:1795:80: error: either all initializer clauses should be designated or none of them should be
1795 | data_dims_t filter_dims = {.width = filter_width, .height = filter_height, 0, 0};
| ^
c:\Arduino\libraries\final_battery_sorting_inferencing\src\edge-impulse-sdk\tensorflow\lite\micro\kernels\conv.cpp: In function ‘void tflite::{anonymous}::EvalQuantizedPerChannel(TfLiteContext*, TfLiteNode*, const TfLiteConvParams&, const NodeData&, const TfLiteEvalTensor*, const TfLiteEvalTensor*, const TfLiteEvalTensor*, TfLiteEvalTensor*)’:
c:\Arduino\libraries\final_battery_sorting_inferencing\src\edge-impulse-sdk\tensorflow\lite\micro\kernels\conv.cpp:1883:58: error: either all initializer clauses should be designated or none of them should be
1883 | .channels = input_depth, 1
| ^
c:\Arduino\libraries\final_battery_sorting_inferencing\src\edge-impulse-sdk\tensorflow\lite\micro\kernels\conv.cpp:1887:59: error: either all initializer clauses should be designated or none of them should be
1887 | .channels = output_depth, 1
| ^
c:\Arduino\libraries\final_battery_sorting_inferencing\src\edge-impulse-sdk\tensorflow\lite\micro\kernels\conv.cpp:1889:80: error: either all initializer clauses should be designated or none of them should be
1889 | data_dims_t filter_dims = {.width = filter_width, .height = filter_height, 0, 0};
| ^
“C:\Users\Samira\AppData\Local\Arduino15\packages\esp32\tools\esp-x32\2302/bin/xtensa-esp32-elf-g++” -MMD -c “@C:\Users\Samira\AppData\Local\Arduino15\packages\esp32\tools\esp32-arduino-libs\idf-release_v5.1-bd2b9390ef\esp32/flags/cpp_flags” -w -Os -DF_CPU=240000000L -DARDUINO=10607 -DARDUINO_ESP32_DEV -DARDUINO_ARCH_ESP32 “-DARDUINO_BOARD="ESP32_DEV"” “-DARDUINO_VARIANT="esp32"” -DARDUINO_PARTITION_huge_app “-DARDUINO_HOST_OS="windows"” “-DARDUINO_FQBN="esp32:esp32:esp32cam:CPUFreq=240,FlashFreq=80,FlashMode=qio,PartitionScheme=huge_app,DebugLevel=none"” -DESP32 -DCORE_DEBUG_LEVEL=0 -DBOARD_HAS_PSRAM -mfix-esp32-psram-cache-issue -mfix-esp32-psram-cache-strategy=memw -DARDUINO_USB_CDC_ON_BOOT=0 “@C:\Users\Samira\AppData\Local\Arduino15\packages\esp32\tools\esp32-arduino-libs\idf-release_v5.1-bd2b9390ef\esp32/flags/defines” “-IC:\Users\Samira\AppData\Local\Temp\.arduinoIDE-unsaved2024631-8512-1pssh29.hb9pg\esp32_camera” -iprefix “C:\Users\Samira\AppData\Local\Arduino15\packages\esp32\tools\esp32-arduino-libs\idf-release_v5.1-bd2b9390ef\esp32/include/” “@C:\Users\Samira\AppData\Local\Arduino15\packages\esp32\tools\esp32-arduino-libs\idf-release_v5.1-bd2b9390ef\esp32/flags/includes” “-IC:\Users\Samira\AppData\Local\Arduino15\packages\esp32\tools\esp32-arduino-libs\idf-release_v5.1-bd2b9390ef\esp32/qio_qspi/include” “-IC:\Users\Samira\AppData\Local\Arduino15\packages\esp32\hardware\esp32\3.0.2\cores\esp32” “-IC:\Users\Samira\AppData\Local\Arduino15\packages\esp32\hardware\esp32\3.0.2\variants\esp32” “-Ic:\Arduino\libraries\final_battery_sorting_inferencing\src” “@C:\Users\Samira\AppData\Local\Temp\arduino\sketches\88EF7A14005D490369B6E3575E66A677/build_opt.h” “@C:\Users\Samira\AppData\Local\Temp\arduino\sketches\88EF7A14005D490369B6E3575E66A677/file_opts” “c:\Arduino\libraries\final_battery_sorting_inferencing\src\edge-impulse-sdk\tensorflow\lite\micro\kernels\depthwise_conv.cpp” -o “C:\Users\Samira\AppData\Local\Temp\arduino\sketches\88EF7A14005D490369B6E3575E66A677\libraries\final_battery_sorting_inferencing\edge-impulse-sdk\tensorflow\lite\micro\kernels\depthwise_conv.cpp.o”
c:\Arduino\libraries\final_battery_sorting_inferencing\src\edge-impulse-sdk\tensorflow\lite\micro\kernels\depthwise_conv.cpp: In function ‘void tflite::{anonymous}::EvalQuantizedPerChannel(TfLiteContext*, TfLiteNode*, const TfLiteDepthwiseConvParams&, const NodeData&, const TfLiteEvalTensor*, const TfLiteEvalTensor*, const TfLiteEvalTensor*, TfLiteEvalTensor*)’:
c:\Arduino\libraries\final_battery_sorting_inferencing\src\edge-impulse-sdk\tensorflow\lite\micro\kernels\depthwise_conv.cpp:1727:58: error: either all initializer clauses should be designated or none of them should be
1727 | .channels = input_depth, 1
| ^
c:\Arduino\libraries\final_battery_sorting_inferencing\src\edge-impulse-sdk\tensorflow\lite\micro\kernels\depthwise_conv.cpp:1731:59: error: either all initializer clauses should be designated or none of them should be
1731 | .channels = output_depth, 1
| ^
c:\Arduino\libraries\final_battery_sorting_inferencing\src\edge-impulse-sdk\tensorflow\lite\micro\kernels\depthwise_conv.cpp:1733:80: error: either all initializer clauses should be designated or none of them should be
1733 | data_dims_t filter_dims = {.width = filter_width, .height = filter_height, 0, 0};
| ^
c:\Arduino\libraries\final_battery_sorting_inferencing\src\edge-impulse-sdk\tensorflow\lite\micro\kernels\depthwise_conv.cpp: In function ‘TfLiteStatus tflite::{anonymous}::Prepare(TfLiteContext*, TfLiteNode*)’:
c:\Arduino\libraries\final_battery_sorting_inferencing\src\edge-impulse-sdk\tensorflow\lite\micro\kernels\depthwise_conv.cpp:1836:67: error: either all initializer clauses should be designated or none of them should be
1836 | .channels = input->dims->data[3], 1
| ^
c:\Arduino\libraries\final_battery_sorting_inferencing\src\edge-impulse-sdk\tensorflow\lite\micro\kernels\depthwise_conv.cpp:1840:68: error: either all initializer clauses should be designated or none of them should be
1840 | .channels = output->dims->data[3], 1
| ^
c:\Arduino\libraries\final_battery_sorting_inferencing\src\edge-impulse-sdk\tensorflow\lite\micro\kernels\depthwise_conv.cpp:1842:80: error: either all initializer clauses should be designated or none of them should be
1842 | data_dims_t filter_dims = {.width = filter_width, .height = filter_height, 0, 0};
| ^

Using library final_battery_sorting_inferencing at version 1.0.2 in folder: C:\Arduino\libraries\final_battery_sorting_inferencing
exit status 1

Compilation error: exit status 1

Ah ok try Disabling EI_CLASSIFIER_TFLITE_ENABLE_ESP_NN if it is enabled.

#define EI_CLASSIFIER_TFLITE_ENABLE_ESP_NN 1

replace with:

#define EI_CLASSIFIER_TFLITE_ENABLE_ESP_NN 0

Best

Eoin

I did just that and it compiled successfully. Thank you very much for your assistance