nRF52840 UARTE RX DMA pointer

Hi

Is there a possibility to read out the actual RX pointer of the DMA if the amount of chars is not reached?

Start Stop the RX is not really an option and I have no free Timer for PPI function...

https://devzone.nordicsemi.com/f/nordic-q-a/33813/nrf58232-uarte-rx-easydma-pointer

There should be a possibility to read the actual pointer value.

nrf_uarte_rx_amount_get(ext_uart.p_reg); this is returning 0 even if I received some characters. the return value is 10 if I the UARTE received 10+ chars, this is useless!

nrfx_uarte_rx(&ext_uart, ext_uart_rx_dma_buffer, 10);

Regards, Dominik

Parents
  • Hi,

    Unfortunately, there is no other ways to check the number of received bytes than the two methods suggested in your linked post. The pointer is handled in the HW peripheral, and there is no register to read out the current RAM pointer from the EasyDMA process. The AMOUNT register is not updated until after the receive operation have been stopped/completed.

    If you have a slow UART speed, you may enable interrupt for the RXDRDY event and count the number of bytes in your application, but this may not be reliable.

    Best regards,
    Jørgen

  • Hi

    This makes the DMA function not really usefull with a RX data with different data length. The DMA has exactly this function to store the data, how should I work with the Buffer when I don't know how many char I have in it?

    Anyway, pointing to the "solution" A from the post:

    A) Stop the RX by activating the STOPRX task, wait for the ENDRX event to occur, and read the number of bytes read in the RXD.AMOUNT register. 
        Since the RX pointer is double buffered you can pre-load the next buffer to be used, and use the ENDRX_STARTRX shortcut to start the RX immediately following the ENDRX event. 

    To Stop the RX which function should I use? And am I right that I have to use 2 RX Buffers for the switch between Stop and Start? Can you provide me the stop and restart functions please? This would be really helpfull.

    Thanks

  • I use this function in the RX IRQ to get the amount of RX DMA chars:

    pos = nrf_uarte_rx_amount_get(ext_uart.p_reg);

    every 10ms I call:

    nrfx_uarte_rx_abort(&ext_uart);

    to trigger the RX IRQ and get the new values. Its working, but on long strings the DMA is losing some chars, what is to improve?

    in the RX IRQ I copy the data to the ringbuffer.

    After processing the data I have to restart the UART DMA with:

    nrfx_uarte_rx(&ext_uart, ext_uart_rx_dma_buffer, RING_BUFFER_SIZE_RX);

    But this is too slow, because the DMA buffer is losing some chars with the nrfx_uarte_rx_abort function

    TX from Terminal:

    Debug Window:

Reply
  • I use this function in the RX IRQ to get the amount of RX DMA chars:

    pos = nrf_uarte_rx_amount_get(ext_uart.p_reg);

    every 10ms I call:

    nrfx_uarte_rx_abort(&ext_uart);

    to trigger the RX IRQ and get the new values. Its working, but on long strings the DMA is losing some chars, what is to improve?

    in the RX IRQ I copy the data to the ringbuffer.

    After processing the data I have to restart the UART DMA with:

    nrfx_uarte_rx(&ext_uart, ext_uart_rx_dma_buffer, RING_BUFFER_SIZE_RX);

    But this is too slow, because the DMA buffer is losing some chars with the nrfx_uarte_rx_abort function

    TX from Terminal:

    Debug Window:

Children
No Data
Related