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

  • More info.

    When I reinit the libuarte async driver, it works for like 5-6 receptions and then it crashes, but there is something strange.

    Usually the RX buffers I get are in the range of 0x20005A00 to 0x20005D00, but after some receptions I get buffers in the range 0x2000FF00 onwards and that is when it crashes, probably goes above the 0x20010000 address but I have no idea why it goes there. I tried putting a flag in the libuarte library so that it only inits the nrf_balloc once (even if I call uninit and init again for the libuarte) but that didn't help.

    I hope this information is useful and thanks in advance for any help.

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

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

Children
Related