I can also set gen0 to /4 division via gendiv before sleep, then restore to div1 after wfi and that also works (instead of switching gen0 to osculp32k, which was just to get an indication if related to clock speed after wakeup). If I use /2 then does not, so it seems <= 250kHz is what I currently need for wake to not trip bod12 (using defaults for osc8m, which is /8 and runstdby=0).
I have also done this in my regular code in the waitms function and am now waiting at 4-5ua.
auto waitms (u16 ms, bool stdby = false) { //0-65535ms, will init on first use
//not shown-
//check ms for 0
//check if rtc bus is on and rtc ensbled, call init if not
//calculate counts needed for ms
//compare = count + ms counts
//clear comp flag, enable comp irq
irqFunction(
RTC_IRQn,
[](){ reg_.RTC_INTENCLR = CMP0bm; }
); //also enables NVIC irq by default
Gclk.generatorDivide( Gclk.GEN0, 4 );
//until cmp0 irq disabled
while( reg_.RTC_INTENSET bitand CMP0bm ) {
Pm.sleep( stdby ? Pm.STANDBY : Pm.IDLE0 );
}
Gclk.generatorDivide( Gclk.GEN0, 0 );
}
>Can you show the schematic of your board?
If I had one, it would be the stick figure of schematics. I can describe it- 1 mcu, the 2 swd pins to header, 2 power pins to header, 1 100nf bypass cap next to mcu, other pins to leds on board, reset pin unused, header is close to mcu. Also tried on another assembled board which acts the same, and another with only mcu/cap soldered. Everything other than this peculiar standby problem works fine.
Also tried running from lithium 3v battery, same. Also have an xplained tiny but cannot really duplicate what I have- I can do the same tests and they work ok, but so do my boards until swd disconnected, which I cannot easily do on the xplained board nor can I measure current easily without changes.
I do not have the 4.7uf as they show in the power supply checklist, but have similar filtering 5" away at the power source. I assume like most they are showing the 100nf which is needed, and the 4.7uf as a 'typical example'. I can piggyback a 4.7uf on the 100nf, but I do not imagine that will make any difference, although my imagination does not have the final say.
It could also be I somehow damaged these mcu's in the process of reflow. My process is not perfect, but has always worked ok to this point- get solder on pads using liberal amount of flux, and for a 0.5mm part the pad does not hold much (but I then know it is the correct amount), place mcu centered on pad, with flux, hot plate for 2-3 minutes until solder flows and mcu settles into place. The temperature is enough to do the job, but not too much as to cause smoke. I have done the same many times with success, so I sort of doubt that this time was the time I damaged the parts somehow but is possible. I do have about 8 other boards I have not tested yet, maybe one or more of them will act differently.
There is a value in user row for BOD12, but it supposed to be hands off (default value is 0x70).
At least I have something working now.