Using "photon-thermistor-master" and "SC16IS740RK-master" code stuck and continously reset

Hi everyone,

I was using first arduino ported thermistor library in code… so working good but as i added SC16IS740RK-master and loaded code in particle P1. device reset when it try to read thermistor adc. if i put to read thermistor adc at 5 sec then P1 reset at every 5 sec. if 10 sec then every 10 sec.

If i remove “SC16IS740RK-master” library then code working great even if i read adc at every 10ms.

then i replaced arduino ported lib with “photon-thermistor-master” and still same issue. board continuous reset at specific interval.

photon-thermistor-master Lib : here
SC16IS740RK-master Lib: here

Will you please guide me what to do now?

Thank you

How have you got the termistor and sensor board wired?
Do you see any RGB LED signals when the device resets?
Are you running the sample code or your own?
If the latter, showing that code would be useful.

thermistor connection:

Do you see any RGB LED signals when the device resets?

Ans: Yes. it’s like Hard fault - 1 blink between 2 SOS patterns

Are you running the sample code or your own?

Ans: Right now in my code but also tried with sample code both lib sample code working good separately but if i merge both lib and make on sample code then it not work.

As ScruffR said, providing the code would be much easier than guessing at the problem.

However if you are using a software timer (Timer class), it is not safe to call any SC16IS740 function from the timer callback. You should instead set a flag in the timer callback and do the serial operation from loop.

Or just skip the timer altogether and check the time to check based on millis().

1 Like
/*
 * Project Serialcode
 * Description:
 * Author:
 * Date:
 */
#include "SC16IS740RK.h"
#include "thermistor.h"
// setup() runs once, when the device is first turned on.
SerialLogHandler logHandler;
SC16IS740 extSerial(Wire, 0x4C);
THERMISTOR gxThermistorTh1(A1, 10000, 3984, 1000);
void setup() {
  // Put initialization like pinMode and begin functions here.
  pinMode(A1, INPUT);
}

// loop() runs over and over again, as quickly as it can execute.
void loop() {
  gxThermistorTh1.read();
  delay(500);
  // The core of your code will likely live here.

}

Also tried with just this simple code still device goes in hard fault - 1 blink between 2 SOS

1 Like

That’s odd. You do need to call begin() from setup() in order to use it, but it’s odd that it would fault as long as you didn’t make any other calls.

extSerial.begin(9600);

Yes. didn’t use .begin just to show by adding that library only hard fault occur.

/*
 * Project Serialcode
 * Description:
 * Author:
 * Date:
 */
#include "SC16IS740RK.h"
#include "photon-thermistor.h"

// setup() runs once, when the device is first turned on.
SerialLogHandler logHandler;
SC16IS740 extSerial(Wire, 0x4C);
Thermistor gxnewtherm(A1, 1000, 10000, 25, 3984, 1, 0);
void setup() {
  // Put initialization like pinMode and begin functions here.
  pinMode(A1, INPUT);
}

// loop() runs over and over again, as quickly as it can execute.
void loop() {
  // The core of your code will likely live here.

  gxnewtherm.readTempC();
  delay(500);

}

This example with “photon-thermistor” library. In this also same issue.

/*
 * Project Serialcode
 * Description:
 * Author:
 * Date:
 */
#include "SC16IS740RK.h"
#include "photon-thermistor.h"

// setup() runs once, when the device is first turned on.
SerialLogHandler logHandler;
//SC16IS740 extSerial(Wire, 0x4C); /////////////////////// Commented 
Thermistor gxnewtherm(A1, 1000, 10000, 25, 3984, 1, 0);
void setup() {
  // Put initialization like pinMode and begin functions here.
  pinMode(A1, INPUT);
}

// loop() runs over and over again, as quickly as it can execute.
void loop() {
  // The core of your code will likely live here.

  gxnewtherm.readTempC();
  delay(500);

}

Even by this code also it enter in hard fault…

I published version 0.0.4 of the SC16IS740 library to fix this issue.

  • Make the Logger log statement static, otherwise it causes a SOS+1 fault on Device OS 1.0.0 due to to overwriting a conflicting declaration.

Because it’s a globally constructed object in the library, just including the library, and not even instantiating any objects, can expose the problem.

The same bug exists in SpiffsParticleRK and that has been upgraded to 0.0.5.

4 Likes

Great. Tested new version 0.0.4 and it’s working perfectly. No hard fault.

Thank you so much @rickkas7 for your quick support.

1 Like