Trying to figure out why my whole system crashed with some high speed microstepping code I managed to isolate the following issue regarding the parameters you can pass to the attack_us function which is probably related to the following code in the mbed lib
@ Ticker.cpp :31 insert(_delay + us_ticker_read());
shouldnt this be intlocked already???
@ us_ticker_api.c:71 if ((int)(timestamp - p->timestamp) <= 0) {
what if we come here too late meaning, the desired delay is too short and by the time we try to insert the item in the list the TC is already at that value?? then we have to wait for a complete rollover.
Thanks in advance guys
here the code example that brings the whole mbed to its knees
Salu2, Hector Soto.
#include "mbed.h"
//Ticker,Timeout crash test
DigitalOut led1(LED1);
DigitalOut led2(LED2);
DigitalOut led3(LED3);
Ticker tm1, tm2;
int count = 0;
void Tm2CB(){
led3 = ! led3;
}
void Tm1CB(){
led2 = !led2;
if(count++ > 20 ){ //after some time, unleash the kraken
count = 0;
led3 = 1;
tm2.attach_us( &Tm2CB, 0xffffffff );
// H.Soto
// 0xffffffff = kabooom!!!
// 0x0 = same, if TC is already at the target count, we should dispatch the callback immediately
// 0xfffff000 = breaks the timers only, linked list broken? timer interrupt disabled by accident?
// maybe it is better to truncate the parameter to avoid this??
}
}
int main() {
tm1.attach_us( &Tm1CB, 100000);
while(true) {
led1 = !led1;
wait(1.0); //show we are alive
}
}
Trying to figure out why my whole system crashed with some high speed microstepping code I managed to isolate the following issue regarding the parameters you can pass to the attack_us function which is probably related to the following code in the mbed lib
@ Ticker.cpp :31 insert(_delay + us_ticker_read()); shouldnt this be intlocked already??? @ us_ticker_api.c:71 if ((int)(timestamp - p->timestamp) <= 0) { what if we come here too late meaning, the desired delay is too short and by the time we try to insert the item in the list the TC is already at that value?? then we have to wait for a complete rollover.
Thanks in advance guys
here the code example that brings the whole mbed to its knees Salu2, Hector Soto.