Commit Graph

486 Commits (1eed0b960dc7905232410e9190c54010309d85d1)

Author SHA1 Message Date
Przemyslaw Stekiel 1eed0b960d Add HAL CRC test and test header file. 2018-06-07 10:17:21 +02:00
Martin Kojtal eddaa8b51b
Merge pull request #6515 from marcemmers/mbed_ticker_api
Only schedule mbed_ticker interrupt if queue->head is changed
2018-06-05 14:14:52 +02:00
Cruz Monrreal 583d77f04d
Merge pull request #7070 from ithinuel/increase_tolerance_for_systick_less_devices
set the tolerance to 5% if NO_SYSTICK is enabled
2018-06-04 10:42:04 -05:00
Cruz Monrreal 52cb119571
Merge pull request #7059 from deepikabhavnani/os_verison_fix
OS version not update in mbed_stats
2018-05-31 12:54:52 -05:00
Cruz Monrreal 26b5f9782f
Merge pull request #7005 from kivaisan/loraradio_tests
Lora: Add greentea tests for LoRaRadio API
2018-05-31 10:12:05 -05:00
Wilfried Chauveau 3745c73e91 set the tolerance to 5% if NO_SYSTICK is enabled 2018-05-31 13:05:37 +01:00
deepikabhavnani d764a7c627 OS version is not available in code, need a fix for this in next patch release 2018-05-30 08:57:47 -05:00
Marc Emmers 046cf1dc58 Ticker test: Add ticker_irq_handler call because the time reaching the previous interrupt_timestamp would have triggered one anyway 2018-05-30 11:36:21 +02:00
Veijo Pesonen 3e6bc32df6 Makes UDPSOCKET_SENDTO_INVALID part of the netsocket extended test set 2018-05-30 12:17:53 +03:00
Kimmo Vaisanen 4ba82c0892 Lora: Add greentea tests for LoRaRadio API
This LoRaRadio test set adds basic tests which can be run with a single HW.
2018-05-29 15:00:49 +03:00
Przemyslaw Stekiel 12be24c98c tests-mbed_hal-common_tickers: Fix increment test case implementation
In case when base tick count is different than next tick count check first if the difference is equal to 1 tick (this is what we are looking for) if not then decrease the tick count.

Repeat counting process few times before incrementing the number of cycles in case when base tick count is equal to next tick count.
2018-05-28 12:39:09 +02:00
Martin Kojtal 501a7b6949
Merge pull request #7009 from bulislaw/merge_feature_branches_for_5.9
Bring in improved HAL APIs to master
2018-05-28 12:31:14 +02:00
Bartek Szatkowski 4ae6491fd5 Disable sleep tests as they are unstable 2018-05-27 23:31:20 -05:00
Bartek Szatkowski 817bf0b092 Disable intermittently failing sleep test 2018-05-27 23:31:20 -05:00
Bartek Szatkowski a305d849a8 Rename LOWPOWERTIMER to LPTICKER 2018-05-25 13:06:56 -05:00
Przemyslaw Stekiel 500be1fbac Fix tolerance definition in ticker tests. 2018-05-25 13:04:23 -05:00
Bartek Szatkowski b9814fae9b Fix missmatch between feature branches and new CMSIS 2018-05-25 13:04:23 -05:00
Przemyslaw Stekiel c437e9d2c6 tests-mbed_hal-rtc_reset: Add ack from the device after each command is executed
RTC reset test was failing when board has been just powered and RTC reset test was executed for the first time (issue has been detected on CI). In such case RTC initialization takes more time than in futher rtc_init calls. This has impact on green-tea communication. Commands send by host immediately after init command (write, read) were not handled on the device side and no response to the host was provided.
To fix this problem test communication flow has been modified. Device sends ack to the host after RTC init is done. Host sends further RTC commands when ack from the device has been received.

Edit:
There are still some communication issues on the CI. Add ack from the device after each executed command. Increase test timeout and wait after reset.
2018-05-25 12:52:02 -05:00
Przemyslaw Stekiel a1d92e5168 HAL rtc test: increase test timeout.
Verified that on some platforms 30s is not enough.
2018-05-25 12:49:48 -05:00
Przemyslaw Stekiel 105b0ab851 HAL rtc test: check only if rtc_isenabled() returns 1 in case when init is done.
Since some platforms use RTC for low power timer RTC may be already enabled.
Because of that we will only verify if rtc_isenabled() returns 1 in case when init is done and RTC time is set.
2018-05-25 12:49:48 -05:00
Przemyslaw Stekiel a0f1627316 Update of RTC HAL API tests.
Provide minor fixes for existing test cases.
Add additional test cases.
2018-05-25 12:49:11 -05:00
Russ Butler 1f97f11373 Add documentation and test the HAL RTC API
Add requirements, tests, an example implementation and additional
function documentation to the HAL RTC API.
2018-05-25 12:37:19 -05:00
Bartek Szatkowski efd307fa79 Rename new occurrences of LOWPOWERTIMER to LPTICKER 2018-05-25 12:33:43 -05:00
Przemyslaw Stekiel e7fa5fc599 tests-mbed_hal-flash: optimieze time_cpu_cycles() function
This function should perform instruction cycles count in critical section.
Additionally remove redundant code.
2018-05-25 12:33:42 -05:00
Przemyslaw Stekiel be098399a8 tests-mbed_hal-flash: Remove 5% extra tolerance for NRF52_DK
NRF52_DK is now based on fast and accurate 1MHz counter.
2018-05-25 12:33:42 -05:00
Przemyslaw Stekiel 06c6db5119 tests-mbed_drivers-lp_timer: modify tolerance to percentage form
Represent tolerance value as it is done in `tests-mbed_drivers_timer`.
Use 5% tolerance for lp ticker.
2018-05-25 12:33:42 -05:00
Przemyslaw Stekiel a0a07d9725 tests-mbed_drivers-timerevent: increase tolerance for NRF52_DK
Test inserts event into the TimerEvent object which is scheduled 50 ms in the future. Then test thread hangs on the semaphore for 51 ms and after that time we expect that event handler has been executed. This test fails sometimes on NRF51_DK, NRF52_DK since different clocks are used for event handling and delay. TimerEvent class uses fast us ticker and semaphores are based on lp ticker (NRF51_DK) or System Tick Timer (NRF52_DK).
We assume that ticker measurement error is 10% and our 1 [ms] extra corresponds to 2% error. I suggest to increase delay to 2 [ms] (4%). This should be enough for all boards at this moment.
2018-05-25 12:33:42 -05:00
Przemyslaw Stekiel 50a5e2c1f4 tests-mbed_hal-common_tickers: fix bug in ticker increment test case
It is possible that the difference between base and next tick count on some platforms is greater than 1, in this case we need to repeat counting with the reduced number of cycles (for slower boards).
If number of cycles has been reduced than base tick count needs to be redefined. This operation is missing and is added by this patch.
2018-05-25 12:33:42 -05:00
Bartek Szatkowski 95559ad3e1 Change LPTICKER spec to allow clock freq starting at 4kHz 2018-05-25 12:32:39 -05:00
Przemyslaw Stekiel c18763bb41 tests-mbed_hal-common_tickers: disable os tick while running test cases
It has been noticed on NRF51_DK board that occurrence of system tick have impact on test execution.
NRF51_DK is a slow board with fast us ticker and handling of system tick interrupt takes about 250 us ticker ticks which have huge influence on interrupt tests where interrupt is set to <current count> + 100, 200, 500 ticks.
2018-05-25 12:30:52 -05:00
Przemyslaw Stekiel 75df9ecd19 tests-mbed_drivers-lp_ticker: increase tolerance for NRF51_DK
This test fails sometimes while testing 1 ms timeout on NRF51_DK board.
This board is very slow and lp ticker is inaccurate.
I noticed that measured results are very close to the tolerance value. For 1ms delay we measure in failure case 1560 us and tolerance is set to 550.
Since measurement method is also significantly flawed (extra time for setting up ticker and execution of a ticker irq handler) I recommend to increase tolerance by least +100 us for now.
2018-05-25 12:30:52 -05:00
Przemyslaw Stekiel a3d5921515 tests-mbed_drivers-timerevent: Disable deep-sleep mode in TestTimerEvent class.
Since now us ticker is disabled in deep-sleep mode and tests-mbed_drivers-timerevent verifies TimerEvent class which uses us ticker then deep-sleep mode needs to be disabled during the test execution.
2018-05-25 12:30:52 -05:00
Przemyslaw Stekiel 4fe068834c tests-events-queue: modify tolerance to percentage form
On some boards without SYSTICK support lp ticker is used to trace system ticks.
Event queue uses system ticker to count delay when callback is to be fired.
New ticker implementation for NRF51_DK provides fast and accurate counter for us ticker which shows inaccuracy of the system ticker(which is based on slow and inaccurate lp ticker). This is why measured error grows linearly and percentage form needs to be used.

Currently we use constant tolerance value equal to: 5 [ms].
This patch modifies tolerance to the following form: 5% of measured time [ms].

In this test the lowest delay is equal to 100 [ms], so 5% corresponds to 5 [ms] tolerance - original value. This means that min tolerance is 5 [ms] so this change should not have negative impact on other targets.
2018-05-25 12:30:52 -05:00
Przemyslaw Stekiel ff39a9874a 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.
2018-05-25 12:29:55 -05:00
Przemyslaw Stekiel 79f219bb3d 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.
2018-05-25 12:29:55 -05:00
Przemyslaw Stekiel b524a7f8d9 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
2018-05-25 12:29:54 -05:00
Przemyslaw Stekiel 8979212b78 tests-mbed_hal-lp_ticker: run sleep test only if SLEEP support is enabled. 2018-05-25 12:29:54 -05:00
Przemyslaw Stekiel 2323486bf3 tests-mbed_drivers-timerevent: perform test only if USTICKER support is enabled. 2018-05-25 12:29:54 -05:00
jeromecoutant 26313d8938 tests-mbed_hal-common_tickers_freq : correct overflowCounter value 2018-05-25 12:22:06 -05:00
jeromecoutant d2fff9cab3 tests-mbed_hal-common_tickers_freq : use unsigned long 2018-05-25 12:22:06 -05:00
Przemyslaw Stekiel ea61f9887e tests-mbed_hal-lp_ticker: Add overflow protection. 2018-05-25 12:21:16 -05:00
Russ Butler 9c2d758cda Restore ticker state after each test
Update the ticker common test to clean up after each case by restoring
the ticker IRQ handler. This allows tickers to function normally after
each case has completed.
2018-05-25 12:21:16 -05:00
jeromecoutant 69b51dffaf tests-mbed_hal-lp_ticker : increase time before deep sleep 2018-05-25 12:21:16 -05:00
Przemyslaw Stekiel 85ce887cea lp_us_tickers test: provide minor fixes after review
- count_ticks: fix counter overflow handling,
- count_ticks: use reg_cycles variable in while loop,
- increment test: reduce number of cycles for slow cores if measure process needs to be repeated (difference is greater than 1).
2018-05-25 12:20:10 -05:00
Przemyslaw Stekiel f6163a341c lp_us_tickers test: call overflow_protect function in test functions instead test setup handler.
This is done to bypass green-tea setup handler which takes additional time.
2018-05-25 12:20:10 -05:00
Przemyslaw Stekiel 8f52816bba lp_us_tickers test: fix overflow protection
On slow targets with fast high frequency tickers like NRF51_DK (16 Mhz CPU/1MHz ticker) time window for test case execution without overflow needs to be increased. Add parameter to `overflow_protect` function to be able to set different time window without overflow for us ticker and lp ticker.
2018-05-25 12:20:10 -05:00
Przemyslaw Stekiel 0ecf58f51c lp_us_tickers test: fix `increment test` for slow boards
Increment test proves that ticker counter is incremented by one.
This is done indirectly for high frequency counters where it is impossible to read 'value' and 'value + 1' in two successive ticker reads.
This check is done indirectly by counting ticker ticks elapsed during execution of N cycles of empty while loop. Unfortunately on slow boards with fast tickers like NRF51_DK(16 MHz CPU/1MHz hf ticker) it is possible that for the same N cycles measured number of elapsed ticks in two successive calls is greater than 1. This patch provides fix for such case - measure operation is repeated with the same number of cycles.
2018-05-25 12:20:10 -05:00
Bartek Szatkowski a92ff94904 Fix rebase error 2018-05-25 12:20:10 -05:00
Bartek Szatkowski ba963b4453 Rename lp_us tests to common and hf to microsecond 2018-05-25 12:20:09 -05:00
Bartek Szatkowski 6e9f04bf2f Rename DEVICE_LOWPOWERTIMER to DEVICE_LPTICKER
That's to match DEVICE_USTICKER.
2018-05-25 12:20:09 -05:00