matthijskooijman / arduino-lmic

:warning: This library is deprecated, see the README for alternatives.
707 stars 650 forks source link

Low power function after TXCOMPLETE not powering down #247

Open s-park21 opened 4 years ago

s-park21 commented 4 years ago

Hello, I have been use OTAA and I cannot seem to get my arduino nano to power down after transmitting. I'm using the rocketscream low power library and it seems that this function LowPower.powerDown(SLEEP_8S, ADC_OFF, BOD_OFF); will only power down the arduino when it is placed before os_init() in setup(). When powered down I see a current draw of <1mA but if I place the powerdown function anywhere other than before os_init() I see a current draw of >80mA.

I would appreciate any advice for anyone who may know this issue or has encountered the same problem. Cheers.

void setup() {  
  Serial.begin(115200);
  LowPower.powerDown(SLEEP_8S, ADC_OFF, BOD_OFF);
  //powers down here without a problem

  // LMIC init
  os_init();
  // Reset the MAC state. Session and pending data transfers will be discarded.
  LMIC_reset();
  LMIC_setDrTxpow(DR_SF7, 14); 
  LMIC_selectSubBand(1);
  LMIC_setClockError(MAX_CLOCK_ERROR * 1 / 100);

  LowPower.powerDown(SLEEP_8S, ADC_OFF, BOD_OFF); 
  //will not power down here at all

  // Start job (sending automatically starts OTAA too)
  do_send(&sendjob);