#avr Logs

Feb 19 2019

#avr Calendar

02:09 AM janco_ is now known as janco
07:14 AM McDonaldsWiFi is now known as PublicWiFi
09:09 AM paulo_ is now known as Guest29377
10:38 AM paulo_ is now known as Guest40694
01:46 PM [1]MrMobius is now known as MrMobius
02:14 PM nohit: --
04:29 PM Flecks is now known as Fleck
06:36 PM splud: Hrm, having some timing issues with an ATTiny13A, with Fast PWM, and I'm using the TIM0_OVF_vect interrupt handler to track elapsed uSec and millis.
06:36 PM splud: 9.6MHz internal oscillator, fuse bits set so no divider.
06:36 PM splud: Have FastPWM enabled:
06:37 PM splud: code) TCCR0A |= (1 << WGM01) | (1 << WGM00) |= (1 << COM0B1);
06:37 PM LeoNerd: Internal osc. tends not to be -very- accurate. Expect +/- up to 2% or so
06:37 PM splud: code) TCCR0B = (TCCR0B & 0b11111000) | CLOCK_PRESCALE;
06:37 PM splud: that's not a huge issue. And I know calibration can be done. This is for a pretty coarse PWM.
06:38 PM splud: where CLOCK_PRESCALE is _BV(CS01)
06:38 PM splud: which is equal to 8. As set for now.
06:40 PM splud: this results in a FastPWM of 1/(9600000 / 8 / 256) = 4687.5Hz, give or take. where 8 is the prescaler and 256 is the full 8 bit count for the TIM0 overflow.
06:41 PM splud: code ) TIMSK0 |= _BV(TOIE0);
06:42 PM splud: so I expect the overflow interrupt to be geting called every 213 uSec or so.
06:43 PM splud: er, FastPWM math above with 1/ is the seconds per interrupt, frequency is without 1/
06:43 PM splud: anway. That much has generally worked as expected, and I've used different FastPWM divisors for different projects.
06:45 PM splud: I should point out that the Fast PWM output has been at the frequency I need. I hadn't actually verified the interrupt rate was as expected, but had not actually been using it for anything at the time
06:46 PM splud: Now, I've gone to use the counter manipulated by the OVF, and things are NOT as expected.
06:47 PM splud: With the fragments of code above, I should expect a 213 uSec overflow period generating a TIM0_OVF interrupt, right?
06:49 PM splud: As I'm using FastPWM on this uC that has just a single 8 bit timer, it's on me to track my own time.
07:22 PM splud: nothing?
07:23 PM splud: anyway, I've scoped the PWM output, and I get the expected period for the PWM - eyeball on an analog scope I'm seeing about 2.2 divisions per cycle with the dial at 0.1mS/div, so eyeballed to about 0.22mS, where I expect 213 uS (0.213mS). Just fine.
07:29 PM splud: Tweaking the CPU prescaler has the expected impact on that timing. But for my present purposed, the CPU prescaler is 1.
07:37 PM splud: so, the FastPWM, running on 8-bit TIMER0 (the ONLY timer on the ATTiny13A) with overflow interrupt enabled, SHOULD be triggering the TIM0_OVF 4.7K-ish times a second, right?
07:37 PM splud: yes, no, someone?
09:13 PM splud: I'll try inquiring again tomorrow.
09:21 PM rue_mohr: whats the pwm for?
09:46 PM rue_mohr: hmm where do I get the flash size of a firmware
09:48 PM rue_mohr: program.lst?
09:48 PM rue_mohr: .text?
09:48 PM rue_mohr: I'm only 1.4k
10:18 PM mrpackethead: does anyone know how you get a login to avrfreaks.com?
10:45 PM davor_ is now known as davor
11:09 PM rue_mohr: I just avoid them
11:09 PM rue_mohr: they have a login wall
11:18 PM day_ is now known as day
11:57 PM mrpackethead: rue_mohr, a login wall?
11:58 PM mrpackethead: any suggestons on which is the best forum for discussion about SAM Processors