-
Notifications
You must be signed in to change notification settings - Fork 3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add ability to use multiple UARTs on STM32L0, STM32G0 when IRQ is shared #15221
Conversation
@amcnicoll, thank you for your changes. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Waiting for @ARMmbed/team-st-mcd review as well
static void uart5_irq(void) | ||
{ | ||
#endif | ||
#if defined(USART4_BASE) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Preprocessor macros always at the line beginning, as it was in the file before, please align
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just pushed this.
Pull request has been modified.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
NUCLEO_G071RB doesn't compile
[Error] serial_device.c@368,21: use of undeclared identifier 'USART3_IRQn'
[Error] serial_device.c@373,21: use of undeclared identifier 'USART4_IRQn'
[Error] serial_device.c@388,21: use of undeclared identifier 'LPUART1_IRQn'; did you mean 'USART1_IRQn'?
Why partial ? |
Ah, my bad. Just pushed; give that a shot. Let me know if we're approaching squash territory. "Partial" because I have (and will) only take the time to fix STM32L0 and STM32G0 since these are heavy use entry-level lines. I assume this pattern/issue still exists on G4, L1, L4, L5, etc. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please try to build NUCLEO_G071RB
Thx
{ | ||
#if defined(USART2_BASE) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This line has to be removed ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually it appeared to be missing an #endif, fixed in fe698ea
I'm sorry, but I'm not sure what you mean by
I've read the contribution guide and can't quickly sort out how to test specific platforms, whether there are standard test projects, or anything of the sort. Are you suggesting I take the time to set up my own dummy project for STM32G071RB? I think I fixed the remaining issue - if your test passes then I think we're all set anyway. |
CI started |
Jenkins CI Test : ✔️ SUCCESSBuild Number: 1 | 🔒 Jenkins CI Job | 🌐 Logs & ArtifactsCLICK for Detailed Summary
|
Summary of changes
This commit is a partial solution to issue #15211
Description of the issue with repro steps are included above.
This change allows the concurrent use of multiple UARTs on STM32L0 and STM32G0 platforms, which share an interrupt among multiple UARTs. This is especially critical for STM32G0, where some parts share the same ISR for USART 3, 4, 5, 6 and LPUART1.
Impact of changes
The STM32L0 change has been tested to resolve my particular use case (using USART 4 and 5 and the same time).
I have not tested the changes for STM32G0.
The only side-effect I can think of is that more time will be spent inside the interrupt, particularly for
USART3_4_5_6_LPUART1_IRQn
on STM32G0. The interrupt handler will calluart_irq()
for each of the UARTs. But it will bail out of those calls pretty quickly if the UART is not in use (no interrupt flags set), so the impact seems minimal and worthwhile.Migration actions required
None that I'm aware of, unless the user is already patching around this issue themselves in unconventional ways.
Documentation
None that I'm aware of - could not find any documentation calling this issue out.
Pull request type
Test results
I'm not familiar with how mbed tests. I've only tested the STM32L0 on a real application/hardware. The STM32G0 test should at minimum be unit tested, if something covers that.
Reviewers
Thanks @0xc0170 for sending me here.