logo elektroda
logo elektroda
X
logo elektroda

Zmai-90 with CBU module does not start after flashing. Could not pick up GPIO.

ghost198922 6477 51
ADVERTISEMENT
  • #31 20554804
    Jinaria
    Level 8  
    Thanks,

    I did that but got empty responses:

    Info:CMD:[WebApp Cmd 'uartInit 4800' Result] OK
    Info:CMD:UART received: 
    Info:CMD:UART received: 
    Info:CMD:UART received: 
    Info:CMD:UART received: 
    Info:CMD:UART received: 
    Info:CMD:UART received: 
    Info:CMD:UART received: 
    Info:CMD:UART received: 
    Info:CMD:UART received: 
    Info:CMD:UART received: 
    Info:CMD:UART received: 
    Info:CMD:UART received: 
    Info:CMD:UART received: 
    Info:CMD:UART received: 
    Info:CMD:UART received: 
    Info:CMD:UART received: 
    Info:CMD:UART received: 
    Info:CMD:UART received: 
    Info:CMD:UART received: 
    Info:CMD:UART received: 
    Info:CMD:UART received: 
    Info:CMD:[WebApp Cmd 'uartSendHex 2226242226' Result] OK
    Info:CMD:UART received: 
    Info:CMD:UART received: 
    Info:CMD:UART received: 
    Info:CMD:UART received: 
    Info:CMD:UART received: 
    Info:CMD:UART received: 
    Info:CMD:UART received: 
    Info:CMD:UART received: 
    Info:CMD:UART received: 
    Info:CMD:UART received: 
  • ADVERTISEMENT
  • #32 20554816
    p.kaczmarek2
    Moderator Smart Home
    The log you have posted contains only:
    Jinaria wrote:

    RX capture from RN8209C :
    242226242226242226242226242226242226242226242226242226242226242226242226242226242226242226242226242226242226242226242226242226242226242226242226242226242226242226242226242226242226242226242226242226242226242226242226242226242226242226242226242226242226242226242226242226242226242226242226242226242226242226242226242226242226242226242226242226242226242226242226242226242226242226242226242226242226242226242226242226242226242226242226242226242226242226242226242226242226242226242226242226242226242226242226242226242226242226242226242226242226242226

    so you must somehow use those bytes to trigger a reply from the MCU. I don't know, try every option, including:
    - 26242226
    - 242226
    - 2226
    idk, maybe with power on/off... it's hard to tell what was sent first...

    We need to have a way to request a reply from the MCU, basically mimic the Tuya protocol.

    I know that UART works, look, I've tested it:
    Zmai-90 with CBU module does not start after flashing. Could not pick up GPIO.
    Helpful post? Buy me a coffee.
  • #34 20554956
    p.kaczmarek2
    Moderator Smart Home
    This source code looks complicated, is it the firmware running on RN8209C?

    I'd still say that it should be easier to do an UART capture. Are you 100% sure that you've captured everything, full transaction from the start?

    I know it's not a TuyaMCU, obviously.

    But if you have captured the transaction request message at 4800 baud, we should be able to send it and get some reply and work from there....

    Maybe retry the capture, but make sure to capture the very first initial packet?

    Or maybe is there something else at play, idk, maybe there is a third GPIO used, for example to "start" RN8209C with high or low level, or anything, like chip select, idk?
    Helpful post? Buy me a coffee.
  • #35 20555057
    Jinaria
    Level 8  
    I'll try to capture the communication again, the uart part of the datasheet has some information about the uart setting like slave mode, 9-bit, meat standard protocol, I am not sure how to set those in terminal software when I try to capture! When I captured the RX/TX I used 4800 8N1

    Zmai-90 with CBU module does not start after flashing. Could not pick up GPIO.

    Added after 8 [hours] 9 [minutes]:

    Tried again and managed to capture more, also managed to dump the External EEPROM content.
    TX
    0000FCDF009495B400000045940000FEDD008DD9770000003F9A0000FBE00089470D0000003B9E0000FEDD008280DB00000035A40000FBE000807AE300000031A80000FCDF007ABDA600000030A90000FEDD00713A320000002CAD0000FDDE0065B1C700000027B20000FDDE0062AECD00000025B40000FBE0005FF28C00000022B70000FDDE005EF08F00000020B90000F8E3005D611F00000020B90000FAE1005BB7CB00000019C00000F7E4005820650000001ABF0000F7E400556A1E00000015C40000FBE00052A1EA00000016C30000F6E5004AA7EC00000015C4

    RX
    E0EAE530EAFA1BEADC39EAE530EA5ABBEADC39EAE530EAFA1BEADC39EAE53080160366EADC39EAE53081280155EADC39EAE5308214F376EADC39EAE53083003B41EADC39EAE53085E41E78EADC39EAE53087E692EADC39242226242226242226242226242226242226242226242226242226242226242226242226242226242226242226242226242226242226242226242226242226242226242226


    Even after sending the complete captured data to UART using command or autoexec.bat or sending it in parts, I am getting empty responses. So not sure what else to try, it might require special timing for sending the data.

    BridgePulseLength 5
    uartInit 4800
    uartSendHex EAE530
    uartSendHex EAFA1BEADC39
    uartSendHex EAE530
    uartSendHex EA5ABBEADC39
    uartSendHex EAE530
    uartSendHex EAFA1BEADC39
    uartSendHex EAE530
    uartSendHex 80160366EADC39
    uartSendHex EAE530
    uartSendHex 81280155EADC39
    uartSendHex EAE530
    uartSendHex 8214F376EADC39
    uartSendHex EAE530
    uartSendHex 83003B41EADC39
    uartSendHex EAE530
    uartSendHex 85E41E78EADC39
    uartSendHex EAE530
    uartSendHex 87E692EADC39
    uartSendHex 242226


    Quote:
    This source code looks complicated, is it the firmware running on RN8209C?

    @p.kaczmarek2 As far as I understand, that's the chip driver for a similar device with the same metering chip.
  • ADVERTISEMENT
  • #36 20555628
    Jinaria
    Level 8  
    Update:
    Some success! Tried Again with EVEN parity and 2-bit stop bit:
    Info:CMD:[WebApp Cmd 'uartSendHex EAE530EAFA1BEADC39EAE530EA5ABBEADC39EAE530EAFA1BEADC39EAE53080160366EADC39EAE53081280155EADC39EAE5308214F376EADC39EAE53083003B41EADC39EAE53085E41E78EADC39EAE53087E692EADC39' Result] OK
    
    Info:CMD:UART received: 10 D1 10 D1 00 06 D9 00 00 AD


    However, if I send the same thing again, I get different responses:
    
    Info:CMD:[WebApp Cmd 'uartSendHex EAE530EAFA1BEADC39EAE530EA5ABBEADC39EAE530EAFA1BEADC39EAE53080160366EADC39EAE53081280155EADC39EAE5308214F376EADC39EAE53083003B41EADC39EAE53085E41E78EADC39EAE53087E692EADC39' Result] OK
    Info:CMD:UART received: 00 00 AD 00 00 F5 00 00 00 00 D8
    
    Info:CMD:[WebApp Cmd 'uartSendHex EAE530EAFA1BEADC39EAE530EA5ABBEADC39EAE530EAFA1BEADC39EAE53080160366EADC39EAE53081280155EADC39EAE5308214F376EADC39EAE53083003B41EADC39EAE53085E41E78EADC39EAE53087E692EADC39' Result] OK
    Info:CMD:UART received: 10 D1 10 D1 00 06 D9 00 00 AD 00 00 F5 00 00 00 00 D8
    
    Info:CMD:[WebApp Cmd 'uartSendHex EAE530EAFA1BEADC39EAE530EA5ABBEADC39EAE530EAFA1BEADC39EAE53080160366EADC39EAE53081280155EADC39EAE5308214F376EADC39EAE53083003B41EADC39EAE53085E41E78EADC39EAE53087E692EADC39' Result] OK
    Info:CMD:UART received: 10 D1 10 D1 00 06 D9 00 00 AD 00 00 F5 00 00 00 00 D8
    
    Info:CMD:[WebApp Cmd 'uartSendHex EAE530EAFA1BEADC39EAE530EA5ABBEADC39EAE530EAFA1BEADC39EAE53080160366EADC39EAE53081280155EADC39EAE5308214F376EADC39EAE53083003B41EADC39EAE53085E41E78EADC39EAE53087E692EADC39' Result] OK
    Info:CMD:UART received: 10 D1 10 D1 00 06 D9 00 00 AD 00 00 F5 00 00 00 00 D8
    
    Info:CMD:[WebApp Cmd 'uartSendHex EAE530EAFA1BEADC39EAE530EA5ABBEADC39EAE530EAFA1BEADC39EAE53080160366EADC39EAE53081280155EADC39EAE5308214F376EADC39EAE53083003B41EADC39EAE53085E41E78EADC39EAE53087E692EADC39' Result] OK
    Info:CMD:UART received: 00 06 D9 00 00 AD 00 00 F5 00 00 00 00 D8
      
    Info:CMD:[WebApp Cmd 'uartSendHex EAE530EAFA1BEADC39EAE530EA5ABBEADC39EAE530EAFA1BEADC39EAE53080160366EADC39EAE53081280155EADC39EAE5308214F376EADC39EAE53083003B41EADC39EAE53085E41E78EADC39EAE53087E692EADC39' Result] OK
    Info:CMD:UART received: 10 D1 10 D1 00 06 D9 00 00 AD 00 00 F5
    
    Info:CMD:[WebApp Cmd 'uartSendHex EAE530EAFA1BEADC39EAE530EA5ABBEADC39EAE530EAFA1BEADC39EAE53080160366EADC39EAE53081280155EADC39EAE5308214F376EADC39EAE53083003B41EADC39EAE53085E41E78EADC39EAE53087E692EADC39' Result] OK
    Info:CMD:UART received: 10 D1 10 D1 00 06 D9 00 00 AD 00 00 F5
    
    Info:CMD:[WebApp Cmd 'uartSendHex EAE530EAFA1BEADC39EAE530EA5ABBEADC39EAE530EAFA1BEADC39EAE53080160366EADC39EAE53081280155EADC39EAE5308214F376EADC39EAE53083003B41EADC39EAE53085E41E78EADC39EAE53087E692EADC39' Result] OK
    Info:CMD:UART received: 10 D1 00 06 D9 00 00 AD 00 00 F5


    And if I append the repeating 242226 to it, I get the response below and empty responses after that:

    Info:CMD:UART received: 10 D1 00 06 D9 00 00 AD 00 00 F5 00 00 00 00 D8 00 00 00 00 BB
  • #37 20738330
    oli43
    Level 1  

    >>20451950

    Hi,
    I have the same device with the CBU board which I flashed with kickstart-bk7231n and it's now unusable (I can't find how to set up a working ESPHome firmware on it).
    I want to restore the original firmware but I don't know where to plug 5V and ground on the CBU board. Any idea?
    Thanks for your help.
  • #38 20738348
    p.kaczmarek2
    Moderator Smart Home
    Please do not flash devices with untested firmwares before consulting forum.

    CBU requires 3.3V, not 5V. 5V would damage it.

    Here is CBU pinout:
    https://developer.tuya.com/en/docs/iot/cbu-module-datasheet?id=Ka07pykl5dk4u
    Helpful post? Buy me a coffee.
  • #39 20911958
    brusarp
    Level 4  

    >>20738330

    Hi! I have the same device ZMAI-9 with CBU and now (after having read the various forums too quickly...) I am with the kickstart firmware. In the meantime, has anyone managed to find out anything and manage to create the correct package to install esphome?

    Thanks!
  • ADVERTISEMENT
  • #40 20911966
    p.kaczmarek2
    Moderator Smart Home
    The ZMAI-90 I had recently works only in OpenBeken, I had to write the RN driver from scratch for it. The LCD driver is still pending, but I am planning to add it as well.
    Helpful post? Buy me a coffee.
  • #41 20912372
    brusarp
    Level 4  

    Thank you for the answer @p.kaczmarek2.
    So what's the best option now?
    Waiting until it is implemented into kickstart or send it back?
  • #42 20912404
    p.kaczmarek2
    Moderator Smart Home
    You can't send back device that you have tampered with. I think you can just try flashing OBK, our firmware is being actively developed and I can add fixes and features daily, per request.
    Helpful post? Buy me a coffee.
  • #43 20912563
    brusarp
    Level 4  

    Oh, you're right...
    Thank you for your support, I will make a decision on what to do (maybe I can also wait longer...)
  • #44 20912568
    p.kaczmarek2
    Moderator Smart Home
    OBK supports OTA update of course, so you can flash it now, try the RN driver and do OTA once we get LCD support as well.
    Helpful post? Buy me a coffee.
  • ADVERTISEMENT
  • #45 20912578
    brusarp
    Level 4  

    So can you point me to the correct OTA files (now on kickstart I think that I need a UF2 file...) and relevant RN?
  • #46 20912588
    p.kaczmarek2
    Moderator Smart Home
    They are actively blocking transition to OpenBeken so update may be a bit problematic, as they some kind of non-standard format instead of RBL, that I do not know myself how to export, but as far as I remember, someone created OBK conversion files there:
    https://github.com/BenJamesAndo/OpenBeken_uf2_firmware
    Still, I have never tried it myself so I cant' vouch for it.
    Once you get it working, you can start RN8209 driver via:
    
    startDriver RN8209
    

    and then watch for energymeter messages in log, readouts should be non-zero, but it will require futher calibration.

    Our RN8209 driver is very WIP right now, but gives some basic results.
    Helpful post? Buy me a coffee.
  • #47 20912675
    brusarp
    Level 4  

    So, just to be clear and complete:

    - Download BK7231N CCtr Flash from here https://github.com/openshwprojects/OpenBK7231...download/1.17.410/OpenBK7231N_UG_1.17.410.bin

    - Convert to UF2 with tool https://github.com/BenJamesAndo/OpenBeken_uf2_firmware

    - Upload UF2 to my "Kickstarted" device via webgui

    - Launch RN driver via
     startDriver RN8209 


    - Config to work with Home Assistant (MQTT or autodiscovery??)

    This is all what I have to do?
  • #48 20912713
    p.kaczmarek2
    Moderator Smart Home
    Sorry, I think you got it wrong.

    I don't know how to make UF2, but as far as I know, somebody already put ready to use UF2 here:
    https://github.com/BenJamesAndo/OpenBeken_uf2_firmware
    So, the steps would be:
    1. download uf2 from github I linked
    2. update
    3. then update to latest obk manually
    4. then we can TRY our experimental RN driver on your device with command I've specified
    5. then you most likely will need to calibrate it, as we do always with any Tasmota device, the same we do also for BL0942, BL0937, etc, nothing new here
    6. then you most likely also need to configure GPIO of the device, but the template is somewhere earlier in this topic I think
    7. then you can try HASS discovery:




    Keep in mind that our RN driver is very new and experimental, so we may need to do a bit more of testing along the way. Your contribution to testing will help us make this driver better.
    Helpful post? Buy me a coffee.
  • #49 20920922
    brusarp
    Level 4  

    Sorry for my late reply...
    I successfully flashed and updated the obk firmware.
    Also started the RN8209 driver and now I have this situation:
    Screenshot of the RN8209 monitoring app displaying voltage, current, and power information.

    Voltage needs some calibration but current needs a huge calibration (it should be 0...) 😅😅😅😅
    Also connected to my Home Assistant (via MQTT, can't use auto discovery... it could be my mistake...)
    Screenshot of IoT device interface displaying various sensor readings.
  • #50 20921688
    p.kaczmarek2
    Moderator Smart Home
    So, we have a progress. Good job. Something is working.

    Do you know how to calibrate? It's very similiar to Tasmota. We have the same commands syntax for calibration. Still, you can also do it the Web App. Click Open Web App, then go to Tools tab, find Calibration paragraph.
    Helpful post? Buy me a coffee.
  • #52 20922285
    p.kaczmarek2
    Moderator Smart Home
    Ok, now can you check with different loads etc and give some feedback? I remember I had problems with measuring current on my piece, but voltage and power worked very well. Your input may help us to improve this driver.

    Futhermore, did you configure the bridge relay?
    Helpful post? Buy me a coffee.

Topic summary

The discussion revolves around issues faced with the Zmai-90 device equipped with a CBU module after flashing it with OpenBK firmware. Users report that the device fails to start, with no data displayed on the LCD and GPIO pins not being recognized. Various troubleshooting steps are suggested, including creating an autoexec.bat file for TuyaMCU commands, capturing UART communications, and checking the device's pin connections. Some users have successfully flashed the device and are working on calibrating the RN8209 driver for accurate readings. The conversation highlights the need for a custom driver due to the unique communication protocol of the Zmai-90 and the challenges in restoring original firmware.
Summary generated by the language model.
ADVERTISEMENT