Timer start() in Class Broken in rc27

Hi all,

Working on an Argon program, and it’s suddenly hit a hard fault on a line of code that was previously working in rc26. I’m using a timer inside a class, and starting it is choking out. Because it’s in a class, I’m setting it up as follows:

  • In .h:

    • Timer *solenoidOffTimer;
  • In constructor:

    • solenoidOffTimer = new Timer(solenoidOffPeriod, &Solenoid::turnSolenoidOn, *this, true);
  • Callback for second timer that actually starts the solenoidOffTimer:

    • void Cryo_Solenoid::turnSolenoidOff(){
      digitalWrite(solenoidPin, LOW);
      digitalWrite(ledPin, LOW);
      //May need to change to 'startFromISR()'

The line that’s actually causing the problem is that solenoidOffTimer->start(), when I comment it out things work (connecting to cloud etc.) but when it’s in there, it will compile fine but hits an SOS 1 when it runs. It was working fine on rc26, so I’m not sure what changed… Any thoughts?

I also tried startFromISR(), same thing, SOS 1.

Thanks for the report - @cheong and @avtolstoy can you help to investigate?

Another note, I tried compiling it with the CLI argument --target 0.8.0-rc.26, and had the same issue with start() and startFromISR(), so I’m guessing it’s something in the rc27 Argon firmware?

rc.27 did not introduce any changes to the software timers, so I would appreciate if you could either collect the stacktrace using the debugger, or provide us with a minimal example application showcasing the issue, so that we could easily reproduce it and try to look into this.

Please also make sure that before you start both the timers, they are both correctly initialized. This may very well be caused by solenoidOffTimer not pointing to a proper Timer instance yet in your turnSolenoidOff() depending on the order in which the timers are initialized / started.


Looks like I should order the debugger, as the minimal version, which was basically a copy/past of the two files, worked. I’ll look into the initialization order issue, but I’m heading out for Christmas pretty quick and won’t have access to the Argon until I get back.

Having said that, is it possible to downgrade the firmware on the Argon to rc26, because to the best of my knowledge it was working before the rc27 update, which is confusing as all get out…

Well, sorry about all the bother. Turns out I was creating the new Timers in the constructor rather than the begin, and construction order uncertainty got me. Thanks for the help!

1 Like