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

overrun error when receiving data from UARTE

Hi, 

I have problem with using nrf_serial.h, I am receiving data from Ublox GPS, baud rate = 9600, no flow control as we dont have enough IO pins.

Device is nrf52840 with SDK 16.0. I am using SERIAL_MODE_DMA, SERIAL_BUFF_RX_SIZE = 128, SERIAL_FIFO_RX_SIZE = 4096.

I am constantly getting NRF_SERIAL_EVENT_DRV_ERR events (overrun) even if fifo is empty (see picture below). If i get NRF_SERIAL_EVENT_RX_DATA event I set a flag and call nrf_serial_read in task as i dont want to spend too much time in IRQ.

Parents
  • Hi 

    In general I would strongly recommend switching to the nrf_libuarte library, in particular if you're using UART without flow control. 

    This library is the most feature rich and well tested for UART in the nRF5 SDK, and has an async version for applications where you don't know when you might received data over the UART, or how much data you might receive. 

    Best regards
    Torbjørn

  • Hi,

    thanks for quick reply, but I have one further question:

    We have 2 devices connected with uarte, one without flow control (GPS), and one with flow control and 115200 baud rate. Is that possible with nrf_libuarte library ?

    Best regards,

    Luka

  • Hi Luka

    Yes. The nrf_libuarte library uses instances, which means you can configure the library for each UART interface in the device and use different settings for each one. 

    On a device such as the nRF52840, which has 2 UARTE interfaces, you can then run one without flow control and one with flow control if you want. 

    Best regards
    Torbjørn

  • Hi,

    I implemented libUARTE_async. Everything works fine until first buffer is filled, then my program goes in fault (see attached screenshot). Only thing I do in event handler on RX done is to print one random string, if I remove printf and do nothing in event handler I don't get a fault. I checked with debugger and buffer gets overfilled (my buffer is 200bytes long but there are 205 bytes written, so I suspect that causes a fault.

    Do you have any idea where problem could be?

    Best regards,

    Luka

Reply
  • Hi,

    I implemented libUARTE_async. Everything works fine until first buffer is filled, then my program goes in fault (see attached screenshot). Only thing I do in event handler on RX done is to print one random string, if I remove printf and do nothing in event handler I don't get a fault. I checked with debugger and buffer gets overfilled (my buffer is 200bytes long but there are 205 bytes written, so I suspect that causes a fault.

    Do you have any idea where problem could be?

    Best regards,

    Luka

Children
Related