Skip to content

pic32cz fixes: better reset clock and uart restoration - #843

Open
rizlik wants to merge 3 commits into
wolfSSL:masterfrom
rizlik:pic32cz_fixes
Open

pic32cz fixes: better reset clock and uart restoration#843
rizlik wants to merge 3 commits into
wolfSSL:masterfrom
rizlik:pic32cz_fixes

Conversation

@rizlik

@rizlik rizlik commented Aug 4, 2026

Copy link
Copy Markdown
Contributor

No description provided.

Copilot AI lite review requested due to automatic review settings August 4, 2026 15:10
@rizlik
rizlik force-pushed the pic32cz_fixes branch 2 times, most recently from 84a9815 to 1d647a4 Compare August 4, 2026 15:11
@rizlik
rizlik requested review from bigbrett and danielinux August 4, 2026 15:12

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Improves PIC32CZ boot handoff behavior by deinitializing the debug UART before clock reset, adding a small PLL regulator settle delay and restoration logic, and adjusting the default wolfHSM PIC32CZ port path configuration.

Changes:

  • Add uart_deinit() for PIC32CZ SERCOM1 UART and call it before pic32_clock_reset() when preparing to boot.
  • Track whether the SUPC PLL regulator was already enabled at reset, add a settle delay after enabling it, and restore the regulator state before boot.
  • Change WOLFHSM_MICROCHIP_PIC32CZ from a required setting to a defaulted value in arch.mk.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 3 comments.

File Description
hal/uart/uart_drv_pic32cz.c Adds UART deinitialization to drain TX, disable/reset SERCOM, and release pin muxing before clock reset.
hal/pic32cz.c Tracks PLL regulator initial state, adds a settle delay after enabling it, deinitializes UART before clock reset, and restores PLL regulator state.
arch.mk Defaults the wolfHSM PIC32CZ port path variable instead of hard-erroring when unset.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread hal/pic32cz.c
Comment thread hal/pic32cz.c
Comment on lines 28 to 31
#ifdef DEBUG_UART
#include "uart_drv.h"
void uart_deinit(void);
#endif
Comment thread arch.mk
Comment on lines 290 to 292
ifeq ($(WOLFHSM_CLIENT),1)
ifeq ($(WOLFHSM_MICROCHIP_PIC32CZ),)
$(error WOLFHSM_MICROCHIP_PIC32CZ is not set: point it at the wolfHSM \
PIC32CZ client port directory (the one containing port/))
endif
WOLFHSM_MICROCHIP_PIC32CZ ?= ..

Comment thread hal/pic32cz.c
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.

3 participants