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(Examples,PeriphDrivers): Fix clock option value setting for UART-… #1284

Merged
merged 1 commit into from
Dec 4, 2024
Merged
Show file tree
Hide file tree
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
7 changes: 6 additions & 1 deletion Examples/MAX78000/UART/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -102,8 +102,13 @@ int main(void)
printf("-->Example Failed\n");
return error;
}

#if defined(BOARD_EVKIT_V1)
if ((error = MXC_UART_Init(WRITING_UART, UART_BAUD, MXC_UART_APB_CLK)) != E_NO_ERROR) {
#elif defined(BOARD_FTHR_REVA)
// We define UART3(LPUART) as WRITING_UART for FTHR Board.
// LPUART can use IBRO and ERTCO clocks.
if ((error = MXC_UART_Init(WRITING_UART, UART_BAUD, MXC_UART_IBRO_CLK)) != E_NO_ERROR) {
#endif
printf("-->Error initializing UART: %d\n", error);
printf("-->Example Failed\n");
return error;
Expand Down
8 changes: 4 additions & 4 deletions Libraries/PeriphDrivers/Source/UART/uart_ai85.c
Original file line number Diff line number Diff line change
Expand Up @@ -273,14 +273,14 @@ int MXC_UART_SetClockSource(mxc_uart_regs_t *uart, mxc_uart_clock_t clock)
#ifndef MSDK_NO_GPIO_CLK_INIT
retval = MXC_SYS_ClockSourceEnable(MXC_SYS_CLOCK_IBRO);
#endif // MSDK_NO_GPIO_CLK_INIT
clock_option = 2;
clock_option = 0;
break;

case MXC_UART_ERTCO_CLK:
#ifndef MSDK_NO_GPIO_CLK_INIT
retval = MXC_SYS_ClockSourceEnable(MXC_SYS_CLOCK_ERTCO);
#endif // MSDK_NO_GPIO_CLK_INIT
clock_option = 3;
clock_option = 1;
break;

default:
Expand Down Expand Up @@ -316,9 +316,9 @@ mxc_uart_clock_t MXC_UART_GetClockSource(mxc_uart_regs_t *uart)
break;
case 3:
switch (clock_option) {
case 2:
case 0:
return MXC_UART_IBRO_CLK;
case 3:
case 1:
return MXC_UART_ERTCO_CLK;
default:
return E_BAD_STATE;
Expand Down
Loading