This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

Q:When i reboot the board which burn the serial project , how to add the device key to serial board again?

Hi all:

Q:When i reboot the board which burn the serial project , how to add the device key to serial board again?

I use PYACI to control the board which burn the serial code 

SDK for mesh:v2.0.1

Best regard.

  • This is something the mesh team might consider implementing in the future. For now, what you can do is enable PERSISTENT_STORAGE in the mesh serial example. You should be able to follow the whole interactive mesh provisioning example & then power cycle the serial board.

    Another application engineer & I tested by following all of the steps, including cc.composition_data_get(). We used the serial example & a light switch server to test. Then, we power cycled the serial board & ran the following commands:

    python interactive_pyaci.py -d COM1 --no-logfile
    db = MeshDB("database/example_database.json")
    cc = ConfigurationClient(db)
    device.model_add(cc)
    cc.publish_set(8, 0)
    cc.composition_data_get()

    where 8 is the devkey handle & 0 is the address handle from when you provisioned the first light client (i.e. p.provision(name="Light bulb")).

    You may need to update DSM_DEVICE_MAX & DSM_FLASH_PAGE_COUNT, depending on how many devices you want to test with. I would recommend testing with two devices first, as I mentioned above.

  • Hi all,

    Thanks for your answer.

    Now I reboot the serial board, then send PYACI CMD as below:

    1.db = MeshDB("database/example_database.json")

    2.p=provisioner(d[0],db)

    3.device.send(cmd.AddrPublicationAdd(db.nodes[0].unicast_address))

    4. d0=SimpleOnOffClient()

    5. device.model_add(d0)

    6. d0.publish_set(0,0)

    7. d0.set(1)

    When I send the CMD 1~7 as soon as possible, it can't control the Node's LED On/Off immediately, but over Ten or two seconds, it can control the LED On/Off normal.What cause the delay?From reboot the serial board, how long can i re-control the node?

    Regard

  • At what point did you reboot the serial board? Right after cc.composition_data_get()? Or are you provisioning & configuring the board & getting it to blink the LED first & then resetting the serial board?

    From the commands that you posted in your last comment, it seems you are skipping some code commands. This is why I am wondering how the exact test procedure was.

  • Hi 

    I've done all the  PYACI  need to do and can send the sc.set() command to control the LED OnOff,after that, I reboot the serial board then the issue coming.

  • Sorry for the delayed response. Just finished testing: everything works fine if you follow the guide like stated until sc.set(True). I tested with one serial board & one light switch server board. Remember to enable PERSISTENT_STORAGE on both examples.  Then, power cycle the serial board & enter the following commands:

    python interactive_pyaci.py -d COM1 --no-logfile
    db = MeshDB("database/example_database.json")
    
    cc = ConfigurationClient(db)
    device.model_add(cc)
    cc.publish_set(8, 0)
    cc.composition_data_get()
    cc.appkey_add(0)
    cc.model_app_bind(db.nodes[0].unicast_address, 0, mt.ModelId(0, 0x59))
    sc = SimpleOnOffClient()
    device.model_add(sc)
    sc.publish_set(0, 0)
    sc.set(True)


    Since the provisioning has already been done, you do not need to do this part after you
    power cycled the serial board. Everything should work fine then.

Related