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

nRF52 setup client and server examples to send serial packets over mesh and print on uart

Good day, 

I am starting a new project where I am using the ANNA-B112 BLE device from ublox in a custom design. The ANNA-B112 interfaces with a host MCU over UART. 
I would like to be able to set up a mesh network with one client device and several servers. 
The main function of the server host mcu is to gather data from various sensors, package it into a packet and then send then send the data over uart to the BLE chip, which in turn will forward the packet of (sensor) data over the mesh network to the client . 

for this i will need to provision the client and server using the nRF mesh app, and not using the PyACI scripts. 

I have looked at the serial and light switch examples but not very sure how to move forward from here. 

Help in pointing me in the right direction and usage would be greatly appreciated .

Thank you 

  • Hi Nishant, 

    Have you tried the light switch example  ?

    I don't see any problem doing what you are planning. In our light switch example you can have multiple servers reporting to a client (in the example the client turn off and on the light on the servers, but you can actively publish data from the server without the client asking as well). 

    You just need to implement your own proprietary model (you can refer to our simple_on_off model) and make a network similar to the light switch example. 

  • Hi Hung, 

    I have looked at the light switch example. The part im am not sure about is how and where do i pack my packet of data into for transmitting over the mesh. 

    My idea is to have the host MCU send data to the uart on the BLE chip, once the BLE chip recieves any data on the uart, it should then forward it to the mesh network. Looking at the serial example, that might work for me, but is there a way to provision the serial example on a mesh network?

  • I don't think the serial example would be best match for you. The main purpose of the serial interface is to do serialization. You can control mesh from the external MCU. In your case, maybe the external MCU is only used for collecting data from the sensor, and most of the mesh operation can be executed/processed on the nRF52 ? 

    If that's the case, you can just make your own vendor specific model with your customized data. I would suggest you to have a look at the simple on off model that we provided. To communicate with the external MCU, you can simply use the normal UART/UARTE peripheral. 

  • Hi Hung, 

    I am using the nRF mesh sdk3.2.0 together with nRF sdk 15.3.0. I have added the UART/UARTE functionality into the light switch client and light switch server code examples, and I am able to do a simple print to port. 

    I then added functionality to be able to use the uart input as replacement for buttons, I am able to provision both the client and teh server using the nRF mesh app. However when i use the UART to "simulate" a button press, I get an error "app_error_weak.c,  108, Mesh assert at 0x0002AF10 (:0)" using the addr2line tool, I am able to identify that the issue is at line 214 in the timer_scheduler file.c file. 

    I think it has something to do with interrupt priority levels, but I am nnot sure how to resolve the problem. 

    simulating the button press from the RTT debug terminal, does not give me the same error. 

  • Make sure when you call a mesh API inside an interrupt handle it follows the interrupt level rule as mentioned here.

    If that wouldn't help, could you check which error code and which exact function was at line 214 ? 

Related