-
AuthorPosts
-
October 15, 2017 at 10:10 PM #6938peakParticipant
I can successfully put my Adafruit feather 32u4 FONA to sleep by using your Low-Power library with the function: LowPower.powerDown(SLEEP_FOREVER, ADC_OFF, BOD_OFF)
With an external interrupt the FONA wakes up again and is functional EXCEPT that it cannot write to the Serial Monitor again. Nothing is output but I can have the FONA blink leds and do whatever else.
Note that I call Serial.begin(9600 (or whatever)) to no avail.
Do you have any clue why this is happening?- This topic was modified 7 years, 2 months ago by peak. Reason: Spelling
October 16, 2017 at 4:20 PM #6945LIM PHANG MOHKeymasterThe 32U4 USB needs to be detach before entering a power down mode and attach back once awake.
So, it supposed to look like this:USBDevice.detach(); // Add your wake up source here, example attachInterrupt() LowPower.powerDown(SLEEP_FOREVER, ADC_OFF, BOD_OFF); USBDevice.attach(); delay(1000); // In order for PC to have enough time to show the connected COM port
But, unfortunately, if you look at the core code and search for USBDevice.detach(), you’ll see that it’s an empty function (not implemented). So, you need to add the detaching the USB portion before sleep:
// Disable USB clock USBCON |= _BV(FRZCLK); // Disable USB PLL PLLCSR &= ~_BV(PLLE); // Disable USB USBCON &= ~_BV(USBE); // Add your wake up source here, example attachInterrupt() LowPower.powerDown(SLEEP_FOREVER, ADC_OFF, BOD_OFF); USBDevice.attach(); // In order for PC to have enough time to show the connected COM port delay(1000); // In order for PC to have enough time to show the connected COM port
Also add some delay in the setup code portion so you have enough time for code uploading.
- This reply was modified 7 years, 2 months ago by LIM PHANG MOH.
October 16, 2017 at 8:24 PM #6949peakParticipantLIM PHANG MOH, thank you for an excellent explanation and a working solution.
Regards
PeterJanuary 16, 2018 at 1:30 AM #7598vtomanovParticipantOK,
Kind of a working, BUT then the USB generally do not work most of the time – and no serial logging is possible and to upload a new code is a bit tricky – I need to press reset about 1 sec before the upload to be able to actually upload the new code …
any suggestion how to use the low power lib and in the same time to be able to upload new code and log in the serial while not sleeping ?
e.g. I want to sleep 10 msec , do some measurements, sleep again 10msec etc.
also dies the millis(); function will return the correct value or need to be adjusted with the sleep interval ?
device is Feather 32u4 with LoRa
January 16, 2018 at 1:35 AM #7600peakParticipant“kind of working”? Nope. Working Excellently! Start a new thread
-
AuthorPosts
- You must be logged in to reply to this topic.