Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Checksum Issues #36

Open
ebabcock72 opened this issue Jun 5, 2024 · 0 comments
Open

Checksum Issues #36

ebabcock72 opened this issue Jun 5, 2024 · 0 comments

Comments

@ebabcock72
Copy link

I am having a checksum issue. I am using the Android App and the NimBLE firmware implementation. Everything goes well until the "Update" step where it moves everything from SPIFFS to OTA1 partition.

Here is my serial monitor output:

Characteristic defined! Now you can read it in your phone!
Connected
TX  AA 00 
Available space: 1318001
File Size: 603600
TX  F1 00 01 
TX  F1 00 02 
TX  F1 00 03 
TX  F1 00 04 
TX  F1 00 05 
TX  F1 00 06 
TX  F1 00 07 
TX  F1 00 08 
TX  F1 00 09 
TX  F1 00 0A 
TX  F1 00 0B 
TX  F1 00 0C 
TX  F1 00 0D 
TX  F1 00 0E 
TX  F1 00 0F 
TX  F1 00 10 
TX  F1 00 11 
TX  F1 00 12 
TX  F1 00 13 
TX  F1 00 14 
TX  F1 00 15 
TX  F1 00 16 
TX  F1 00 17 
TX  F1 00 18 
TX  F1 00 19 
TX  F1 00 1A 
TX  F1 00 1B 
TX  F1 00 1C 
TX  F1 00 1D 
TX  F1 00 1E 
TX  F1 00 1F 
TX  F1 00 20 
TX  F1 00 21 
TX  F1 00 22 
TX  F1 00 23 
TX  F1 00 24 
TX  F2 00 25 
Complete
Trying to start update
Written : 603600 successfully
E (146030) esp_image: Checksum failed. Calculated 0x10 read 0x70
Error Occurred. Error #: 9
TX  0F 57 72 69 74 74 65 6E 20 3A 20 36 30 33 36 30 30 2F 36 30 33 36 30 30 20 5B 31 30 30 25 5D 20 0A 45 72 72 6F 72 20 23 3A 20 00 
Removing update file
Rebooting to complete OTA update

Using esptool.py, I am getting a checksum of 0x70 (same as the "read" checksum).

~ esptool.py -c esp32 image_info esp32_nim_ble_ota.ino.doitESP32devkitV1.bin
esptool.py v4.7.0
File size: 603600 (bytes)
Image version: 1
Entry point: 40084318
6 segments

Segment 1: len 0x20804 load 0x3f400020 file_offs 0x00000018 [DROM]
Segment 2: len 0x03470 load 0x3ffbdb60 file_offs 0x00020824 [BYTE_ACCESSIBLE,DRAM]
Segment 3: len 0x00400 load 0x40080000 file_offs 0x00023c9c [IRAM]
Segment 4: len 0x0bf64 load 0x40080400 file_offs 0x000240a4 [IRAM]
Segment 5: len 0x59d40 load 0x400d0018 file_offs 0x00030010 [IROM]
Segment 6: len 0x0984c load 0x4008c364 file_offs 0x00089d58 [IRAM]
Checksum: 70 (valid)
Validation Hash: a6c862fef94f58c8b38a747aaef9f594d5003ce30dad7a8cee7be4dac70a1d38 (valid)

I am using the "Default 4MB with spiffs" partition scheme.

# Name,   Type, SubType, Offset,  Size, Flags
nvs,      data, nvs,     0x9000,  0x5000,
otadata,  data, ota,     0xe000,  0x2000,
app0,     app,  ota_0,   0x10000, 0x140000,
app1,     app,  ota_1,   0x150000,0x140000,
spiffs,   data, spiffs,  0x290000,0x160000,
coredump, data, coredump,0x3F0000,0x10000,

I tried reading the dump from the app1 (ota_1) partition using esptool as well, but it always fails with a checksum error at the exact same address location.

~ esptool.py --port /dev/ttyUSB0 --no-stub read_flash 0x150000 0x140000 ota_1_default.bin
esptool.py v4.7.0
Serial port /dev/ttyUSB0
Connecting.....
Detecting chip type... Unsupported detection protocol, switching and trying again...
Connecting....
Detecting chip type... ESP32
Chip is ESP32-D0WD-V3 (revision v3.1)
Features: WiFi, BT, Dual Core, 240MHz, VRef calibration in efuse, Coding Scheme None
Crystal is 40MHz
MAC: 70:b8:f6:64:41:68
Enabling default SPI flash mode...
720896 (55 %)
A fatal error occurred: Failed to read flash block (result was 01090000: CRC or checksum was invalid)

Note that it always gets to 720896 decimal, or 0xB0000. No matter how many times I attempt to run the OTA update through the app, this command always fails in this location. If I read from the partition and stop at 0xB0000 it completes just fine. I try to read from 0x150000+0xB0000 = 0x200000 and it immediately gives a checksum error. Even just trying to read 1 byte from any address after 0x2000000 results in a checksum error.

Does anyone have any ideas why this might be happening? I did try switching to FFAT already and I get the same results, so I am back on SPIFFS.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant