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
NRF_51_DK - adapt lp/us ticker drivers to the new standards #5629
NRF_51_DK - adapt lp/us ticker drivers to the new standards #5629
Commits on Apr 20, 2018
-
NRF5 - make us ticker to be driven by high speed 1MHz timer
According to new ticker standards the following requirements for us ticker are not met on RRF5 boards: - has a frequency between 250KHz and 8MHz (currently is driven by 32kHz clock) - ticker increments by 1 each tick (currently is scaled to 1 MHz by incrementing counter by ~31) Since BLE softdevice uses TIMER0 the proposition is to use high speed TIMER1 for us ticker configured as follows: - TIMER counter width: 16 bits (max) - TIMER frequency: 1MHz This solution also uses Timer's capture/compare register 0 to specify interrupt time and Timer's capture/compare register 1 to read current timer value.
Configuration menu - View commit details
-
Copy full SHA for aee099c - Browse repository at this point
Copy the full SHA aee099cView commit details
Commits on Apr 23, 2018
-
Configuration menu - View commit details
-
Copy full SHA for d700144 - Browse repository at this point
Copy the full SHA d700144View commit details -
Update lp ticker to be consistent with the new standards.
Provide the following modifications for lp ticker driver: - According to NRF51_DK reference manual rtc interrupt cannot be controlled by rtc event. In the previous implementation interrupts were enabled permanently and specific interrupt was enabled/disabled by enabling/disabling the specific event. If event is enabled, then event signal is provided to Programmable Peripheral Interconnect (PPI). If interrupt is enabled, then interrupt signal is provided to Nested Vector Interrupt Controller (NVIC). Disable all events permanently. Enable lp ticker overflow interrupt permanently(needed for RTC), disable lp ticker capture/compare interrupt on init (lp_ticker_init) , enable lp ticker interrupt when lp ticker interrupt is set (lp_ticker_set_interrupt), disable lp ticker interrupt on disable request(lp_ticker_disable_interrupt). - Provide lp ticker data for higher level (freq: 32kHz / len: 24 bits), - Add the following features to init routine: disable lp ticker interrupt. - Make ticker driver to operate on ticks instead of us. - Simplify lp ticker read and set interrupt routines (upper layers handle conversion to us and interrupt scheduling).
Configuration menu - View commit details
-
Copy full SHA for bab5e60 - Browse repository at this point
Copy the full SHA bab5e60View commit details -
Configuration menu - View commit details
-
Copy full SHA for 098a30a - Browse repository at this point
Copy the full SHA 098a30aView commit details -
Configuration menu - View commit details
-
Copy full SHA for 21058a4 - Browse repository at this point
Copy the full SHA 21058a4View commit details -
tests-mbed_drivers-lp_ticker: Adapt tolerance for new Ticker driver
Since this change concerns new ticker driver for NRF51_DK it goas on ticker feature branch. On master NRF51_DK Ticker driver uses 32kHz RTC for lp and us ticker. Test uses us ticker to measure lp ticker interrupt scheduling (LowPowerTicker.attach), but since the same hardware is used for both tickers the measurement error is constant. On this branch us ticker uses 1 MHz higher precision clock and the results are different - measurement error grows linearly and shows inaccuracy of the RTC. Test implements constant delta for measured time equal to 2000 us. Change delta so it depends on lp ticker tested timeout value: 500us for measurement inaccuracy + 5% tolerance for LowPowerTicker
Configuration menu - View commit details
-
Copy full SHA for 6c6e36f - Browse repository at this point
Copy the full SHA 6c6e36fView commit details -
tests-mbed_drivers-timer: Adapt tolerance for new Ticker driver
Since this change concerns new ticker driver for NRF51_DK it goas on ticker feature branch. On this branch us ticker is based on 1 MHz higher precision counter (on master is based on 32kHz RTC). As a result of using higher precision counter measurement error increased: :485::FAIL: Expected 1.060000 Was 1.070478 For delay 1060 ms we measured ~1070 ms so we have about ~1% measurement error which is not bed for this board. To make it work with 1MHz us ticker increase test tolerance. Define tolerance as follows: tolerance = 500us + 0.02 * delay.
Configuration menu - View commit details
-
Copy full SHA for 467f6e2 - Browse repository at this point
Copy the full SHA 467f6e2View commit details -
Configuration menu - View commit details
-
Copy full SHA for b832022 - Browse repository at this point
Copy the full SHA b832022View commit details -
tests-mbed_hal-common_tickers: increase overflow protection limit
For NR51_DK US_TICKER_OV_LIMIT needs to be increased since if test is run few times in row sometimes fails. This is because NR51_DK is a slow board (16 MHz) with fast and short us ticker counter 1 MHz/16 bits.
Configuration menu - View commit details
-
Copy full SHA for de4bcba - Browse repository at this point
Copy the full SHA de4bcbaView commit details