Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sleep mode may need an extra reset #2

Open
henkmuller opened this issue Mar 9, 2016 · 0 comments
Open

Sleep mode may need an extra reset #2

henkmuller opened this issue Mar 9, 2016 · 0 comments

Comments

@henkmuller
Copy link
Member

I think sleep mode cannot work without an extra reset.

The process for sleep mode in this repo is:

  1. Setup sleep mode
  2. switch silicon oscillator on
  3. switch to silicon oscillator
  4. switch crystal oscillator off
  5. go to sleep

The problem is with step (3). If there is a sudden change to the oscillator, then the PLL will unlock, chase, and may run the processor at an out-of-spec frequency, hanging the processor before (4) and (5) complete.

As USB relies on 12 or 24 MHz, and the crystal oscillator runs at 20, this is a nono for devices that use a USB style crystal. The software in this repo checks for the crystal frequency and skips steps 2, 3 and 4 in this case; this is a bit unfortunate, as you will end up in a less deep sleep mode that uses 10x more power.

Even if you use a 20 MHz crystal, it still does not work because (a) the silicon oscillator may be way out, and (b) even if it was 20 MHz, it may be out of phase by 180 degrees, and I don’t think the PLL will take that well. At present, the software in this repo accepts this case.

I think an extra reset will work:

  1. Setup sleep mode
  2. switch silicon oscillator on
  3. switch to silicon oscillator & reset the xCORE
  4. on boot check if the silicon oscillator is on - if so
    • switch crystal oscillator off
    • go to sleep

When it comes out of sleep it should switch back to the crystal oscillator.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant