From d4a64f07c9c72dace160f4742ba4b70799811ed2 Mon Sep 17 00:00:00 2001 From: Sihyung Woo <75494566+sihyung-maxim@users.noreply.github.com> Date: Mon, 12 Feb 2024 13:36:29 -0600 Subject: [PATCH] chore(Boards,PeriphDrivers): Add Olimex selection, treat UART3 as other UARTs, and fix BCB build errors for MAX32572 (#914) --- Libraries/Boards/MAX32572/BCB/board.mk | 6 +- .../Boards/MAX32572/EvKit_V1/adapters.txt | 4 ++ .../PeriphDrivers/Source/UART/uart_me55.c | 70 +------------------ 3 files changed, 11 insertions(+), 69 deletions(-) diff --git a/Libraries/Boards/MAX32572/BCB/board.mk b/Libraries/Boards/MAX32572/BCB/board.mk index 37a4537a8c9..b8715611b71 100644 --- a/Libraries/Boards/MAX32572/BCB/board.mk +++ b/Libraries/Boards/MAX32572/BCB/board.mk @@ -27,9 +27,13 @@ endif SRCS += board.c SRCS += stdio.c SRCS += led.c +SRCS += w25.c SRCS += pb.c -MISC_DRIVERS_DIR ?= $(LIBS_DIR)/MiscDrivers +PROJ_CFLAGS+=-DSPIXF_RAM +PROJ_CFLAGS+=-DEXT_FLASH_W25 + +MISC_DRIVERS_DIR ?= $(MAXIM_PATH)/Libraries/MiscDrivers # Where to find BSP source files VPATH += $(BOARD_DIR)/Source diff --git a/Libraries/Boards/MAX32572/EvKit_V1/adapters.txt b/Libraries/Boards/MAX32572/EvKit_V1/adapters.txt index 90ef4c19906..93ce16025fa 100644 --- a/Libraries/Boards/MAX32572/EvKit_V1/adapters.txt +++ b/Libraries/Boards/MAX32572/EvKit_V1/adapters.txt @@ -1,2 +1,6 @@ CMSIS-DAP, interface/cmsis-dap.cfg MAX32625_PICO, interface/cmsis-dap.cfg +OLIMEX-ARM-USB-OCD-H, interface/ftdi/olimex-arm-usb-ocd-h.cfg +OLIMEX-ARM-USB-OCD-H SWD, interface/ftdi/olimex-arm-usb-ocd-h.cfg -f interface/ftdi/olimex-arm-jtag-swd.cfg +OLIMEX-ARM-USB-TINY-H, interface/ftdi/olimex-arm-usb-tiny-h.cfg +OLIMEX-ARM-USB-TINY-H SWD, interface/ftdi/olimex-arm-usb-tiny-h.cfg -f interface/ftdi/olimex-arm-jtag-swd.cfg \ No newline at end of file diff --git a/Libraries/PeriphDrivers/Source/UART/uart_me55.c b/Libraries/PeriphDrivers/Source/UART/uart_me55.c index 581ae6cee81..87aabebf70f 100644 --- a/Libraries/PeriphDrivers/Source/UART/uart_me55.c +++ b/Libraries/PeriphDrivers/Source/UART/uart_me55.c @@ -131,59 +131,12 @@ int MXC_UART_ReadyForSleep(mxc_uart_regs_t *uart) int MXC_UART_SetFrequency(mxc_uart_regs_t *uart, unsigned int baud, mxc_uart_clock_t clock) { int freq; - int mod = 0; - int clkdiv = 0; if (MXC_UART_GET_IDX(uart) < 0) { return E_BAD_PARAM; } - // check if the uart is LPUART - if (uart == MXC_UART3) { - // OSR default value - uart->osr = 5; - - switch (clock) { - case MXC_UART_APB_CLK: - clkdiv = ((IBRO_FREQ) / baud); - mod = ((IBRO_FREQ) % baud); - break; - - case MXC_UART_EXT_CLK: - uart->ctrl |= MXC_S_UART_CTRL_BCLKSRC_EXTERNAL_CLOCK; - break; - - case MXC_UART_ERTCO_CLK: - uart->ctrl |= MXC_S_UART_CTRL_BCLKSRC_CLK2; - uart->ctrl |= MXC_F_UART_CTRL_FDM; - if (baud == 9600) { - clkdiv = 7; - mod = 0; - } else { - clkdiv = ((ERTCO_FREQ * 2) / baud); - mod = ((ERTCO_FREQ * 2) % baud); - } - - if (baud > 2400) { - uart->osr = 0; - } else { - uart->osr = 1; - } - break; - - default: - return E_BAD_PARAM; - } - - if (!clkdiv || mod > (baud / 2)) { - clkdiv++; - } - uart->clkdiv = clkdiv; - - freq = MXC_UART_GetFrequency(uart); - } else { - freq = MXC_UART_RevB_SetFrequency((mxc_uart_revb_regs_t *)uart, baud, clock); - } + freq = MXC_UART_RevB_SetFrequency((mxc_uart_revb_regs_t *)uart, baud, clock); if (freq > 0) { // Enable baud clock and wait for it to become ready. @@ -196,30 +149,11 @@ int MXC_UART_SetFrequency(mxc_uart_regs_t *uart, unsigned int baud, mxc_uart_clo int MXC_UART_GetFrequency(mxc_uart_regs_t *uart) { - int periphClock = 0; - if (MXC_UART_GET_IDX(uart) < 0) { return E_BAD_PARAM; } - // check if UARt is LP UART - if (uart == MXC_UART3) { - if ((uart->ctrl & MXC_F_UART_CTRL_BCLKSRC) == MXC_S_UART_CTRL_BCLKSRC_EXTERNAL_CLOCK) { - return E_NOT_SUPPORTED; - } else if ((uart->ctrl & MXC_F_UART_CTRL_BCLKSRC) == - MXC_S_UART_CTRL_BCLKSRC_PERIPHERAL_CLOCK) { - periphClock = IBRO_FREQ; - } else if ((uart->ctrl & MXC_F_UART_CTRL_BCLKSRC) == MXC_S_UART_CTRL_BCLKSRC_CLK2) { - periphClock = ERTCO_FREQ * 2; - } else if ((uart->ctrl & MXC_F_UART_CTRL_BCLKSRC) == MXC_S_UART_CTRL_BCLKSRC_CLK3) { - periphClock = INRO_FREQ * 2; - } else { - return E_BAD_PARAM; - } - return (periphClock / uart->clkdiv); - } else { - return MXC_UART_RevB_GetFrequency((mxc_uart_revb_regs_t *)uart); - } + return MXC_UART_RevB_GetFrequency((mxc_uart_revb_regs_t *)uart); } int MXC_UART_SetDataSize(mxc_uart_regs_t *uart, int dataSize)