TIC example sketches not working w/ESP8266

I am trying to run the basic I2C TIC example sketches on ESP8266 for TIC1500. For any I2C example sketch and for any board, I get the error:

Soft WDT reset

alternating with:

ets Jan  8 2013,rst cause:2, boot mode:(3,6)

I used these sketches and libraries a year ago and everything worked then. The TIC is connected with I2C and I have configured it with the control center. Do you know what could be wrong?



Here is the stack trace:

Soft WDT reset


ctx: cont
sp: 3ffffda0 end: 3fffffc0 offset: 01a0
3fffff40:  3ffe868c 00000000 3ffee318 402012bd  
3fffff50:  00000022 00000004 3ffee318 402011c0  
3fffff60:  3fffdad0 00000064 3ffee308 3ffee4b4  
3fffff70:  3fffdad0 00000064 3ffee308 402010fc  
3fffff80:  00000000 3ffee44c 3ffee308 40204125  
3fffff90:  3fffdad0 3ffee44c 3ffee308 4020115a  
3fffffa0:  feefeffe 00000000 3ffee474 40201eb4  
3fffffb0:  feefeffe feefeffe 3ffe84e8 40100e11  

Here is what the exception decoder says:

0x402012bd: TicI2C::getSegment(TicCommand, unsigned char, unsigned char, void*) at C:\Users\perigalacticon\Documents\Arduino\libraries\Tic\Tic.cpp line 211
0x402011c0: TicI2C::commandQuick(TicCommand) at C:\Users\perigalacticon\Documents\Arduino\libraries\Tic\Tic.cpp line 184
0x402010fc: waitForPosition(int) at C:\Users\perigalacticon\Documents\Arduino\libraries\Tic/Tic.h line 1346
0x40204125: TicBase::setTargetPosition(int) at C:\Users\perigalacticon\Documents\Arduino\libraries\Tic/Tic.h line 348
0x4020115a: loop() at C:\Users\perigalacticon\Documents\Arduino\sketches\Modified Examples\I2CPositionControl_mod/I2CPositionControl_mod.ino line 90
0x40201eb4: loop_wrapper() at C:\Users\perigalacticon\AppData\Local\arduino15\packages\esp8266\hardware\esp8266\2.7.4\cores\esp8266\core_esp8266_main.cpp line 197

The last line of code is 211 from Tic.cpp:

  _lastError = Wire.endTransmission(false); // no stop (repeated start)

Sometimes the stack gives a different line:

0x4020259e: Twi::write_bit(bool) at C:\Users\perigalacticon\AppData\Local\arduino15\packages\esp8266\hardware\esp8266\3.0.2\cores\esp8266\core_esp8266_si2c.cpp line 282

It sounds like you are triggering a watchdog timer. I am not very familiar with the ESP8266, but from a quick Google search, it sounds like the watchdog timer is typically enabled by default on ESP8266 modules, and it gets reset whenever you call the delay() or yield() functions, or when it returns from loop(). If the watchdog timer isn’t periodically reset, then it will automatically reset the ESP8266.

From your exception readout it looks like you probably modified our library (since we do not have a built-in waitForPosition() function in our “Tic Stepper Motor Controller library for Arduino”). If that is the case, you might try adding a yield() command to your added function.

If that does not work, I recommend trying our included I2CSpeedControl and I2CPositionControl examples. We have not tested any of our unmodified examples with an ESP8266, but I suspect you will get the same soft WDT reset error (if not from the unmodified examples, then when you increase the delay argument passed to the delayWhileResettingCommandTimeout() function). If you do, then you could try adding yield() to the delayWhileResettingCommandTimeout() function directly after resetCommandTimeout(); to see if that helps.