Skip to content
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

Correctly enable / disable InterruptIn Edges detection #4676

Merged
merged 4 commits into from
Jul 17, 2017

Conversation

LMESTM
Copy link
Contributor

@LMESTM LMESTM commented Jun 30, 2017

Description

When disabling GPIO irq, also the falling / rising edge settings need
to be reset (EXTI_RTSR and EXTI_FTSR registers).

See #2959:
If not reset, the same EXTI line can be later enabled again with a wrong
Rising / Falling configuration. This was especially seen and reported in
ci-test tests-api-interruptin on NUCLEO_F446RE target where DIO2=PA_10 and
DIO6=PB_10 were successively tested: as they are sharing the same EXTI_LINE
(EXTI_10), this resulted in calling the irq_handler with wrong
IRQ_FALL/IRQ_RAISE parameter and donothing being called in loop

Also after correctly disabling, another commit handles the save restore part.

Finally en error is added in case of spurious interrupt to make it easily detectable.

Status

READY

Tests results

NUCLEO_F446RE ci-test-shield passed ok
+-----------------------+---------------+-----------------------------+--------+--------------------+-------------+
| target | platform_name | test suite | result | elapsed_time (sec) | copy_method |
+-----------------------+---------------+-----------------------------+--------+--------------------+-------------+
| NUCLEO_F446RE-GCC_ARM | NUCLEO_F446RE | tests-api-analogin | OK | 12.3 | shell |
| NUCLEO_F446RE-GCC_ARM | NUCLEO_F446RE | tests-api-analogout | OK | 11.27 | shell |
| NUCLEO_F446RE-GCC_ARM | NUCLEO_F446RE | tests-api-businout | OK | 27.7 | shell |
| NUCLEO_F446RE-GCC_ARM | NUCLEO_F446RE | tests-api-digitalio | OK | 12.94 | shell |
| NUCLEO_F446RE-GCC_ARM | NUCLEO_F446RE | tests-api-i2c | OK | 13.87 | shell |
| NUCLEO_F446RE-GCC_ARM | NUCLEO_F446RE | tests-api-interruptin | OK | 12.72 | shell |
| NUCLEO_F446RE-GCC_ARM | NUCLEO_F446RE | tests-api-pwm | OK | 176.18 | shell |
| NUCLEO_F446RE-GCC_ARM | NUCLEO_F446RE | tests-api-spi | OK | 15.53 | shell |
| NUCLEO_F446RE-GCC_ARM | NUCLEO_F446RE | tests-assumptions-analogin | OK | 15.12 | shell |
| NUCLEO_F446RE-GCC_ARM | NUCLEO_F446RE | tests-assumptions-analogout | OK | 10.99 | shell |
| NUCLEO_F446RE-GCC_ARM | NUCLEO_F446RE | tests-assumptions-digitalio | OK | 13.72 | shell |
| NUCLEO_F446RE-GCC_ARM | NUCLEO_F446RE | tests-assumptions-i2c | OK | 11.36 | shell |
| NUCLEO_F446RE-GCC_ARM | NUCLEO_F446RE | tests-assumptions-pwm | OK | 11.86 | shell |
| NUCLEO_F446RE-GCC_ARM | NUCLEO_F446RE | tests-assumptions-pwmout | OK | 11.19 | shell |
| NUCLEO_F446RE-GCC_ARM | NUCLEO_F446RE | tests-assumptions-spi | OK | 11.81 | shell |
+-----------------------+---------------+-----------------------------+--------+--------------------+-------------+
mbedgt: test suite results: 15 OK

All families Interrupt-in tests passed
+-----------------------+---------------+-----------------------+--------+--------------------+-------------+
| target | platform_name | test suite | result | elapsed_time (sec) | copy_method |
+-----------------------+---------------+-----------------------+--------+--------------------+-------------+
| NUCLEO_F091RC-ARM | NUCLEO_F091RC | tests-api-interruptin | OK | 57.33 | shell |
| NUCLEO_F091RC-GCC_ARM | NUCLEO_F091RC | tests-api-interruptin | OK | 58.05 | shell |
| NUCLEO_F103RB-ARM | NUCLEO_F103RB | tests-api-interruptin | OK | 58.64 | shell |
| NUCLEO_F103RB-GCC_ARM | NUCLEO_F103RB | tests-api-interruptin | OK | 60.54 | shell |
| NUCLEO_F207ZG-ARM | NUCLEO_F207ZG | tests-api-interruptin | OK | 54.88 | shell |
| NUCLEO_F207ZG-GCC_ARM | NUCLEO_F207ZG | tests-api-interruptin | OK | 57.05 | shell |
| NUCLEO_F303ZE-ARM | NUCLEO_F303ZE | tests-api-interruptin | OK | 57.77 | shell |
| NUCLEO_F303ZE-GCC_ARM | NUCLEO_F303ZE | tests-api-interruptin | OK | 57.77 | shell |
| NUCLEO_F446RE-ARM | NUCLEO_F446RE | tests-api-interruptin | OK | 56.6 | shell |
| NUCLEO_F446RE-GCC_ARM | NUCLEO_F446RE | tests-api-interruptin | OK | 57.0 | shell |
| NUCLEO_F767ZI-ARM | NUCLEO_F767ZI | tests-api-interruptin | OK | 56.52 | shell |
| NUCLEO_F767ZI-GCC_ARM | NUCLEO_F767ZI | tests-api-interruptin | OK | 56.04 | shell |
| NUCLEO_L073RZ-ARM | NUCLEO_L073RZ | tests-api-interruptin | OK | 59.84 | shell |
| NUCLEO_L073RZ-GCC_ARM | NUCLEO_L073RZ | tests-api-interruptin | OK | 60.43 | shell |
| NUCLEO_L152RE-ARM | NUCLEO_L152RE | tests-api-interruptin | OK | 57.28 | shell |
| NUCLEO_L152RE-GCC_ARM | NUCLEO_L152RE | tests-api-interruptin | OK | 58.14 | shell |
| NUCLEO_L476RG-ARM | NUCLEO_L476RG | tests-api-interruptin | OK | 57.24 | shell |
| NUCLEO_L476RG-GCC_ARM | NUCLEO_L476RG | tests-api-interruptin | OK | 57.45 | shell |
+-----------------------+---------------+-----------------------+--------+--------------------+-------------+

When disabling GPIO irq, also the falling / rising edge settings need
to be reset (EXTI_RTSR and EXTI_FTSR registers).

If not reset, the same EXTI line can be later enabled again with a wrong
Rising / Falling configuration. This was especially seen and reported in
ci-test tests-api-interruptin on NUCLEO_F446RE target where DIO2=PA_10 and
DIO6=PB_10 were successively tested: as they are sharing the same EXTI_LINE
(EXTI_10), this resulted in calling the irq_handler with wrong
IRQ_FALL/IRQ_RAISE parameter and donothing being called in loop.
Now that rising / falling edge detection is disabled in the
gpio_irq_disable function, we also need to restore it when gpio_irq_enable
gets called.
In case we've run through the entire GPIOs loop, withouth finding a
matching interrupt, we're in the case of a spurious interrupt, let's
raise an error to track it down.
Copy link
Contributor

@0xc0170 0xc0170 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, just one line seems misaligned?

LL_EXTI_EnableRisingTrig_0_31(1 << STM_PIN(obj->pin));
}
if (obj->event & IRQ_FALL) {
LL_EXTI_EnableFallingTrig_0_31(1 << STM_PIN(obj->pin));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

misaligned

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I had forgotten that one ... done now !

@0xc0170
Copy link
Contributor

0xc0170 commented Jul 10, 2017

/morph test

@mbed-bot
Copy link

Result: FAILURE

Your command has finished executing! Here's what you wrote!

/morph test

Output

mbed Build Number: 760

Example Build failed!

@0xc0170
Copy link
Contributor

0xc0170 commented Jul 11, 2017

I noticed this failure for the second time today, IAR for one nucleo target, mash minimal throws an error, traceback does not say much, assuming this is assembly file, wrong CPU or ? @LMESTM Are you able to reproduce this? Please look at the CI output

@0xc0170
Copy link
Contributor

0xc0170 commented Jul 13, 2017

/morph test

@mbed-bot
Copy link

Result: SUCCESS

Your command has finished executing! Here's what you wrote!

/morph test

Output

mbed Build Number: 805

All builds and test passed!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants