bikemike / MikesThermostat

Alternative Firmware for the ESP WiFi module of the Floureon C17.GH3 and MoesHouse BHT-002-GBLW Thermostats
20 stars 12 forks source link

esp12s firmware upgrade #6

Open devits opened 4 years ago

devits commented 4 years ago

Dear comrades, help with the equipment is required.

The wires were soldered to the board to the rx-tx connectors ground is also connected to USB-TTL power is used externally, and soldered to the legs of the ESP.

GPIO hooked to 0

When turned on, the microcontroller does not enter the firmware mode. One gets the feeling that the internal communication is decoupled on the same rx-tx ports to which it is connected.

I ask for help with the firmware. I did not check the option with full soldering of the ESP module with a hairdryer, and I would not like it, because there is a great chance of damage to the display.

Board version c17_6.0

Which raises questions: I connect to port monitoring, on speed 9600

and I get a strange answer: Some of the data is readable, some are not. there is a feeling that the port is transmitting data to a neighboring microcircuit.

screenshot https://dl.dropboxusercontent.com/s/hxyf1ud335lyxin/javaw_2020-09-03_01-24-34.png

Thanks for reply

bikemike commented 4 years ago

You are trying to flash the C17GH3? I'm not sure if there is an easy way to do it. You could try to increase the baud rate for flashing and perhaps that would succeed. I wasn't able to flash so I cut the RX/TX traces on the PCB. After flashing, I scrapped the mask above the traces near the cut and applied a solder bridge across the cut.

Here are my notes:

Reading flash: Cut traces to rx/tx pins on esp-12s( leave room on the trace to solder bridge) Connect gpio0 to ground for 2 seconds while powering up Connect usb ttl to rx/tx Run esptool command: ./esptool.py --baud 921600 --port /dev/ttyUSB0 read_flash 0x00000 0x400000 floureon_c17_gh3_thermostat_4mb.img

Writing: ./esptool.py --baud 921600 write_flash -fs 4MB -fm dout 0x0 firmware.bin

After that you should be able to flash from platformio:

platformio run --target upload --upload-port 192.x.x.x (thermostat ip address)

devits commented 4 years ago

Hell but it seems that the firmware is encrypted. what is esptool reminding about

esptool.py v3.0-dev
Serial port COM8
Connecting ......
Detecting chip type ...

A fatal error occurred: Unsupported Command Error received. Probably this means Secure Download Mode is enabled, autodetection will not work. Need to manually specify the chip.

pointed the chip manually, we get the same fun:

Serial port COM8
Connecting ...
Chip is ESP8266 in Secure Download Mode
WARNING: Stub loader is not supported in Secure Download Mode, setting --no-stub
WARNING: ROM doesn't support changing baud rate. Keeping initial baud rate 115200
Enabling default SPI flash mode ...
Traceback (most recent call last):
  File "esptool.py", line 3692, in <module>
    _main ()
  File "esptool.py", line 3685, in _main
    main ()
  File "esptool.py", line 3383, in main
    esp.flash_spi_attach (0)
  File "esptool.py", line 1151, in flash_spi_attach
    self.flash_begin (0, 0)
  File "esptool.py", line 648, in flash_begin
    params, timeout = timeout)
  File "esptool.py", line 413, in check_command
    val, data = self.command (op, data, chk, timeout = timeout)
  File "esptool.py", line 398, in command
    raise UnsupportedCommandError (self, op)
__main __. UnsupportedCommandError: This command (0x2) is not supported in Secure Download Mode

add stub - we get

Enabling default SPI flash mode ...
Traceback (most recent call last):
  File "esptool.py", line 3692, in <module>
    _main ()
  File "esptool.py", line 3685, in _main
    main ()
  File "esptool.py", line 3383, in main
    esp.flash_spi_attach (0)
  File "esptool.py", line 1151, in flash_spi_attach
    self.flash_begin (0, 0)
  File "esptool.py", line 648, in flash_begin
    params, timeout = timeout)
  File "esptool.py", line 413, in check_command
    val, data = self.command (op, data, chk, timeout = timeout)
  File "esptool.py", line 398, in command
    raise UnsupportedCommandError (self, op)
__main __. UnsupportedCommandError: This command (0x2) is not supported in Secure Download Mode

Was your version without these problems?

PS commands erase_flash & region also unsupported :(

bikemike commented 4 years ago

Did you cut the traces on your PCB?

ghost commented 4 years ago

I am in no way an expert on this, coding is not one of my virtues! I have 5 Floureon C17.GH3 thermostats in my house controlling the floor heating. A sixt is available for an upstairs extension. I have not modified them yet, but want to. Meanwhile I successfully converted all kind of "tuya compatible" devices using the tuya-convert from Tasmota. Did you try that route? Tuya-convert captures and reroutes the device to a temporary wifi and does not let it connect to the Tuya cloud. Could it be that is your problem?

bikemike commented 4 years ago

Great point. Tuya-Convert is probably the first thing to try. I didn't know about it when I was flashing my device. If you can get it to work, please keep notes and send them to me so I can add them to the documentation.

ghost commented 4 years ago

I'll try to Tuya-Convert my spare thermostat in the next few day and keep you abreast on this channel.

devits commented 4 years ago

Did you cut the traces on your PCB?

yes, rx and tx lines cutted Without cutting the outputs, it was impossible to connect to the ESP. in this case, the connection goes through, reads the mac-address...

bikemike commented 4 years ago

yes, rx and tx lines cutted Without cutting the outputs, it was impossible to connect to the ESP. in this case, the connection goes through, reads the mac-address...

Are you using the latest version of esptool from github?

devits commented 4 years ago

yes, rx and tx lines cutted Without cutting the outputs, it was impossible to connect to the ESP. in this case, the connection goes through, reads the mac-address...

Are you using the latest version of esptool from github?

yes

3.0 dev and 2.5.0

bikemike commented 4 years ago

It looks like secure download is a feature of ESP32-S2 (see here) so perhaps there is a bug with 3.0.dev that you are trying. Try using the latest released versoin which is 2.8.

devits commented 4 years ago

Hell.

Not esptool ...

USB-TTL fried to hell

CH340 TTL poured out without problems with cut rxtx.

It would be nice to describe these points in the instructions.

The question is, can the firmware display the temperatures of both sensors?

PS Thank you so much for the cutting tip. I already wanted to dry the ESP with a hairdryer!

bikemike commented 4 years ago

Great news! I'm glad you were able to get it flashed.

The firmware will send changes for both internal and external temperature over mqtt and also display them on a very rudimentary webpage. I only have the internal sensor enabled so I haven't really tested this.

szeryf85 commented 2 years ago

Hell.

Not esptool ...

USB-TTL fried to hell

CH340 TTL poured out without problems with cut rxtx.

It would be nice to describe these points in the instructions.

The question is, can the firmware display the temperatures of both sensors?

PS Thank you so much for the cutting tip. I already wanted to dry the ESP with a hairdryer!

hello :) can you share the firmware you uploaded to esp?