I have an AI-Thinker esp32cam board and I modified the firmware as suggested and recompiled and flashed the firmware onto my AI-Thinker board.
It appears the firmware works fine on my board, as verified via idf.py -p /dev/ttyUSB0 monitor:
entry 0x40080694
I (28) boot: ESP-IDF v4.4.1-dirty 2nd stage bootloader
I (28) boot: compile time 13:24:30
I (29) boot: chip revision: 1
I (32) boot_comm: chip revision: 1, min. bootloader chip revision: 0
I (39) boot.esp32: SPI Speed : 80MHz
I (44) boot.esp32: SPI Mode : DIO
I (48) boot.esp32: SPI Flash Size : 4MB
I (53) boot: Enabling RNG early entropy source...
I (58) boot: Partition Table:
I (62) boot: ## Label Usage Type ST Offset Length
I (69) boot: 0 nvs WiFi data 01 02 00009000 00006000
I (76) boot: 1 phy_init RF data 01 01 0000f000 00001000
I (84) boot: 2 factory factory app 00 00 00010000 00300000
I (91) boot: 3 storage Unknown data 01 82 00310000 000f0000
I (99) boot: End of partition table
I (103) boot_comm: chip revision: 1, min. application chip revision: 0
I (110) esp_image: segment 0: paddr=00010020 vaddr=3f400020 size=24350h (148304) map
I (164) esp_image: segment 1: paddr=00034378 vaddr=3ffb0000 size=03d94h ( 15764) load
I (169) esp_image: segment 2: paddr=00038114 vaddr=40080000 size=07f04h ( 32516) load
I (181) esp_image: segment 3: paddr=00040020 vaddr=400d0020 size=73500h (472320) map
I (324) esp_image: segment 4: paddr=000b3528 vaddr=40087f04 size=0a4d0h ( 42192) load
I (339) esp_image: segment 5: paddr=000bda00 vaddr=50000000 size=00010h ( 16) load
I (348) boot: Loaded app from partition at offset 0x10000
I (348) boot: Disabling RNG early entropy source...
Hello from Edge Impulse Device SDK.
Compiled on Jun 30 2022 13:44:39
ERR: failed to connect to inertial sensor!
Inertial sensor initialization failed
Type AT+HELP to see a list of commands.
>
I am able to verify the AT+HELP and AT+CONFIG? commands work just fine.
But when I try to run edge-impulse-daemon, I get the following error:
Edge Impulse serial daemon v1.15.1
Endpoints:
Websocket: wss://remote-mgmt.edgeimpulse.com
API: https://studio.edgeimpulse.com/v1
Ingestion: https://ingestion.edgeimpulse.com
[SER] Connecting to /dev/ttyUSB0
[SER] Serial is connected, trying to read config...
[SER] Failed to get info off device Timeout when waiting for > (timeout: 5000) onConnected
[SER] Serial is connected, trying to read config...
[SER] Failed to get info off device Timeout when waiting for > (timeout: 5000) onConnected
I then tried: edge-impulse-run-impulse
Edge Impulse impulse runner v1.15.1
[SER] Connecting to /dev/ttyUSB0
[SER] Serial is connected, trying to read config...
[SER] Failed to get info off device:undefined. Is this device running a binary built through Edge Impulse? Reconnecting in 5 seconds...
Then I tried the following: edge-impulse-run-impulse --raw
Edge Impulse impulse runner v1.15.1
[SER] Connecting to /dev/ttyUSB0
[SER] Connected to /dev/ttyUSB0
AT+HELP
I tried entering AT+HELP on the console, but there was no response. I am totally at a loss as to how to get this working… Any suggestions?
I tried bypassing the edge-impulse-daemon by using WebUSB via the lastest Chrome Browser and when connecting to my AI-Thinker board on /dev/ttyUSB0 I get the following error:
I’ve also tried the pre-compiled firmware images that you offered in this post and after uploading it successfully to my AI-Thinker esp32cam board, I get the exact same results as in my original post.
I have also tried the following:
Reboot computer
New USB cable
Is there any way to get some type of verbose output from the edge-impulse-daemon to see what is going on?
So after a little more debugging, I compiled the edge-impulse-daemon to output verbose serial data and noticed that when connecting via SERIAL (/dev/ttyUSB0) I get a constant stream of 00h (garbage) across the port:
[SER] serial data <Buffer 00>
[SER] serial data <Buffer 00 00>
[SER] serial data <Buffer 00 00>
[SER] serial data <Buffer 00>
I can confirm this when connecting via screen to /dev/ttyUSB0 (115200 8N1). Either i get a bunch of raw ‘00’ streaming across the screen, or I get nothing.
However, when I connect via idf.py -p /dev/ttyUSB0, it seems to work; however, the chip seems to be forced to reset:
This is really odd. I just tried my AI Thinker ESP32-CAM board, and I was able to connect with edge-impulse-daemon after uploading the new firmware. As @norik.badalyan suggests, you may want to check your power supply to the ESP32 board.
I tried the build you linked with the same result. The flash looks successful:
Wrote 776320 bytes (405346 compressed) at 0x00000000 in 9.5 seconds (effective 653.6 kbit/s)...
Hash of data verified.
Leaving...
Hard resetting via RTS pin...
Flashed your ESP32 development board.
To set up your development with Edge Impulse, run 'edge-impulse-daemon'
To run your impulse on your development board, run 'edge-impulse-run-impulse'
But edge-impulse-daemon still fails:
[SER] Connecting to /dev/ttyUSB0
[SER] Serial is connected, trying to read config...
[SER] Failed to get info off device Timeout when waiting for > (timeout: 5000) onConnected
[SER] Serial is connected, trying to read config...
[SER] Failed to get info off device Timeout when waiting for > (timeout: 5000) onConnected
As with @gururise though, I am able to connect over serial and run AT commands with idf.py -p /dev/ttyUSB0 monitor:
Hello from Edge Impulse Device SDK.
Compiled on May 5 2022 12:55:53
ERR: failed to connect to inertial sensor!
Inertial sensor initialization failed
Type AT+HELP to see a list of commands.
===== Device info =====
ID: ##:##:##:##:##:##
Type: ESPRESSIF_ESP32
AT Version: 1.7.0
Data Transfer Baudrate: 1500000
...
Oh I think I understand, there is no inertial sensor attached to that device, @AIWintermuteAI, do you think we can easily disable the inertial part in the code when recompiling the firmware?
Else you might just want to comment out the following lines before recompiling the firmware
I don’t have my ESP32-CAM with me at the moment so I won’t be able to test but last time I tried, I successfully managed to use the firmware I sent you
I do not think that is inertial sensor issue - it checks if sensor is connected and if not prints out that message without interrupting normal boot sequence. Granted, it should be an INFO message and not ERR - I’ll fix it in the next upgrade.
My bet is on TTL-USB serial converter and driver issues, especially since stray 00 characters were mentioned on serial connection. We had multiple users successfully using ESP-CAM and it was tested internally too.
For testing I was using regular AI-Thinker esp32cam and Adafruit USB to TTL Serial Cable - Debug / Console Cable for Raspberry Pi USB to TTL Serial Cable - Debug / Console Cable for Raspberry Pi : ID 954 : $9.95 : Adafruit Industries, Unique & fun DIY electronics and kits
Perhaps @shawn_edgeimpulse and @louis can share their hardware setups?
@louis - once we’ve got all this working locally, what’s the next step for actually deploying?
It looks like edge-impulse-run-impulse requires a compiled binary for our board, but if we’re using the ESP32-CAM AI-Thinker as you are, there doesn’t seem to be a binary we can use. Only ESP-EYE appears to supported.
Do you happen to have a flow you’d recommend? Maybe creating a c++ library and running that?