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

libuarte issue: nrf_balloc_alloc retuns NULL after a while.

Hi.

I'm having an issue with the libuarte library. It seems to work perfectly but after some hours of running the program crashes because nrf_balloc_alloc returns NULL inside the rx_buffer_scheduile function which is called from the uart_evt_handler under the NRF_LIBUARTE_DRV_EVT_RX_BUF_REQ event.

I tried enabling the RX pullup. Increasing the RX buffer (count 16, size 250) but still getting the NULL pointer. I receive very little data @ 1125200 (it's an AT command module so there's not much being sent/received).

Any idea on how I can debug or fix this? Maybe increasing the ISR priority?? 


Thanks a lot.

Parents
  • I did some more testing.

    This happens after I get an NRF_LIBUARTE_ASYNC_EVT_OVERRUN_ERROR error, so obviously I'm not handling the error correctly.

    When I get an NRF_LIBUARTE_ASYNC_EVT_OVERRUN_ERROR, what should I do?? Should I clear manually the error registers? or should I uninit and reinit the libuarte?


    Thanks.

  • I tried calling libuarte uninit and init inside the overrun case in the event handler but it later crashes when I try to access the data of received data from UART, so I guess that's not the right way of doing it.

    Does anyone know how to clear or handle the LIBUARTE OVERRUN error? I was not able to find in the documentation the proper way of handling it. In other architectures I used to clear the flag and reenable the receiver. But I'm not sure how to do something similar with the libuarte async library.

    Thanks!!

  • Hello, 

    My apologies for the late reply. Our team is currently understaffed due to summer vacations. I will have a look at your case within today or tomorrow. 

    Sorry for the inconvenience. 

    Kind regards,
    Øyvind

  • Thanks Øyvind,

    More information (probably useful). The received data from the UART is fine, I connected a logic analyzer and there were no framing errors and also there was no data overrun, less than 200 bytes were received between the last successful receptions and when the libuarte overrun gets triggered. 

    I configured the libuarte with (5) 255 byte buffers so we should have enough space.

    Somehow I think this is either DMA related or a timer related issue, where it's counting more bytes than it actually received. 

    Any additional idea on what I can test?

    Thanks.

  • Hi, 

    I could not see what SDK you are using. Can you please provide some details on how I can reproduce this issue?

    Thanks!

    -Øyvind

  • Hi,

    It's SDK 16.0

    I do not have the steps to reproduce this. The project is kind of complex (lots of code) and the issue happens once every 2-4 hours randomly. 

    I disabled (commented) many parts of the project to start narrowing the issue. I now think it's related to other parts of the project, probably a timer.

    I left it running all the night and the issue never happened. So now I'm uncommenting (enabling) other modules in the project to see if it happens again and probably narrow it. 

    But probably I won't be able to tell you an exact way to reproduce so we might just need to deduce what is happening with the evidence I'm getting.

    Thanks.

  • I think it's related to the ESB library. I'm also using that in the project. Probably a timer or PPI channel?? 

    Øyvind, what parts of the ESB library do you think can conflict with the Libuarte library?

    Thanks.

Reply Children
Related