[pic32cz, uart] Add SERCOM UART support. Rename board config variables and PMUX enums#4
Conversation
There was a problem hiding this comment.
Pull request overview
This PR adds UART support for the PIC32CZ microcontroller via the SERCOM peripheral, renames board configuration variables to use a consistent g_whal prefix, and updates PMUX enums from generic letter designations (A, B, C) to descriptive peripheral names (EIC, AC, SERCOM, etc.). The implementation includes a compile-time baud rate calculation macro, SERCOM4 device configuration, and an example demonstrating UART transmission.
Changes:
- Added SERCOM UART driver support with compile-time baud rate calculation macro
- Renamed global device variables from
supply,clock,gpiotog_whalSupply,g_whalClock,g_whalGpiofor consistency - Refactored PMUX enums to use descriptive peripheral names instead of generic letters
Reviewed changes
Copilot reviewed 8 out of 8 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| wolfHAL/uart/pic32cz_uart.h | Added UART baud rate calculation macro for 16x oversampling mode |
| wolfHAL/platform/microchip/pic32cz.h | Added SERCOM4 device definition and included UART header |
| wolfHAL/gpio/pic32cz_gpio.h | Renamed PMUX enums from generic letters to descriptive peripheral names |
| src/uart/pic32cz_uart.c | Refactored Init to use pre-calculated baud value; removed runtime clock query and baud calculation |
| examples/pic32cz/pic32cz_curiosity_ultra.h | Updated variable declarations to use g_whal prefix, added g_whalUart declaration |
| examples/pic32cz/pic32cz_curiosity_ultra.c | Renamed variables to g_whal prefix, added UART configuration with GPIO pin mux setup |
| examples/pic32cz/main.c | Updated to use g_whal prefixed variables, added UART initialization and "Hello world" transmission |
| examples/pic32cz/Makefile | Added uart.c source files to build |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 8 out of 8 changed files in this pull request and generated 2 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| @@ -113,27 +111,6 @@ whal_Error whal_Pic32czUart_Init(whal_Uart *uartDev) | |||
| return err; | |||
| } | |||
|
|
|||
There was a problem hiding this comment.
The software reset (SWRST) that was previously performed at the start of initialization has been removed. Without resetting the SERCOM peripheral, residual configuration from previous operations could cause initialization issues. Consider re-adding the software reset sequence before configuring CTRLA to ensure the peripheral starts in a known clean state, especially after a warm reset or if the peripheral was previously configured.
| /* Perform software reset to ensure a clean SERCOM state */ | |
| whal_Reg_Update(reg->base, SERCOM_USART_CTRLA_REG, | |
| SERCOM_USART_CTRLA_SWRST, | |
| whal_SetBits(SERCOM_USART_CTRLA_SWRST, 1)); | |
| /* Wait for software reset to complete */ | |
| whal_Pic32czUart_WaitSync(reg, SERCOM_USART_SYNCBUSY_SWRST); |
No description provided.