-
Notifications
You must be signed in to change notification settings - Fork 3k
Fix serial IRQ handling #10774
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
Fix serial IRQ handling #10774
Conversation
c2e8417
to
189b4d6
Compare
@ARMmbed/team-st-mcd |
@fkjagodzinski, 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.
Looks good to me - thanks.
should be applied to all STM32 targets in a similar way (the same MACROs should be available)
Check that the RX or TX interrupt is enabled before calling a registered handler with RxIrq or TxIrq arg.
Check that the RX or TX interrupt is enabled before calling a registered handler with RxIrq or TxIrq arg.
Check that the RX or TX interrupt is enabled before calling a registered handler with RxIrq or TxIrq arg.
Check that the RX or TX interrupt is enabled before calling a registered handler with RxIrq or TxIrq arg.
Check that the RX or TX interrupt is enabled before calling a registered handler with RxIrq or TxIrq arg.
Check that the RX or TX interrupt is enabled before calling a registered handler with RxIrq or TxIrq arg.
Check that the RX or TX interrupt is enabled before calling a registered handler with RxIrq or TxIrq arg.
Check that the RX or TX interrupt is enabled before calling a registered handler with RxIrq or TxIrq arg.
Check that the RX or TX interrupt is enabled before calling a registered handler with RxIrq or TxIrq arg.
Check that the RX or TX interrupt is enabled before calling a registered handler with RxIrq or TxIrq arg.
Check that the RX or TX interrupt is enabled before calling a registered handler with RxIrq or TxIrq arg.
Check that the RX or TX interrupt is enabled before calling a registered handler with RxIrq or TxIrq arg.
Check that the RX or TX interrupt is enabled before calling a registered handler with RxIrq or TxIrq arg.
Check that the RX or TX interrupt is enabled before calling a registered handler with RxIrq or TxIrq arg.
Check that the RX or TX interrupt is enabled before calling a registered handler with RxIrq or TxIrq arg.
Check that the RX or TX interrupt is enabled before calling a registered handler with RxIrq or TxIrq arg.
Check that the RX or TX interrupt is enabled before calling a registered handler with RxIrq or TxIrq arg.
189b4d6
to
8e3ca20
Compare
@fkjagodzinski |
@jeromecoutant I think I've covered all the affected ST targets. I provided patches for ST targets that have an
Checking F1, F2, F4 and L1 all already use
Of course I might have missed something. I've just checked |
@jeromecoutant could you re-review please ? |
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 one question left to be answered
@@ -62,12 +62,12 @@ static void uart_irq(UARTName uart_name) | |||
UART_HandleTypeDef *huart = &uart_handlers[id]; | |||
if (serial_irq_ids[id] != 0) { | |||
if (__HAL_UART_GET_FLAG(huart, UART_FLAG_TXE) != RESET) { | |||
if (__HAL_UART_GET_IT(huart, UART_IT_TXE) != RESET) { | |||
if (__HAL_UART_GET_IT(huart, UART_IT_TXE) != RESET && __HAL_UART_GET_IT_SOURCE(huart, UART_IT_TXE)) { |
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.
Ok so in case Interrupt has been disabled but FLAG is on anyway, handler will not be called, then shouldn't we clear the flag ?
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.
Giving it a second thought ... that should not be required. The flag could be left in current state I guess until inerrupt is activated again
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.
Good point; I haven't thought about that. In a normal flow, these flags are cleared by the handler (provided it actually calls serial_putc()
/ serial_getc()
):
- TXE is cleared by a write to the USART_TDR register,
- RXNE is cleared by a read to the USART_RDR register.
When the handler is not called, the flags will remain asserted. I can't think of any side effects of that right now. Both flags may be cleared with the use of USART_RQR though.
Right indeed. On F1, F2, F4, L1 __HAL_UART_GET_IT() is actually the same as __HAL_UART_GET_IT_SOURCE() from other families. From discussions we've had in #10853 , on those families _HAL_UART_GET_IT() does the same as __HAL_UART_GET_FLAG ... So I'm fine with this PR. |
@LMESTM could you approve on the review if you're happy now thanks. |
@kjbracey-arm could you possibly review on behalf of maintainers ? |
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.
for STM targets - approved
I can't find this in Travis logs, it has not even started. I'll reopen this PR |
Travis pending, should help |
CI started |
Test run: FAILEDSummary: 1 of 11 test jobs failed Failed test jobs:
|
All greentea tests run for
@0xc0170, is there a daplink/st-link issue on this board? |
Yes, also noticed in another test but latest one was all good, restarted |
This is ready to go in 👍 |
Description
Check that the RX or TX interrupt is enabled before calling a registered handler with
RxIrq
orTxIrq
arg.Fixes #10773
Pull request type
Reviewers
Release Notes