Hi any advance on this? I flashed and everything works, what should i try to read the power meter?
I check on S31 and uses CSE7766 Tx and CSE7766 Rx to read that info, but culdnt find that option to check here...
I remember that I was adding some UART features but ultimately I wasn't been able to check them, as I don't have that Sonoff BL602 device at hand. So, someone would have to test them. It shouldn't be that hard, especially now that we have working OTA for BL602.
Hello Gents!
I had flashed a few BL602s a few months ago (MagicHome controllers) and had made notes to follow.
Now, I have a few MagicHome controllers which have the LF686 chipset.
1. Flashed using the DevCube 1.4.8 using the same settings as used for BL602. Latest serial bin for BL602.
2. AP comes up and I am able to connect to it - IP range 192.168.169.XX.
3. Captive portal is alive but will not 'Save' the wifi settings or even a 'Static IP". I can navigate the pages but wifi credentials are not saved and device never reboots to join wifi network.
4. Tried using the latest devcube app from buffalo website but that just does not allow any AP to come-up in the first place.
5. Flash is successful in both the version 1.4.8 and the latest version of devcube.
Hi, I am new to this, I currently have some Sonoff B05-BL-60 Bulb.
This bulb has the DIY mode where you can run some REST commands on the Bulb, and there are some to flash the Bulb.
Is there some suggestion on how could we use this REST OTA command to flash this Bulb with the OpenBL602_1.15.355.bin.xz.ota firmware?
Link to the DIY documentation of Sonoff:
https://sonoff.tech/sonoff-diy-developer-documentation-b02-bl-b05-bl-http-api/ Thanks for the great work you already did for this Bulb.
I remember that I was adding some UART features but ultimately I wasn't been able to check them, as I don't have that Sonoff BL602 device at hand. So, someone would have to test them. It shouldn't be that hard, especially now that we have working OTA for BL602.
@p.kaczmarek2 , @jbrande, @davidcpurdy@bxwen19
I was give as a gift a package of 4 S40. Since then I been reading this thread with attention.
I do not know an easy way to break apart the plastic housing-case. If any one have a good idea please help. I guess tomorrow i will hand saw from the side to get to internal boards unless I see any Ideas.
I am offering myself to serve as a tester. Never work with BL602 nor any other RISC-V, but had experience with other micros; ARM, MIPSEL. Motorolla, etc.
From what I have read, we need to test communication between cse7759b/CSE7766 and BL602
From page 6 bxwen19 posted
Quote:
Middle pin is connected to pi 20 (GPIO11)
button->GPIO0
LED2-> GPIO1
relay = LED1 ->GPIO11
So from bxwen19 it seems "S40 WiFi module" have pin out using GND, 21, 20, 22 & 5V!! I guess I will have to check once I open the case.
Asuming it is in fact serial data, It will be nice to check if we can see the signal from "cse7759b" and the determine boud rate and log data before we program BL602. I know working it hot can be dangerous but it may be the step is required.
@p.kaczmarek2
Witch pins are RX1 and TX1 on BL602? I guess once I crack the plastic case I will be able to check.
UART Port at /dev/ttyS0, on [ GPIO 7/ Pin 16 ] (rx) and [ GPIO 16 / Pin 27 ](tx)
UART Port at /dev/ttyS1, on [ GPIO 3 / Pin 4] (rx)and [ GPIO 4 / PIN 5 ] (tx)[
Then why bxwen19 reference them as [ 21, 20, 22 ] ???
I see from image bxwen19 wrote "GPIO 14 / Pin 22" goes to "Pad 3 ( CSE7759B Pin 6 ). HAHAHA this may mean CSE7759B may not use UART!!! Or in the other hand from https://lupyuen.github.io/articles/uart#initialise-uart-port it may seem that Pins for UART can be manually programed !!
On page 16 of Bouffalo Lab BL602_BL604_DS_en_Combo_1.1.pdf I can read:
Quote:
20 PAD_GPIO_11 Digital SPI, I2C, UART, PWM, AUXADC, GPIO
21 PAD_GPIO_12 Digital SPI, I2C, UART, PWM, AUXADC, GPIO
22 PAD_GPIO_14 Digital SPI, I2C, UART, PWM, AUXADC, GPIO
So pin 20, 21 & 22 seems to be able to configure as UART lines. Interesting
On page 5 of CSE7759B.PDF I can read
Quote:
6 TI O UART transmit port
8 RI I UART receive port
I could guess then that
CSE7759B.pin6(TI) <==> WifiBoard.PAD3 <==> BL602.pin22(RX1)
That means that
CSE7759B.pin8(RI) <==> WifiBoard.PAD2 <==> BL602.pin20(TX1) **** After some reading, this may be wrong conclusion read bellow
Hope my deduction work. Please advise.
PD Yes I need to crack open one of my devices for verification.
Added after 23 [minutes]:
May be I was wrong on my conclusion, as "8 RI I UART receive port; reserved." read reserved. "Receive port RI is reserved temporarily and does
not have actual function." Usually meaning Not in use now but for future use!!! So it is possible no RX signal is NOT needed!!
CSE7759B.pin6(TI) requires Optocopler Isolation or transistorized network to switch from 5V to 3,3V
CSE7759B is a calibration-free electric energy measuring chip.
At present, this serial port only supports baud rate of 4800bp
Serial port Protocol is at page 13 of CSE7759B.PDF 3.4 Serial Port Protocol In general a 24 byte per stream
I guess people in vacations. Hope to see some one else soon. Could not do much today. I hand saw it open. Corroborated the Right side of the table. Did not wanted to remove WifiBoard. Hopefully I will be able to install new firmware and detect pin-out on the left side.
BL602.pins I did corroborated this side
as per
bxwen19
I need to check
it myself
.|
\/
Then check if anything is received:
This will print UART data, no matter if checksum is correct or not.
The UART selection seemed to be done at compile time in DTS files:
https://www.elektroda.com/rtvforum/viewtopic.php?p=20366504#20366504 but I didn't have a device to check is it working. There are two UARTs available:
- "/dev/ttyS0"
- "/dev/ttyS1"
In code, I can only select between them:
It would be easier for me if I had that device at hand.
CSE7759B seems similar to CSE7766, packet is also 24 bytes long, header seem to match:
If you want, you could try to power the device from safe, isolated, 5V (inject 5V before LDO, not directly to WiFi module!!!) and try to capture packets with UART.
Or you could use isolators like ADuM1201 to get capture with mains connected in a safe manner.
I got stock need help. My USBtoUART is a CP2102 USB to UART Bridge Controller.
When I went to page 1 to try to follow I see Baudrate of 2000000!!
I have a felling my CP2102 will not do 2000000, I do not see that settings. As a test, I connected RX0 only with BLDevCube.exe and Connected UART. And saw no signal received while normally booting. Is this correct? Normally at boot CPU will show some kind of message. Then why 2000000? when the upload firmware is so so small!! So I did not uploaded firmare yet. Please advice.
In BLDevCube.exe the firmware bin has a different file or filename. Is this correct?
Now regards RX1 receiving CSE7759B output. I hook to RX1 at boudrate 4800 and clearly see the CSE7759B output signal.
Quote:
enrique@live:$ od capture.txt -t x1 -w24
0000000 f2 5a 02 e3 ec 3f ff 6e 29 e3 4f cd b0 91 42 2c 61 00 06 ea f2 5a 02 e3
0000030 d8 07 34 d5 00 3e 9e 03 29 e3 4f cd b0 92 dc 90 61 00 06 e9 f2 5a 02 e3
0000060 d8 07 34 d5 00 3e 9e 03 29 e3 4f cd b0 94 75 f5 61 00 06 e9 f2 5a 02 e3
0000110 d8 07 34 d5 00 3e 9e 03 29 e3 4f cd b0 96 0f 5a 61 00 06 ea f2 5a 02 e3
0000140 d8 07 2a 15 00 3e 9e 03 29 e3 4f cd b0 97 a8 bf 61 00 06 1f f2 5a 02 e3
0000170 d8 07 2a 15 00 3e 9e 03 29 e3 4f cd b0 99 41 25 61 00 06 20 f2 5a 02 e3
0000220 d8 07 2a 15 00 3e 9e 03 29 e3 4f cd b0 9a db 89 61 00 06 1f f2 5a 02 e3
0000250 d8 07 2a 15 00 3e 9e 03 29 e3 4f cd b0 9c 74 ee 61 00 06 1f f2 5a 02 e3
0000300 d8 07 2a 15 00 3e 9e 03 29 e3 4f cd b0 9e 0e 53 61 00 06 20 f2 5a 02 e3
0000330 d8 07 2a 15 00 3e 9e 03 29 e3 4f cd b0 9f a7 b8 61 00 06 1f f2 5a 02 e3
0000360 d8 07 2a 15 00 3e 9e 03 29 e3 4f cd b0 a1 41 1d 61 00 06 20 f2 5a 02 e3
0000410 d8 07 2a 15 00 3e 9e 03 29 e3 4f cd b0 a2 d9 83 61 00 06 1f f2 5a 02 e3
0000440 d8 07 2a 15 00 3e 9e 03 29 e3 4f cd b0 a4 73 e7 61 00 06 1f f2 5a 02 e3
0000470 d8 07 2a 15 00 3e 9e 03 29 e3 4f cd b0 a6 0c 4d 61 00 06 20 f2 5a 02 e3
0000520 d8 07 2a 15 00 3e 9e 03 29 e3 4f cd b0 a7 a5 b2 61 00 06 1f f2 5a 02 e3
0000550 d8 07 2a 15 00 3e 9e 03 29 e3 4f cd b0 a9 3f 17 61 00 06 20 f2 5a 02 e3
0000600 d8 07 2a 15 00 3e 9e 03 29 e3 4f cd b0 aa d9 7b 61 00 06 1f f2 5a 02 e3
0000630 d8 07 2a 15 00 3e 9e 03 29 e3 4f cd b0 ac 72 e0 61 00 06 1f f2 5a 02 e3
0000660 d8 07 2a 15 00 3e 9e 03 29 e3 4f cd b0 ae 0c 45 61 00 06 20 f2 5a 02 e3
0000710 d8 07 2a 15 00 3e 9e 03 29 e3 4f cd b0 af a5 aa 61 00 06 1f 2d 02 e3 d8
0000740 07 2a 15 00 3e 9e 03 29 e3 4f cd b0 b1 3f 0f 61 00 06 20 f2 5a 02 e3 d8
0000770 07 2a 15 00 3e 9e 03 29 e3 4f cd b0 b2 d7 75 61 00 06 1f f2 5a 02 e3 d8
0001020 07 2a 15 00 3e 9e 02 c0 af 4f cd b0 b4 71 d9 61 00 06 81 f2 5a 02 e3 d8
0001050 07 2a 15 00 3e 9e 02 c0 af 4f cd b0 b6 0b 3e 61 00 06 82 f2 5a 02 e3 d8
0001100 07 2a 15 00 3e 9e 02 c0 af 4f cd b0 b7 a3 a4 61 00 06 81 f2 5a 02 e3 d8
0001130 07 2a 15 00 3e 9e 02 c0 af 4f cd b0 b9 3e 08 61 00 06 82 f2 5a 02 e3 d8
0001160 07 2a 15 00 3e 9e 02 c0 af 4f cd b0 ba d6 6e 61 00 06 81 f2 5a 02 e3 d8
0001210 07 2a 15 00 3e 9e 02 c0 af 4f cd b0 bc 70 d2 61 00 06 81 f2 5a 02 e3 d8
0001240 07 2a 15 00 3e 9e 02 c0 af 4f cd b0 be 0a 37 61 00 06 82 f2 5a 02 e3 d8
0001270 07 2a 15 00 3e 9e 02 c0 af 4f cd b0 bf a3 9c 61 00 06 81 f2 5a 02 e3 d8
0001320 07 2a 15 00 3e 9e 02 c0 af 4f cd b0 c1 3c 02 61 00 06 82 f2 5a 02 e3 d8
0001350 07 2a 15 00 3e 9e 02 c0 af 4f cd b0 c2 d5 67 61 00 06 81 f2 5a 02 e3 d8
0001400 07 2a 15 00 3e 9e 02 c0 af 4f cd b0 c4 6f cb 61 00 06 81 f2 5a 02 e3 d8
0001430 07 2a 15 00 3e 9e 02 c0 af 4f cd b0 c6 09 30 61 00 06 82 f2 5a 02 e3 d8
0001460 07 2a 15 00 3e 9e 02 c0 af 4f cd b0 c7 a2 95 61 00 06 81 f2 5a 02 e3 d8
0001510 07 2a 20 00 3e 9e 02 c0 af 4f cd b0 c9 3a fb 61 00 06 8c f2 5a 02 e3 d8
0001540 07 2a 20 00 3e 9e 02 c0 af 4f cd b0 ca d5 5f 61 00 06 8c f2 5a 02 e3 d8
0001570 07 2a 20 00 3e 9e 02 c0 af 4f cd b0 cc 6e c4 61 00 06 8c f2 5a 02 e3 d8
0001620 07 2a 20 00 3e 9e 02 c0 af 4f cd b0 ce 08 29 61 00 06 8d f2 5a 02 e3 d8
0001650 07 2a 20 00 3e 9e 02 c0 af 4f cd b0 cf a1 8e 61 00 06 8c f2 5a 02 e3 d8
0001700 07 2a 20 00 3e 9e 02 c0 af 4f cd b0 d1 3a f3 61 00 06 8c f2 5a 02 e3 d8
0001730 07 2a 20 00 3e 9e 02 c0 af 4f cd b0 d2 d3 59 61 00 06 8c f2 5a 02 e3 d8
0001760 07 2a 20 00
0001764
Yes I got some error but maybe was because I was holding cable by hand.
This UART data capture is useful. I can later try to manually plug it into our CSE driver and see if it works.
fcopurico wrote:
When I went to page 1 to try to follow I see Baudrate of 2000000!!
I have a felling my CP2102 will not do 2000000, I do not see that settings. As a test, I connected RX0 only with BLDevCube.exe and Connected UART. And saw no signal received while normally booting. Is this correct? Normally at boot CPU will show some kind of message. Then why 2000000? when the upload firmware is so so small!! So I did not uploaded firmare yet. Please advice.
I think that device log output on UART is at fixed 2000000 baud. For flashing, you can use lower speeds if it's needed.
fcopurico wrote:
Quote:
... Use it only to read data (2MB len) to make a backup and then flash ...
Do we have an option in BL602, to backup existing firmware previous to upload your new firmware?
I think it may be possible to switch BL602 dev cube to advanced mode and do a firmware read, but I don't know much about it. BL602 devices are very rare, I got only about 3 of them, 2 of them are the same LED strip controller and one was sent from a donator (Sonoff bulb). On the other hand, I had over 300 Beken devices in my hand during last years.
Please try to make a backup and we'll see if anything is read.
Hi, I'm stuck with a bl602 powered smartplug. The exact module on this device is this one. The issue is that whilst trying to write i get an error regarding the mac adress:
I'm using a newer version of devcube, a newer release of the firmware, and an arduino uno and a few resistors to drop 5v to 3.3v. I have to reset the chip by shorting chip_EN to gnd before I can flash, but after that it seems to communicate well except for the mac address part.
[13:44:43.483] - ========= Interface is Uart =========
[13:44:43.486] - eflash loader bin is eflash_loader_40m.bin
[13:44:43.487] - ========= chip flash id: ef4015 =========
[13:44:43.490] - create partition.bin, pt_new is True
[13:44:43.500] - fw_boot_head_gen xtal: 40M
[13:44:43.502] - Create bootheader using chips\bl602\img_create_iot\efuse_bootheader_cfg.ini
[13:44:43.502] - Updating data according to <chips\bl602\img_create_iot\efuse_bootheader_cfg.ini[BOOTHEADER_CFG]>
[13:44:43.504] - Created file len:176
[13:44:43.506] - Create efuse using chips\bl602\img_create_iot\efuse_bootheader_cfg.ini
[13:44:43.506] - Updating data according to <chips\bl602\img_create_iot\efuse_bootheader_cfg.ini[EFUSE_CFG]>
[13:44:43.507] - Created file len:128
[13:44:43.510] - ========= sp image create =========
[13:44:43.511] - Image hash is b'b49fabed0f90a611347853de19135afccb49c9bdce7bede3295ba846542a77ae'
[13:44:43.511] - Hash ignored
[13:44:43.511] - Header crc ignored
[13:44:43.511] - Write flash img
[13:44:43.513] - Encrypt efuse data
[13:44:43.517] - fw_boot_head_gen xtal: 40M
[13:44:43.518] - Create bootheader using chips\bl602\img_create_iot\efuse_bootheader_cfg.ini
[13:44:43.518] - Updating data according to <chips\bl602\img_create_iot\efuse_bootheader_cfg.ini[BOOTHEADER_CFG]>
[13:44:43.520] - Created file len:176
[13:44:43.522] - Create efuse using chips\bl602\img_create_iot\efuse_bootheader_cfg.ini
[13:44:43.522] - Updating data according to <chips\bl602\img_create_iot\efuse_bootheader_cfg.ini[EFUSE_CFG]>
[13:44:43.523] - Created file len:128
[13:44:43.550] - ========= sp image create =========
[13:44:43.554] - Image hash is b'070e2a224f13c632ad68c849cd6b0f7fa9d16e609b148d19218f49892eef2ec1'
[13:44:43.554] - Header crc: b'c5010150'
[13:44:43.554] - Write flash img
[13:44:43.558] - Encrypt efuse data
[13:44:43.560] - FW Header is 176, 3920 still needed
[13:44:43.561] - FW OTA bin header is Done. Len is 4096
[13:44:43.611] - BL60X_OTA_Ver1.0
[13:44:43.664] - FW OTA bin is Done. Len is 758112
[13:44:43.974] - OTA XZ file len = 403568
[13:44:43.974] - Partiton len = 557056
[13:44:43.974] - BL60X_OTA_Ver1.0
[13:44:44.008] - FW OTA xz is Done
[13:44:44.008] - ========= eflash loader config =========
[13:44:44.009] - Image offset = 8192
[13:44:44.093] - Version: eflash_loader_v2.4.6
[13:44:44.094] - Program Start
[13:44:44.094] - ========= eflash loader cmd arguments =========
[13:44:44.094] - E:\BUFFER\New folder (5)\bl602 flashing\devcube\chips\bl602\eflash_loader/eflash_loader_cfg.ini
[13:44:44.094] - Config file: E:\BUFFER\New folder (5)\bl602 flashing\devcube\chips\bl602\eflash_loader/eflash_loader_cfg.ini
[13:44:44.095] - serial port is COM3
[13:44:44.095] - cpu_reset=False
[13:44:44.095] - chiptype: bl602
[13:44:44.095] - ========= Interface is uart =========
[13:44:44.095] - com speed: 2000000
[13:44:44.095] - Eflash load helper file: E:\BUFFER\New folder (5)\bl602 flashing\devcube\chips\bl602\eflash_loader/eflash_loader_40m.bin
[13:44:44.096] - ========= load eflash_loader.bin =========
[13:44:44.096] - Load eflash_loader.bin via uart
[13:44:44.096] - ========= image load =========
[13:44:44.125] - FL8080 unknown
[13:44:44.126] - Not ack OK
[13:44:44.126] - FL8080 unknown
[13:44:44.126] - result: FL8080 unknown
[13:44:44.419] - tx rx and power off, press the machine!
[13:44:44.420] - cutoff time is 0.1
[13:44:44.529] - power on tx and rx
[13:44:45.341] - reset cnt: 0, reset hold: 0.005, shake hand delay: 0.1
[13:44:45.341] - clean buf
[13:44:45.369] - send sync
[13:44:45.588] - ack is 8080808080808080804f4b
[13:44:45.634] - shake hand success
[13:44:45.650] - get_boot_info
[13:44:45.652] - data read is b'010000000000000003000000c722bc4cb97c1700'
[13:44:45.653] - ========= ChipID: 7cb94cbc22c7 =========
[13:44:45.653] - last boot info: None
[13:44:45.653] - sign is 0 encrypt is 0
[13:44:45.653] - segcnt is 1
[13:44:45.664] - segdata_len is 38464
[13:44:45.743] - 4080/38464
[13:44:45.819] - 8160/38464
[13:44:45.896] - 12240/38464
[13:44:45.972] - 16320/38464
[13:44:46.049] - 20400/38464
[13:44:46.125] - 24480/38464
[13:44:46.202] - 28560/38464
[13:44:46.278] - 32640/38464
[13:44:46.355] - 36720/38464
[13:44:46.391] - 38464/38464
[13:44:46.395] - Run img
[13:44:46.505] - Load helper bin time cost(ms): 2408.900146484375
[13:44:46.614] - Flash load shake hand
[13:44:46.631] - default set DTR high
[13:44:46.740] - clean buf
[13:44:46.767] - send sync
[13:44:47.004] - ack is 4f4b
[13:44:47.050] - Read mac addr
[13:44:49.060] - ack is
[13:44:49.060] - Not ack OK
[13:44:49.060] - ErrorCode: 0023, ErrorMsg: BFLB EFUSE READ MAC ADDR FAIL
[13:44:49.060] - read mac addr fail!!
[13:44:49.060] - Read mac addr
[13:44:51.070] - ack is
[13:44:51.070] - Not ack OK
[13:44:51.070] - ErrorCode: 0023, ErrorMsg: BFLB EFUSE READ MAC ADDR FAIL
[13:44:51.070] - read mac addr fail!!
[13:44:51.070] - Read mac addr
[13:44:53.080] - ack is
[13:44:53.080] - Not ack OK
[13:44:53.080] - ErrorCode: 0023, ErrorMsg: BFLB EFUSE READ MAC ADDR FAIL
[13:44:53.080] - read mac addr fail!!
[13:44:53.080] - Read mac addr
[13:44:55.086] - ack is
[13:44:55.086] - Not ack OK
[13:44:55.086] - ErrorCode: 0023, ErrorMsg: BFLB EFUSE READ MAC ADDR FAIL
[13:44:55.086] - read mac addr fail!!
[13:44:55.087] - Read mac addr
[13:44:57.100] - ack is
[13:44:57.100] - Not ack OK
[13:44:57.100] - ErrorCode: 0023, ErrorMsg: BFLB EFUSE READ MAC ADDR FAIL
[13:44:57.100] - read mac addr fail!!
[13:44:57.100] - Burn Retry
[13:44:57.101] - 0
[13:44:57.101] - Burn return with retry fail
The error does not seem to appear in google or if I search this forum. I've little to no experience flashing chips like this so I would presume a simple mistake on my part, but I'm incapable of figuring out what it might be. Any help would be appreciated.
Followup on the above: my ch340 based programmer finally arrived and it flashed just fine now, 0 errors. Just like the earlier poster.
If it is possible to do this with an uno, I don't know how. I'm gonna go ahead and say it's not worth the effort figuring it out, and echo everyone else in recommending a ch340 programmer.
Hmm. Strange. I will try when I have some free time. I heard that people used Arduino UNO (or maybe NodeMCU?) successfully for flashing ESP, so here it also should work...
I didn't have much time to look into BL602 platform these days but it seems that on the German side of our forum there is a progress with IR driver.
You can read more at:
https://www.elektroda.de/rtvforum/viewtopic.php?p=20745336#20745336 That thread is in German but there is one post with a BL602 IR driver draft, I haven't tested it yet, but maybe some of the readers can find it interesting.