Replies: 3 comments
-
See datasheet. It needs the peripheral clock to be active. |
Beta Was this translation helpful? Give feedback.
-
Hey Thanks for the tip! I solved it using: and CLKCTRL.OSC20MCTRLA = 0x02; //Clock_Per to run in standby mode ---> CTRLA = 00000010, page 85 |
Beta Was this translation helpful? Give feedback.
-
It can't be run in power down sleep. But according to the datasheet, powerdown sleep on a 1-series tiny isn't necessarily any lower power than standby sleep - power down and standby sleep with everything disabled is listed in the same line of table 36.5 (based on the 3216 datasheet - you don't inherently get anything for going all the way to power down sleep, assuming you don't have any other peripherals wedged on with the RUNSTBY bit. So you need to be using SLEEP_MODE_STANDBY not SLEEP_MODE_POWER_DOWN, and you need to have set the run-standby bit.
That said, it's a DAC, and DAC power consumption is With current released version, if using analogWrite() to control the DAC, you need to do that after every call to analogWrite(), or just manually configure the DAC (by setting DAC0.DATA=(8-bit value) and DAC0.CTRLA = 0xC1 (if manually controlling the DAC, you only need to change DAC0.DATA to change the value once CTRLA is set up (it looks like you're doing it manually In analogWrite() I used simple assignment to write 0x41 (0x01 is enable, 0x40 is output buffer enable) to CTRLA; (the code does DAC0.DATA=val; DAC0.CTRLA=0x41; which compiles to sts 0x0680, r26; ldi r26, 0x41; sts 0x0681, r26; - 5 words 5 clocks) I've changed that so that analogWrite() won't forget the current runstby setting, and it will be in the next release. I think that LTO is clever enough that as long as you don't analogWrite() the DAC pin or a compile-time-unknown pin, it won't include that case in the generated code to prevent it from taking an extra 4 bytes of flash (though it will still forget the setting when you turn the pin off with digitalWrite(), which I would argue is correct behavior). Note: It is recommended that you set |
Beta Was this translation helpful? Give feedback.
-
Hi,
I have a situation where I need to keep the DAC ON while the CPU is in standby sleep, how can I accomplish this?
I am using an ATTINY816 or ATTINY1616 @ 2.5V @ 5MHz
For context I am using an external interrupt on PIN PC2 from an accelerometer to wake the CPU and change the DAC value, then go back to sleep. The problem is when the system goes to sleep, the DAC output also gets disabled.
Thanks,
Andrew
Beta Was this translation helpful? Give feedback.
All reactions