nRF51822 Ticker bug

08 Sep 2014

Hello,

There is bug somewhere in ticker.
I'm using nRF51822-EK board with lastest mbed-src, nRF51822 and BLE_API library revisions.
And with this test code:

#include "mbed.h"
 
DigitalOut led1(LED1);
DigitalOut led2(LED2);
Ticker ticker;
Ticker ticker2;

void periodicCallback(void)
{
    led1 = !led1;
}

void periodicCallback2(void)
{
    led2 = !led2;
}

int main(void)
{
    led1 = 0;
    led2 = 0;

    ticker.attach(periodicCallback, 1);
    ticker2.attach(periodicCallback2, 1);

    while (true);
}

It stucks after first call of periodicCallback and periodicCallback2 is never called. I.e. led1 is lit and led2 is never lit.

11 Oct 2014

I still have Ticker problem, I can't even reuse ticker like this:

#include "mbed.h"

#define LED0_PIN_NO  p18
#define LED1_PIN_NO  p19

void ticker_callback_1(void);
void ticker_callback_2(void);

DigitalOut led0(LED0_PIN_NO);
DigitalOut led1(LED1_PIN_NO);
Ticker ticker;

void ticker_callback_2(void)
{
    ticker.detach();
    ticker.attach(ticker_callback_1, 1);
    led1 = !led1;
}

void ticker_callback_1(void)
{
    ticker.detach();
    ticker.attach(ticker_callback_2, 1);
    led0 = !led0;
}

int main(void)
{
    led0 = 0;
    led1 = 0;
    
    ticker.attach(ticker_callback_1, 1);

    while(1);
}

It hangs after exiting from first callback ticker_callback_1() and never enter ticker_callback_2().
This is with latest mbed SDK libraries: mbed-src, BLE_API, nRF51822.

14 Oct 2014

Hi, thanks for reporting. I created an issue on github for this https://github.com/mbedmicro/mbed/issues/539

15 Oct 2014

Hi guys, I've created test MBED_34 with this above code:

Test summary:

ResultTargetToolchainTest IDTest DescriptionElapsed Time (sec)Timeout (sec)Loops
OKNUCLEO_F103RBuARMMBED_34Ticker Two callbacks11.38151/1
TIMEOUTNRF51822ARMMBED_34Ticker Two callbacks15.5150/1
OKLPC1768ARMMBED_34Ticker Two callbacks12.27151/1
OKKL25ZARMMBED_34Ticker Two callbacks12.42151/1

Result: 3 OK / 1 TIMEOUT

Completed in 76.70 sec

15 Oct 2014

Hi Przemek,

there is another issues with the nRF ticker. Code crashes when using 3 Tickers. See here. Maybe you can add that to the test.

15 Oct 2014

@Wim , will do or anybody is more than welcome to provide a test (via pull request if possible or code snippet at least)

16 Oct 2014

Hi Martin, I can create pull request with 3 x Ticker simple test from bug Wim pointed to. This pull request can be used as 'template' for others to add new tests.

But still if Wim wants to do it it is OK for me :)