#I get following error when trying to flash viam-micro-rdk server on ESP32

1 messages · Page 1 of 1 (latest)

crisp arrow
#

Error: EspFlashError(RomError(RomError { command: FlashDeflData, kind: Other }))

tacit peakBOT
#

Hi @crisp arrow, I'm an AI assistant for Viam. I'll analyze available sources and get back to you shortly.

#

Answer

Try the following troubleshooting steps:

  1. 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

(1)

  1. If that doesn't work, you can try using the monitor command to see detailed logs:
espflash monitor

(2)

  1. 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

(1)

  1. 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.

crisp arrow
#

you didn't provide partitions.csv file

unkempt chasm
#

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).

unkempt chasm
#

@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!

crisp arrow
#

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

#

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

unkempt chasm
#

Hey @crisp arrow - No worries, I'm glad you are back. Do you happen to know how much flash each of those boards holds?

crisp arrow
#

Nope. Is there a way I can find out?

unkempt chasm
#

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?

unkempt chasm
#

@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.

crisp arrow
#

That makes sense. I'll try to verify the flash memory later today

#

Thanks for checking though

unkempt chasm
#

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.

unkempt chasm
#

@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.

crisp arrow
#

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...
crisp arrow
#

Meanwhile, I will try to find an 8MB device and see if I can make that work as well

unkempt chasm
#

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

Viam Documentation

Set up an Espressif ESP32 microcontroller for development with the Micro-RDK including writing and using custom modules rather than using the pre-built viam-micro-server.

unkempt chasm
#

@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?

crisp arrow
#

I will try to be prompt to your responses now

unkempt chasm
#

@crisp arrow - OK that looks like it should work fine!

unkempt chasm
#

@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?

crisp arrow
#

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

unkempt chasm
#

@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?

crisp arrow
#

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

unkempt chasm
#

@crisp arrow - Are you comfortable getting a rust dev environment up and running?

crisp arrow
#

Yes. I did these steps

unkempt chasm
#

@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

crisp arrow
#

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
unkempt chasm
#

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.

crisp arrow
#

Thanks. I'll try to check these things next time I try a board

#

Thank you for being patient with me