Open
Conversation
LCOV of commit
|
There was a problem hiding this comment.
Pull request overview
Expands the STM32L4 debug-UART selection to cover additional UART/USART peripherals and wires up the corresponding RCC + GPIO configuration in the STM32L4 HAL interface layer.
Changes:
- Extend
debug.uartallowed values to include USART1/2/3 and UART4 (in addition to UART5 and LPUART1). - Update
HAL_UART_MspInitto initialize clocks and pins for the newly supported UART instances. - Fix LPUART1 pin mapping to use PG7 (TX) / PG8 (RX).
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| options.toml | Expands the selectable debug UART peripherals. |
| machine/arm/stm32l4xx/interface/uart.c | Adds MSP init support for additional USART/UART instances and corrects LPUART1 RX pin. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This MR adds support for more UARTs (all the STM32L4 family has).
I have tested all UARTs' TX by using an USB to TTL CH340 bridge (3.3V), except for USART1 (this one is a bit weird, as on the Nucleo board the pin PA9, which would be tx, is not exposed) and LPUART1 (obviously this is directly available via the Nucleo USB connection).
Then I configured that UART as debug output, and had a program just print in a loop:
Then on Linux, get the output of the TTL connector:
stty -F /dev/ttyUSB0 115200 raw && cat /dev/ttyUSB0I'm not sure if we always want to set the mode, pull and speed this way (makes sense for output, may make less sense for other use cases like sensor drivers), but I'd leave it like that for now.
Also note the pin change for LPUART1, where the RX pin was wrong. PG7 is tx, PG8 is rx. So we keep the same tx pin (that's why output worked before) - see page 100 here.