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

cpu/stm32_common/uart: fix rare uart failure #12100

Merged
merged 3 commits into from
Sep 10, 2019

Conversation

toonst
Copy link
Member

@toonst toonst commented Aug 27, 2019

Contribution description

in uart_poweroff the peripheral should be disabled through the register instead of just disabling the peripheral clock. In uart_poweron the peripheral should be enabled after enabling the clock.

This change seems to fix some rare issues with the uart not working properly after a power off.

Testing procedure

I reproduced the issue by letting a custom app run for a few hours which powers the uart on & off. At some point the uart_write was not actually sending any data on the TX line.

Issues/PRs references

none

Toon Stegen added 2 commits August 27, 2019 19:09
in uart_poweroff the peripheral should be disabled through the register
instead of just disabling the peripheral clock. In uart_poweron the
peripheral should be enabled after enabling the clock.

Not explicitely disabling the peripheral causes some bad signals on the
uart line sometimes.
once hardware flow control is enabled, rts should only be initialized
after the uart is enabled by setting the UE flag. This is stated in the
stm32f4 errata.
@aabadie aabadie added Area: cpu Area: CPU/MCU ports Platform: ARM Platform: This PR/issue effects ARM-based platforms Type: bug The issue reports a bug / The PR fixes a bug (including spelling errors) labels Aug 28, 2019
@aabadie aabadie added CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR Reviewed: 1-fundamentals The fundamentals of the PR were reviewed according to the maintainer guidelines Reviewed: 2-code-design The code design of the PR was reviewed according to the maintainer guidelines Reviewed: 4-code-style The adherence to coding conventions by the PR were reviewed according to the maintainer guidelines Reviewed: 5-documentation The documentation details of the PR were reviewed according to the maintainer guidelines labels Sep 9, 2019
Copy link
Contributor

@aabadie aabadie left a comment

Choose a reason for hiding this comment

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

LGTM. @fjmolinas is it possible to test this PR on your STM32 cluster ?

@fjmolinas
Copy link
Contributor

LGTM. @fjmolinas is it possible to test this PR on your STM32 cluster ?

Will do, I'm testing some watchdog stuff but I will do that promptly. Do you want to run all tests or a subset?

@aabadie
Copy link
Contributor

aabadie commented Sep 9, 2019

Do you want to run all tests or a subset?

This is touching UART so I don't see any particular restriction. Just run them all :)

@fjmolinas
Copy link
Contributor

Here are the results:

failuresummary.md

nucleo-f091rc/failuresummary.md

Failures during test:
- [tests/driver_grove_ledbar](tests/driver_grove_ledbar/test.failed)
- [tests/driver_my9221](tests/driver_my9221/test.failed)
- [tests/gnrc_ipv6_ext](tests/gnrc_ipv6_ext/test.failed)
- [tests/gnrc_rpl_srh](tests/gnrc_rpl_srh/test.failed)
- [tests/gnrc_sock_dns](tests/gnrc_sock_dns/test.failed)
- [tests/pkg_fatfs_vfs](tests/pkg_fatfs_vfs/test.failed)
- [tests/shell](tests/shell/test.failed)
- [tests/ssp](tests/ssp/test.failed)

Failures during test.flash:
- [tests/stdin](tests/stdin/test.flash.failed)
- [tests/struct_tm_utility](tests/struct_tm_utility/test.flash.failed)
- [tests/sys_arduino](tests/sys_arduino/test.flash.failed)
- [tests/sys_crypto](tests/sys_crypto/test.flash.failed)
- [tests/test_tools](tests/test_tools/test.flash.failed)
- [tests/thread_basic](tests/thread_basic/test.flash.failed)
- [tests/thread_cooperation](tests/thread_cooperation/test.flash.failed)
- [tests/thread_exit](tests/thread_exit/test.flash.failed)
- [tests/thread_flags](tests/thread_flags/test.flash.failed)
- [tests/thread_flags_xtimer](tests/thread_flags_xtimer/test.flash.failed)
- [tests/thread_flood](tests/thread_flood/test.flash.failed)
- [tests/thread_msg](tests/thread_msg/test.flash.failed)
- [tests/thread_msg_block_race](tests/thread_msg_block_race/test.flash.failed)
- [tests/thread_msg_block_w_queue](tests/thread_msg_block_w_queue/test.flash.failed)
- [tests/thread_msg_block_wo_queue](tests/thread_msg_block_wo_queue/test.flash.failed)
- [tests/thread_msg_seq](tests/thread_msg_seq/test.flash.failed)
- [tests/thread_race](tests/thread_race/test.flash.failed)
- [tests/trickle](tests/trickle/test.flash.failed)
- [tests/xtimer_hang](tests/xtimer_hang/test.flash.failed)
- [tests/xtimer_msg](tests/xtimer_msg/test.flash.failed)
- [tests/xtimer_msg_receive_timeout](tests/xtimer_msg_receive_timeout/test.flash.failed)
- [tests/xtimer_mutex_lock_timeout](tests/xtimer_mutex_lock_timeout/test.flash.failed)
- [tests/xtimer_now64_continuity](tests/xtimer_now64_continuity/test.flash.failed)
- [tests/xtimer_periodic_wakeup](tests/xtimer_periodic_wakeup/test.flash.failed)
- [tests/xtimer_remove](tests/xtimer_remove/test.flash.failed)
- [tests/xtimer_reset](tests/xtimer_reset/test.flash.failed)
- [tests/xtimer_usleep](tests/xtimer_usleep/test.flash.failed)
- [tests/xtimer_usleep_short](tests/xtimer_usleep_short/test.flash.failed)

#### nucleo-f103rb/failuresummary.md

Failures during test:
- [tests/driver_grove_ledbar](tests/driver_grove_ledbar/test.failed)
- [tests/driver_my9221](tests/driver_my9221/test.failed)
- [tests/gnrc_ipv6_ext](tests/gnrc_ipv6_ext/test.failed)
- [tests/gnrc_rpl_srh](tests/gnrc_rpl_srh/test.failed)
- [tests/gnrc_sock_dns](tests/gnrc_sock_dns/test.failed)
- [tests/pkg_fatfs_vfs](tests/pkg_fatfs_vfs/test.failed)
- [tests/shell](tests/shell/test.failed)
- [tests/xtimer_periodic_wakeup](tests/xtimer_periodic_wakeup/test.failed)
- [tests/xtimer_usleep_short](tests/xtimer_usleep_short/test.failed)

#### nucleo-f207zg/failuresummary.md

Failures during compilation:
- [tests/riotboot](tests/riotboot/compilation.failed)

Failures during test:
- [tests/gnrc_ipv6_ext](tests/gnrc_ipv6_ext/test.failed)
- [tests/gnrc_rpl_srh](tests/gnrc_rpl_srh/test.failed)
- [tests/gnrc_sock_dns](tests/gnrc_sock_dns/test.failed)
- [tests/pkg_fatfs_vfs](tests/pkg_fatfs_vfs/test.failed)
- [tests/shell](tests/shell/test.failed)

#### nucleo-f303k8/failuresummary.md

Failures during compilation:
- [tests/riotboot](tests/riotboot/compilation.failed)

Failures during test:
- [tests/cpp11_condition_variable](tests/cpp11_condition_variable/test.failed)
- [tests/driver_grove_ledbar](tests/driver_grove_ledbar/test.failed)
- [tests/driver_hd44780](tests/driver_hd44780/test.failed)
- [tests/driver_my9221](tests/driver_my9221/test.failed)
- [tests/pkg_fatfs_vfs](tests/pkg_fatfs_vfs/test.failed)
- [tests/pthread_cooperation](tests/pthread_cooperation/test.failed)
- [tests/shell](tests/shell/test.failed)

#### nucleo-f446re/failuresummary.md

Failures during compilation:
- [tests/riotboot](tests/riotboot/compilation.failed)

Failures during test:
- [tests/driver_grove_ledbar](tests/driver_grove_ledbar/test.failed)
- [tests/driver_my9221](tests/driver_my9221/test.failed)
- [tests/gnrc_ipv6_ext](tests/gnrc_ipv6_ext/test.failed)
- [tests/gnrc_rpl_srh](tests/gnrc_rpl_srh/test.failed)
- [tests/gnrc_sock_dns](tests/gnrc_sock_dns/test.failed)
- [tests/pkg_fatfs_vfs](tests/pkg_fatfs_vfs/test.failed)
- [tests/shell](tests/shell/test.failed)

#### nucleo-f767zi/failuresummary.md

Failures during compilation:
- [tests/riotboot](tests/riotboot/compilation.failed)

Failures during test:
- [tests/gnrc_ipv6_ext](tests/gnrc_ipv6_ext/test.failed)
- [tests/gnrc_rpl_srh](tests/gnrc_rpl_srh/test.failed)
- [tests/gnrc_sock_dns](tests/gnrc_sock_dns/test.failed)
- [tests/shell](tests/shell/test.failed)

#### nucleo-l073rz/failuresummary.md

Failures during compilation:
- [tests/riotboot](tests/riotboot/compilation.failed)

Failures during test:
- [tests/driver_grove_ledbar](tests/driver_grove_ledbar/test.failed)
- [tests/driver_my9221](tests/driver_my9221/test.failed)
- [tests/gnrc_ipv6_ext](tests/gnrc_ipv6_ext/test.failed)
- [tests/gnrc_rpl_srh](tests/gnrc_rpl_srh/test.failed)
- [tests/gnrc_sock_dns](tests/gnrc_sock_dns/test.failed)
- [tests/pkg_fatfs_vfs](tests/pkg_fatfs_vfs/test.failed)
- [tests/shell](tests/shell/test.failed)

#### nucleo-l152re/failuresummary.md

Failures during compilation:
- [tests/riotboot](tests/riotboot/compilation.failed)

Failures during test:
- [tests/driver_grove_ledbar](tests/driver_grove_ledbar/test.failed)
- [tests/driver_my9221](tests/driver_my9221/test.failed)
- [tests/gnrc_ipv6_ext](tests/gnrc_ipv6_ext/test.failed)
- [tests/gnrc_rpl_srh](tests/gnrc_rpl_srh/test.failed)
- [tests/gnrc_sock_dns](tests/gnrc_sock_dns/test.failed)
- [tests/pkg_fatfs_vfs](tests/pkg_fatfs_vfs/test.failed)
- [tests/shell](tests/shell/test.failed)

#### nucleo-l432kc/failuresummary.md

Failures during compilation:
- [tests/riotboot](tests/riotboot/compilation.failed)

Failures during test:
- [tests/driver_grove_ledbar](tests/driver_grove_ledbar/test.failed)
- [tests/driver_hd44780](tests/driver_hd44780/test.failed)
- [tests/driver_my9221](tests/driver_my9221/test.failed)
- [tests/gnrc_ipv6_ext](tests/gnrc_ipv6_ext/test.failed)
- [tests/gnrc_rpl_srh](tests/gnrc_rpl_srh/test.failed)
- [tests/gnrc_sock_dns](tests/gnrc_sock_dns/test.failed)
- [tests/pkg_fatfs_vfs](tests/pkg_fatfs_vfs/test.failed)
- [tests/shell](tests/shell/test.failed)

The failures with nucleo-f091rc are because this PR isn't rebased on #11976. All tests/riotboot fail because I'm compiling in docker and there is an issue there, and tests/shell because I didn't have socat at the time of the test on my ci-machine. I see no issue on my side with this PR.

@toonst if possible could you post the terminal output that showed the issue.

Copy link
Contributor

@aabadie aabadie left a comment

Choose a reason for hiding this comment

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

No obvious failure reported by @fjmolinas. We discussed the problem IRL with @toonst and the changes of this PR make sense.

Let's merge this, so ACK.

@aabadie aabadie merged commit 3d8c4d5 into RIOT-OS:master Sep 10, 2019
@fjmolinas
Copy link
Contributor

fjmolinas commented Sep 10, 2019

We discussed the problem IRL with @toonst and the changes of this PR make sense.

If there is more context to what is stated in the PR, its better if you also comment it in the PR.

@toonst if possible could you post the terminal output that showed the issue.

For future PR's it would be ideal if you could post in the PR the details of your setup that caused the issue and some terminal output that showcases it. In any case thanks for the fix!

@toonst
Copy link
Member Author

toonst commented Sep 10, 2019

I used our custom app & board to reproduce this issue. I will try to find time to make an upstreamable test to reproduce.

@fjmolinas
Copy link
Contributor

I used our custom app & board to reproduce this issue. I will try to find time to make an upstreamable test to reproduce.

No need in this case, its unnecessary overhead here. My comment was just intended as a suggestion for future PR's ;) .

@kb2ma kb2ma added this to the Release 2019.10 milestone Sep 16, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area: cpu Area: CPU/MCU ports CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR Platform: ARM Platform: This PR/issue effects ARM-based platforms Reviewed: 1-fundamentals The fundamentals of the PR were reviewed according to the maintainer guidelines Reviewed: 2-code-design The code design of the PR was reviewed according to the maintainer guidelines Reviewed: 4-code-style The adherence to coding conventions by the PR were reviewed according to the maintainer guidelines Reviewed: 5-documentation The documentation details of the PR were reviewed according to the maintainer guidelines Type: bug The issue reports a bug / The PR fixes a bug (including spelling errors)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants