Skip to content

[pic32cz, uart] Add SERCOM UART support. Rename board config variables and PMUX enums#4

Merged
AlexLanzano merged 1 commit intowolfSSL:mainfrom
AlexLanzano:pic32cz
Feb 13, 2026
Merged

[pic32cz, uart] Add SERCOM UART support. Rename board config variables and PMUX enums#4
AlexLanzano merged 1 commit intowolfSSL:mainfrom
AlexLanzano:pic32cz

Conversation

@AlexLanzano
Copy link
Member

No description provided.

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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, gpio to g_whalSupply, g_whalClock, g_whalGpio for 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.

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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;
}

Copy link

Copilot AI Feb 13, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Suggested change
/* 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);

Copilot uses AI. Check for mistakes.
@AlexLanzano AlexLanzano merged commit 2343509 into wolfSSL:main Feb 13, 2026
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant