logo elektroda
logo elektroda
X
logo elektroda

IMMAX NEO Smart (BK7231N): Flashing OpenBK and Troubleshooting Boot Issues

vkoutnik 459 1
ADVERTISEMENT
  • Helpful post
    #1 21356272
    vkoutnik
    Level 2  
    Let me summarize my way to tear IMMAX NEO Smart (bk7231n/cbu) down and to flash it with OpenBK. So, just someone may find it useful in the future and learn from my dead ends i had waled through...

    I bough my self this device as i thought i might to connect it with simple DIY CC&CP circuit, so it might make a simple DIY EVSE with wattmeter together. However, I realised it needs cloud to connect to, which showed up to be Tuya cloud. So I decided to tear this device down in order to know what is inside. What a surprise, there is BK7231N in it. This way i get to know there is something like OpenBK, so I decided to flash it.

    I tried with hid_download_py on my Macbook first. I did not work for me eventually. Reading and erasing seemed to work somehow, writing always failed. I was not successful varying the baud rates, not even changing the way i was resetting the device to get the bus. I tried also connecting CSN to ground without any success. There is few threads on the net addressing same issues, they all ended up in using https://github.com/openshwprojects/BK7231GUIFlashTool under Windows. BK7231GUIFlashTool worked for me eventually. I was able to flash it with this tool successfully.

    Anyway, during the previous attempts the CBU suffered quite lot, so I am not able to tell what actually causes how it afterwards...

    After flashing the device, it did not boot, no wifi appeared, nothing was comming from TX2 for debugging. So I almost gave up already when it came to my mind that I screwed up a bootloader somehow with my previous attemps, so I was trying some (maybe really random) steps to recover it.

    tl/dr... the sequence which seemed to work for me was
    1) Use 'Erase all' button
    2) Check 'Overwrite bootloader'
    3) Do firmware write - using the latest firmware (which currently is this file https://github.com/openshwprojects/OpenBK7231...wnload/1.17.802/OpenBK7231N_QIO_1.17.802.bin)

    After this and (some amount of restarts - will address later) it suddenly appears to be findable as an Wifi access point. ...as a charm. I connected to AP and was able to ,ake some configurations etc.

    However... there is one thing i am not able to deal with in any deterministic way and maybe this was actually source of my troubles, not the boot loader actually...

    When I connect it to flash tool, I need to initiate the flash reading/writing with short touching CEN to GND. It seems like nothing is needed to be done with CSN. But after successful flashing I am not (in any reliable way) able to force the device to come from the flashing mode to the normal operation mode.

    Lastly it worked something like disconnect it from flasher, turn it off, leave it for a minute, turn it on, leave it for the minute and it is up. But this works for me ONLY after full erase and full flash (see above), for the first time. If i connect it to read/write configuration, I am not able to get it out the flashing mode in any possible way. So I ended up in erase, flash, this weird reboot sequence and reconfigure from web. This way it works for me and I am all good now. But still wondering why :)


    Few pictures from my experience...
    Close-up of a BK7231N electronic module with marked components and inscriptions. Close-up of a BK7231N module with wires soldered to the pins on the circuit board. PCB module with visible processor and marked components on the board. Interior of an electronic device with a BK7231N chip and a relay. Close-up of a circuit board with visible electronic components. Opened electronic device on a blue work mat with disassembly tools. Hand holding an Immax Neo Smart device with visible power button and metering labels.
    AI: Could you specify the exact version of the OpenBK firmware you used for flashing the device?
    OpenBK7231N_QIO_1.17.802.bin
    AI: Did you notice any error messages or logs during the failed boot attempts that might provide more insight into the issue?
    i was not able to get the BK7231N from the flash mode after flashing...

    Added after 8 [hours] 23 [minutes]:

    so far the device seems to be identical to this one https://www.elektroda.com/rtvforum/topic3990985.html
    at least same configuration for leds, button and relay works for me
  • ADVERTISEMENT
  • #2 21361964
    vkoutnik
    Level 2  
    Let me give a follow up on my bk7231n adventure :)

    I do not like wasting resources, so when i happen to realise the power of OpenBeken, i came to the decision to try to implement the EVSE in the immax device completely

    AC EVSE is basically three things...
    1) AC relay
    2) proximity pilot
    3) control pilot

    ad 1) this is what immax neo smart actually is
    ad 2) this means reading the resistance between PP (proximity pilot) and PE (ground) to achieve maximum current the cable is capable of - assuming 5x4 cable i do not feel like i really need this now
    ad 3) this is the key part. it consist of 1kHz -12V PWM signal to CP (control pilot). Its duty cycle says how much current EV should take from EVSE. EV manipulates the 12V (and EVSE reads it back) to control the charging cycle (which actually is turning on/off the AC relay)

    So my idea is to use ADC pin and PWM pin of the device. Then the only thing i would need to do outside is to change 0 - 3.3V to -12V like here for instance https://openev.freshdesk.com/support/solutions/articles/6000052070-theory-of-operation

    My current set up is...

      "pins": {
        "8": "PWM;2",
        "9": "LED_n;1",
        "15": "WifiLED_n;0",
        "17": "dInput;46",
        "23": "ADC;3",
        "24": "Rel;1",
        "26": "Rel_n;1"
      },


    Then i realised i am not able to trigger the levels of the signal with just simple addChangeHandler, because the signal is a wave actually, so i need the maximum and minimum value of it

    I manipulated the ADCSmoother for it in my fork https://github.com/wwwenca/OpenBK7231T_App so it gives the min/max value as an output to particular channels.

    It might be refactored to something called ADCSampler or I might to create my own driver. It would be so similar however, that if there would be consensus i would give that generalisation a try...


    Then with setup like this...

    StartDriver ADCSmoother
    ADCSmoother 23 100 37 4 5000 5 6 7
    


    I should be able to do my stuff with code like this (just a sketch for now)

    
    alias idle backlog echo “Idle (A)"; setChannel 1 0; setChannel 2 100
    alias ev_connected backlog echo "EV connected (B) - Setting current"; setChannel 1 0; setChannel 2 25
    alias ev_charge backlog echo "EV charge (C/D) - Turning power on"; setChannel 1 1; setChannel 2 25
    alias ev_error backlog echo "Error (E/F) - Turn power off"; setChannel 1 0; setChannel 2 0
    
    alias check_12v if $CH7>2410 then idle else check_9v 
    alias check_9v if $CH7>2104 then ev_connected else check_6v 
    alias check_6v if $CH7>1797 then ev_charge else check_3v 
    alias check_3v if $CH7>1491 then ev_charge else check_0v 
    alias check_0v if $CH7>265 then ev_error
    
    PWMfrequency 1000  
    idle
    AddChangeHandler Channel7 > 265 check_12v
    


    The values of the ADC are just guess now, i will test it, debug it, tune it and then give a another follow up
ADVERTISEMENT