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!!

  • 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.

  • I'm sorry for not answering your ticket. We are currently swamped with tickets, and I have not had the time to reproduce errors. I will need to start looking at this on Monday when more of our resources are back. 

    Sorry for the inconvenience this may cause. 

    Kind regards,
    Øyvind

  • Were you able to resolve this issue? I am attempting to use libuarte with ESB and nrf_balloc_alloc returns NULL every time.

  • Hi,

    yes, I was able to solve this. I don't remember exactly how but I think it had something to do with the timers assigned to the LIBUARTE library or to ESB. I reviewed the timers and did some changes and it got fixed. I did try many things and nothing worked. 

    But maybe your issue is different, I only got a NULL once every several hours of constant activity. Was pretty rare so was really hard to debug.

    regards.

Reply
  • Hi,

    yes, I was able to solve this. I don't remember exactly how but I think it had something to do with the timers assigned to the LIBUARTE library or to ESB. I reviewed the timers and did some changes and it got fixed. I did try many things and nothing worked. 

    But maybe your issue is different, I only got a NULL once every several hours of constant activity. Was pretty rare so was really hard to debug.

    regards.

Children
Related