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

BLE Mesh SDK along with peripheral mode.

I want to change the light-control example given in mesh SDK such that instead of using buttons to trigger messages, I want to connect client with mobile and control servers through mobile. At beginning, I am trying with one client and one server to reduce the complexities. I have combined the mesh SDK light control client example with our SDK12 based application as suggested here

The client side application has both mesh and peripheral mode activated. I am using the ble_nus service to communicate with the mobile. The client communicates with the server using the simple_on_off model provided in the mesh SDK. I have not called the mesh related calls from the ble_nus context and have kept the two contexts exclusive.

On the server side, I have flashed the server example directly on a PCA10040 board directly without tampering with the example code. So the server side is only mesh.

When the devices are powered, the provisioning happens successfully. And the mobile also gets connected to the client successfully. But when I send a command from the mobile, I get the error 8 (NRF_ERROR_INVALID_STATE) from the ble_nus_string_send function, and nothing happens. When I send a command again, then I receive "Device is busy" error from the mesh side.

Can someone help me on this?

Parents
  • Hello, Have you ever check if softdevice_handler can dispatch the mesh event? For me, I add the following line in intern_softdevice_events_execute(), which under softdevice_handler.c

    while (sd_evt_get(&evt_id) == NRF_SUCCESS)
    {
        nrf_mesh_on_sd_evt(evt_id);
    }
    

    I also update my main.c in the attachment. And in my experience, if you moving all the mesh resource to nRF5x SDK workspace. Please do not use the uECC resource inside the SDK12.1. Instead, please add the uECC.c and include eECC.h from mesh SDK.

    The Keil project (which is very rough) is also attached in the enclosure.

    To using nRFconnect the mesh light control client, please:

    1. Unzip the mesh.7z, and place it under SDK12.1\components\
    2. Unzip the mesh_example.7z and place it under SDK12.1\examples\
    3. Open the Keil project in SDK12.1\examples\mesh_example\light_control\client\arm5_no_packs
    4. Compile and program it to nRF52-DK
    5. After provisioning with three light control server, please open nRFconnect or nRFTool box with UART control on mobile device
    • Write ‘0’ -> control LED1 on the light control server 0
    • Write ‘1’ -> control LED1 on the light control server 1
    • Write ‘2’ -> control LED1 on the light control server 2
    • Write ‘3’ -> control LED1 on all the light control server

    Hope this can help you.

    softdevice_handler.c main.c mesh.7z mesh_example.7z

  • Hi Rick, thanks. The problem solved partially. Now the mesh part works after client connects with phone. I can send commands to the server through client (through mesh). But there is one problem. I'm still getting the error 8 (NRF_ERROR_INVALID_STATE) from the ble_nus_string_send function. Also when I disconnect the client from the phone, the client advertises weirdly (The name is changed to "N/A" (the MAC address is same), it advertises after long intervals (almost 10seconds)) and I cannot connect to it.

Reply
  • Hi Rick, thanks. The problem solved partially. Now the mesh part works after client connects with phone. I can send commands to the server through client (through mesh). But there is one problem. I'm still getting the error 8 (NRF_ERROR_INVALID_STATE) from the ble_nus_string_send function. Also when I disconnect the client from the phone, the client advertises weirdly (The name is changed to "N/A" (the MAC address is same), it advertises after long intervals (almost 10seconds)) and I cannot connect to it.

Children
No Data
Related