Backup Mode Outputs and Waking on RTC Alarm

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

I'm working with a project that uses a SAML21 device with a backup SuperCap attached to the VBatt pin. I've run into a couple issues working with this that hopefully someone with experience can help sort out. I need to recharge the SuperCap every ~10hrs by switching on the external power supply. Originally I planned to do this by setting an RTC alarm for 10hrs after the unit enters backup mode. However, I have to toggle an IO pin to do this. I thought the SUPC Backup Outputs could be used for this, but the datasheet seems to imply parts of the SUPC don't work in Backup mode. If that's the case, it's a bit misleading to call them 'Backup Outputs'...

 

If I can't use the SUPC BKOUT functions, then I see no way to affect any external device while in Backup mode. I also don't think the RTC Alarm would work anyway since there's no Main Power to run the CPU and execute the ISR with. The only solution that comes to mind would be supplying all VDD with the SuperCap and putting the MCU into Backup Sleep mode in software when I want to sleep (I'm using the auto power switch now). Then, when the RTC Alarm occurs, the MCU can fully wakeup using SuperCap power and switch the external supply on to charge. Does that seem like the best way to do it?

 

There's also the RTC Toggle function that toggles one of the BKOUT pins when a RTC event occurs. I guess that could be used if that part of the SUPC works when in Backup mode...

 

Thanks as always guys.

This topic has a solution.
Last Edited: Thu. Nov 17, 2016 - 05:13 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Bump, and a more concise question:

 

Has anyone used the SUPC BKOUT (SUPC/OUT[1:0]) pins on a SAML21 or similar device? I can't get them to work at all. I switch the PB02 PINMUX to 'H' and enable it, but it still works as normal I/O. I've even confirmed all registers are set in the debugger. I dug into ASF, and they seem to setup the outputs the same way.

 

The basic setup goes like this:

#define PWREN GPIO(GPIO_PORTB, 2)

gpio_set_pin_function(PWREN, PINMUX_PB02H_SUPC_OUT1);   //Set PINMUX to 'H'(7) function (PORT.GROUP[1].PMUX1=0x07 and .PINCFG2=0x01 confirmed)
REG_SUPC_BKOUT |= SUPC_BKOUT_EN(2);                     //Enable SUPC control of PB02 (SUPC.BKOUT=0x2 confirmed)

After doing this, PB02 can still be controlled with normal PORT settings, and the SUPC.BKOUT.SET/CLR have no effect

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

Finally had a minor breakthrough that makes me think more of potential errata:

 

  • If the pin is set to output in the DIR register, the PORT maintains control and the SUPC does nothing.
  • If DIR is left 0, the SUPC seems to affect the pins, but with no real drive strength (0-410mV).
  • Even more strangely, if I disable the PMUXEN on that pin, the SUPC still controls the pin, but with even less drive strength (0-360mV).

 

Thought I could enable the pullup and get most of what I need, but that seems to have no effect. Think I'll add an external pull-up and see if I can at least get it working that way. As a final sanity check, I tried another board, and it exhibits the same problem (MCUs are likely from the same batch though.).

 

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

Wow, hours of Googling and troubleshooting only to find an article in the Atmel KB that only came up after trying to submit a support ticket. Maybe because it only mentions the SAML22. Either way, it's one of those things that makes you just want to walk away.

 

See Atmel KB Article  000010704: SUPC and RTC output pins configuration in backup mode in SAML22 devices. Basically, don't configure the pins using the PORT registers. Even though there's a MUX setting for them, don't do it... My drive strength issue may be related to the VBAT pin sucking the supercap supply way down (~10mA) for some reason. Still can't get backup outputs working correctly, but it's a step in the right direction...

This reply has been marked as the solution. 
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Alright, I can probably mark this as solved. Turns out you can use the Toggle on RTC Event function of the BKOUT pins while in Backup Sleep mode. Here's a quick summary on how to make the SUPC/RTC BKOUT pins work:

 

  1. Only Configure the BKOUT pins in the SUPC - Do NOT use the PORT/DIR/PMUX registers
  2. For 'Toggle on RTC Event' functionality, you must enable the RTC Event Output for the event you're interested in (eg ALARM0)
    1. Must do this even though the Event System is not functional in Backup mode
    2. Just set event bits in the RTC.EVCTRL register
    3. Note that you must disable RTC to write this reg
  3. These pins do seem to have less drive strength when in this mode, but it's enough to drive the buffer circuits I need.

EDIT: Section 46.8 I/O Characteristics provides a spec for the low drive strength: "Max. Output Current: Backup Pins in Backup Mode: 3-3.63V: 0.008mA". I'm still reeling after missing that section for so long.

Last Edited: Thu. Dec 1, 2016 - 04:08 PM