Integrating UART with BLE Mesh

Hi!

I am currently working on a project that involves taking a command sent over UART and broadcasting the data sent in that command to a number of BLE Mesh devices. I currently have this somewhat working using the dimming client example from the BLE Mesh v5 development kit and the libUART_async library from NRF SDK 17.0.2.

This being said, I have run into an issue where after sending a large number of commands the rx UART buffer suddenly appears to contain all of the commands that I had sent up until that point. For example, If I am sending 'hello' 100 times, the buffer will suddenly contain 'llohellohellohello'. I am clearing the rx buffer each time the interrupt is triggered using this  nrf_libuarte_async_rx_free(p_libuarte, p_evt->data.rxtx.p_data, p_evt->data.rxtx.length); command.

Additionally, each time I send a command via UART it seem that the rx interrupt is triggered twice. The first time, the data in the buffer looks correct. For example it would contain 'hello'. The second time the data contained in the buffer is incorrect, containing the same data but missing the first index. For example it will contain 'ello'.

Question 1) Does anyone know why I might be encountering these two bugs?

Question 2) Is there a better way to integrate BLE Mesh with UART than using the libUART_async library from NRF SDK 17.0.2. So far I have not seen any other ways to do this but I am open to other options.

Parents
  • Hi,

    Question 1) Does anyone know why I might be encountering these two bugs?

    Our initial thoughts is that this is related to the UART part of your application and not the Mesh part. 

    1. Could you explain how you set up the UART?
    2. Have you seen and/or gotten the libuart sample in nRF5 SDK to work on its own without being integrated in a Mesh device?
    3. Can you check if you already have one UART in your application before you add libuarte? This might be the case since you get 2x interrupts
    Question 2) Is there a better way to integrate BLE Mesh with UART than using the libUART_async library from NRF SDK 17.0.2. So far I have not seen any other ways to do this but I am open to other options.

    If you don't need to use libuarte it might be sufficient to use a "normal" UART, like the one used in the ble_app_uart sample

    Kind regards,
    Andreas

  • Have you seen and/or gotten the libuart sample in nRF5 SDK to work on its own without being integrated in a Mesh device?

    I got the sample to work independently from mesh and it worked perfectly.

    Can you check if you already have one UART in your application before you add libuarte? This might be the case since you get 2x interrupts

    I have not seen a second implementation of UART and I cannot find one when I look. The only UART is libUART


    Could you explain how you set up the UART?

    I did not write the original libUART implementation for the application and I cannot figure out the exact way that we made it work with the mesh. What I can say is that when I try to re-implement libUART on a fresh version of the mesh dimming example I am running into a number of runtime error that I am assuming the person who originally did this ran into and fixed by modifying the libUART library. I am running into an issue where I am getting an INVALID_STATE runtime error from line 398 in nrf_libuart_async.c 

    if (p_libuarte->p_ctrl_blk->enabled)
    {
       return NRF_ERROR_INVALID_STATE;
    }

    do you know what might be the cause of this? I am following the libuart sample exactly so I am inferring that this is a issue where the library is conflicting with the mesh. If I can troubleshoot these issues the reason why there is a duplicated interrupt may become apparent.

Reply
  • Have you seen and/or gotten the libuart sample in nRF5 SDK to work on its own without being integrated in a Mesh device?

    I got the sample to work independently from mesh and it worked perfectly.

    Can you check if you already have one UART in your application before you add libuarte? This might be the case since you get 2x interrupts

    I have not seen a second implementation of UART and I cannot find one when I look. The only UART is libUART


    Could you explain how you set up the UART?

    I did not write the original libUART implementation for the application and I cannot figure out the exact way that we made it work with the mesh. What I can say is that when I try to re-implement libUART on a fresh version of the mesh dimming example I am running into a number of runtime error that I am assuming the person who originally did this ran into and fixed by modifying the libUART library. I am running into an issue where I am getting an INVALID_STATE runtime error from line 398 in nrf_libuart_async.c 

    if (p_libuarte->p_ctrl_blk->enabled)
    {
       return NRF_ERROR_INVALID_STATE;
    }

    do you know what might be the cause of this? I am following the libuart sample exactly so I am inferring that this is a issue where the library is conflicting with the mesh. If I can troubleshoot these issues the reason why there is a duplicated interrupt may become apparent.

Children
Related