Skip to content

NCS36510: Timeout: Inconsistent delay when using multilple timeout objects #5431

Closed
@fkjagodzinski

Description

@fkjagodzinski

Description

Target
NCS36510

Toolchain:
ARM, IAR, possibly GCC_ARM

Expected behavior
When multiple Timeout objects are scheduled all callbacks are called after a given delay.

Actual behavior
Not all callbacks are called; in fact only 2/16 and 3/16 as CI tests show. Unfortunately I'm unable to reproduce this locally as I don't have the board but I suppose this has to be related to #5150 & #5185 where some callbacks get an additional delay.

Steps to reproduce
Fetch #5106 and run mbed test -n tests-mbed_drivers-timeout -t IAR -m NCS36510. Expect a failure same as here: NCS36510, IAR, Multiple_timeouts_running_in_parallel__attach_us_ or here: NCS36510, ARM, Multiple_timeouts_running_in_parallel__attach_.

Assertion fails on line 181: https://github.com/fkjagodzinski/mbed-os/blob/a0829eebc2b42085757cd1061be7228e88506077/TESTS/mbed_drivers/timeout/timeout_tests.h#L181

/* [...]
 * Test multiple Timeouts
 * Given multiple separate Timeout objects
 * When a callback is attached to all of these Timeout objects with @a attach_us()
 *     and delay for every Timeout elapses
 * Then all callbacks are called
 */
template<typename T>
void test_multiple(void)
{
    volatile uint32_t callback_count = 0;
    T timeouts[NUM_TIMEOUTS];
    for (size_t i = 0; i < NUM_TIMEOUTS; i++) {
        timeouts[i].attach_callback(mbed::callback(cnt_callback, &callback_count), TEST_DELAY_US);
    }
    Thread::wait(TEST_DELAY_MS + 1);
    TEST_ASSERT_EQUAL(NUM_TIMEOUTS, callback_count);
}

cc @bulislaw @0xc0170

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