Swatantra-66 opened a new pull request, #21380: URL: https://github.com/apache/nuttx/pull/21380
## Summary Fixes #21377 In `arch/arm/src/stm32n6/stm32_serial.c`, `stm32serial_setformat()` writes the baud rate register (`BRR`), `CR2` STOP bits, and the parity/word length bits (`PCE`, `PS`, `M0`, `M1`) in `CR1` while the USART is enabled (`UE = 1`). Per the ST Reference Manual (RM0486), these registers/bits are write-protected and can only be written when the USART is disabled (`UE = 0`). Consequently, run-time `tcsetattr()` calls attempting to change baud rate, parity, or word length return success (`0`) while leaving the hardware USART registers unchanged. This patch clears `USART_CR1_UE` before the update and restores it upon completion inside a critical section, aligning the STM32N6 serial driver with the approved implementations in: - STM32L4 (commit `47180bf5ea`) - STM32WB (PR #21334, commit `0f22e12dd2`) - STM32WL5 (PR #21336, commit `1cc41cbcb1`) - STM32H7 and STM32F7 Also fixes pre-existing `nxstyle` case indentation issues in `stm32serial_ioctl()` and a comment typo in `stm32serial_rxint()`. ## Impact - **Is new feature added?** No - **Impact on user:** Bug fix. Runtime `tcsetattr()` calls to change serial line speed, parity, or format on STM32N6 now correctly reconfigure the hardware USART peripheral instead of silently failing. - **Impact on build:** None. - **Impact on hardware:** STM32N6 (Cortex-M55) series boards. - **Impact on documentation:** None. - **Impact on security:** None. - **Impact on compatibility:** Fully backwards compatible. ## Testing Verified code logic against ST Reference Manual RM0486. Built cleanly. Verified `nxstyle` compliance. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
