Sorry do I need to compile that or just git clone it?
Added after 6 [minutes]:
When trying to install. Still cannot run uartprogram.
PC:~/hid_download_py$ sudo python3 setup.py install --user /home/dean/hid_download_py/setup.py:1: DeprecationWarning: The distutils package is deprecated and slated for removal in Python 3.12. Use setuptools or check PEP 632 for potential alternatives from distutils.core import setup running install running build running build_py running build_scripts running install_lib running install_scripts changing mode of /root/.local/bin/uartprogram to 755 changing mode of /root/.local/bin/hidprogram to 755 running install_egg_info Removing /root/.local/lib/python3.10/site-packages/hid_downloader-1.0.egg-info Writing /root/.local/lib/python3.10/site-packages/hid_downloader-1.0.egg-info PC:~/hid_download_py$ uartprogram uartprogram: command not found PC:~/hid_download_py$
This is the flashing procedure:
1. start read or write operation in the flashing tool (bkWriter, hid_download_py, anything)
2. while tool is waiting for a start, do a reboot (by power off/on cycle or by shorting CEN to ground for 0.25s)
3. flashing operation will then start, wait for it to finish.
Tried, and got this. Also, I cannot unplug the USB after starting the flash. It instantly fails saying the comport went offline.
dean@Dean-PC:~/hid_download_py$ sudo python3 uartprogram OpenBK7231N_QIO_1.15.219.bin -d /dev/ttyUSB0 -r -s 0x0 -l 0x200000
UartDownloader....
Read Getting Bus...
Cannot get bus.
Traceback (most recent call last):
File "/home/dean/hid_download_py/uartprogram", line 56, in downloader.read(args.filename, args.startaddr, args.length)
File "/home/dean/hid_download_py/bkutils/uart_downloader.py", line 83, in read
self.pbar.close()
AttributeError: 'NoneType' object has no attribute 'close'
Added after 3 [minutes]:
Ok, there is a small button like a break button on the USBTTL, I pushed this and it flashed. Now I got
Reading 1ff000
ReadSector Success 1ff000 len 1000
2097152
CRC should be 25148233
CRC is 7b5093db
CRC check failed
Wrote 200000 bytes to OpenBK7231N_QIO_1.15.219.bin
dean@Dean-PC:~/hid_download_py$
Reading 1ff000
ReadSector Success 1ff000 len 1000
2097152
CRC should be 25148233
CRC is 7b5093db
CRC check failed
Wrote 200000 bytes to OpenBK7231N_QIO_1.15.219.bin
dean@Dean-PC:~/hid_download_py$
this is normal for N, you managed to read flash correctly. We will fix that bug later in hid_download_py.
It should be ok now, does the OpenBeken AP shows up?
Did you confuse file names? You just read firmware to the filename called OpenBK (instead of 'backup-meter-something.bin' ?) and then wrote it back....
it looks like you won't get OBK Access point yet because you confused file names.
Please:
1. save the firmware backup with a correct filename and if you want, provide it here (it might be needed later to add OTA flashing for this device, so you can flash next pieces without attaching wires)
2. flash the OBK build from releases...
Hey, you just did the read operation and overwrote OpenBK7231N_QIO_1.15.219.bin file.
You were supposed to do it the other way around.
You got all wires 100% perfectly connected, and do operations correctly, but you swapped read with write (swapped filenames)...)
Still, please post here this file as a backup of your firmware and then please download the file you overwrote from Github again, and then flash it with command:
If command contains "-r", then it takes current firmware from device (usually original one, Tuya firmware), and saves it to your PC (as a backup)
If command contains "-w", then it takes file from your PC and writes to IoT device (it's "write")
You are supposed to:
1. first do firmware backup to file "myfirmwarebackup.bin", the command with "-r" switch, that does the READING (copy Tuya firmware to your disk so you can restore later and/or provide use for OTA cloudcutter hack, so further devices can be programmed like in tuya-convert, without soldering)
2. Then download OpenBK7231N_QIO_1.15.206.bin from Github and write it to your device (install OpenBeken on your device)[/code]
No, dont flash other devices yet, first we must configure your first device.
This might be a TuyaMCU device.
TuyaMCU devices are different between each other, use different dpIDs, etc. So each model requires a slightly different setup which we need to figure out.
First, go to Launch Web Application, to LittleFS, create a file autoexec.bat and enter command:
"startDriver TuyaMCU"
Reboot your device and show me the packets from Web Application -> Logs, we need to know what TuyaMCU sends to us
You are looking for something like this:
PS: I also need to know the names of the ICs from the board in case that's not TuyaMCU device. Is there a BL0942 on the board? Maybe BL0937? Where is relay connected? Please provide any information you can. If that's not a TuyaMCU, then configuration could be even easier. But you might need to check where the UART lines go. Do you have a multimeter?
What are the functionalities we are looking for?
- control relay?
- support button from case?
- measure voltage, current and power?
What are the functionalities we are looking for?
- control relay? - No there is no relay
- support button from case? - Yes, I think it had a Bluetooth icon on it?
- measure voltage, current and power? Yes
Please disconnect everything from serial and PC while doing things from mains! It would be very dangerous!
I need to know what kind of power measurement chip is inside. Maybe that's even not a TuyaMCU, just a bare bones BL0937 or BL0942, that would be even easier to support.
You can also try:
1. remove "startDriver TuyaMCU" from autoexec.bat
2. enter "startDriver BL0942" there
3. reboot
4. show me what kind of measurements you get
but more reliable way would be to just read IC names....
EDIT: Take a look into the spoiler photo, this is how BL0942 looks like. Is there such a chip in your device?
You can also provide a list of chips on the board, because it has to measure the current/power/voltage somehow.
If not BL0942, then maybe BL0937 or CSE?
EDIT: I can see that you have updated your post with a photo. Very nice quality, btw. That's what we want! The chip you've shown is DP2525 and it's a power supply controller, it converts 110V (or 220V, idk which standard you use) to 12V or 5V or something like than.
This is not the chip we're looking for, there might be something else as well.
Maybe it's using a different method of measurement. We need to investigate.
That I+ and I-...
that markings made me think they are using current measurement transformer, but maybe I am wrong. I haven't found any such devices yet.
Are you able to check with multimeter (in a continuity test mode, the beeper mode) which CBU module pads/signals are connected to the second board by that ribbon?
TuyaMCU is here: but TuyaMCU is an external chip/MCU connect to UART lines (RXD1, TXD1) of WiFi module and I can't see any MCU on the photos/videos
Exactly, that's what I said I suspect in my previous post.
The I+ and I- markings:
p.kaczmarek2 wrote:
That I+ and I-...
that markings made me think they are using current measurement transformer, but maybe I am wrong. I haven't found any such devices yet.
so we might do this just by using the ADC, but again, I need to you to determine the pinouts....
The discussion revolves around issues related to flashing the Tuya Single Phase Energy Meter 6 In 1, which utilizes a CBU chip based on the BK7231N. The user experienced difficulties in flashing the device to integrate it with ESPHome, leading to inquiries about the correct flashing procedure, tools, and binary files. Various responses provided troubleshooting steps, including the use of specific Python tools (hid_download_py, uartprogram) for firmware backup and flashing. The conversation evolved to identify the internal components, particularly the BL0942 chip, and the need to switch from SPI to UART mode for proper communication. The community also discussed calibration and MQTT setup for Home Assistant integration, emphasizing the importance of accurate readings and device configuration. Summary generated by the language model.