Arduino Portenta and deep sleep

hello,

I have the Arduino Portenta and LoraWan Shield and I'm trying to get the device to sleep, however it wont sleep in between sending a lora message. The script works fine without " LowPower.deepSleep(10000);" command. When the low power code is added i get the following when building. Any ideas how to get the portenta to sleep?

WARNING: library Arduino_Low_Power claims to run on samd, nrf52 architecture(s) and may be incompatible with your current board which runs on mbed architecture(s).

Generating function prototypes...


......"""""more log here but probably not relevent"""".......

Linking everything together...

"C:\\Users\\user\\AppData\\Local\\Arduino15\\packages\\arduino\\tools\\arm-none-eabi-gcc\\7-2017q4/bin/arm-none-eabi-g++" "-LC:\\Users\\user~1.KEL\\AppData\\Local\\Temp\\arduino_build_960595" -Wl,--gc-sections -w -Wl,--as-needed "@C:\\Users\\user\\AppData\\Local\\Arduino15\\packages\\arduino\\hardware\\mbed\\1.3.2\\variants\\PORTENTA_H7_M7/ldflags.txt" "-TC:\\Users\\user\\AppData\\Local\\Arduino15\\packages\\arduino\\hardware\\mbed\\1.3.2\\variants\\PORTENTA_H7_M7/linker_script.ld" "-Wl,-Map,C:\\Users\\user~1.KEL\\AppData\\Local\\Temp\\arduino_build_960595/first_lora_sketch.ino.map" --specs=nosys.specs -o "C:\\Users\\user~1.KEL\\AppData\\Local\\Temp\\arduino_build_960595/first_lora_sketch.ino.elf" "C:\\Users\\user~1.KEL\\AppData\\Local\\Temp\\arduino_build_960595\\sketch\\first_lora_sketch.ino.cpp.o" "C:\\Users\\user~1.KEL\\AppData\\Local\\Temp\\arduino_build_960595\\libraries\\Arduino_Low_Power\\nrf52\\ArduinoLowPower.cpp.o" "C:\\Users\\user~1.KEL\\AppData\\Local\\Temp\\arduino_build_960595\\libraries\\Arduino_Low_Power\\samd\\ArduinoLowPower.cpp.o" "C:\\Users\\user~1.KEL\\AppData\\Local\\Temp\\arduino_build_960595\\core\\variant.cpp.o" -Wl,--whole-archive "C:\\Users\\user~1.KEL\\AppData\\Local\\Temp\\arduino_build_960595/..\\arduino_cache_820976\\core\\core_arduino_mbed_envie_m7_abe1730ad370353d21509b4392678096.a" "C:\\Users\\user\\AppData\\Local\\Arduino15\\packages\\arduino\\hardware\\mbed\\1.3.2\\variants\\PORTENTA_H7_M7/libs/libmbed.a" -Wl,--no-whole-archive -Wl,--start-group -lstdc++ -lsupc++ -lm -lc -lgcc -lnosys -Wl,--end-group

C:\Users\user~1.KEL\AppData\Local\Temp\arduino_build_960595\sketch\first_lora_sketch.ino.cpp.o: In function `loop':

C:\IOT\ArduinoTesting\portenta\libraries\Arduino_Low_Power\src/ArduinoLowPower.h:65: undefined reference to `ArduinoLowPowerClass::deepSleep(unsigned long)'

C:\Users\user~1.KEL\AppData\Local\Temp\arduino_build_960595\sketch\first_lora_sketch.ino.cpp.o: In function `loop':

C:\IOT\ArduinoTesting\portenta\first_lora_sketch/first_lora_sketch.ino:106: undefined reference to `LowPower'

collect2.exe: error: ld returned 1 exit status

Using library MKRWAN at version 1.0.15 in folder: C:\IOT\ArduinoTesting\portenta\libraries\MKRWAN 

Using library Arduino_Low_Power at version 1.2.2 in folder: C:\IOT\ArduinoTesting\portenta\libraries\Arduino_Low_Power 

exit status 1

Error compiling for board Arduino Portenta H7 (M7 core).
/*
  First Configuration
  This sketch demonstrates the usage of MKR WAN 1300/1310 LoRa module.
  This example code is in the public domain.
*/

#include <MKRWAN.h>
#include "ArduinoLowPower.h"


LoRaModem modem;

// Uncomment if using the Murata chip as a module
// LoRaModem modem(Serial1);

String appEui;
String appKey;
String devAddr;
String nwkSKey;
String appSKey;

void setup() {
  // put your setup code here, to run once:
  Serial.begin(115200);
  while (!Serial);
  Serial.println("Welcome to MKRWAN1300/1310 first configuration sketch");
  Serial.println("Register to your favourite LoRa network and we are ready to go!");
  // change this to your regional band (eg. US915, AS923, ...)
  if (!modem.begin(EU868)) {
    Serial.println("Failed to start module");
    while (1) {}
  };
  Serial.print("Your module version is: ");
  Serial.println(modem.version());
  if (modem.version() != ARDUINO_FW_VERSION) {
    Serial.println("Please make sure that the latest modem firmware is installed.");
    Serial.println("To update the firmware upload the 'MKRWANFWUpdate_standalone.ino' sketch.");
  }
  Serial.print("Your device EUI is: ");
  Serial.println(modem.deviceEUI());

  int mode = 1;
  //while (mode != 1 && mode != 2) {
    //Serial.println("Are you connecting via OTAA (1) or ABP (2)?");
    //while (!Serial.available());
    //mode = Serial.readStringUntil('\n').toInt();
    
  //}

  int connected;
  if (mode == 1) {
    //Serial.println("Enter your APP EUI");
    //while (!Serial.available());
    //appEui = Serial.readStringUntil('\n');
    appEui = "my EUI";

    //Serial.println("Enter your APP KEY");
    //while (!Serial.available());
    //appKey = Serial.readStringUntil('\n');
    appKey = "my app key";

    appKey.trim();
    appEui.trim();

    connected = modem.joinOTAA(appEui, appKey);
  } 

  if (!connected) {
    Serial.println("Something went wrong; are you indoor? Move near a window and retry");
    while (1) {}
  }

  delay(5000);

  int err;
  modem.setPort(3);
  modem.beginPacket();
  modem.print("HeLoRA world!");
  err = modem.endPacket(true);
  if (err > 0) {
    Serial.println("Message sent correctly!");
  } else {
    Serial.println("Error sending message :(");
  }
}

int counter = 0; 
void loop() {
  while (modem.available()) {
      Serial.write(modem.read());
    }
  
  int err;
  modem.setPort(3);
  modem.beginPacket();
  modem.poll();
  counter = counter + 1;
  modem.print(counter);
  err = modem.endPacket(true);
  if (err > 0) {
    Serial.println("Message sent correctly!");
  } else {
    Serial.println("Error sending message :(");
  }
  LowPower.deepSleep(10000);
}

This topic was automatically closed 120 days after the last reply. New replies are no longer allowed.