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

nRF52 DK Serial Configuration for light switch

I am doing something really really crazy, that's writing some application on PC using opcode serial port for configuration a light switch server (maybe light switch client someday). The problem is I don't know the detail procedure for configuration (even though I already read interactive_pyaci example - It's so hard to image a big picture, like... When the function call an opcode, what's next?! How to send opcode for composition data get? I have tried 0x8008 but it's sending back is error status 0x82). Then the next question is "Do I have to config configuration server?? Health server?? What is Acknowledge massages and how to send it????" 

If you know where to find the answer, please let me know too. Cause I really stuck in a mountain of documents - I don't know where to start. 

  • Hi Thịnh, 

    Have you managed to do provisioning from the PC ? 


    I would suggest to get started step by step. First please made sure you went through the provisioning and configuration tutorial with PyACI. Get familiar with how the configuration client is define on PC and which commands it sends over UART. 

    You can have a look at the serial interface library documentation here and then match it with what you can observe over UART (use a logic analyzer to get the UART communication trace or printout the log on the serial firmware). 

  • Thanks Hung Bui, but I already read the serial interface library for 3 weeks and still get nothing done from it (except provision step).

    After I provisioned the light switch, I get 0xC5 event (mean that's the provisioning completed). I saw these functions: dsm_address_publish_add(...); dsm_devkey_add(...); config_client_server_bind(...); config_client_server_set(...) is called (I found this at Provisioner example - https://infocenter.nordicsemi.com/index.jsp?topic=%2Fcom.nordic.infocenter.meshsdk.v4.2.0%2Fmd_examples_provisioner_README.html&cp=7_6_0_3_10).

    Now, here the problem comes from. I don't know the exact opcode for these functions. But base on the mesh folder and models folder in SDK Mesh. I'm sure 90% that dsm_address_publish_add(...) is 0xA4, dsm_devkey_add(...) is 0x9C, onfig_client_server_bind(...) is 0xE7, config_client_server_set(...) is 0xE0 and 0xEA. But after that, the diagram jump to config_client_composition_data_get() without any instruction, I don't know how to send the opcode 0x8008. I'm stuck at right that point. 

  • Hi Blackbird, 

    I think we need some clarification here. 

    Note that on the provisioner example, the provisioner and its database is located on the nRF52. 

    When in the PyACI example, the provisioner is located on the PC and the serial example is flashed on the nRF52.
    The nRF52 when connecting to PC acts as a backend that send the mesh packets that instructed by PC via UART. 

    So when you called  "cc.composition_data_get()" in python, the serial interface will send the command to the Access layer in the serial interface to "forward" the 0x8008 opcode to the destination (the provisionee) via opcode SERIAL_OPCODE_CMD_MESH_PACKET_SEND.

    I would strongly suggest to use a logic analyzer to capture the UART communication , that's the best way you can break down the pyACI example and can do something similar with your application. 

  • Hi Hung Bui, 

    Yeah, maybe I'm not clear enough and make reader confuses, my fault, I so sorry for that.

    So gonna explain the detail of what I'm doing right now: I have 2 board nRF52 DK. One of them is loaded with light switch server example. The other is loaded with serial example. 


    Now I connect the board with serial example to my PC. After that I write some C code to control it for provisioning and configuration the light switch server board. 

    I think maybe logic analyzer is the wise way to see what happen in pyACI. I have order one and it will come soon. 

    Thanks for the advises Hung Bui. I'm gonna update soon for anything new. 

Related