Checksum errors with ESP8266

Hello everybody,

I’ve bought this ESP8266 board recently on ebay: Ebay Link

My plan is to program this little board with platformio and vscode on Linux but I’m stucked.

My platformio.ini looks like this:

platform = espressif8266
board = nodemcuv2
framework = esp8266-nonos-sdk
board_upload.maximum_size = 1048576

I’m using this code: Github

I’ve got no errors when I build or upload. But when I start the serial monitor and reset the board I just get checksum errors

 ets Jan  8 2013,rst cause:2, boot mode:(3,6)

load 0x40100000, len 25408, room 16 
tail 0
chksum 0xef
load 0x00000000, len 0, room 8 
tail 0
chksum 0xef
load 0x00000000, len 0, room 0 
tail 0
chksum 0xef
csum 0xef
csum err
ets_main.c  

I also tried to upload espeasy binaries with esptool.py which worked perfectly. So the board should work. I’m bit curious what is going wrong when I use platformio. I hope you can help me. Thanks

I’ve seen this problem pop up in different variations (e.g. here) and it has to do with that some binaries (blank.bin, esp_init_data_default.bin etc) are flashed to the wrong address of the board in relation to the module’s flash size. Please do the following: Find out your flash size using esptool.py -p <serial> flash_id

C:\Users\Maxi\.platformio\packages\tool-esptoolpy>esptool.py -pCOM7 flash_id
esptool.py v2.6
Serial port COM7
Connecting....
Detecting chip type... ESP8266
Chip is ESP8266EX
Features: WiFi
MAC: 2c:3a:e8:XX:XX:XX
Uploading stub...
Running stub...
Stub running...
Manufacturer: c8
Device: 4016
Detected flash size: 4MB
Hard resetting via RTS pin...

Since you gave it NodeMCUv2 it will use the 4MB linker script (here). Adding a maximum upload size does not change this. If you have a different flash size, you need to give it another board target.

Thanks for your answer. Here is the output of esptool.py:

~> esptool.py --port /dev/ttyUSB0 flash_id
esptool.py v2.6
Serial port /dev/ttyUSB0
Connecting....
Detecting chip type... ESP8266
Chip is ESP8285
Features: WiFi, Embedded Flash
MAC: dc:4f:XX:XX:XX:XX
Uploading stub...
Running stub...
Stub running...
Manufacturer: 51
Device: 4014
Detected flash size: 1MB
Hard resetting via RTS pin...

I already tried to use the linker script “eagle.flash.1m256.ld” without success. Maybe I need to consider the embedded flash too?

All flash is external to the ESP8266 I thought? Only IRAM/DRAM is internal.

Hm maybe try the following first: Erase the chip using esptool.py -p<PORT> erase_flash to get a clean state. Then try board = esp8285, if that doesn’t work board = esp01_1m.

This seems to be an ESP8285 which has 1MB built-in SPI flash. See section 3.1.3. in the Datasheet for more information.

This doesn’t compile for me. I don’t know why:

Processing myenv (platform: espressif8266; board: esp8285; framework: esp8266-nonos-sdk)
--------------------------------------------------------------------------------------------------------------------------------
Verbose mode can be enabled via `-v, --verbose` option
CONFIGURATION: https://docs.platformio.org/page/boards/espressif8266/esp8285.html
PLATFORM: Espressif 8266 > Generic ESP8285 Module
HARDWARE: ESP8266 80MHz 80KB RAM (423.98KB Flash)
Library Dependency Finder -> http://bit.ly/configure-pio-ldf
LDF MODES: FINDER(chain) COMPATIBILITY(soft)
Collected 0 compatible libraries
Scanning dependencies...
No dependencies
Compiling .pioenvs/myenv/src/user_main.o
Compiling /home/myuser/.platformio/packages/framework-esp8266-nonos-sdk/lib/driver/driver/gpio16.o
Compiling /home/myuser/.platformio/packages/framework-esp8266-nonos-sdk/lib/driver/driver/hw_timer.o
Compiling /home/myuser/.platformio/packages/framework-esp8266-nonos-sdk/lib/driver/driver/i2c_master.o
Compiling /home/myuser/.platformio/packages/framework-esp8266-nonos-sdk/lib/driver/driver/key.o
Compiling /home/myuser/.platformio/packages/framework-esp8266-nonos-sdk/lib/driver/driver/sdio_slv.o
Compiling /home/myuser/.platformio/packages/framework-esp8266-nonos-sdk/lib/driver/driver/spi.o
Compiling /home/myuser/.platformio/packages/framework-esp8266-nonos-sdk/lib/driver/driver/spi_interface.o
Compiling /home/myuser/.platformio/packages/framework-esp8266-nonos-sdk/lib/driver/driver/spi_overlap.o
Compiling /home/myuser/.platformio/packages/framework-esp8266-nonos-sdk/lib/driver/driver/uart.o
Archiving /home/myuser/.platformio/packages/framework-esp8266-nonos-sdk/lib/libdriver.a
Indexing /home/myuser/.platformio/packages/framework-esp8266-nonos-sdk/lib/libdriver.a
Linking .pioenvs/myenv/firmware.elf
Building .pioenvs/myenv/eagle.flash.bin
Retrieving maximum program size .pioenvs/myenv/firmware.elf
Checking size .pioenvs/myenv/firmware.elf
esptool v0.4.13 - (c) 2014 Ch. Klippel <ck@atelier-klippel.de>
using ELF file ".pioenvs/myenv/firmware.elf"
created structure for binimage ".pioenvs/myenv/eagle.flash.bin" with entry address 0x40100004
setting flash mode from qio to dout
setting flash frequency from 40 to 40
error: invalid flash size value: 423K
saved binimage file, total size is 16 bytes, checksum byte is 0xEF
*** [.pioenvs/myenv/eagle.flash.bin] Error 2
Memory Usage -> http://bit.ly/pio-memory-usage
DATA:    [===       ]  33.2% (used 27194 bytes from 81920 bytes)
PROGRAM: [======    ]  60.0% (used 226009 bytes from 376832 bytes)
================================================== [ERROR] Took 1.23 seconds ==================================================
The terminal process terminated with exit code: 1

I can’t flash this binary. I think because of the reset_method “ck”:

Processing myenv (platform: espressif8266; board: esp01_1m; framework: esp8266-nonos-sdk)
--------------------------------------------------------------------------------------------------------------------------------
Verbose mode can be enabled via `-v, --verbose` option
CONFIGURATION: https://docs.platformio.org/page/boards/espressif8266/esp01_1m.html
PLATFORM: Espressif 8266 > Espressif Generic ESP8266 ESP-01 1M
HARDWARE: ESP8266 80MHz 80KB RAM (1MB Flash)
Library Dependency Finder -> http://bit.ly/configure-pio-ldf
LDF MODES: FINDER(chain) COMPATIBILITY(soft)
Collected 0 compatible libraries
Scanning dependencies...
No dependencies
Retrieving maximum program size .pioenvs/myenv/firmware.elf
Checking size .pioenvs/myenv/firmware.elf
Memory Usage -> http://bit.ly/pio-memory-usage
DATA:    [===       ]  33.2% (used 27194 bytes from 81920 bytes)
PROGRAM: [======    ]  60.0% (used 226009 bytes from 376832 bytes)
Configuring upload protocol...
Looking for upload port...
Auto-detected: /dev/ttyUSB0
Uploading .pioenvs/myenv/eagle.flash.bin
esptool v0.4.13 - (c) 2014 Ch. Klippel <ck@atelier-klippel.de>
setting board to ck
setting baudrate from 115200 to 115200
setting port from /dev/ttyUSB0 to /dev/ttyUSB0
setting address from 0x00000000 to 0x00000000
espcomm_upload_file
espcomm_upload_mem
opening port /dev/ttyUSB0 at 115200
tcgetattr
tcsetattr
serial open
opening bootloader
resetting board
trying to connect
espcomm_send_command: sending command header
espcomm_send_command: sending command payload
trying to connect
espcomm_send_command: sending command header
espcomm_send_command: sending command payload
trying to connect
espcomm_send_command: sending command header
espcomm_send_command: sending command payload
resetting board
trying to connect
espcomm_send_command: sending command header
*** [upload] Error 2
espcomm_send_command: sending command payload
trying to connect
espcomm_send_command: sending command header
espcomm_send_command: sending command payload
trying to connect
espcomm_send_command: sending command header
espcomm_send_command: sending command payload
resetting board
trying to connect
espcomm_send_command: sending command header
espcomm_send_command: sending command payload
trying to connect
espcomm_send_command: sending command header
espcomm_send_command: sending command payload
trying to connect
espcomm_send_command: sending command header
espcomm_send_command: sending command payload
warning: espcomm_sync failed
error: espcomm_open failed
error: espcomm_upload_mem failed
================================================== [ERROR] Took 13.39 seconds ==================================================
The terminal process terminated with exit code: 1

After that I tried to write my own board.json, which is a mix between the three boards. It looks like this:

{
    "build": {
      "core": "esp8266",
      "extra_flags": "-DESP8266 -DARDUINO_ARCH_ESP8266 -DESP8266_ESP01",
      "f_cpu": "80000000L",
      "f_flash": "40000000L",
      "flash_mode": "dout",
      "ldscript": "eagle.flash.1m256.ld",
      "mcu": "esp8266",
      "variant": "generic"
    },
    "connectivity": [
      "wifi"
    ],
    "frameworks": [
      "arduino",
      "simba",
      "esp8266-rtos-sdk",
      "esp8266-nonos-sdk"
    ],
    "name": "My Custom NodeMCU",
    "upload": {
      "maximum_ram_size": 81920,
      "maximum_size": 1048576,
      "require_upload_port": true,
      "resetmethod": "nodemcu",
      "speed": 115200
    },
    "url": "http://www.nodemcu.com/",
    "vendor": "NodeMCU"
  }

Now I get the following messages rapidly:

 ets Jan  8 2013,rst cause:2, boot mode:(3,6)

load 0x40100000, len 25408, room 16 
tail 0
chksum 0xb8
load 0x3ffe8000, len 892, room 8 
tail 4
chksum 0xab
load 0x3ffe8380, len 952, room 4 
tail 4
chksum 0x77
csum 0x77
rf_cal[0] !=0x05,is 0xFF

Sorry for all the formatted text. I hope this will help to find the error.

That is closer, this exact same rf_cal error is what I referenced in my first post at esp8266 - Endless loop on boot after reflashing ESP-12E with AT firmware - Arduino Stack Exchange. Can you manually flash esp_init_data_default.bin from here on address 0xfc000 using your download tool?

Now I get a different message if I flash esp_init_data_default.bin like described. The esp is switching to 115200 baud and prints the following:

version:2.1.0(7106d38)
mode : null

Don’t know what is missing now. I also tried to upload the blank.bin files but nothing changed.

Does it blink the LED now? the mode : null should be the WiFi mode I think… and version:2.1.0(7106d38) the core SDK version (e.g. referenced here)

You’re right. I had no LED on this port but the esp is toggling. So the “version…” belongs to the os_printf("SDK version:%s\n", system_get_sdk_version());… Don’t know where the SDK was gone but when I add a \n I see the correct output.

Thank you very much for your help :slight_smile:

Nice that it works. Indeed, the output is exactly that from

Now what’s left is to find out why PIO doesn’t flash esp_init_data_default.bin the correct address (or assumes that it’s already there and doesn’t flash it?). I’ll leave it to the devs. PIO doesn't flash init data to the right address for 1MB modules · Issue #133 · platformio/platform-espressif8266 · GitHub

1 Like