Implementing Interference-Free UART Communication in a Zephyr-based BLE Mesh

Hi everyone.

I am running a BLE mesh stack in my Zephyr-based application and need to interface with another device using UART.

How can I implement UART communication to avoid any interference with the BLE mesh stack?

tell me if its correct or if there is any other solution, I have heard that using DMA for UART communication can help ensure that the BLE mesh stack runs smoothly, 

from this assumption I am unsure whether to use the UARTE driver with EasyDMA or the UART driver with the Asynchronous API using DMA.

Can you help me understand which driver and API functions are best suited for my hardware platform ?

- using nrf52840 and ncs. 

Thanks Cedric.

  • Hello Cedric,

    How can I implement UART communication to avoid any interference with the BLE mesh stack?

    This shouldn't be a real problem either way, as these things are handled by threads of different priorities - what is time critical gets priority. Though with UARTE you get EasyDMA which would make sure that the CPU doesn't get interrupted. If you want DMA, which I assume you do, go for UARTE. One negative side of DMA would be a slightly higher power consumption, but as you're doing Mesh I assume that is of no big concern.

    If you are getting started I should mention that you should have a look at the DevAcademy. There is a section on UART there as well!

    Regards,

    Elfving

  • Thanks Elfving 

    I will go with UARTE to get the EasyDMA 

    Here my little prototype that involves two nRF52840 DK and I am trying to establish a communication between the two boards using UARTE based on this example. one nRF52840 DK acts as the transmitter and the other is the receiver.

    I modified the example to sends a message or call  nrfx_uarte_tx()  when a button is pressed, 

    The first time I press the button, the message is successfully transmitted and received by the receiver board, and everything works as expected. However, when you press the button for the second time, an error event NRFX_UARTE_EVT_ERROR.

    I  tried resetting the receive buffer using memset to clear the buffer, but the issue persists. not sure if I need to uninitialize the UART after receiving a message or perform some other action to be able to send more than one successful message.

    Could you help me on this please ?

    Thanks

    Cedric 

  • Hello Cedric, and so sorry about the delay. Its been a bit busy here, and I haven't been able to prioritize you.

    cedriczz said:
    Here my little prototype that involves two nRF52840 DK and I am trying to establish a communication between the two boards using UARTE based on this example.

    Which of the samples did you base it on?  

    cedriczz said:
    However, when you press the button for the second time, an error event NRFX_UARTE_EVT_ERROR.

    I see. Could you share the entire error message? This is typically due to that not the entire buffer is being reset. 

    Regards,

    Elfvomg

  • Hi,

    Thanks for your response.

    The issue is fixed I end up using  the asynchronous api based on devzone academie example 

Related