standby wake from UART causes inability to program board

Go To Last Post
4 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Anyone had issues getting the samd21 to wake from sleep via UART?  What I am experiencing is that the wake is a little buggy and results in strange print output or the board hangs.  What is really interesting is that after trying to wake from sleep I can no longer program the board (using openocd or edbg).  I asked Atmel (Microchip) and they gave me a tool that erases the board continuously as you reset the samd21.  I created my own version by putting this command in a loop:

 

./edbg/edbg -t atmel_cm0p -be

 

Which works to reprogram the boards.

 

I can wakeup from an external input on a pin, but in that case I use the 32768 HZ external oscillator or the low power internal one.  The problem appears to be trying to put the system clock (GEN0) into standby/ondemand mode and then trying to wake that using the USART interrupt.  I don't see this issue if you put sleep in one of the idles modes and it is interesting that application note AT11626 which demonstrates how to wake from sleep using USART actually puts the code in IDLE 2 rather than standby sleep in the final version.

 

Anyone experience anything similar?

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Got a response from Atmel/Microchip (so much more responsive than before) and they said they have seen this issue on board revisions before revision D for the samd21.  I will have to get some new boards and see if the problem goes away.

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Actually the issue still exists with the latest revision, working with Atmel/Microchip to try and find the problem.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Turns out that how you tweak the DFLL can be a big part of the issue.  Here is a quote from Microchip support:

 

another issue is the STABLE bit of the DFLLCTRL.
When this bit is not set, DFLL tracks changes in output frequency and tries to callibrate DFLL on the fly.
This causes momentary frequency overshoots in some versions of the D21 device and hence the issue.

 

So in essence waking from standby sleep using the heart isn't sounding like a good idea, especially if you are using the DFLL.  Might be best just to use the external interrupt for the gpio pin so you can use the 32 kHz external oscillator which I keep on all the time during sleep.

 

Anyone else tried this?