mightymos / RF-Bridge-OB38S003

Alternative firmware for the OB38S003 and EFM8BB1 microcontrollers present in Sonoff radio to wifi bridges.
BSD 2-Clause "Simplified" License
37 stars 3 forks source link

How to flash ? #4

Closed the-mentor closed 4 weeks ago

the-mentor commented 8 months ago

Hi, If i want to test this firmware what is the process of flashing it to the chip? Is it possible to use a chip clamp to flash the chip or de-soldering and re-soldering it the only way?

Thank you very much for your work !!

-DM

mightymos commented 6 months ago

@otsoni Do you mean that you CAN read the chip type after erasing the chip (but not before)? Or not? If so, can you try to protect one of your rf bridge again (setfuse 18 0), then reset microcontroller, and try to read chip type?

It is a little annoying to relock chip but you should be able to unlock again as you have done previously. But I understand if you would prefer to leave unlocked and use for smart home integration now.

mightymos commented 6 months ago

@otsoni Good point on Atmega2560, I forgot about the voltage translation issue. Thank you for trying, I have updated the readme to help and warn others.

otsoni commented 6 months ago

@mightymos Are you sure the protection command is setfuse 18 0? I found somewhere that the protection byte is 0x10 and used setfuse 16 0 and it made my rf bridge to fail handshake again, but I got it back to working again with erasing. It seems that maybe my rf bridges have something different then?

By the way, I have three rf bridges now and I'm using just one for smart home integration and I'm planning to do some development on the extra ones also. So if you want me to test anything, it is possible.

mightymos commented 6 months ago

@otsoni You are correct, I was forgetting previous work. I have updated the readme to explain the expected behavior when handshaking/flashing a protected chip. I also started this wiki which will be needed if people eventually need to modify other fuse bits: https://github.com/mightymos/OnbrightFlasher/wiki

diepeterpan commented 5 months ago

My experience, if it helps anybody else (I tried 4 hours unsuccessfully and then this recipe worked):

Chip programming was done from a Wemos D1 without any additional power source. No headers were soldered to the Sonoff RF Bridge, I just used breadboard patch cables. I must admit it can be problematic, as I did experience some failed flashes as a result of using dangling cables, you just need to retry and be patient if you are not going to solder headers to the RF Bridge.

IMPORTANT: The chip would not identify as 0xA until I ignored it and erased it successfully, it then identified as 0xA !!!!!

  1. Erase the ESP8285 on the 433RFBRIGE R2 V2.2 board esptool.py --chip auto --port /dev/........ erase_flash
  2. Using the Arduino Serial Monitor I then did a handshake that gave the incorrect chip ID, ignore that, and do an erase I found that it is very important for the handshake to only connect the power when the handshake is waiting
  3. Then after a successful erase still in the Arduino IDE serial monitor setfuse 18 249
  4. Followed by a signature command in the Arduino IDE serial monitor the chip then identified as 0xA
  5. Then from the command line python3 flashScript.py
  6. Then flash the esp with either Esphome or Tasmotizer

My output from flashScript

2024-04-03 23:44:39,817 - INFO - State changing to handshake
2024-04-03 23:44:39,817 - INFO - cycle power to target (start with power off and then turn on)
2024-04-03 23:44:41,716 - INFO - Handshake succeeded
2024-04-03 23:44:41,837 - INFO - Status: 0
2024-04-03 23:44:41,837 - INFO - Success
2024-04-03 23:44:41,839 - INFO - Chip read: 0xA
2024-04-03 23:44:41,840 - INFO - Connected...
2024-04-03 23:44:41,843 - INFO - Returning to idle state...
2024-04-03 23:44:41,945 - INFO - erase
2024-04-03 23:44:42,448 - INFO - Erasing chip...
2024-04-03 23:44:42,449 - INFO - Status: 0
2024-04-03 23:44:42,449 - INFO - Success
2024-04-03 23:44:42,449 - INFO - Chip erase successful
2024-04-03 23:44:42,551 - INFO - 
2024-04-03 23:44:43,052 - INFO - setfuse 18 249
2024-04-03 23:44:43,554 - INFO - Set configuration byte...
2024-04-03 23:44:43,554 - INFO - Status: 0
2024-04-03 23:44:43,555 - INFO - Success
2024-04-03 23:44:43,555 - INFO - Wrote configuration byte
2024-04-03 23:44:43,565 - INFO - :1000BB00AE82AF837C007D00C3EC9EED9F50147A23
2024-04-03 23:44:43,604 - INFO - Write successful
2024-04-03 23:44:43,606 - INFO - Wrote 16 bytes
2024-04-03 23:44:43,615 - INFO - :1000CB000B7B001ABAFF011BEA4B70F70CBC00E864
2024-04-03 23:44:43,652 - INFO - Write successful
2024-04-03 23:44:43,655 - INFO - Wrote 16 bytes
......
2024-04-03 23:45:00,798 - INFO - :0C15170075830022E280F7E49322E022BA
2024-04-03 23:45:00,829 - INFO - Write successful
2024-04-03 23:45:00,832 - INFO - Wrote 12 bytes
2024-04-03 23:45:00,837 - INFO - :00000001FF
2024-04-03 23:45:00,938 - INFO - mcureset
2024-04-03 23:45:01,444 - INFO - MCU reset...
Martimlin commented 4 months ago

hi @diepeterpan

I was able to flash my MCU following your guide and the OB38S003_PassthroughMode file. Do you have any experiences using Tasmota as well? I'm not receiving any data ;-(. I have to admit that I never tested my Sonoff bridge with a supported IR-transmitters before flashing. Do I need a custom build of Tasmota?

diepeterpan commented 4 months ago

hi @diepeterpan

I was able to flash my MCU following your guide and the OB38S003_PassthroughMode file. Do you have any experiences using Tasmota as well? I'm not receiving any data ;-(. I have to admit that I never tested my Sonoff bridge with a supported IR-transmitters before flashing. Do I need a custom build of Tasmota?

If you are using passthrough mode then ensure you are using tasmota-sensors.bin and configure Tasmota as GPIO1 (RFSend) and GPIO3 (RFRecv) , I initially used but then switched to ESPHOME.

Martimlin commented 4 months ago

I've tried with

hi @diepeterpan I was able to flash my MCU following your guide and the OB38S003_PassthroughMode file. Do you have any experiences using Tasmota as well? I'm not receiving any data ;-(. I have to admit that I never tested my Sonoff bridge with a supported IR-transmitters before flashing. Do I need a custom build of Tasmota?

If you are using passthrough mode then ensure you are using tasmota-sensors.bin and configure Tasmota as GPIO1 (RFSend) and GPIO3 (RFRecv) , I initially used but then switched to ESPHOME.

Now I got it working with my low budget remote for sockets :-). But I do not receive anything from my other remotes. I've tried both passthrough and SerialMode.

diepeterpan commented 4 months ago

I've tried with

hi @diepeterpan I was able to flash my MCU following your guide and the OB38S003_PassthroughMode file. Do you have any experiences using Tasmota as well? I'm not receiving any data ;-(. I have to admit that I never tested my Sonoff bridge with a supported IR-transmitters before flashing. Do I need a custom build of Tasmota?

If you are using passthrough mode then ensure you are using tasmota-sensors.bin and configure Tasmota as GPIO1 (RFSend) and GPIO3 (RFRecv) , I initially used but then switched to ESPHOME.

Now I got it working with my low budget remote for sockets :-). But I do not receive anything from my other remotes. I've tried both passthrough and SerialMode.

As far as I understand SerialMode is not working on the new MCU - OB38S003, that's why I switched to ESPHOME so that I can get the raw messages.

mightymos commented 2 months ago

@diepeterpan @Martimlin

Serial mode decoding and transmitting with RFRaw 0xA5 or 0xA8 commands should be working on both EFM8BB1 and OB38S003 board. However, I have not tried every protocol etc. But I am able to receive from a door sensor and transmit/receive between boards.

Nevertheless...it is probably most straightforward to use the passthrough mode along with ESPHome. If that is not even working I can try to help figure out why. I just end up having to reflash between Tasmota and ESPHome for various debugging reasons and that is getting a little annoying lol.

fragpic commented 2 months ago

@mightymos How does one flash the new firmware directly on the sonoff without using a second controller? I'm already running the old passthrough firmware and am looking to try the new decode version

mightymos commented 2 months ago

@mightymos How does one flash the new firmware directly on the sonoff without using a second controller? I'm already running the old passthrough firmware and am looking to try the new decode version

The file [https://github.com/mightymos/OnbrightFlasher/blob/main/OnbrightFlasher.ino] has a note that says on the Sonoff ESP8285 pin 16 and pin 24 (gpio4 and gpio5) (or USBRXD and UXBTXD on J3 connector) need to be bridged to SDA and SCL pins.

Or it should say that. I'll try to remember to fix the comment.

Various pinouts for other modules are discussed here: https://randomnerdtutorials.com/esp8266-pinout-reference-gpios/

The datasheet contradicts this and I don't remember why (0a-esp8285_datasheet_en.pdf).

Of course first you would need to flash the sketch to the Sonoff ESP using the normal method. Then afterward follow instructions to further flash the microcontroller.

fragpic commented 2 months ago

Oh, I saw that comment in the sketch. So I would need to solder those pins. I'll just stick to using an external esp32. Also, I'm trying to use the new onbrightflasher sketch to update the firmware but I keep getting errors with the wifi and web server setup. Since the network flash is an optional feature, can you tell me which all lines I can comment out so I can do the bog standard install that worked with the sketch a few months ago?

mightymos commented 2 months ago

Oh, I saw that comment in the sketch. So I would need to solder those pins. I'll just stick to using an external esp32. Also, I'm trying to use the new onbrightflasher sketch to update the firmware but I keep getting errors with the wifi and web server setup. Since the network flash is an optional feature, can you tell me which all lines I can comment out so I can do the bog standard install that worked with the sketch a few months ago?

That's a good point, but what errors are you getting? Maybe I can fix that faster and look into giving the option to omit web stuff later.

fragpic commented 2 months ago

In file included from C:\Users\Chai\AppData\Local\Arduino15\packages\esp32\hardware\esp32\3.0.2\libraries\WiFi\src/WiFiSTA.h:29, from C:\Users\Chai\AppData\Local\Arduino15\packages\esp32\hardware\esp32\3.0.2\libraries\WiFi\src/WiFi.h:33, from C:\Users\Chai\Downloads\OnbrightFlasher\OnbrightFlasher.ino:28: C:\Users\Chai\AppData\Local\Arduino15\packages\esp32\hardware\esp32\3.0.2\libraries\WiFi\src/WiFiGeneric.h:44:25: error: 'network_event_handle_t' does not name a type; did you mean 'esp_event_handler_t'? 44 | #define wifi_event_id_t network_event_handle_t | ^~~~~~ C:\Users\Chai\AppData\Local\Arduino15\packages\esp32\hardware\esp32\3.0.2\libraries\WiFi\src/WiFiGeneric.h:80:3: note: in expansion of macro 'wifi_event_id_t' 80 | wifi_event_id_t onEvent(WiFiEventCb cbEvent, arduino_event_id_t event = ARDUINO_EVENT_MAX); | ^~~~~~~ C:\Users\Chai\AppData\Local\Arduino15\packages\esp32\hardware\esp32\3.0.2\libraries\WiFi\src/WiFiGeneric.h:44:25: error: 'network_event_handle_t' does not name a type; did you mean 'esp_event_handler_t'? 44 | #define wifi_event_id_t network_event_handle_t | ^~~~~~ C:\Users\Chai\AppData\Local\Arduino15\packages\esp32\hardware\esp32\3.0.2\libraries\WiFi\src/WiFiGeneric.h:81:3: note: in expansion of macro 'wifi_event_id_t' 81 | wifi_event_id_t onEvent(WiFiEventFuncCb cbEvent, arduino_event_id_t event = ARDUINO_EVENT_MAX); | ^~~~~~~ C:\Users\Chai\AppData\Local\Arduino15\packages\esp32\hardware\esp32\3.0.2\libraries\WiFi\src/WiFiGeneric.h:44:25: error: 'network_event_handle_t' does not name a type; did you mean 'esp_event_handler_t'? 44 | #define wifi_event_id_t network_event_handle_t | ^~~~~~ C:\Users\Chai\AppData\Local\Arduino15\packages\esp32\hardware\esp32\3.0.2\libraries\WiFi\src/WiFiGeneric.h:82:3: note: in expansion of macro 'wifi_event_id_t' 82 | wifi_event_id_t onEvent(WiFiEventSysCb cbEvent, arduino_event_id_t event = ARDUINO_EVENT_MAX); | ^~~~~~~ C:\Users\Chai\AppData\Local\Arduino15\packages\esp32\hardware\esp32\3.0.2\libraries\WiFi\src/WiFiGeneric.h:41:25: error: 'NetworkEventCb' has not been declared 41 | #define WiFiEventCb NetworkEventCb | ^~~~~~ C:\Users\Chai\AppData\Local\Arduino15\packages\esp32\hardware\esp32\3.0.2\libraries\WiFi\src/WiFiGeneric.h:83:20: note: in expansion of macro 'WiFiEventCb' 83 | void removeEvent(WiFiEventCb cbEvent, arduino_event_id_t event = ARDUINO_EVENT_MAX); | ^~~ C:\Users\Chai\AppData\Local\Arduino15\packages\esp32\hardware\esp32\3.0.2\libraries\WiFi\src/WiFiGeneric.h:83:41: error: 'arduino_event_id_t' has not been declared 83 | void removeEvent(WiFiEventCb cbEvent, arduino_event_id_t event = ARDUINO_EVENT_MAX); | ^~~~~~ C:\Users\Chai\AppData\Local\Arduino15\packages\esp32\hardware\esp32\3.0.2\libraries\WiFi\src/WiFiGeneric.h:43:25: error: 'NetworkEventSysCb' has not been declared 43 | #define WiFiEventSysCb NetworkEventSysCb | ^~~~~ C:\Users\Chai\AppData\Local\Arduino15\packages\esp32\hardware\esp32\3.0.2\libraries\WiFi\src/WiFiGeneric.h:84:20: note: in expansion of macro 'WiFiEventSysCb' 84 | void removeEvent(WiFiEventSysCb cbEvent, arduino_event_id_t event = ARDUINO_EVENT_MAX); | ^~~~~~ C:\Users\Chai\AppData\Local\Arduino15\packages\esp32\hardware\esp32\3.0.2\libraries\WiFi\src/WiFiGeneric.h:84:44: error: 'arduino_event_id_t' has not been declared 84 | void removeEvent(WiFiEventSysCb cbEvent, arduino_event_id_t event = ARDUINO_EVENT_MAX); | ^~~~~~ C:\Users\Chai\AppData\Local\Arduino15\packages\esp32\hardware\esp32\3.0.2\libraries\WiFi\src/WiFiGeneric.h:84:8: error: 'void WiFiGenericClass::removeEvent(int, int)' cannot be overloaded with 'void WiFiGenericClass::removeEvent(int, int)' 84 | void removeEvent(WiFiEventSysCb cbEvent, arduino_event_id_t event = ARDUINO_EVENT_MAX); | ^~~ C:\Users\Chai\AppData\Local\Arduino15\packages\esp32\hardware\esp32\3.0.2\libraries\WiFi\src/WiFiGeneric.h:83:8: note: previous declaration 'void WiFiGenericClass::removeEvent(int, int)' 83 | void removeEvent(WiFiEventCb cbEvent, arduino_event_id_t event = ARDUINO_EVENT_MAX); | ^~~ C:\Users\Chai\AppData\Local\Arduino15\packages\esp32\hardware\esp32\3.0.2\libraries\WiFi\src/WiFiGeneric.h:44:25: error: 'network_event_handle_t' has not been declared 44 | #define wifi_event_id_t network_event_handle_t | ^~~~~~ C:\Users\Chai\AppData\Local\Arduino15\packages\esp32\hardware\esp32\3.0.2\libraries\WiFi\src/WiFiGeneric.h:85:20: note: in expansion of macro 'wifi_event_id_t' 85 | void removeEvent(wifi_event_id_t id); | ^~~~~~~ C:\Users\Chai\AppData\Local\Arduino15\packages\esp32\hardware\esp32\3.0.2\libraries\WiFi\src/WiFiGeneric.h:129:25: error: 'arduino_event_id_t' has not been declared 129 | const char eventName(arduino_event_id_t id); | ^~~~~~ C:\Users\Chai\AppData\Local\Arduino15\packages\esp32\hardware\esp32\3.0.2\libraries\WiFi\src/WiFiGeneric.h:131:30: error: 'arduino_event_t' has not been declared 131 | static void _eventCallback(arduino_event_t event); | ^~~~~~~ C:\Users\Chai\AppData\Local\Arduino15\packages\esp32\hardware\esp32\3.0.2\libraries\WiFi\src/WiFiGeneric.h:83:68: error: 'ARDUINO_EVENT_MAX' was not declared in this scope; did you mean 'WIFI_EVENT_MAX'? 83 | void removeEvent(WiFiEventCb cbEvent, arduino_event_id_t event = ARDUINO_EVENT_MAX); | ^~~~~ | WIFI_EVENT_MAX C:\Users\Chai\AppData\Local\Arduino15\packages\esp32\hardware\esp32\3.0.2\libraries\WiFi\src/WiFiGeneric.h:84:71: error: 'ARDUINO_EVENT_MAX' was not declared in this scope; did you mean 'WIFI_EVENT_MAX'? 84 | void removeEvent(WiFiEventSysCb cbEvent, arduino_event_id_t event = ARDUINO_EVENT_MAX); | ^~~~~ | WIFI_EVENT_MAX C:\Users\Chai\AppData\Local\Arduino15\packages\esp32\hardware\esp32\3.0.2\libraries\WiFi\src/WiFiSTA.h:44:42: error: expected class-name before '{' token 44 | class STAClass : public NetworkInterface { | ^ In file included from C:\Users\Chai\AppData\Local\Arduino15\packages\esp32\hardware\esp32\3.0.2\libraries\WiFi\src/WiFi.h:34: C:\Users\Chai\AppData\Local\Arduino15\packages\esp32\hardware\esp32\3.0.2\libraries\WiFi\src/WiFiAP.h:39:41: error: expected class-name before '{' token 39 | class APClass : public NetworkInterface { | ^ In file included from C:\Users\Chai\Downloads\OnbrightFlasher\OnbrightFlasher.ino:37: C:\Users\Chai\Downloads\OnbrightFlasher\Network.h:4:11: error: redefinition of 'IPAddress local_IP' 4 | IPAddress local_IP(192, 168, 0, 222); // Set your server's fixed IP address here | ^~~~ In file included from C:\Users\Chai\AppData\Local\Arduino15\packages\esp32\hardware\esp32\3.0.2\libraries\WiFi\src/WiFiGeneric.h:39: C:\Users\Chai\Downloads\OnbrightFlasher/Network.h:4:11: note: 'IPAddress local_IP' previously declared here 4 | IPAddress local_IP(192, 168, 0, 222); // Set your server's fixed IP address here | ^~~~ C:\Users\Chai\Downloads\OnbrightFlasher\Network.h:5:11: error: redefinition of 'IPAddress gateway' 5 | IPAddress gateway(192, 168, 0, 1); // Set your network Gateway usually your Router base address | ^~~ C:\Users\Chai\Downloads\OnbrightFlasher/Network.h:5:11: note: 'IPAddress gateway' previously declared here 5 | IPAddress gateway(192, 168, 0, 1); // Set your network Gateway usually your Router base address | ^~~ C:\Users\Chai\Downloads\OnbrightFlasher\Network.h:6:11: error: redefinition of 'IPAddress subnet' 6 | IPAddress subnet(255, 255, 255, 0); // Set your network sub-network mask here | ^~ C:\Users\Chai\Downloads\OnbrightFlasher/Network.h:6:11: note: 'IPAddress subnet' previously declared here 6 | IPAddress subnet(255, 255, 255, 0); // Set your network sub-network mask here | ^~ C:\Users\Chai\Downloads\OnbrightFlasher\Network.h:7:11: error: redefinition of 'IPAddress dns' 7 | IPAddress dns(192,168,0,1); // Set your network DNS usually your Router base address | ^~~ C:\Users\Chai\Downloads\OnbrightFlasher/Network.h:7:11: note: 'IPAddress dns' previously declared here 7 | IPAddress dns(192,168,0,1); // Set your network DNS usually your Router base address | ^~~

exit status 1

Compilation error: redefinition of 'IPAddress local_IP'

This is the error I get. I created the secrets.h and also filled in my ip info in the networks.h file

fragpic commented 2 months ago

Also, when trying the flashscript, i get a timeout error

2024-07-06 14:08:07,876 - INFO - Handshake failed (1355) 2024-07-06 14:08:07,877 - INFO - cycle power to target (start with power off and then turn on) 2024-07-06 14:08:08,146 - INFO - Handshake complete... 2024-07-06 14:08:08,168 - INFO - Chip read: 0xA 2024-07-06 14:08:08,169 - INFO - Connected... 2024-07-06 14:08:08,171 - INFO - Returning to idle state... 2024-07-06 14:08:27,324 - ERROR - Timeout reached. No valid response within 30 seconds. Last response was: 2024-07-06 14:08:27,324 - ERROR - State 4 failed. Returning to handshake state. 2024-07-06 14:08:28,434 - INFO - handshake 2024-07-06 14:08:28,434 - INFO - Reset to handshake 2024-07-06 14:08:28,434 - INFO - Handshake failed (1356)

mightymos commented 2 months ago

Also, when trying the flashscript, i get a timeout error

2024-07-06 14:08:07,876 - INFO - Handshake failed (1355) 2024-07-06 14:08:07,877 - INFO - cycle power to target (start with power off and then turn on) 2024-07-06 14:08:08,146 - INFO - Handshake complete... 2024-07-06 14:08:08,168 - INFO - Chip read: 0xA 2024-07-06 14:08:08,169 - INFO - Connected... 2024-07-06 14:08:08,171 - INFO - Returning to idle state... 2024-07-06 14:08:27,324 - ERROR - Timeout reached. No valid response within 30 seconds. Last response was: 2024-07-06 14:08:27,324 - ERROR - State 4 failed. Returning to handshake state. 2024-07-06 14:08:28,434 - INFO - handshake 2024-07-06 14:08:28,434 - INFO - Reset to handshake 2024-07-06 14:08:28,434 - INFO - Handshake failed (1356)

I could not reproduce that compilation error.

Do you have "esp32" by Espressif Systems installed in the board manager? It would be version 3.0.2.

I also do not understand how you got a script output if the chip is failing to compile and then flash?

fragpic commented 2 months ago

I am using the 3.0.2 board. I have an esp 32 c3 super mini. I had a copy of an older version of the code without the wifi stuff, so I flashed that and ran the flashscript.py to do the rest. Old code runs fine and is able to do the handshake, erase and set fuse but I needed the flashscript.py to flash the firmware.

mightymos commented 2 months ago

I am using the 3.0.2 board. I have an esp 32 c3 super mini. I had a copy of an older version of the code without the wifi stuff, so I flashed that and ran the flashscript.py to do the rest. Old code runs fine and is able to do the handshake, erase and set fuse but I needed the flashscript.py to flash the firmware.

I went ahead and removed the web upload stuff for now since it is interfering and probably unneeded. I also changed the readme to better explain need for external flasher. I tried the script and was able to flash the blink.ihx file.

If you flash the serial mode and try it out it would be helpful to know that it worked for you.

mightymos commented 2 months ago

@fragpic I was also able to flash main_rcswitch_OB38S003.hex with the script. I am able to see decoding with Tasmota configured as Sonoff Bridge (25). Recall should probably flash with tasmota-sensors.bin to support passthrough if used later.

fragpic commented 2 months ago

Thanks for the quick fix! Flash went perfectly now. Sketch compiled without any errors and script worked perfectly. Do you have an example yaml for using serial mode with EspHome?

mightymos commented 2 months ago

Thanks for the quick fix! Flash went perfectly now. Sketch compiled without any errors and script worked perfectly. Do you have an example yaml for using serial mode with EspHome?

No not at the moment. If no one else contributes one I might make another yaml example but people seem to prefer passthrough mode generally. I am trying to support everything but it is difficult to test all combinations myself.

fragpic commented 2 months ago

I found this example, does it make sense to you? https://www.irrgang.dev/how-to-flash-the-sonoff-rf-bridger2-with-esphome/ It's using the decoding from the stock MCU firmware. I can test it and add it to the repo if you think this makes sense. Thanks again for maintaining this project.

mightymos commented 2 months ago

I found this example, does it make sense to you? https://www.irrgang.dev/how-to-flash-the-sonoff-rf-bridger2-with-esphome/ It's using the decoding from the stock MCU firmware. I can test it and add it to the repo if you think this makes sense. Thanks again for maintaining this project.

Yes, I think so. I didn't check it in detail but it looks like they are following this example: https://esphome.io/components/rf_bridge.html

fragpic commented 2 months ago

I found this example, does it make sense to you? https://www.irrgang.dev/how-to-flash-the-sonoff-rf-bridger2-with-esphome/ It's using the decoding from the stock MCU firmware. I can test it and add it to the repo if you think this makes sense. Thanks again for maintaining this project.

Yes, I think so. I didn't check it in detail but it looks like they are following this example: https://esphome.io/components/rf_bridge.html

Sounds good. Let me try that and report back.

fragpic commented 2 months ago

I tried this but I dont see any output in HomeAssistant events. The code is meant for the older Sonoff bridge, do you know if the R2.2 version uses the same uart pins from the mcu?

mightymos commented 2 months ago

I tried this but I dont see any output in HomeAssistant events. The code is meant for the older Sonoff bridge, do you know if the R2.2 version uses the same uart pins from the mcu?

I was sure the white box Sonoff was the newest one, not older, correct?

I do not know why they listed the board that way. You can see what I think is the proper board assignment here: https://github.com/mightymos/RF-Bridge-OB38S003/blob/main/example_esphome_yaml/sonoff_bridge.yaml

Anyway, GPIO1 (U0TXD)(pin 26) is radio transmit and GPIO3 (U0RXD)(pin 25) is radio receiver on ESP8285.

fragpic commented 2 months ago

I tried this but I dont see any output in HomeAssistant events. The code is meant for the older Sonoff bridge, do you know if the R2.2 version uses the same uart pins from the mcu?

I was sure the white box Sonoff was the newest one, not older, correct?

I do not know why they listed the board that way. You can see what I think is the proper board assignment here: https://github.com/mightymos/RF-Bridge-OB38S003/blob/main/example_esphome_yaml/sonoff_bridge.yaml

Anyway, GPIO1 (U0TXD)(pin 26) is radio transmit and GPIO3 (U0RXD)(pin 25) is radio receiver on ESP8285.

I was referring to the esphome code. That was for the black one with the older MCU. When trying to use the same code with the OB38S003, it doesnt send any RF messages like it's supposed to. I am using GPIO1 and 3 for UART. Is there a specific format in which the mcu sends data to the esp in the stock firmware?

mightymos commented 2 months ago

I only support the 0xA5 and 0xA8 commands for sending, the Portisch commands are described here: https://github.com/Portisch/RF-Bridge-EFM8BB1/wiki/Commands

RfSend command should work with Tasmota, see the example here: https://tasmota.github.io/docs/Commands/#rf-bridge

How do you know if a radio message is received or not? Does RfSend work for your device?

fragpic commented 2 months ago

I only support the 0xA5 and 0xA8 commands for sending, the Portisch commands are described here: https://github.com/Portisch/RF-Bridge-EFM8BB1/wiki/Commands

RfSend command should work with Tasmota, see the example here: https://tasmota.github.io/docs/Commands/#rf-bridge

How do you know if a radio message is received or not? Does RfSend work for your device?

Ah okay, so you only support transmit on the serial mode. I'm trying to receive the code from the remote. I guess I have to order an SDR and sniff it then. Pass through mode reads the raw signal but I'm unable to do much with that.

mightymos commented 2 months ago

I also support receiving on serial mode. It's difficult to know if there's another problem or if the remote is just an unsupported protocol.

Can you carefully open the remote and see what chip is inside? Or try to capture with dump in passthrough mode on ESPHome?

fragpic commented 2 months ago

Oh okay. Passthrough mode dumps the button click in a weird Pronto format. It's a ceiling fan remote which has multiple things on it(color changing light, air filter and fan speec with direction) and I think it sends the full state on each press. I receive 6 messages on each button press, I cleaned it up trying to figure out what it meant but got nowhere, here's the dump of the 6 messages

0000 006D 0042 0000 0009 0092 0025 0076 0027 0027 0025 0076 0026 0027 0025 0076 0026 0028 0026 0027 0025 0077 0026 0027 0027 0028 0026 0028 0026 0076 0026 0028 0026 0027 0025 0076 0026 0029 0026 0027 0026 0028 0025 0076 0026 0027 0025 0076 0025 0075 0025 0075 0025 0076 0026 0027 0025 0076 0025 0075 0026 0027 0026 0076 0025 0076 0025 0076 0025 0077 0025 0076 0025 0076 0025 0076 0026 0027 0026 0027 0025 0076 0026 0027 0025 0077 0026 0075 0025 0076 0026 0027 0026 0028 0026 0028 0026 0027 0026 0027 0025 0077 0026 0076 0026 0027 0025 0076 0025 0076 0026 0028 0026 0028 0025 0076 0026 0028 0025 0076 0026 0076 0026 0027 0026 0076 0025 0076 0025 0076 0025 0076 0025 0072 002F 0181 06C3

0000 006D 0042 0000 00DA 0026 0025 0076 0026 0027 0025 0076 0026 0027 0026 0076 0026 0028 0026 0027 0025 0077 0026 0027 0026 0028 0025 0028 0025 0076 0026 0027 0025 0027 0025 0075 0025 0029 0026 0027 0025 0027 0025 0075 0025 0028 0025 0075 0026 0075 0025 0075 0025 0076 0025 0027 0025 0075 0025 0075 0026 0027 0025 0076 0025 0075 0025 0075 0026 0076 0025 0075 0026 0075 0025 0075 0026 0027 0026 0027 0025 0075 0026 0028 0025 0076 0025 0076 0025 0076 0026 0027 0026 0028 0026 0028 0026 0027 0026 0028 0025 0077 0025 0076 0026 0027 0026 0076 0025 0076 0026 0027 0026 0028 0025 0076 0026 0028 0025 0076 0026 0076 0026 0028 0025 0075 0025 0076 0025 0076 0025 0076 0025 0072 0052 0181 06C3

0000 006D 0042 0000 00DA 0026 0025 0076 0026 0027 0025 0075 0026 0027 0025 0075 0026 0028 0026 0027 0025 0076 0025 0028 0025 0028 0026 0027 0025 0075 0025 0027 0025 0027 0025 0075 0026 0029 0026 0027 0025 0027 0025 0075 0026 0028 0025 0075 0025 0076 0025 0075 0025 0076 0026 0028 0025 0075 0025 0075 0026 0027 0025 0075 0025 0075 0026 0075 0025 0076 0025 0075 0025 0076 0025 0076 0027 0028 0026 0028 0026 0076 0026 0028 0026 0077 0025 0076 0025 0076 0026 0027 0026 0028 0026 0028 0026 0028 0026 0027 0026 0076 0026 0076 0026 0028 0026 0076 0025 0076 0026 0027 0026 0028 0025 0076 0026 0028 0025 0075 0025 0076 0026 0028 0026 0076 0025 0076 0025 0076 0025 0075 0025 0072 0046 0181 06C3

0000 006D 0042 0000 00DA 0026 0025 0075 0025 0028 0025 0076 0026 0027 0025 0075 0025 0028 0026 0027 0026 0075 0026 0028 0026 0028 0026 0027 0025 0075 0026 0028 0025 0028 0025 0075 0026 0028 0025 0027 0025 0028 0025 0076 0026 0027 0025 0075 0025 0075 0025 0075 0025 0076 0026 0027 0025 0075 0025 0075 0025 0028 0026 0076 0025 0075 0025 0076 0025 0077 0025 0076 0026 0076 0025 0076 0026 0027 0026 0028 0025 0076 0026 0027 0025 0077 0026 0076 0025 0076 0026 0028 0026 0028 0026 0028 0026 0027 0026 0028 0025 0077 0025 0076 0026 0027 0025 0076 0025 0076 0026 0027 0026 0028 0025 0076 0026 0028 0025 0076 0025 0076 0026 0028 0025 0075 0025 0075 0025 0076 0025 0075 0025 0072 0046 0181 06C3

0000 006D 0042 0000 00DA 0026 0025 0075 0025 0028 0025 0075 0026 0027 0025 0075 0025 0028 0026 0027 0025 0076 0025 0028 0026 0027 0026 0027 0025 0075 0026 0028 0026 0027 0026 0075 0025 0029 0026 0027 0026 0027 0025 0075 0026 0028 0025 0075 0025 0076 0025 0076 0025 0077 0026 0027 0026 0076 0025 0076 0026 0027 0025 0076 0026 0076 0025 0075 0026 0077 0025 0076 0025 0076 0025 0076 0026 0028 0026 0027 0026 0076 0026 0028 0026 0077 0026 0076 0025 0076 0026 0027 0026 0027 0026 0028 0026 0028 0026 0027 0026 0077 0025 0076 0026 0027 0026 0076 0025 0076 0026 0027 0025 0027 0025 0076 0026 0028 0025 0075 0025 0075 0026 0027 0025 0075 0025 0075 0025 0075 0025 0075 0025 0072 0051 0181 06C3

0000 006D 0041 0000 00DA 0026 0025 0075 0025 0028 0025 0076 0026 0027 0025 0075 0026 0028 0026 0027 0025 0076 0026 0028 0026 0028 0026 0027 0025 0075 0025 0028 0026 0028 0025 0076 0026 0029 0025 0028 0026 0027 0026 0076 0026 0027 0026 0076 0025 0076 0025 0075 0025 0077 0026 0028 0025 0076 0026 0076 0026 0027 0025 0076 0025 0075 0026 0076 0025 0076 0025 0075 0025 0076 0026 0076 0026 0027 0026 0027 0025 0076 0026 0027 0026 0077 0026 0076 0025 0075 0026 0027 0026 0028 0025 0028 0026 0027 0026 0027 0025 0076 0025 0076 0026 0027 0025 0075 0025 0075 0026 0027 0026 0027 0025 0075 0025 0029 0025 0075 0025 0075 0026 0027 0025 0074 0025 0075 0025 0075 0025 0075 0025 0181 06C3

the-mentor commented 2 months ago

@fragpic what you're seeing is normal since esphome can't decode the fan protocol most likely since it's not a standard protocol like rc switch. If you're seeing data it's good

fragpic commented 2 months ago

So can the serial mode firmware decode this as raw?

the-mentor commented 2 months ago

So can the serial mode firmware decode this as raw?

From my experience decoding the fan remote signal should be done using universal radio hacker and not directly on the esp

fragpic commented 2 months ago

Makes sense, just ordered an SDR. Thanks for all the help!

asetzeradmin commented 3 weeks ago

Hi @all

i‘ve successfully flashed Tasmota and done the GPIOs soldering.

when i now klick on „Firmware Upgrade“ to Upload the portisch.hex i get a error Message „File Upload failure code 210“

Do you have any ideas?

Best regards andy

mightymos commented 3 weeks ago

Hi @ALL

i‘ve successfully flashed Tasmota and done the GPIOs soldering.

when i now klick on „Firmware Upgrade“ to Upload the portisch.hex i get a error Message „File Upload failure code 210“

Do you have any ideas?

Best regards andy

If you're flashing Portisch you'll probably need to ask for help over there: https://github.com/Portisch/RF-Bridge-EFM8BB1

However, are you flashing a Sonoff hardware? If so, what hardware version do you have?

asetzeradmin commented 3 weeks ago

Hi, thank you for fast responding :)

I use Sonoff Bridge v2.2 grafik

thanks andy

mightymos commented 3 weeks ago

Hi, thank you for fast responding :)

I use Sonoff Bridge v2.2 grafik

thanks andy

Ok, Portisch does not work on that hardware, it has a different microcontroller. You will need to flash one of the firmwares provided in this repository.

asetzeradmin commented 3 weeks ago

okay crazy - i've bought it beacause of this video https://www.youtube.com/watch?v=k-FLN1cM4jk

now what do you think what i can do? which firmware do you mean exactly? or do i have do buy a other bridge?

mightymos commented 3 weeks ago

okay crazy - i've bought it beacause of this video https://www.youtube.com/watch?v=k-FLN1cM4jk

now what do you think what i can do? which firmware do you mean exactly? or do i have do buy a other bridge?

That video is explaining how to modify the hardware itself so the radio pins bypass the microcontroller and radio decoding is performed on the ESP8285 itself. Tasmota uses RCSwitch library.

Alternatively you can achieve a similar result by flashing the passthrough firmware from this repository. However, you will either need an official flasher or an external Arduino board to act as the flasher. You can read the instructions under "Flasher (Official)" and "Flasher (Open source)" here: https://github.com/mightymos/RF-Bridge-OB38S003

You could also just leave the microcontroller with stock firmware and see if it can decode your radio devices without modification.

asetzeradmin commented 3 weeks ago

Okay, could you please so good and tell me where to find passthrough firmware and which flasher will be needed?

mightymos commented 3 weeks ago

Okay, could you please so good and tell me where to find passthrough firmware and which flasher will be needed?

You need to read everything at the link I provided previously and just be familiar with github layout. The firmware files are listed under Releases.

Here is the open source flasher sketch and python script for Arduino: https://github.com/mightymos/OnbrightFlasher

Again you need to read the repository, everything is explained there.

asetzeradmin commented 3 weeks ago

Hi,

Thank you - i've read all and think i am ready - two more questions just to be shure

thank you

mightymos commented 3 weeks ago

Hi,

Thank you - i've read all and think i am ready - two more questions just to be shure

* this controller will work: https://shorturl.at/67CnX

* Sonoff ZF bridge: i ve cut some lines as discribed in the video https://www.youtube.com/watch?v=k-FLN1cM4jk
  do i have to buy a new one or will it still work with the Arduino Flash project?

thank you

If you have completed the hardware modification Tasmota should decode available radio protocols itself on the ESP8285. Why do you not just use it that way (and skip flashing microcontroller)?

If you have modified the bridge, flashing the microcontroller will not work. If the ESP on that module has I2C pins then it should work for flashing.

asetzeradmin commented 3 weeks ago

Hello,

The Sonoff RF bridge does not recognize my signals for rollershutter control and garage doors, so I want/have to flash and modify with your project.

That means I need a new RF bridge 2.2 to flash with Arduino, right because of modifing already?

mightymos commented 3 weeks ago

Hello,

The Sonoff RF bridge does not recognize my signals for rollershutter control and garage doors, so I want/have to flash and modify with your project.

That means I need a new RF bridge 2.2 to flash with Arduino, right because of modifing already?

Assuming you performed the hardware modification correctly, flashing the passthrough firmware to the microcontroller will also not work. Both methods ultimately use the RCSwitch library in Tasmota for decoding.

It is possible you could try using ESPHome for decoding but without knowing the protocol that the roller shutter and garage doors use it is not possible to know beforehand if it will work or not.

asetzeradmin commented 3 weeks ago

Hi,

I want to Control A-OK Motors - what do you think will be the easiest Option?

Am 24.08.2024 um 19:46 schrieb Jonathan Armstrong @.***>:



Hello,

The Sonoff RF bridge does not recognize my signals for rollershutter control and garage doors, so I want/have to flash and modify with your project.

That means I need a new RF bridge 2.2 to flash with Arduino, right because of modifing already?

Assuming you performed the hardware modification correctly, flashing the passthrough firmware to the microcontroller will also not work. Both methods ultimately use the RCSwitch library in Tasmota for decoding.

It is possible you could try using ESPHome for decoding but without knowing the protocol that the roller shutter and garage doors use it is not possible to know beforehand if it will work or not.

— Reply to this email directly, view it on GitHubhttps://github.com/mightymos/RF-Bridge-OB38S003/issues/4#issuecomment-2308469989, or unsubscribehttps://github.com/notifications/unsubscribe-auth/ARZMTQLQNUTYSFS5WKRVPELZTDBINAVCNFSM6AAAAABBUUSZV2VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDGMBYGQ3DSOJYHE. You are receiving this because you commented.Message ID: @.***>

mightymos commented 3 weeks ago

A-OK Motors

You might be able to use a software defined radio RT-SDR to understand your device. @the-mentor was helping people on Discord to do this, you might be able to talk to them.