Community
OpenEnergyMonitor

Community

WIFI Relay,Problem loading the code

Tags: #<Tag:0x00007fc91ce06270>

hi, I do not get to run the relay wifi.
https://openenergymonitor.org/emon/node/12507
well, i charged a original firmware from ESP8266, and only work in program mode (the AT comand, onli work in this mode). in normal mode do not work.
Please gave me a solution.
I think that my ESP8266 is broken.

How did you upload the new code, did you use OTA upload?

Please tell us exactly what you did to change the code.

hi, thanks for your answer.
i can’t entry in AP mode, and i can’t use OTA upload.
well. in linux, i can upload the firm, but do not work.

[email protected]:~/Documentos/bootloader$ sudo python esptool.py --port /dev/ttyUSB0 --baud 460800 write_flash --flash_freq 80m --flash_mode qio --flash_size 16m-c1 \ 0x00000 blank.bin \ 0x01000 blank.bin \ 0x7C000 esp_init_data_default.bin \ 0x7D000 blank.bin \ 0x7E000 blank.bin \ 0x7F000 blank.bin \ 0x80000 blank.bin \ 0xFE000 blank.bin \ 0x100000 blank.bin \ 0x101000 blank.bin \ 0x1FC000 esp_init_data_default.bin \ 0x1FD000 blank.bin \ 0x1FE000 blank.bin \ 0x1FF000 blank.bin \ 0x3FC000 esp_init_data_default.bin \ 0x3FD000 blank.bin \ 0x3FE000 blank.bin \

[sudo] password for juan:
usage: esptool write_flash [-h] [–flash_freq {40m,26m,20m,80m}]
[–flash_mode {qio,qout,dio,dout}]
[–flash_size {4m,2m,8m,16m,32m}]
addr_filename [addr_filename …]
esptool write_flash: error: argument --flash_size/-fs: invalid choice: ‘16m-c1’ (choose from ‘4m’, ‘2m’, ‘8m’, ‘16m’, ‘32m’)
[email protected]:~/Documentos/bootloader$ sudo python esptool.py --port /dev/ttyUSB0 --baud 460800 write_flash --flash_freq 80m --flash_mode qio --flash_size 16m \ 0x00000 blank.bin \ 0x01000 blank.bin \ 0x7C000 esp_init_data_default.bin \ 0x7D000 blank.bin \ 0x7E000 blank.bin \ 0x7F000 blank.bin \ 0x80000 blank.bin \ 0xFE000 blank.bin \ 0x100000 blank.bin \ 0x101000 blank.bin \ 0x1FC000 esp_init_data_default.bin \ 0x1FD000 blank.bin \ 0x1FE000 blank.bin \ 0x1FF000 blank.bin \ 0x3FC000 esp_init_data_default.bin \ 0x3FD000 blank.bin \ 0x3FE000 blank.bin
Connecting…
Traceback (most recent call last):
File “esptool.py”, line 471, in
esp.connect()
File “esptool.py”, line 149, in connect
raise Exception(‘Failed to connect’)
Exception: Failed to connect
[email protected]:~/Documentos/bootloader$ sudo python esptool.py --port /dev/ttyUSB0 --baud 460800 write_flash --flash_freq 80m --flash_mode qio --flash_size 16m \ 0x00000 blank.bin \ 0x01000 blank.bin \ 0x7C000 esp_init_data_default.bin \ 0x7D000 blank.bin \ 0x7E000 blank.bin \ 0x7F000 blank.bin \ 0x80000 blank.bin \ 0xFE000 blank.bin \ 0x100000 blank.bin \ 0x101000 blank.bin \ 0x1FC000 esp_init_data_default.bin \ 0x1FD000 blank.bin \ 0x1FE000 blank.bin \ 0x1FF000 blank.bin \ 0x3FC000 esp_init_data_default.bin \ 0x3FD000 blank.bin \ 0x3FE000 blank.bin
Connecting…
Erasing flash…
Writing at 0x00000c00… (100 %)
Erasing flash…
Writing at 0x00001c00… (100 %)
Erasing flash…
Writing at 0x0007c000… (100 %)
Erasing flash…
Writing at 0x0007dc00… (100 %)
Erasing flash…
Writing at 0x0007ec00… (100 %)
Erasing flash…
Writing at 0x0007fc00… (100 %)
Erasing flash…
Writing at 0x00080c00… (100 %)
Erasing flash…
Writing at 0x000fec00… (100 %)
Erasing flash…
Writing at 0x00100c00… (100 %)
Erasing flash…
Writing at 0x00101c00… (100 %)
Erasing flash…
Writing at 0x001fc000… (100 %)
Erasing flash…
Writing at 0x001fdc00… (100 %)
Erasing flash…
Writing at 0x001fec00… (100 %)
Erasing flash…
Writing at 0x001ffc00… (100 %)
Erasing flash…
Writing at 0x003fc000… (100 %)
Erasing flash…
Writing at 0x003fdc00… (100 %)
Erasing flash…
Writing at 0x003fec00… (100 %)

Leaving…
[email protected]:~/Documentos/bootloader$ sudo python esptool.py --port /dev/ttyUSB0 --baud 460800 write_flash --flash_freq 80m --flash_mode qio --flash_size 16m-c1 0x00000 "boot_v1.5.bin"
usage: esptool write_flash [-h] [–flash_freq {40m,26m,20m,80m}]
[–flash_mode {qio,qout,dio,dout}]
[–flash_size {4m,2m,8m,16m,32m}]
addr_filename [addr_filename …]
esptool write_flash: error: argument --flash_size/-fs: invalid choice: ‘16m-c1’ (choose from ‘4m’, ‘2m’, ‘8m’, ‘16m’, ‘32m’)
[email protected]:~/Documentos/bootloader$ sudo python esptool.py --port /dev/ttyUSB0 --baud 460800 write_flash --flash_freq 80m --flash_mode qio --flash_size 16m 0x00000 "boot_v1.5.bin"
Connecting…
Traceback (most recent call last):
File “esptool.py”, line 471, in
esp.connect()
File “esptool.py”, line 149, in connect
raise Exception(‘Failed to connect’)
Exception: Failed to connect
[email protected]:~/Documentos/bootloader$ sudo python esptool.py --port /dev/ttyUSB0 --baud 460800 write_flash --flash_freq 80m --flash_mode qio --flash_size 16m 0x00000 "boot_v1.5.bin"
Connecting…
Erasing flash…
Writing at 0x00000c00… (100 %)

Leaving…
[email protected]:~/Documentos/bootloader$ sudo python esptool.py --port /dev/ttyUSB0 --baud 460800 write_flash --flash_freq 80m --flash_mode qio --flash_size 16m 0x1000 oem.v2088.bin
Connecting…
Erasing flash…
Writing at 0x00060400… (100 %)

Leaving…

I do this, then i remove the programmer and the bridge in J5.

I push the reset button, but no entry in AP mode. The blue led is always fixed.

Are you trying to flash your own custom firmware? Was the unit working as intended before you tried to flash?

looks like you use old esptool.py that doesn’t support this flash map; please update it to the latest one: https://github.com/themadinventor/esptool/blob/master/esptool.py

hi, i updated esptool.py and i charged the firmware again, but no entry in AP mode.

[email protected]:~/Documentos/bootloader$ sudo python esptool.py --port /dev/ttyUSB0 --baud 460800 write_flash --flash_freq 80m --flash_mode qio --flash_size 16m-c1 \ 0x00000 blank.bin \ 0x01000 blank.bin \ 0x7C000 esp_init_data_default.bin \ 0x7D000 blank.bin \ 0x7E000 blank.bin \ 0x7F000 blank.bin \ 0x80000 blank.bin \ 0xFE000 blank.bin \ 0x100000 blank.bin \ 0x101000 blank.bin \ 0x1FC000 esp_init_data_default.bin \ 0x1FD000 blank.bin \ 0x1FE000 blank.bin \ 0x1FF000 blank.bin \ 0x3FC000 esp_init_data_default.bin \ 0x3FD000 blank.bin \ 0x3FE000 blank.bin \

[sudo] password for juan:
esptool.py v1.0.2-dev
Connecting…
Running Cesanta flasher stub…
Writing 4096 @ 0x0… 4096 (100 %)
Wrote 4096 bytes at 0x0 in 0.1 seconds (320.8 kbit/s)…
Writing 4096 @ 0x1000… 4096 (100 %)
Wrote 4096 bytes at 0x1000 in 0.1 seconds (318.4 kbit/s)…
Writing 4096 @ 0x7c000… 4096 (100 %)
Wrote 4096 bytes at 0x7c000 in 0.1 seconds (318.4 kbit/s)…
Writing 4096 @ 0x7d000… 4096 (100 %)
Wrote 4096 bytes at 0x7d000 in 0.1 seconds (318.4 kbit/s)…
Writing 4096 @ 0x7e000… 4096 (100 %)
Wrote 4096 bytes at 0x7e000 in 0.1 seconds (318.3 kbit/s)…
Writing 4096 @ 0x7f000… 4096 (100 %)
Wrote 4096 bytes at 0x7f000 in 0.1 seconds (318.2 kbit/s)…
Writing 4096 @ 0x80000… 4096 (100 %)
Wrote 4096 bytes at 0x80000 in 0.1 seconds (318.6 kbit/s)…
Writing 4096 @ 0xfe000… 4096 (100 %)
Wrote 4096 bytes at 0xfe000 in 0.1 seconds (318.3 kbit/s)…
Writing 4096 @ 0x100000… 4096 (100 %)
Wrote 4096 bytes at 0x100000 in 0.1 seconds (318.6 kbit/s)…
Writing 4096 @ 0x101000… 4096 (100 %)
Wrote 4096 bytes at 0x101000 in 0.1 seconds (318.4 kbit/s)…
Writing 4096 @ 0x1fc000… 4096 (100 %)
Wrote 4096 bytes at 0x1fc000 in 0.1 seconds (318.4 kbit/s)…
Writing 4096 @ 0x1fd000… 4096 (100 %)
Wrote 4096 bytes at 0x1fd000 in 0.1 seconds (318.3 kbit/s)…
Writing 4096 @ 0x1fe000… 4096 (100 %)
Wrote 4096 bytes at 0x1fe000 in 0.1 seconds (318.6 kbit/s)…
Writing 4096 @ 0x1ff000… 4096 (100 %)
Wrote 4096 bytes at 0x1ff000 in 0.1 seconds (318.4 kbit/s)…
Writing 4096 @ 0x3fc000… 4096 (100 %)
Wrote 4096 bytes at 0x3fc000 in 0.1 seconds (318.4 kbit/s)…
Writing 4096 @ 0x3fd000… 4096 (100 %)
Wrote 4096 bytes at 0x3fd000 in 0.1 seconds (318.3 kbit/s)…
Writing 4096 @ 0x3fe000… 4096 (100 %)
Wrote 4096 bytes at 0x3fe000 in 0.1 seconds (318.3 kbit/s)…
Leaving…
[email protected]:~/Documentos/bootloader$ sudo python esptool.py --port /dev/ttyUSB0 --baud 460800 write_flash --flash_freq 80m --flash_mode qio --flash_size 16m-c1 0x00000 "boot_v1.5.bin"
esptool.py v1.0.2-dev
Connecting…
Running Cesanta flasher stub…
Flash params set to 0x005f
Writing 4096 @ 0x0… 4096 (100 %)
Wrote 4096 bytes at 0x0 in 0.1 seconds (320.9 kbit/s)…
Leaving…
[email protected]:~/Documentos/bootloader$ sudo python esptool.py --port /dev/ttyUSB0 --baud 460800 write_flash --flash_freq 80m --flash_mode qio --flash_size 16m-c1 0x1000 oem.v2088.bin
esptool.py v1.0.2-dev
Connecting…
Running Cesanta flasher stub…
Writing 393216 @ 0x1000… 393216 (100 %)
Wrote 393216 bytes at 0x1000 in 9.4 seconds (334.8 kbit/s)…
Leaving…

What does

esptool.py --port /dev/ttyUSB0 --baud 115200 read_mac

give you?

hi, thank you for your answer.

if I remove the JP5 bridge and I not press the reset button

[email protected]:~/Documentos/bootloader$ sudo python esptool.py --port /dev/ttyUSB0 --baud 115200 read_mac
esptool.py v1.0.2-dev
Connecting…

A fatal error occurred: Failed to connect to ESP8266

but, if i not remove the JP5 bridge, and i press the reset button and hold it.

[email protected]:~/Documentos/bootloader$ sudo python esptool.py --port /dev/ttyUSB0 --baud 115200 read_mac
esptool.py v1.0.2-dev
Connecting…
MAC: 18:fe:34:d7:d9:d1

looks like that work in program mode but not work in normal mode.

Interesting. Can you try this https://harizanov.com/wp-content/uploads/2016/05/recoveryattempt.bin_.zip instead of v2088?
Let me know what is on the serial debug as well, lets see if there would be pointers

How i can do that??
I unpload the new bin, but i don’t know do this “Let me know what is on the serial debug as well, lets see if there would be pointers”

So any improvement since you reflashed the new firmware? try holding the button for 4 seconds, it will restart the unit into AP setup mode; at that point hold the button for 4 more seconds to reset it to defaults. At that point the AP should show up…

By “minitor the serial debug” I mean to use a terminal tool like minicom to see what is on the serial comms and

hi, with the new firmware neither entry in AP mode.
I hold the button for 4 more seconds and the AP do not show up. I do this operation with the jp5 remove.
i tried with the minicom, i tried whit jp5 removed and put. and differents serial speed. And it did not work.

hi again. i have changed the chip. i unpload the firmware again but it do not work.

please, i need help.

I have now received this unit back from @pychu. As you mention you have changed the ESP chip to ESP-WROOM-02. @Martin_Harizanov do you see an issue with this? Should the relay code be able to work on this chip.

I have successfully managed to upload recoveryattempt.bin and oem.v2088.bin but have not managed to read any serial output @ 115200 baud.

What do you think I should do? Can I send the board back to you @Martin_Harizanov to have the ESP replaced and latest code reloaded? Everything else on the board looks fine. I am a bit confused why @pychu changed the ESP?

I don’t mind re-flashing it; Glyn, PM me and I’ll give you an address to send it to. No guarantees, the modifications may have bricked the unit.

Cheers, I have sent you an email :slight_smile:

@pychu @Martin_Harizanov has fixed the issue with your relay you sent back. He replaced the ESP module then re-flashed it. Please could you PM me with a return address for us to send the working relay back to you?