Parameter requirements for the FLASH_BEGIN serial protocol command

alexdr5398
Posts: 1
Joined: Mon Nov 21, 2022 6:59 pm

Parameter requirements for the FLASH_BEGIN serial protocol command

Postby alexdr5398 » Mon Nov 21, 2022 7:18 pm

Hi,

I am trying to program the ESP32 C3 over UART using the serial protocol: https://docs.espressif.com/projects/esp ... l#checksum

The FLASH_BEGIN command is giving me trouble. It seems that no matter what parameters I send (size to erase, number of data packets, data size in one packet, flash offset). It returns status code 0x5 which means “Received message is invalid” (parameters or length field is invalid).

I am using the same method from this example: https://github.com/espressif/esp-serial-flasher

All of the previous commands before the BEGIN_FLASH command have worked fine (SYNC, READ_REG, WRITE_REG, SPI_ATTACH, etc...)_

I am trying to upload 181KB of data (i.e. image_size = 181KB). I am calculating the parameters as follows:

packet_size = 1024
number_of_data_packets = (image_size + packet_size - 1) / packet_size;
size_to_erase = number_of_data_packets * packet_size
flash_offset = 0x100000

I have tried every multiple of 256 up to 65536 for the packet size (with the rest of parameters calculated as above) and all have returned 0x5. What could I be doing wrong? I am very confused.

Is there any documentation for what combination of parameters returns this error code?

Thanks

Who is online

Users browsing this forum: No registered users and 117 guests