Skip to content

ARM_BEETLE_SOC: lp_ticker implementation broken #2525

@bulislaw

Description

@bulislaw

New tests are failing for Beetle board: tests-mbed_drivers-lp_timeout and tests-mbed_hal-lp_ticker. I spent quite a bit of time investigating this issue, but didn't get too far. pyOCD is unable to attach a breakpoint while debugging and printing info on serial introduces too much overhead for it to be reliable.
It seems that the board can handle 1 timeout very well (tested up to 30s), but when there are 2 consecutive waits longer than 'some milliseconds' eg 2x1s the second delay/wait will never finish.

eg

void cb_done() {
    complete = true;
}

int main() {
    LowPowerTimeout lpt;
    complete = false;
    uint32_t start, end;
    printf("START\r\n");

    start = us_ticker_read();
    lpt.attach_us(&cb_done, 1000000);
    while (!complete);
    end = us_ticker_read();
    printf("DIFF: %u\r\n", end - start);

    complete = false;
    start = us_ticker_read();
    lpt.attach_us(&cb_done, 1000000);
    while (!complete);
    end = us_ticker_read();
    printf("DIFF: %u\r\n", end - start);

or for test runs:

mbedgt: test suite 'tests-mbed_drivers-lp_timeout' ................................................... TIMEOUT in 49.06 sec
    test case: '1ms LowPowerTimeout' ............................................................. OK in 0.04 sec
    test case: '1sec LowPowerTimeout' ............................................................ ERROR in 0.00 sec
    test case: '1sec LowPowerTimeout from deepsleep' ............................................. SKIPPED in 0.00 sec
    test case: '1sec LowPowerTimeout from sleep' ................................................. SKIPPED in 0.00 sec
    test case: '500us LowPowerTimeout' ........................................................... OK in 0.05 sec
    test case: '5sec LowPowerTimeout' ............................................................ SKIPPED in 0.00 sec
mbedgt: all tests finished!
mbedgt: shuffle seed: 0.4031991574
mbedgt: test suite report:
+------------------------+----------------+-------------------------------+---------+--------------------+-------------+
| target                 | platform_name  | test suite                    | result  | elapsed_time (sec) | copy_method |
+------------------------+----------------+-------------------------------+---------+--------------------+-------------+
| ARM_BEETLE_SOC-GCC_ARM | ARM_BEETLE_SOC | tests-mbed_drivers-lp_timeout | TIMEOUT | 49.06              | shell       |
+------------------------+----------------+-------------------------------+---------+--------------------+-------------+
mbedgt: test suite results: 1 TIMEOUT
mbedgt: test case report:
+------------------------+----------------+-------------------------------+-------------------------------------+--------+--------+---------+--------------------+
| target                 | platform_name  | test suite                    | test case                           | passed | failed | result  | elapsed_time (sec) |
+------------------------+----------------+-------------------------------+-------------------------------------+--------+--------+---------+--------------------+
| ARM_BEETLE_SOC-GCC_ARM | ARM_BEETLE_SOC | tests-mbed_drivers-lp_timeout | 1ms LowPowerTimeout                 | 1      | 0      | OK      | 0.04               |
| ARM_BEETLE_SOC-GCC_ARM | ARM_BEETLE_SOC | tests-mbed_drivers-lp_timeout | 1sec LowPowerTimeout                | 0      | 0      | ERROR   | 0.0                |
| ARM_BEETLE_SOC-GCC_ARM | ARM_BEETLE_SOC | tests-mbed_drivers-lp_timeout | 1sec LowPowerTimeout from deepsleep | 0      | 0      | SKIPPED | 0.0                |
| ARM_BEETLE_SOC-GCC_ARM | ARM_BEETLE_SOC | tests-mbed_drivers-lp_timeout | 1sec LowPowerTimeout from sleep     | 0      | 0      | SKIPPED | 0.0                |
| ARM_BEETLE_SOC-GCC_ARM | ARM_BEETLE_SOC | tests-mbed_drivers-lp_timeout | 500us LowPowerTimeout               | 1      | 0      | OK      | 0.05               |
| ARM_BEETLE_SOC-GCC_ARM | ARM_BEETLE_SOC | tests-mbed_drivers-lp_timeout | 5sec LowPowerTimeout                | 0      | 0      | SKIPPED | 0.0                |
+------------------------+----------------+-------------------------------+-------------------------------------+--------+--------+---------+--------------------+
mbedgt: test case results: 3 SKIPPED / 2 OK / 1 ERROR
mbedgt: test suite 'tests-mbed_hal-lp_ticker' ........................................................ TIMEOUT in 48.98 sec
    test case: '1ms lp_ticker' ................................................................... OK in 0.04 sec
    test case: '1s lp_ticker' .................................................................... ERROR in 0.00 sec
    test case: '1s lp_ticker deepsleep' .......................................................... SKIPPED in 0.00 sec
    test case: '1s lp_ticker sleep' .............................................................. SKIPPED in 0.00 sec
    test case: '500us lp_ticker' ................................................................. OK in 0.04 sec
    test case: '5s lp_ticker' .................................................................... SKIPPED in 0.00 sec
mbedgt: all tests finished!
mbedgt: shuffle seed: 0.0260624216
mbedgt: test suite report:
+------------------------+----------------+--------------------------+---------+--------------------+-------------+
| target                 | platform_name  | test suite               | result  | elapsed_time (sec) | copy_method |
+------------------------+----------------+--------------------------+---------+--------------------+-------------+
| ARM_BEETLE_SOC-GCC_ARM | ARM_BEETLE_SOC | tests-mbed_hal-lp_ticker | TIMEOUT | 48.98              | shell       |
+------------------------+----------------+--------------------------+---------+--------------------+-------------+
mbedgt: test suite results: 1 TIMEOUT
mbedgt: test case report:
+------------------------+----------------+--------------------------+------------------------+--------+--------+---------+--------------------+
| target                 | platform_name  | test suite               | test case              | passed | failed | result  | elapsed_time (sec) |
+------------------------+----------------+--------------------------+------------------------+--------+--------+---------+--------------------+
| ARM_BEETLE_SOC-GCC_ARM | ARM_BEETLE_SOC | tests-mbed_hal-lp_ticker | 1ms lp_ticker          | 1      | 0      | OK      | 0.04               |
| ARM_BEETLE_SOC-GCC_ARM | ARM_BEETLE_SOC | tests-mbed_hal-lp_ticker | 1s lp_ticker           | 0      | 0      | ERROR   | 0.0                |
| ARM_BEETLE_SOC-GCC_ARM | ARM_BEETLE_SOC | tests-mbed_hal-lp_ticker | 1s lp_ticker deepsleep | 0      | 0      | SKIPPED | 0.0                |
| ARM_BEETLE_SOC-GCC_ARM | ARM_BEETLE_SOC | tests-mbed_hal-lp_ticker | 1s lp_ticker sleep     | 0      | 0      | SKIPPED | 0.0                |
| ARM_BEETLE_SOC-GCC_ARM | ARM_BEETLE_SOC | tests-mbed_hal-lp_ticker | 500us lp_ticker        | 1      | 0      | OK      | 0.04               |
| ARM_BEETLE_SOC-GCC_ARM | ARM_BEETLE_SOC | tests-mbed_hal-lp_ticker | 5s lp_ticker           | 0      | 0      | SKIPPED | 0.0                |
+------------------------+----------------+--------------------------+------------------------+--------+--------+---------+--------------------+
mbedgt: test case results: 3 SKIPPED / 2 OK / 1 ERROR

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions