OTA boot doesn't run expected partition (flash read err, 1000)

mr1000
Posts: 23
Joined: Fri Jan 12, 2018 9:05 am

OTA boot doesn't run expected partition (flash read err, 1000)

Postby mr1000 » Fri Aug 24, 2018 8:41 am

Hi, this is my partition table

Code: Select all

# Name,   Type, SubType, Offset,   Size
nvs,      data, nvs,     0x9000,  0x4000
otadata,  data, ota,     0xd000,  0x2000
phy_init, data, phy,     0xf000,  0x1000
ota_0,    app,  ota_0,   0x010000,  1M
ota_1,    app,  ota_1,   0x110000,  1M
some_space,  data, ,   0x210000,	384K
more_space,data, ,   0x270000,	384K
I configured via make menuconfig Factory app partition offset to 0x010000 (ota_0).

My prgram executes exactly same functions of ota_example_main.c.
All of them execute with no errrors:
1- esp_ota_get_next_update_partition (here I print what partition returns and returns correctly ota_1 address)
2- esp_ota_begin
3- esp_ota_write (a lot of them, the size of downloaded file corresponds to the file so I'm assuming it's downloading it ok)
4- esp_ota_end
5- esp_ota_set_boot_partition
6- esp_restart

After restart, it doesn't boot from ota_1 and I can see this from configured/running partition check:
Configured OTA boot partition at offset 0x00110000 but running from offset 0x00010000


So what could be wrong?
Is partition table ok?

I'm using make erase_flash before each try (it only takes 4,7s, is this time ok?)

Thanks in advance

EDIT:
That's what is printed when powering on

Code: Select all

ets Jun  8 2016 00:22:57

rst:0x1 (POWERON_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT)
flash read err, 1000
ets_main.c 371 
ets Jun  8 2016 00:22:57

rst:0x10 (RTCWDT_RTC_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT)
configsip: 0, SPIWP:0xee
clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00
mode:DIO, clock div:2
load:0x3fff0018,len:4
load:0x3fff001c,len:732
load:0x40078000,len:0
load:0x40078000,len:10208
entry 0x40078aa4
In https://github.com/espressif/esptool/wi ... -Selection is explained that:
Early flash read error
flash read err, 1000
This fatal error indicates that the bootloader tried to read the software bootloader header at address 0x1000 but failed to read valid data. Possible reasons for this include:

-Physical problem with the connection to the flash chip, or flash chip power.
-Boot mode accidentally set to HSPI_FLASH_BOOT, which uses different SPI flash pins. Check GPIO2 (see above).
-VDDSDIO has been enabled at 1.8V (due to MTDI/GPIO12, see above), but this flash chip requires 3.3V.
So that could explain why isn't booting the corresponent partition.

However in our custom pcb IO2, IO12 and IO15 are left unconnected. Checked them and are all ok:
-IO2: low
-IO12: low
-IO15: high

Checked the power and EN pin, they're stable at 3,3V.
Checked other boards with same hardware and the 'flash read err, 1000' happens too.

Also I've runned this command I read somewhere:
$ py esptool.py -p COM13 verify_flash 0x1000 ../../../../../../../build/bootloader/bootloader.bin
esptool.py v2.1
Connecting......
Detecting chip type... ESP32
Chip is ESP32D0WDQ6 (revision 1)
Uploading stub...
Running stub...
Stub running...
Configuring flash size...
Auto-detected Flash size: 4MB
Verifying 0x5560 (21856) bytes @ 0x00001000 in flash against ../../../../../../../build/bootloader/bootloader.bin...
-- verify OK (digest matched)
Hard resetting...
Seems like bootloader is written correctly... so I guess it's a hardware problem?
Last edited by mr1000 on Fri Aug 24, 2018 3:42 pm, edited 2 times in total.

mr1000
Posts: 23
Joined: Fri Jan 12, 2018 9:05 am

Re: OTA boot doesn't run expected partition

Postby mr1000 » Fri Aug 24, 2018 3:06 pm

We connected the module like this schematic from "esp_wroom_32_datasheet_en.pdf" (SD0, SD1, SD2, SD3, CMD, CLK are unconntected)
Image

But I've seen it's slightly different from the one from "ESP32-Core-Board-V2_sch.pdf" (capacitor values)
Image

Can this have some effect?

I've tried my program in a ESP32-Core-Board-V2 and show no 'flash read err, 1000'

ESP_igrr
Posts: 2071
Joined: Tue Dec 01, 2015 8:37 am

Re: OTA boot doesn't run expected partition (flash read err, 1000)

Postby ESP_igrr » Sat Aug 25, 2018 5:31 pm

Flash read error likely happens because flash chip start up time is too slow, and ROM code tries to read from it before it is ready. It should not cause problems though, just an extra RTC WDT reset. Can you enable debug log level for both bootloader and app, and post the log produced when doing OTA, perhaps this can help better understand your original problem.

mr1000
Posts: 23
Joined: Fri Jan 12, 2018 9:05 am

Re: OTA boot doesn't run expected partition (flash read err, 1000)

Postby mr1000 » Mon Aug 27, 2018 8:15 am

ESP_igrr wrote:Flash read error likely happens because flash chip start up time is too slow, and ROM code tries to read from it before it is ready. It should not cause problems though, just an extra RTC WDT reset. Can you enable debug log level for both bootloader and app, and post the log produced when doing OTA, perhaps this can help better understand your original problem.
Thanks Ivan, showing the bootloader debug info I found what was wrong
Apparently the partition 'more_space' was being detected as 'OTA partition data' and when bootloader readed that was always full of FF's so it would boot the first partition.

Changed the partition table to this and seems to work (added factory app, and renamed subtype of space from 'data' to 0x40):

Code: Select all

# Name,   Type, SubType, Offset,   Size
nvs,      data, nvs,     0x9000,  0x4000
otadata,  data, ota,     0xd000,  0x2000
phy_init, data, phy,     0xf000,  0x1000
some_space,  0x40, ,   0x10000,	384K
more_space,0x40, ,   0x70000,	384K
factory,	0,	0,		 0x100000,	1M
ota_0,    	0,	ota_0, 	 0x200000,	1M
ota_1,    	0,  ota_1,   0x300000,  1M
I have to verify and test a lot of times now but I think this is it.
And the flash error isn't happening with SW_CPU_RESET indeed, only in the power on, so I was tangling myself there :P
Thanks again and cheers.

ESP_igrr
Posts: 2071
Joined: Tue Dec 01, 2015 8:37 am

Re: OTA boot doesn't run expected partition (flash read err, 1000)

Postby ESP_igrr » Mon Aug 27, 2018 9:13 am

I see now, thanks and good to know that you got the problem solved. This might explain a few other bug reports we got. We should update the partition table generation tool to detect duplicate partitions of certain types, such as in your case:

otadata, data, ota, 0xd000, 0x2000
some_space, data, , 0x210000, 384K
more_space, data, , 0x270000, 384K

WiFive
Posts: 3529
Joined: Tue Dec 01, 2015 7:35 am

Re: OTA boot doesn't run expected partition (flash read err, 1000)

Postby WiFive » Mon Aug 27, 2018 9:22 am

Code: Select all

#define PART_SUBTYPE_DATA_OTA 0x00
is not a great idea

Who is online

Users browsing this forum: No registered users and 113 guests