#I get following error when trying to flash viam-micro-rdk server on ESP32
1 messages · Page 1 of 1 (latest)
Hi @crisp arrow, I'm an AI assistant for Viam. I'll analyze available sources and get back to you shortly.
While I generate an answer, here are some sources that might be helpful:
- Create or use a Micro-RDK module
| Integrate other hardware - Table of Contents
- ESP32 micro-RDK
- ESP32-CAM Support
Answer
Try the following troubleshooting steps:
- First, try erasing the flash memory and reflashing with a lower baud rate using this command:
espflash flash --erase-parts nvs --partition-table partitions.csv target/xtensa-esp32-espidf/release/esp32-camera --baud 115200 && sleep 2 && espflash monitor
- If that doesn't work, you can try using the monitor command to see detailed logs:
espflash monitor
- Make sure you have all the required dependencies installed for your operating system. For Linux systems, you need:
sudo apt-get install bison ccache cmake curl dfu-util flex git gperf libffi-dev libssl-dev libudev-dev libusb-1.0-0 ninja-build python3 python3-pip python3-venv wget
- If you're still having issues, check that your machine cloud credentials are properly configured in your viam.json file and that your WiFi credentials are correctly provided.
The error you're seeing could be related to flash memory issues or incorrect configuration settings. Following these steps should help resolve the issue.
Feel free to tag @tacit peak with additional questions. I also appreciate feedback, it helps me improve.
you didn't provide partitions.csv file
Hi @crisp arrow could you provide some further information that may help us understand what is going wrong here?
In particular, it would be very helpful if we could know the exact board you are trying to flash to (e.g. WROVER dev kit, etc.), and some basic system parameters (size of flash, size of ram). Also any information about your serial connection (are there multiple ports on the board, or just one).
@crisp arrow - It is heading into the weekend, but I hope you will come back to this thread next week. We want to help you succeed with the micro-rdk!
Sorry, I was travelling and didn't have my board with me. Now that I am back I can debug with you and try out the viam web server with my ESP32 boards
I tried the steps mentioned to install micro-rdk using micro-rdk-installer-amd64-linux but it errors out during flash.
To check if I can flash over the USB, I also try esp-idf (https://docs.espressif.com/projects/esp-idf/en/stable/esp32/get-started/linux-macos-setup.html#). And it works fine.
I am attaching terminal logs of both methods here.
Here are images of two board that I tried it on. Same error for both. One of them is a WROVER module with a camera at the backside
Hey @crisp arrow - No worries, I'm glad you are back. Do you happen to know how much flash each of those boards holds?
Nope. Is there a way I can find out?
I don't happen to know right away but let me see if there is an esptool command or similar that might help you find out.
@crisp arrow - It looks like esptool has a flash_id that will tell you that. For me, I obtained access to esptool via cargo install esptools, connected my device, and then ran:
$ esptools tool flash_id
Executing `esptool`
esptool.py v4.8.1
Found 1 serial ports
Serial port
...
Detected flash size: 8MB
...
Which tells me this board has 8MB of flash. If you have a configured ESP-IDF environment (e.g. where idf.py works) , then you can probably just run esptool.py flash_id to get the same effect.
Can you try that on both boards and report back the flash sizes?
@crisp arrow - I'm fairly sure this is going to turn out that those are 4MB boards. I found a 4MB'er at my office and just tried to flash it with micro-rdk, and got the same error:
Writing credentials to binary.
Connecting...
Connected. Writing to flash...
Error: EspFlashError(RomError(RomError { command: FlashDeflData, kind: Other }))
The prebuilt micro-rdk binaries are for 8MB devices, so that we can support OTA updates.
That makes sense. I'll try to verify the flash memory later today
Thanks for checking though
It should be possible to build micro-rdk yourself for a 4MB device and I can give you instructions to do that.
I'm going to test it out now and I'll follow-up here with my findings.
Another concern will be whether these boards have sufficient PSRAM.
@crisp arrow - I was able to make some small modifications in the Micro-RDK repo and build a 4MB flash compatible Micro-RDK server image and flash it to a 4MB device. So, if your devices have sufficient PSRAM, it should be possibel for you to do the same. I can provide instructions if you would like to try it.
You were right. The flash size is 4MB
$ esptool.py flash_id
esptool.py v4.8.1
Found 1 serial ports
Serial port /dev/ttyUSB0
Connecting.........
Detecting chip type... Unsupported detection protocol, switching and trying again...
Connecting......
Detecting chip type... ESP32
Chip is ESP32-D0WDQ6 (revision v1.0)
Features: WiFi, BT, Dual Core, 240MHz, VRef calibration in efuse, Coding Scheme None
Crystal is 40MHz
MAC: c8:c9:a3:c7:24:c4
Uploading stub...
Running stub...
Stub running...
Manufacturer: 5e
Device: 4016
Detected flash size: 4MB
Flash voltage set by eFuse to 3.3V
Hard resetting via RTS pin...
Yes, I would like to try it
Meanwhile, I will try to find an 8MB device and see if I can make that work as well
Great! If you want to try to go ahead with the 4MB device, the first step is to get the Micro-RDK building from source. This will first require getting a rust development environment configured. We have some environment setup instructions here: https://docs.viam.com/operate/get-started/other-hardware/micro-module/#required-software. You only need to follow setps 1-4 in order to get an ESP32 rust toolchain installed and running. Please let me know when you have that done and I'll share the next steps
@crisp arrow - Just checking in. Were you able to find an 8MB device, or get a dev environment up to work on building for a 4MB?
somehow my discord notifications didn't occur for your messages.
- I did the steps 1-4
- I tried multiple boards in my lab. Apparently all are 4MB flash. Now I know why they were cheaper on Amazon :P. So I have placed order for some of these (https://www.amazon.com/gp/product/B087TNPQCV?smid=A33XZ36WFNH796&th=1).
I will try to be prompt to your responses now
@crisp arrow - OK that looks like it should work fine!
What about next steps here?
@crisp arrow - Sorry, not sure which way you mean. Do you mean you tried with the 8MB device and it worked and want to know next steps once you have viam-micro-server running? Or are you going back to the 4MB devices and want instructions on how to make that (hopefully) work?
I have only tried with 4MB boards till now. I have ordered 8MB boards so that I can use the preferred method of flashing micro-rdk. But if I can also use the micro-rdk on 4MB boards, that'll be great. It will allow me to use existing inventory of 4MB boards for Viam projects
@crisp arrow - I'm going to make a branch that shows what you need to change. One question: are you planning to install vanilla viam-micro-server? Or are you planning to build a custom firmware that includes additional modules?
I'll start with vanilla version. I have never worked with Viam before but I want to try and use webRTC and OTA capabilities of Viam platform
@crisp arrow - Are you comfortable getting a rust dev environment up and running?
Basically, getting steps 1-4 done from here: https://docs.viam.com/operate/get-started/other-hardware/micro-module/#required-software
Yes. I did these steps
@crisp arrow - OK. I made a branch here. Can you please pul that code?
Then:
make build-esp32-bin build-installer./target/release/micro-rdk-installer write-flash --baud 460800 --binary-path target/xtensa-esp32-espidf/release/micro-rdk-server-esp32.bin --wifi-ssid <YOUR-2.4G-WIFI-SSID-HERE> --app-config <PATH-TO-YOUR-APP-CONFIG-HERE> --monitor(please fill in the indicated INFO between< >)
You will get prompted for the wifi password
The app config you can get from your machine on app.viam.com
successful flash. But I am getting following error from the monitor. Attaching detailed log
E (1414) psram: PSRAM ID read error: 0xffffffff
E (1416) cpu_start: Failed to init external RAM, needed for external .bss segment
I think your board doesn't have PSRAM. I think you will either need to find a 4MB board that does, or wait on your 8MB board.