Note https://github.com/OpenBekenIOT/hid_download_py updated - minor changes, most important lowering default baud rate <1mbit.
![[BK7231T] My HTTP server, configurator, MQTT support from Home Assistant [BK7231T] My HTTP server, configurator, MQTT support from Home Assistant](https://obrazki.elektroda.pl/9439844700_1643888555_thumb.jpg)
pepesuriano wrote:
And the other one was an AMS1117 indeed!
pepesuriano wrote:Thank you! Your advice is very useful because I just handle the basics on electronics, so my apologies in advance if I ask anything kind of obvious. Software programming is where I do best (and where I can make any contributions after having openbk running).
So, to wrap up the flashing process (and avoid any mistakes or bad interpretations for me that could break anything) I should:
1- Take a PL2303 for flashing that I have around, (it does not have a VCC pin to bridge with 3.3 or 5v, should I just connect to 5v from the PL2303?)
2- Solder 1TX and 1RX to WB2S module, and solder 5V in AMS1117 input pin
3- Connect CEN pin of WB2S to ground (the big ground metal piece of the power connector is fine?) (should I keep CEN to ground all the time?)
4- Connect the smart plug to mains and power it (with the soldered wires disconnected for the moment)
5- Connect 1TX, 1RX and 5V to the PL2303
5- Run bkwriter, take a backup of original firmware
6- Flash openbk
7- Open a beer
Cheers
pepesuriano wrote:pepesuriano wrote:Connect the smart plug to mains and power it (with the soldered wires disconnected for the moment)
Quote:
1- Take a trusted USB to UART converter with 3.3V logic levels (for example hw 597 ) for flashing
![]()
2 select 3.3v logic levels by jumper between 3.3V and VCC on (for example hw 597 ), break out 5V from USB directly (white wire)
![]()
(the "5V and 3.3V pins won't work for my")
3- Solder 1TX and 1RX to WB2S module, and solder 5V directly from USB (not from pins on HW) in AMS1117 input pin
4. Run bkwriter,
5. Select COM port (if not present, install drivers for USB to UART dongle you're using)
6. start "Read" in bkwriter
![]()
7. while BK is trying to read, connect CEN pin of WB2S to ground for a short while and disconnect it (try to do this really once, if you do twice, then you'll get error)
8. wait for read to finish. If it fails, try different baud rates
EXPLANATION: BKwriter is waiting to detect WB2S (or other) module booting on RX/TX pins. You can start WB2S boot by powering it on after it was off for a while (disconnect power method) or by resetting it (CEN aka RESET pin method). BKwriter must be already started with read/write command before resetting, so it can "catch" the boot and proceed)
OPTIONAL MODIFICATION:
- if you're having problems with CEN, you can try replacing point 7 with repowering whole WB2S module (disconnect power connected to WB2S, start read in BKwriter, connect power again). It will work as long as you don't overcurrent your USB port and cause COM port to reset (I was using this method for many modules and it worked as long as I removed 220uF capacitor at 5V rail before 1117-3.3V).
SPECIAL HINT:
- you can also try connecting second UART which is useful for debugging, but that's not required for succesful flashing
boozeman wrote:
Edit: Managed to read flash. It is surely voltage drop when connecting vcc when try to write flash.
p.kaczmarek2 wrote:
Congratulations! Welcome to Bekken readers club!
boozeman wrote:Erasing flash:0x00011000 FAIL
p.kaczmarek2 wrote:I haven't experienced this issue yet. Let's try with trimmed down flash (thanks @btsimonh for clear up work)
Does it work for you, @boozeman @kuba2k2 ? Burn UA as usual.
p.kaczmarek2 wrote:Does it work for you,@boozeman@kuba2k2 ? Burn UA as usual.
kuba2k2 wrote:
No, it won't work, the UA flash file is too big. Your file is 1,09MB in size, and it needs to be exactly 956KB.
out_json = {
"magic": "RT-Thread",
"version": "0.1",
"count": 4,
"section": [
{
"firmware": "bootloader_enc.bin",
"version": "1.00",
"partition": "bootloader",
"start_addr": "0x00000000",
"size": "68K"
},
{
"firmware": "bk7231_common_1.0.1_enc.bin",
"version": "1.00",
"partition": "app",
"start_addr": "0x00011000",
"size": "1150832"
}
]
}
kuba2k2 wrote:There's no need to make the image even smaller, as the code won't fit if it exceeds that size.
kuba2k2 wrote:If the erasing error happens at the very beginning of the flashing process, change the baud rate to 921600. For me, 115200 produces that error at the start and doesn't allow to flash anything.
btsimonh wrote:
Q: When you read from 0x11000, do you have a 0x1000 byte header containing the string 'RBL'?
Some of the chips have the bootloader in ROM (bk7231n?), and I believe may flash firmware at 0x00000.... and need unprotect.
btsimonh wrote:Q: When you read from 0x11000, do you have a 0x1000 byte header containing the string 'RBL'?
p.kaczmarek2 wrote:Can you all@kuba2k2@boozeman and others specify which BK modules are you flashing? I would like to determine which ones have that 956K limit, because for me, all my WB2S and WB3S moduls so far worked with previous sector size (1150832)
btsimonh wrote:Advise you try the python flasher, and print the returned chip ID - if it's not a 2MByte part, then it's a different beast to the ones which are being programmed successfully.
btsimonh wrote:
here maybe initially:
https://github.com/OpenBekenIOT/hid_download_py/wiki/Device-specific-information
p.kaczmarek2 wrote:PS: EDM-01-AA-EU KER_V1.6 progress (full teardown will be posted on Elektroda soon):