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

nrf52840 serial

If I put too many characters into a serial using IRQ mode, it stops reading input.

I haven't tried polling or DMA yet.

Using

  • nRF5_SDK_15.0.0_a53641a
  • gcc-arm-none-eabi 6.3.1 and I also tried segger
  • nRF52840-DK with a PCA10056 1.0.0
  • examples/peripheral/serial.

I can't get the onboard USB serial to work with flow control enabled(works with it disabled), so I'm doing testing with an FTDI breakout.

The serial example works consistently and correctly if I just type characters on the keyboard, but if I paste a chunk of text larger than 47 characters, the serial port reads between 20 and 40 characters, and then stops reading.

If I connect  a gps unit that emits NMEA sentences, it will read some of them, and then stop reading. ~47 characters every second, and it was getting like 3-10 seconds.

Looking at what it does with gdb (I have not yet followed too closely) it seems that nrf_serial_read function just returns nothing, and everything else keeps working.

It does this with and without the hardware flow control.

I tried increasing the buffer size, but it didn't seem to change the issue.

If I change the timeout parameter on nrf_serial_read to 0 (as documentation says it really should be in IRQ contexts), it actually reads less characters when you paste data.

https://infocenter.nordicsemi.com/topic/com.nordic.infocenter.sdk5.v15.0.0/group__nrf__serial.html#details

Am I using the example wrong, or is this a bug?

Parents Reply
  • I was trying to use blocking rx/tx calls.

    I switched to using the event handler, and it never gets an event of type NRFX_UARTE_EVT_RX_DONE or NRFX_UARTE_EVT_RX_DONE

    I was already calling APP_ERROR on the return codes of the driver calls, and that will block if it's not a success. The code doesn't block, so they're all returning NRF_SUCCESS.

    Newest code: http://ix.io/1lZh

    Also I updated to nRF5_SDK_15.1.0_a8c0c4d

    There is a bug where "use_easy_dma" which was removed from "nrf_drv_uart_config_t", is still used by "components/libraries/serial/nrf_serial.c" line 208

    I just commented it out, is that the suggested fix?

Children
Related