Skip to content

Commit 6ec4436

Browse files
sgfeniexkartben
authored andcommitted
drivers: serial: fix uart_sam0 async rx timeout calculation
Zephyr moved to microseconds to represent uart async timeout. This one has some additional logic that was not adjusted in the transition from milliseconds. c590b35 was integrated in #39041 Signed-off-by: Stefan Giroux <stefan.g@feniex.com>
1 parent f070786 commit 6ec4436

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

drivers/serial/uart_sam0.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -361,7 +361,7 @@ static void uart_sam0_rx_timeout(struct k_work *work)
361361
return;
362362
}
363363

364-
uint32_t now = k_uptime_get_32();
364+
uint32_t now = USEC_PER_MSEC * k_uptime_get_32();
365365
uint32_t elapsed = now - dev_data->rx_timeout_start;
366366

367367
if (elapsed >= dev_data->rx_timeout_time) {
@@ -762,7 +762,7 @@ static void uart_sam0_isr(const struct device *dev)
762762
*/
763763
if (dev_data->rx_timeout_time != SYS_FOREVER_US) {
764764
dev_data->rx_timeout_from_isr = true;
765-
dev_data->rx_timeout_start = k_uptime_get_32();
765+
dev_data->rx_timeout_start = USEC_PER_MSEC * k_uptime_get_32();
766766
k_work_reschedule(&dev_data->rx_timeout_work,
767767
K_USEC(dev_data->rx_timeout_chunk));
768768
}

0 commit comments

Comments
 (0)