#avr | Logs for 2016-12-26

Back
[03:08:57] <_ami_> i have made a gpio over usb board. To benchmark the gpio read/write, i just to gpio on/off continuously and read it on logical analyzer?
[03:09:13] <_ami_> i just have* to
[03:24:57] <rue_house> do tell what you get
[03:25:21] <rue_house> hmmm
[03:25:28] <rue_house> spindle motor for new cnc
[03:25:36] <rue_house> $300 easy from china
[03:25:46] <rue_house> $40 for a local dremel knockoff
[03:25:53] <rue_house> $32 from amazon for the same thing
[03:26:10] <rue_house> $20 for a dust buster from amazon that'll have a motor with enough rpm
[03:26:22] <rue_house> $free to use the dust buster motor I have
[03:26:50] <rue_house> I could finish this scale is someone would just pay me to not do the project!
[03:41:50] <Tigzee> trying to create my first real avr project since the original 2313 (now using attiny44a). I am using assembly and I can't get an interrupt to fire with timer1 compareb. anyone up to looking at my code?
[04:15:42] <antto> Tigzee i can't help with the asm but re-check that you've enabled the timer interrupt and the global interrupt
[04:16:01] <Tigzee> Im starting to doubt something
[04:16:13] <Tigzee> do I need the CTC timer mode to use compare?
[04:17:22] <antto> and also, it's possible some other interrupt to be causing the mcu to block in a loop, so if possible - check that your main thread is operating (by toggling a pin or something)
[04:17:56] <Tigzee> I was planning on having the timer in normal mode (forever looping) and trigger an interrupt when the timer reaches a value (but still keeps counting)
[04:18:40] <Tigzee> I have no other interrupts enabled. I have an led that polls on and off verifying cor eis still running
[04:19:26] <antto> so your main thread is alive then
[04:19:48] <Tigzee> yep
[04:20:14] <antto> then the problem is somewhere around the timer setup and/or timer interrupt handler
[04:20:24] <Tigzee> I agree
[04:20:32] <antto> but.. i don't speak asm
[04:21:27] <Tigzee> I have TCCR1A = 0b00000000, TCCR1B = 0b00000011, OCIE1B set to 1 in TIMSK1
[04:22:59] <Tigzee> I have 2 leds hooked up. 1 blinks every 2 seconds showing main thread is alive. I have the 2cnd led turn on at chip start and use interrupt to turn it off (which never happens)
[04:26:27] <Tigzee> By converting TCCR1B to 0b00001011, the interrupt does trigger (but the timer stops and I wanted it to forever loop)
[04:27:17] <antto> ah, i remember all that in a table in the datasheet
[04:27:37] <antto> but is it common between attiny and atmega
[04:28:22] <Tigzee> I think so, but don't really know
[04:29:26] <Tigzee> Under Normal Mode the datasheet says "The Output Compare units can be used to generate interrupts at some given time."
[04:29:37] <Tigzee> so I wonder why I am running into a problem
[04:30:21] <antto> in my atmega datasheet, normal mode says that it just runs from 0 to 255 and produces an interrupt each time it wraps around
[04:31:00] <Tigzee> does your atemga have output compare?
[04:31:06] <antto> yes
[04:32:07] <antto> (i'm looking at the datasheet for atmega640/1280/1281/2560/2561)
[04:34:18] <Tigzee> in yoru datasheet 17.7, it sounds like my attiny44a
[04:34:38] <antto> CTC mode is like normal mode but another register is used (OCR2A) for the "TOP" point instead of 255
[04:35:11] <antto> oh, i was looking at 20 (8bit timers)
[04:35:16] <Tigzee> antto, I want the timer to forever loop and for me to pick times to run an interrupt
[04:35:49] <Tigzee> from my understanding of the datasheet for both our chips, I think it's supposed to work
[04:36:06] <antto> CTC mode is a good candidate then, you just have to watch out when you change the period
[04:37:09] <antto> 17.7 is "output compare units" .. uhm
[04:37:17] <Tigzee> I don't want the counter to have a limited top. that will bring in a whole bunch of extra math to compensate
[04:39:13] <Tigzee> I built a new program for testing, it may be owkring properly
[04:43:53] <antto> i have some commented-out chunk of code which initializes timer3 on my atmega2561
[04:45:29] <antto> TCCR3A = 0; TCCR3B = (1 << WXM32); OCR3A = 6667; TCNT3 = 0; TIMSK3 = (1 << OCIE3A);
[04:45:56] <antto> and then eventually sbi(TIMSK3, TOIE3); enables the interrupt
[04:46:26] <antto> according to the comments - this should set the timer in CTC mode
[04:47:02] <Tigzee> I want normal, not CTC
[04:47:35] <antto> that would be easier to set up
[04:50:36] <antto> btw..
[04:51:20] <antto> depending on the timer prescaler and stuff, the period could potentially be quite long (if it's a 16bit timer)
[04:52:08] <antto> so it might not produce an interrupt immediately after start, and it might take a while to wrap around before it produces an interrupt for the first time
[04:52:59] <Tigzee> I'm using a division of 64. at 8mhz means the led should be blinking at 1/2 second intervals
[04:55:27] <antto> btw, according to my datasheet, in normal mode you need TOV interrupt (timer overflow)
[04:56:28] <Tigzee> I didn't know you needed it
[04:56:28] <antto> the TOV flag is said to be cleared automatically only if you use the interrupt
[04:56:57] <antto> ehm not that you "need it" .. more like, that's the interrupt you get in that mode
[04:57:19] <Tigzee> But it still says you can use the compare interrupt in normal mode
[04:58:36] <antto> hm
[06:39:44] <rue_bed> did you need to clear the compare match flag?
[06:40:16] <rue_bed> oops, needed to keep scrolling
[07:37:36] <martinus> Dammit, how do I find a replacement ferrite loop for what appears to be HF noise suppression in an electric hedge trimmer when there are no bloody markings on the thing?!
[07:43:43] <Emil> martinus: ...
[07:43:58] <Emil> you dont find an exact value one
[07:44:12] <Emil> do you not know how elwctronics works :D
[07:45:23] <Emil> especially with ferrite cores you just take one that looks the same
[07:45:41] <Emil> Especially with this application
[08:22:48] <martinus> it's the shape that's the problem - it's rectangular. Almost everything I see is a bead or one of those plastic encapsulated split beads.
[08:26:17] <Emil> hm?
[08:26:22] <Emil> Shape dont matter
[08:28:31] <martinus> It does when it's mounted inside the handle of a device and there's no room for a standard toroid.
[08:32:12] <Emil> martinus: mouser/digikey/farnell and then ferrites
[08:32:21] <Emil> Im sure they carry a rectangular one
[08:32:37] <Lambda-Aurigae> pull the old one and rewind it.
[08:33:02] <Emil> Also Arrow and Elfa