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

How to trigger dma buffer with UARTE (no async)?

Dear Devzoners,

I have a question about triggering received data via UART with the nrf_libuarte_drv

Prehistory:
We started using the libuarte async driver, but due to data losses (because of timer restarting after each receive event) we are looking another solution. I started testing the libuarte driver (no async), unfortunately there is no working example. Nordic offers only the libuarte-async example.

My problem with using libuarte (async):
I can see how the received data is written to the given dma buffer, this buffer I can set with nrf_libuarte_drv_rx_start(&m_uarte1_sync,m_readbuffer,64,false). As described somewhere in Nordic's info center, I get an NRF_LIBUARTE_DRV_EVT_RX_BUF_REQ and NRF_LIBUARTE_DRV_EVT_RX_DATA if the buffer is full.

But we have different length of messages, some are 8 bytes, some are 15 bytes long etc.
I would need to know before NRF_LIBUARTE_DRV_EVT_RX_DATA, if something was written to the dma buffer. I found that I can use MYPERIPHERAL->WRITER.AMOUNT, but there is no WIRTER in the UARTE1 instance. 

I found RXD.AMOUNT within NRF_UARTE_Type, but it gives me only 0 or 64 (my buffer size).

My question:
Does anybody knows, how I can trigger changes on the dma buffer? Is there a event pointer or something else?

Best regards,
Jeff

Parents
  • Hi Jeff

    Possibly the RXDRDY event in the UARTE peripheral is what you need. This event should be generated after each received byte, and if you combine it with some form of timeout mechanism you can use it to detect that a transaction over the UART was just completed. 

    As a side note it is odd to hear that you weren't able to get the async driver working properly. By setting up the RAM buffers properly it should be possible to use the driver in such a way that you don't get any data loss, and if there is an issue in the driver preventing this then it's something we need to look into. 

    Best regards
    Torbjørn

Reply
  • Hi Jeff

    Possibly the RXDRDY event in the UARTE peripheral is what you need. This event should be generated after each received byte, and if you combine it with some form of timeout mechanism you can use it to detect that a transaction over the UART was just completed. 

    As a side note it is odd to hear that you weren't able to get the async driver working properly. By setting up the RAM buffers properly it should be possible to use the driver in such a way that you don't get any data loss, and if there is an issue in the driver preventing this then it's something we need to look into. 

    Best regards
    Torbjørn

Children
No Data
Related