#avr | Logs for 2012-06-14

Back
[02:50:11] <mrfrenzy> beware of motorola processors with the security bit set!
[04:09:05] <mitsakos> Hello, i'm building a RTC using avr atmega168. At the current stage i'm trying to put the mcu in power save mode when power is off so it will run in battery with low power consumption. I'm using Timer/Counter2 in asynchronous mode (32.768Khz external crystal on XTAL1 XTAL2) to update the RTC. I have connected a voltage divider on AIN1 pin on the Analog Comperator in order to detect the voltage drop on power lose and AIN0 is connected inte
[04:09:05] <mitsakos> rnaly to Bandgap Ref Volt. I have enabled An. Comperator interrupt (toggle detect) and i have written an ISR where i check if the bit AC0 is set (battery mode). If it is true i but the mcu in Power Save Mode. The problem is that it never wakes up!
[04:09:38] <mitsakos> i have also tried to add a simple if (battery_mode) and put in sleep mode and it worked correctly.
[04:11:00] <mitsakos> what i have to ask is. When the mcu wakes up from Timer/Counter2 runs the Timer/Counter2 ISR and then continues the program from the Analog Comperator ISR instruction after SLEEP or at the last instruction in the main program before Analog Comperator interrupt occured?
[04:21:47] <BusError> the sleep wake and the interrupts are not correlated. the program will continue after sleep for at least a cycle, before the interrupt is triggered
[04:22:46] <mitsakos> before whch interrupt ?
[04:23:04] <BusError> the one that woke the cpu,
[04:26:57] <mitsakos> sorry, explain me again. the analog comp interrupt occures and mcu goes to sleep. but you say the mcu doesn't go to sleep imediately but it contiues runing for at least one cycle. When a timer2 interrupt occures the mcu wakes up and runs the timer2 ISR right?
[04:30:52] <mitsakos> BusError
[04:31:29] <Tom_itx> inflex you around?
[04:31:44] <BusError> no sleep is immediate, if there are no pending interrupts
[04:31:58] <Tom_itx> was curious what settings you used to blow / reset the attiny10 fuses with avrdude...
[04:35:05] <mitsakos> BusError so putting the avr in sleep mode in analog comperator interrupt isn't wrong right? why it doesn't work? when the timer2 interrupt occures it is supposed the mcu will wake up and start running until next power lose
[04:39:12] <BusError> mindw0rk, are the interrupt non-masked when you go to sleep ? made sure of that? I'm not sure what the behaviour should be going to sleep in an interrupt, thats not something I would try :-)
[04:39:56] <BusError> no sure if the MCU can wake from an interrupt, since technicaly it hasn't finished one
[04:41:18] <mitsakos> mitsakos not mindw0rk :P
[04:41:25] <mitsakos> "are the interrupt non-masked when you go to sleep ?" what do you mena?
[04:41:28] <mitsakos> *mean
[04:44:07] <BusError> sei() -- if the interrupts are masked when you sleep, it will never wake again.
[04:48:23] <inflex> Tom_itx: wassup?
[04:48:39] <inflex> Tom_itx: oh... will have to check my laptop to see what I used for that
[07:57:03] <mitsakos> can we say that pwm is an ac voltage? what i'm thinking is, to add a capacitor in series to a pwm output which is driving a fet for voltage booster. So if something goes wrong and pwm doesn't work and insteed of pwm we have a dc voltage the capacitor will cut it off
[07:57:31] <specing> NO, It is definetely not AC voltage!
[07:57:37] <mitsakos> thus the inductor doesn't get burned :P
[07:57:46] <mitsakos> so the capacitor can't work?
[07:58:09] <specing> what are you trying to do?
[07:58:30] <mitsakos> i have an openloop voltage booster using avr
[07:58:37] <specing> PWM is tipicaly a square-wave signal
[07:58:49] <specing> You can control FETs with it
[07:58:49] <mitsakos> what i want is to prevent a DC voltage insteed of PWM on the FET
[07:58:56] <mitsakos> yes i know..
[07:58:58] <specing> ?
[07:59:11] <mitsakos> if something goes wrong to the avr
[07:59:20] <mitsakos> and insteed of PWM it outputs DC voltage
[07:59:29] <mitsakos> i don't want the inductor driver by the fet to get burned
[07:59:33] <specing> You want to auto-close the FET when the AVR goes !@#$%^&*(?
[07:59:50] <mitsakos> i want to close the FET on DC voltage
[07:59:58] <specing> ?
[08:00:17] <specing> I still don't get what you want
[08:00:23] <specing> PWM is DC voltage
[08:00:36] <specing> So you want the FET to be always closed? :)
[08:00:42] <mitsakos> it is a saw DC voltage
[08:00:51] <mitsakos> it isn't a line DC
[08:00:57] <specing> It is a square-wave DC signal
[08:01:07] <mitsakos> yes
[08:01:13] <Steffanx> it'll work with a cap mitsakos
[08:01:19] <Steffanx> but it'll change the signal too
[08:01:30] <mitsakos> what i want is when i don't have a square wave but a straight DC voltage to pull down the fet
[08:01:38] <specing> mitsakos: How about using a driver circuitry after an inverter?
[08:02:02] <specing> mitsakos: See AVRBC100
[08:02:12] <specing> Its all there
[08:02:15] <Steffanx> It's very easy to simulate things like this mitsakos
[08:02:26] <Steffanx> or try it and look at the signal with a scope?
[08:02:46] <mitsakos> yes that's a solution
[08:03:39] <mitsakos> for now i don't have an oscilloscope so i think that simulation is the only way
[08:03:56] <Steffanx> A cap will work and afaik it's a 'common' soluation
[08:06:49] <mitsakos> yes i have seen it in microphones
[08:06:58] <mitsakos> which is used for cutting the DC voltages
[12:07:03] <Sgt_Lemming> hey guys, AT Tiny 45 question
[12:07:14] <Sgt_Lemming> anyone know how many of the pins can run PWM?
[12:09:13] <Steffanx> All of them, when you use software pwm :P
[12:09:57] <Corwin> Steffanx, vcc/gnd pins too? :)
[12:10:08] <Steffanx> I knew someone was going to say that
[12:10:11] <Corwin> :D
[12:11:00] <Corwin> anyway... the answer is 4
[12:11:00] <Sgt_Lemming> hardware PWM
[12:11:05] <Steffanx> Looks like there are 3 pins you can use as 'independent' pwm signals
[12:11:10] <Sgt_Lemming> awesome
[12:11:28] <Steffanx> 4 Corwin ?
[12:11:42] <Corwin> pb0,1,3,4
[12:11:43] <Corwin> no ?
[12:11:45] <Steffanx> OC0A, 0C0B and OC1A
[12:11:55] <Steffanx> Uhm
[12:12:00] <Steffanx> OC1B :P
[12:12:30] <Steffanx> pb3 and 4 are OC1B and \OC1B …
[12:12:54] <Sgt_Lemming> ah, so 2
[12:12:57] <Sgt_Lemming> shite
[12:13:07] <Sgt_Lemming> 2 is doable, 3 would be better
[12:13:13] <Steffanx> No, 3
[12:13:33] <Steffanx> OC0A and OC0B probably use the same timer
[12:14:04] <Sgt_Lemming> looking at the datasheet and I don't see OC0B
[12:14:23] <Sgt_Lemming> oh, woops
[12:14:24] <Sgt_Lemming> nm
[12:14:26] <Sgt_Lemming> see it now
[12:14:30] <Steffanx> :)
[12:14:37] <Sgt_Lemming> shush :-P
[12:17:04] <Sgt_Lemming> working on an µC powered rear bike light :-D
[12:20:12] <Corwin> and how many PWM signals you need for that?
[12:20:17] <Sgt_Lemming> 3
[12:20:34] <Sgt_Lemming> Red flashing, Left Turn and Right Turn
[12:20:55] <Sgt_Lemming> hand signals don't work in traffic at night, and if it's worth doing, it's worth overdoing :-P
[12:21:25] <Corwin> :)
[12:22:48] <CapnKernel> I've always wanted flashing turn signals
[12:22:58] <CapnKernel> I'm tempted to mount them on my hands
[12:23:18] <Sgt_Lemming> I've considered doing that
[12:23:34] <Sgt_Lemming> but unless you have a jacket you ALWAYS wear when riding, the wiring becomes a problem
[12:23:57] <Sgt_Lemming> and wireless is just too insane for such a simple task, not mention batteries....
[12:24:13] <Sgt_Lemming> I've considered doing it on my backpack, but then how do I control it?
[12:24:29] <Sgt_Lemming> so mounting it to the bike, with handle bar mounted controls makes the most sense to me
[12:25:01] <CapnKernel> Gloves, which I always wear, because one day I'm going to come off (again) and I'd like to mimimise lost flesh
[12:25:12] <Sgt_Lemming> I always wear gloves
[12:25:17] <CapnKernel> I can get little "ball in can" orientation sensors here. When you hold your hand out straight, it would start to flash
[12:25:22] <Sgt_Lemming> but getting the power to the gloves is the PITA bit
[12:25:38] <Sgt_Lemming> those things do not reject vibration well
[12:25:47] <CapnKernel> Little Li-ion battery about size of postage stamp
[12:25:51] <Sgt_Lemming> so they'd be flashing constantly on and off as you rode
[12:26:15] <Sgt_Lemming> also, your hands tend to slope outwards anyway when you are riding
[12:26:22] <Sgt_Lemming> so the sensor would almost always be on
[14:07:49] <Xata> Hello
[14:09:04] <Xata> Just came to say - I MADE IT. Go damn MCP41010, i made it work. Thus had to use program SPI - SCK had to be in _middle_ of SI
[15:13:30] <uv_> re