8 years, 3 months ago.

Ticker problems on mDot

We're having problems where creating a Ticker seems to be hanging the system. Trawling through the Questions, it looks like there's been similar issues on other mBed platforms. I have synced to the latest mBed libraries etc. and am (currently) using the online compiler. This means that my only real debuging tool is good ol' printf, and this is showing that not only is the ticker callback function never being hit, execution of main() comes to a stop at the point where the ticker is attached.

Anyone have any ideas?

many thanks

Can you share a code snippet to be tested?

posted by Martin Kojtal 09 Feb 2016

No problem. The following is a snippet of the code that grinds to a halt. The printf after the attach never happens and the printf in the callback function never appears.

There is, of course, more code than this however commenting out large sections have proven that that it has no effect on the result.

Any suggestions for a fix, workaround or alternative will be greatly appreciated.

-H

//---------------------------------------------------------------------
Ticker ClkTick;


int main()
{     
    mDot* dot = mDot::getInstance();
    debug.baud(dot->getDebugBaud());
    
    
    G_Pos_Period = POS_PERIOD;  // default
    

    char RXLoRa[20];
    int32_t ret;
    std::vector<uint8_t> data;
    std::string data_str = "Project Jericho - contact!" ;
    
    Config_LoRa();

    Config_FuelGauge();
    
    Config_GPS();

    ClkTick.attach(&SystemTick,5);  // system event timer         

    debug.printf("about to enter flash loop \r\n");


	"
	"
	"
	"
}


//********************************************************
void SystemTick()
{
    static int LED_count = 0;
    static int Beep_count = 0;
    static int Zap_count = 0;
    static int Pos_count = 0;
    
    static int Pulse = 0;
 
    debug.printf("SystemTick() \r\n"); 
       
    if (Pulse++ >=10)
    {
        Pulse = 0;
        
        G_Volts = FuelGauge.voltage();
        G_Charge = FuelGauge.accumulatedCharge();
        G_Temperature = FuelGauge.temperature();
    }


	"
	"
	"
	"
}

posted by Howard Bray 09 Feb 2016

AFter battling with Ticker for too much time, I have abandoned it and stuck with RtosTimer which works fine.

posted by Howard Bray 10 Feb 2016
Be the first to answer this question.