-->
Page 1 of 2

fatal error programming flash on custom board

PostPosted: Tue Jul 26, 2016 9:03 am
by kalauffenburger
I am trying to bring up a custom board using the ESP8266EX. The hardware behavior seems to be solid but I am encountering the following fatal error when attempting to program the flash using esptool.py:

saturn:~/work/blelink/esp-open-sdk/source-code-examples/tango1_test> make flash
esptool.py --port /dev/ttyUSB0 --baud 115200 write_flash 0x00000 firmware/0x00000.bin 0x40000 firmware/0x40000.bin
Connecting...
Erasing flash...
Took 0.13s to erase flash block
Writing at 0x00000000... (3 %)
A fatal error occurred: Failed to write to target Flash after seq 0 (got result 0x1, 0x8)
Makefile:134: recipe for target 'flash' failed


I can successfully read chip ID and flash ID:
saturn:~/work/blelink/esp-open-sdk/source-code-examples/tango1_test> esptool.py --port /dev/ttyUSB0 --baud 115200 chip_id
Connecting...
Chip ID: 0x0002616a
saturn:~/work/blelink/esp-open-sdk/source-code-examples/tango1_test> esptool.py --port /dev/ttyUSB0 --baud 115200 flash_id
Connecting...
Manufacturer: bf
Device: 258e


However, I noticed that I can only read the flash ID once, and then I get this on the second try:
saturn:~/work/blelink/esp-open-sdk/source-code-examples/tango1_test> esptool.py --port /dev/ttyUSB0 --baud 115200 flash_id
Connecting...

A fatal error occurred: Failed to connect to ESP8266


I thought that possibly the flash device on the board is somehow not compatible with the ESP8266EX, so I tried replacing it with a device from a working module. With that device I receive the same behavior, except that the flash ID is different.

I probed the SPI signals between the processor and flash; they look clean to me. Here are a couple of screenshots from my scope:

scope_104.png

scope_105.png


Any suggestions or help you can provide would be greatly appreciated.

Thanks.

--ken

Re: fatal error programming flash on custom board

PostPosted: Tue Jul 26, 2016 9:41 am
by martinayotte
kalauffenburger wrote:Manufacturer: bf
Device: 258e



This FlashID looks really strange ... :?

It should be something like :

Code: Select allManufacturer: e0
Device: 4016


Where the 16 means 4MB (13 is 512KB, 14 is 1MB).
So, 8E is simply garbage value.

BTW, how your SPI Flash is connected ?
Because, there are QIO mode, DIO mode, but you seems to describe SIO mode (Single data line).

Re: fatal error programming flash on custom board

PostPosted: Tue Jul 26, 2016 1:07 pm
by kalauffenburger
Thanks for the quick response.

I think that I did get a flash ID of 4016 with the other flash device that I took off of the working module. But I received the same fatal error using that flash device.

The flash is connected to the processor like this:
SDIO_CMD (pin 20) --- flash CEn
SDIO_CLK (pin 21) --- 200 Ohm resistor --- flash CLK
SDIO_DATA0 (pin 22) -- flash SO
SDIO_DATA1 (pin 23) --- flash SI
SDIO_DATA2 (pin 18) -- flash HOLDn
SDIO_DATA3 (pin 19) -- flash WPn

(This is the same connectivity as described in the 0B-ESP8266__Hardware_User_Guide__EN_v1.1 document.)

Both the WPn and the HOLDn signals remain high during all of the bus transactions.

I did try the different modes using the write_flash command, but I received the same fatal error in all cases.

I am not exactly sure what the difference is between each of the modes, but I assume that the QIO mode uses all four SDIO_DATA signals, and I am guessing that is the one I should use (?).

I am wondering if the error I am getting has something to do with write protection?

--ken

Re: fatal error programming flash on custom board

PostPosted: Tue Jul 26, 2016 6:19 pm
by martinayotte
If you are getting 4016 as part of the FlashID, then communication should be Ok.

Did you tried with other kind of esp flashing tool ?