Due to high demand expect some shipping delays at this time, orders may not ship for 1-2 business days.
0

Feather M0 Serial Port INOP After Waking Up from Standby Mod
Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.

Feather M0 Serial Port INOP After Waking Up from Standby Mod

by gfvalvo on Tue Jun 26, 2018 9:50 pm

I'm putting the processor on my Feather M0 to sleep in Standby Mode. It's later awakened by an RTC interrupt. After waking up, the code executes again from where it left off -- I have it blinking an LED to let me know it's back. But, prints to Serial are not showing up in the monitor. I've tried Serial.end() and a new Serial.begin() after waking up. Didn't help.

So, what do I need to do to bring the Serial port back to life?

Thanks.

gfvalvo
 
Posts: 267
Joined: Fri Oct 07, 2016 1:35 pm

Re: Feather M0 Serial Port INOP After Waking Up from Standby

by gfvalvo on Tue Jun 26, 2018 10:35 pm

Update:
Google found me a few references to this issue -- but no solution yet. It's related to the complexities of the USB port and using it for Serial. However, Serial1 (Hardware UART) works fine after waking up from deep sleep. Guess I can use that for my debug prints.

gfvalvo
 
Posts: 267
Joined: Fri Oct 07, 2016 1:35 pm

Re: Feather M0 Serial Port INOP After Waking Up from Standby

by BryonMiller on Tue Jun 26, 2018 11:07 pm

On a Trinket M0 what I did right before sleeping
Code: Select all | TOGGLE FULL SIZE
   Serial.end();
   USBDevice.detach(); // Safely detach the USB prior to sleeping

And right after waking I did
Code: Select all | TOGGLE FULL SIZE
   USBDevice.attach();   // Re-attach the USB, audible sound on windows machines
   delay(500);
   Serial.println("awake");

I would have thought I should do Serial.begin() after waking but my working code does not. You should also know that the serial monitors I tried (Arduino IDE & Putty) had to be reconnected after this sequence. So if, for instance, you're using the Arduino IDE Serial monitor you'll have to close it and restart it. I got so tired of this (and missing my initial wakeup messages) I wrote a Windows Serial Monitor that would automatically reconnect.

BryonMiller
 
Posts: 214
Joined: Fri Mar 04, 2016 10:34 am

Re: Feather M0 Serial Port INOP After Waking Up from Standby

by ShelM on Wed Jun 27, 2018 1:13 am

BryonMiller wrote: I got so tired of this (and missing my initial wakeup messages) I wrote a Windows Serial Monitor that would automatically reconnect.


Ooooh, @BryonMiller can you tell us (please!) more about your automatically-reconnecting Windows Serial Monitor? Sounds like it could replace the annoying need for mousing to Tools/Port/ComX each and every program iteration.

ShelM
 
Posts: 58
Joined: Sun Mar 11, 2018 1:45 am

Re: Feather M0 Serial Port INOP After Waking Up from Standby

by BryonMiller on Wed Jun 27, 2018 3:39 pm

Ooooh, @BryonMiller can you tell us (please!) more about your automatically-reconnecting Windows Serial Monitor?


OP never said whether his problem has been solved so I don't want to hijack this question. I created a separate post with info regarding my Serial Comm program https://forums.adafruit.com/viewtopic.php?f=52&t=137543

BryonMiller
 
Posts: 214
Joined: Fri Mar 04, 2016 10:34 am

Re: Feather M0 Serial Port INOP After Waking Up from Standby

by gfvalvo on Wed Jun 27, 2018 10:58 pm

BryonMiller wrote:OP never said whether his problem has been solved so I don't want to hijack this question.

Thanks @BryonMiller. Yes, it now works but with the same connect / disconnect behavior that you mentioned. For me, sticking with the Hardware UART will probably be easiest since I'm only using it for debug prints.

gfvalvo
 
Posts: 267
Joined: Fri Oct 07, 2016 1:35 pm

Please be positive and constructive with your questions and comments.