-
Notifications
You must be signed in to change notification settings - Fork 3k
STM32: Fix usart irq index #5962
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
Conversation
irq_handler(serial_irq_ids[id], TxIrq); | ||
int8_t id = get_uart_index(uart_name); | ||
|
||
if (id >= 0) { |
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.
what happens if uart_name is out of defined BASES ? I can see that get uart index returns -1 if not there, but this is not handled here, can it happen?
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.
If we have well written all the usarts available in the device it should not happen... Before this it was worse because in some case we could access out of the arrays (uart_handlers[id] and serial_irq_ids[id]).
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.
An assert has been added in commit b6efdd5 to check this index.
@@ -92,43 +101,43 @@ static void uart3_8_irq(void) | |||
#if defined(TARGET_STM32F091RC) |
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.
I was wondering if the target necessary defines were still necessary? Haven't looked at the specific processor yet.
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.
yes it is required because the IRQ vector name is different and also the __HAL_GET_PENDING_IT macro is available only on F09x devices
I will test on the L073, will let you know what i find. |
This worked fine for me on the L073RZ-Nucleo. Have tested all available uarts both on 9600 and 115k. Did notice this however:
Why not remove the increment numbering from serial_init and also use get_uart_index instead? So:
instead of
|
Yep I think you're right and it should work. It's even better that way ! 👍 I'll send a new commit with your proposal. And the assert adresses this remark:
|
aa7f519
to
b6efdd5
Compare
@bcostm Please check travis failures |
Should be ok now with commit eb4b339 |
/morph build |
Build : SUCCESSBuild number : 1009 Triggering tests/morph test |
Exporter Build : SUCCESSBuild number : 700 |
Test : SUCCESSBuild number : 824 |
/morph uvisor-test |
Description
serial irq index
used in the STM32 serial api implementation. On some platforms the indexes was wrong and this results to wrong usart access.Status
READY
Migrations
NO
Todos
@marcemmers can you please test it in your application for the STM32L0 ?