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

Sketch not running after power lost
Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.

Sketch not running after power lost

by markwill on Fri Apr 23, 2021 1:57 pm

I suspect I am missing something fundamental about how a Feather starts up when power is applied. Here is what I am seeing (very consistently), Perhaps I just missed something obvious.

I have a Feather M0 with 900Mhz LORA, configured as the sender. When I have this plugged in (I use PlatformIO) and I upload my sender sketch, all is well and the receiver beeps every second or two, based on the sketch I downloaded there.

The problem comes when I pull the USB and try to run the sender off battery. I confess I have a slightly dodgy connection to the battery and sometimes I briefly lose power, due to the removal of the USB. No biggie and I will fix that, but that's not really the problem here.

When I reposition the battery connection I see the light come on again. But that NEVER communicates with the receiver (ie. the receiver no longer receives a message).

If, however, I get lucky and pull the USB without that brief loss of power then everything continues just fine.

I don't understand that. Yes, when I lose power briefly I'd expect the receive to stop receiving message. But when I re-apply the power (via battery) wouldn't the sender just start up again and start sending messages again?

But there's more...

If I plug the sender back into USB, the sender again fails to send again. When I try look at the serial monitor (via PlatformIO) a message pops up offering me the chance to restart the process on the device. That is the only way I can get it sending again.

And finally, when I plug in the sender to USB (without the battery) I have to upload the sketch again and, as soon as I do, it starts resending.

It all sounds like the sender doesn't boot to a working (sending) state. My working assumption - and maybe my mistake - is that if I a) upload a sketch b) pull the power and c) reapply power, then the sender will simply run the sketch.

What am I missing here? Can someone put me out of my misery?

Thank you.

markwill
 
Posts: 2
Joined: Tue Apr 13, 2021 7:46 pm

Re: Sketch not running after power lost

by markwill on Fri Apr 23, 2021 2:06 pm

Well, I just demonstrated the lost art of looking at something for an age (including searches), posting to a public group and then almost immediately finding the problem :)

For reasons that I don't fully understand the AdaFruit same code has a wait(!serial) in startup(), on both sender and receiver. Duh!!!

Commented that out, it's working now and - fighting against my embarrassment - will leave this here in case others have this brain freeze in the future!

Apologies for the false alarm.

markwill
 
Posts: 2
Joined: Tue Apr 13, 2021 7:46 pm

Please be positive and constructive with your questions and comments.