[LPC15XX] Fixed µs_ticker implementation #2193

Merged
merged 3 commits into from Jul 22, 2016

Projects

None yet

3 participants

@neilt6
Contributor
neilt6 commented Jul 19, 2016

Re-wrote µs_ticker implementation to use SCT3 instead of RIT in order to fix a serious rollover bug at 1:11:34 (#1699).

neilt6 added some commits Jul 19, 2016
@neilt6 neilt6 [LPC15XX] Fixed µs_ticker implementation
Re-wrote µs_ticker implementation to use SCT3 instead of RIT in order to
fix a serious rollover bug at 1:11:34.
9f6b2c4
@neilt6 neilt6 [LPC15XX] Fixed µs_ticker implementation for GCC
Modified SCT3 match register critical section for compatibility with GCC toolchain.
d5f0985
@neilt6
Contributor
neilt6 commented Jul 19, 2016 edited

In regards to the Travis CI failure, it would seem that the GCC toolchain only implements void __disable_irq() and not int __disable_irq(). The integer version returns whether or not interrupts were already disabled, preventing nested critical section calls from re-enabling interrupts too soon. This is a problem that exists throughout the mbed library, and should really be investigated at some point.

@0xc0170
Member
0xc0170 commented Jul 20, 2016

In regards to the Travis CI failure, it would seem that the GCC toolchain only implements void __disable_irq() and not int __disable_irq(). The integer version returns whether or not interrupts were already disabled, preventing nested critical section calls from re-enabling interrupts too soon. This is a problem that exists throughout the mbed library, and should really be investigated at some point.

We added core_util_critical_section_enter/exit that shall be used

@neilt6 neilt6 [LPC15XX] Modified μs_ticker to use critical API
Replaced __disable_irq() and __enable_irq() with core_util_critical_section_enter() and core_util_critical_section_exit().
2259834
@neilt6
Contributor
neilt6 commented Jul 20, 2016

@0xc0170 - I was not aware of this, PR has been updated.

@0xc0170
Member
0xc0170 commented Jul 21, 2016

LGTM

@0xc0170
Member
0xc0170 commented Jul 21, 2016
@toyowata
Contributor

@neilt6 Thank you very much for this PR. The code looks good to me.
I have tested this with few example projects using Ticker with PwmOut and could not see any problem at all.

@0xc0170 0xc0170 merged commit 781fda0 into ARMmbed:master Jul 22, 2016

1 check passed

continuous-integration/travis-ci/pr The Travis CI build passed
Details
@neilt6 neilt6 deleted the unknown repository branch Jul 22, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment