Sodaq Sara AFF Low Temperature

Hello

I have a sodaq Sara outside in low temperature.

The code sets the RGB led to Yellow, then calls this snippet

Wire.begin();

accelerometer.rebootAccelerometer();
delay(1000);

accelerometer.enableAccelerometer(Sodaq_LSM303AGR::LowPowerMode, Sodaq_LSM303AGR::HrNormalLowPower10Hz, Sodaq_LSM303AGR::XYZ, Sodaq_LSM303AGR::Scale2g, true);
// Enable the Accelerometer, in2 G (default)
pinMode(ACC_INT_PIN, INPUT);


// Enable interrupts on the SAMD
GCLK->CLKCTRL.reg = GCLK_CLKCTRL_ID(GCM_EIC) |
GCLK_CLKCTRL_GEN_GCLK1 |
GCLK_CLKCTRL_CLKEN;

float threshold =  0.5;		



pinMode(GPS_ENABLE, OUTPUT);
digitalWrite(GPS_ENABLE, HIGH);

#if (GPS_INTERFACE == WIRE_BUS)
Wire.begin();
#elif (GPS_INTERFACE == SERIAL_BUS)
GPS_STREAM.begin(GPS_BAUD);
#endif

Had this been successful, the LED would have been blue
At the globals, i have #define ACC_INT_PIN ACCEL_INT2 and GPS_ENABLE is also defined.

So alltogether, normally, this works without a problem.

But in the night the board was left outside for testing qand the temperature went below zero. Then the board went to sleep.

This morning, the temperature was 4°C, and after waking up, the board was unable to execute this snippet (hanged in one of these functions)

What is the cause, and what is the remedy.

Hi,

It could be that the low temperature is causing issues with waking up the board.
Do you have a watchdog implemented?

Best regards,
Jan

Could you please point me to a solution / example code please??

Hi @Sean_Con ,

We recently found out that sometimes the wake from the board does not happen correctly since the systick timer isn’t ready yet.

This can be fixed by adding two lines of code around the __WFI()

/**
  Powers down all devices and puts the system to deep sleep.
*/
void systemSleep()
{
  // Disable systick interrupt
  SysTick->CTRL &= ~SysTick_CTRL_TICKINT_Msk;

  __WFI(); // SAMD sleep

  // Enable systick interrupt
  SysTick->CTRL |= SysTick_CTRL_TICKINT_Msk;

}

Best regards,
Jan

Hi

It can also be I2C bus. I have had several boards not starting up due to the SCL line on I2C is somehow driven low by the accelerometer at startup. This freezes the wire library! The workaround solution I found is to pull both line high before calling the wire.begin()

pinMode(PIN_WIRE_SCL, OUTPUT);
digitalWrite(PIN_WIRE_SCL, HIGH);
pinMode(PIN_WIRE_SDA, OUTPUT);
digitalWrite(PIN_WIRE_SDA, HIGH);

Br
Klein