Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: increased UART Read Timeout #186

Merged
merged 1 commit into from
Feb 17, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions src/bus/uart/uart.c
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,12 @@
#include "uart.h"
#include "../../helpers/delay.h"
#include "../../commands.h"
#include "../../registers/system/watchdog.h"

/**********/
/* Macros */
/**********/
#define UART_READ_TIMEOUT (FCY / 1000) // 1 ms
#define UART_READ_TIMEOUT (FCY / 10UL) // 100 ms

/**************/
/* Interrupts */
Expand Down Expand Up @@ -329,8 +330,9 @@ void UART_Initialize(const EUxSelect select) {

uint8_t UART_Read(const EUxSelect select) {
// Wait for data to become available.
uint16_t timeout = 0;
uint32_t timeout = 0;
while (timeout++ < UART_READ_TIMEOUT) {
WATCHDOG_TimerClear();
if (UART_IsRxReady(select)) {
break;
}
Expand Down