Hi
I'm using asynchron UART.
For example, I defined idle time to 20us.
It works without any problem.
#define RECEIVE_TIMEOUT 20
static uint8_t rx_buf[512];
Hi
I'm using asynchron UART.
For example, I defined idle time to 20us.
It works without any problem.
#define RECEIVE_TIMEOUT 20
static uint8_t rx_buf[512];
Hi,
If the message is too long, it takes some time to get event "UART_RX_RDY".
The reason why it takes longer when you're actively receiving data is due to how the hardware peripheral works:
https://docs.nordicsemi.com/bundle/ps_nrf52840/page/uarte.html#ariaid-title4
In that thread, I want to check Rx-Data for example every 1ms.How can I get the data and length every 1ms ?Zephyr offers just one trigger "idle time".Is there any other trigger for example (every X ms)?
You can run the uart_rx_enable in a dedicated thread, with a timeout of 1 ms for instance. Or am I misunderstanding your scenario here?
Kind regards,
Håkon
Do you mean, I can call "uart_rx_enable(..)" every 1 ms? Doesn't it disturb the running receive buffer? I thought, I may call uart_r_enable() either at beginning or after uart_rx_disable().
Could you explain in detail what you're trying to achieve?
The behavior, in terms of event process, of the uart async API is described in the docs here:
https://docs.zephyrproject.org/latest/hardware/peripherals/uart.html#asynchronous-api
Do I understand correctly when you always want to return every 'n' ms? If yes, is there a specific reason why?
Normally, one would run the serial communication in a dedicated thread, which then yields for the remainder of the system, and combined with a signalling/k_poll functionality; you can share the communicated data on-demand between threads/functions.
Kind regards,
Håkon
Hi
I think, you don't understand what I want to do.
What I want to just do:
- I have to read DMA from UART Rx every 1ms.
Problem is if I use asynch, the Call Back Event occurs after the idle time expires.
It can be less than 1ms or more than 1ms.
Is there any function just like "dma_get_data(UART)"?
Thank you.
Hi,
Did you read the UARTE behavior when stopping the RX?
The reason why it takes longer when you're actively receiving data is due to how the hardware peripheral works:
https://docs.nordicsemi.com/bundle/ps_nrf52840/page/uarte.html#ariaid-title4
- I have to read DMA from UART Rx every 1ms.
Problem is if I use asynch, the Call Back Event occurs after the idle time expires.
You can potentially be blocked by higher priority threads, thus this might be skewed in time.
Problem is if I use asynch, the Call Back Event occurs after the idle time expires.
This is also expected, as a reception is timed out after 1 ms, and if there's more bytes; the above linked UARTE behavior will also skew your timing.
If I've understood you correctly; It sounds like you need to do polling per-byte, not use the async UART library functionality, as you want to fetch each byte as quick as possible for processing.
Kind regards,
Håkon
Hi,
Did you read the UARTE behavior when stopping the RX?
The reason why it takes longer when you're actively receiving data is due to how the hardware peripheral works:
https://docs.nordicsemi.com/bundle/ps_nrf52840/page/uarte.html#ariaid-title4
- I have to read DMA from UART Rx every 1ms.
Problem is if I use asynch, the Call Back Event occurs after the idle time expires.
You can potentially be blocked by higher priority threads, thus this might be skewed in time.
Problem is if I use asynch, the Call Back Event occurs after the idle time expires.
This is also expected, as a reception is timed out after 1 ms, and if there's more bytes; the above linked UARTE behavior will also skew your timing.
If I've understood you correctly; It sounds like you need to do polling per-byte, not use the async UART library functionality, as you want to fetch each byte as quick as possible for processing.
Kind regards,
Håkon