#garfield Logs
Jul 07 2020
#garfield Calendar
08:29 AM aandrew: Morning all
09:48 AM rue_mohr: hey
10:50 AM Tom_L: hi
10:52 AM polprog: hi
07:14 PM Tom_L: med
07:32 PM rue_mohr: cant remember what to do when I got home
07:34 PM Tom_L: <rue_mohr> over the week I'll see if I can tweek the handshake on the cnc spooler, add the 4th gear to the gearbox, and write some sine pwm stuff for the atmega88
07:35 PM rue_mohr: got the 4th gear
07:35 PM rue_mohr: need to test some pwm code
07:35 PM rue_mohr: and havn't written more on the handshaking yet
07:37 PM rue_mohr: it looks like there is a clock divider that can help me out lots
07:37 PM rue_mohr: but I need to make sure the general pwm is working first
09:45 PM aandrew: man I have not done ANY meaningful work in like a month now
09:49 PM rue_shop1: ok I mowed the lawm, cleaned part of the yard and picked a bunch of berries, what was I supposed to be doing?
09:49 PM rue_shop1: oh right, the m88 code
09:50 PM aandrew: my lawn is mostly dry so no mowing really needed
09:52 PM aandrew: I wake up, feed the kids, mke coffee and spend ~2h drinking it in the back yard until i run out or it's just too hot to stay
09:53 PM aandrew: then I come in and do stuff with the kids, futz around online, give them a snack/lunch, etc. start dinner
09:53 PM aandrew: then I futz around some more until 1-2am. lather, rinse, repeat
09:53 PM aandrew: it's a rough life, but someone's gotta do it I guess
09:54 PM rue_shop1: :)
09:55 PM aandrew: I need to drill a couple holes in the garage wall for a water tap and some conduit so I can put some shelves up there
09:57 PM rue_shop1: its all growing so fast
09:57 PM aandrew: once the wall is finished I want to build some workbenches
09:58 PM aandrew: your lawn?
09:59 PM rue_shop1: everything
09:59 PM rue_shop1: nature is closing in from all directions
10:02 PM aandrew: heh
10:03 PM aandrew: the forest is alive here, my flower beds have absolutely *exploded*, particuarly the hostas, my tiny little collection of flowers/plants by the kitchen sink is doing awesome
10:03 PM aandrew: even my basil clipping grew a crazy root system in water and when I planted it I expected it to wilt for a few days but it took right off
10:16 PM Tom_L: mucked with the cutters a min or three
10:17 PM rue_shop1: and!?
10:18 PM rue_shop1: can I switch off the root email notification in bash??? must be able to...
10:18 PM Tom_L: i just wanted to see how they did
10:18 PM Tom_L: nothing special
10:19 PM Tom_L: but mighty fine cutters
10:19 PM rue_shop1: usbinstall
10:21 PM rue_shop1: hmmm the usb port on this computer is getting really bad
10:21 PM rue_shop1: I probably need to do capacitors on it soon
10:23 PM Tom_L: started to make a holder for them last night but got interrupted with a linux install
10:23 PM rue_shop1: huh, you do that a lot
10:23 PM Tom_L: they're testing a new build
10:24 PM Tom_L: since i don't code, i try to test when i can
10:24 PM rue_shop1: OC0A OC0B OC2A OC2B
10:24 PM Tom_L: same timer?
10:25 PM rue_shop1: PD6 PD5 PB3 PD3
10:25 PM Tom_L: and where'd 1 go?
10:25 PM rue_shop1: 12 11 17 5
10:25 PM rue_shop1: you skipped 1
10:27 PM rue_shop1: pin 11 66%
10:27 PM zhanx_ is now known as zhanx
10:27 PM rue_shop1: OCR0B = 85; // PD5 pin11 Timer0 output compare B
10:27 PM rue_shop1: so its inverted
10:27 PM rue_shop1: heh
10:27 PM Tom_L: timer 1 must be 16 bit
10:27 PM rue_shop1: yup
10:27 PM Tom_L: or vise versa
10:28 PM Tom_L: notes say not inverted
10:28 PM rue_shop1: OCR0A = 1; // PD6 pin12 Timer0 output compare A
10:28 PM rue_shop1: that ones right
10:28 PM Tom_L: unless you set COM0B1
10:28 PM Tom_L: and A
10:29 PM Tom_L: err cleared it
10:29 PM Tom_L: them
10:29 PM rue_shop1: the init of timer 2 didn't work
10:30 PM rue_shop1: TCCR0A = 1 << COM0A1 | /* not inverted */
10:30 PM rue_shop1: 0 << COM0A0 |
10:30 PM rue_shop1: 1 << COM0B1 | /* not inverted */
10:30 PM rue_shop1: 1 << COM0B0 |
10:30 PM rue_shop1: ^^ something seems smyss
10:32 PM Tom_L: the code says they're backwards on purpose
10:32 PM Tom_L: one counts up, one counts down
10:33 PM Tom_L: one comment is wrong
10:34 PM rue_shop1: TCCR0A = 1 << COM0A1 | /* not inverted */
10:34 PM rue_shop1: 0 << COM0A0 |
10:34 PM rue_shop1: 1 << COM0B1 | /* not inverted */
10:34 PM rue_shop1: 0 << COM0B0 |
10:34 PM rue_shop1: 1 << WGM01 | /* fast pwm */
10:34 PM rue_shop1: 1 << WGM00 ; /* fast pwm */
10:35 PM Tom_L: :)
10:36 PM Tom_L: the demo probably dimmed an led on and off or something
10:36 PM Tom_L: so one had to be backwards
10:37 PM rue_shop1: I have an old guy I know talking to me on the phone again
10:37 PM rue_shop1: he's trying to deal with the batteries in his cordless
10:37 PM rue_shop1: he's been workign on this for 8 months now
10:37 PM rue_shop1: he will not go out and buy a new cordless phone
10:37 PM Tom_L: no wonder he's old
10:37 PM rue_shop1: and he will not pay what they want for a new battery for it
10:38 PM rue_shop1: so why does timer 2 not work
10:38 PM Tom_L: it should
10:39 PM Tom_L: i know i tested code i put on the site
10:40 PM Tom_L: maybe it needs those init bits set for it too
10:40 PM Tom_L: maybe i only did one
10:40 PM Tom_L: those are all 0, not 0 & 2
10:40 PM Tom_L: i'd have to check the data sheet
10:41 PM Tom_L: maybe you need a set for TCCR2A TCCR2B too
10:41 PM zhanx_ is now known as zhanx
10:41 PM Tom_L: it's beyond the realm of my memory
10:42 PM rue_shop1: still telling me about it
10:42 PM Tom_L: mebbe the battery will go dead
10:42 PM Tom_L: :)
10:43 PM Tom_L: do both those come off timer0? i certainly don't remember now
10:44 PM rue_shop1: no he's talking on another phone
10:45 PM Tom_L: maybe OCR2A 2B need initialized with the same code as 0 but i forgot to put it in?
10:46 PM rue_shop1: he's telling me about how he's been recharging alkaline batteries in nicd chargers for years
10:46 PM Tom_L: is his name 'lucky' ?
10:47 PM rue_shop1: ok
10:47 PM rue_shop1: now, timer 2
10:47 PM Tom_L: http://tom-itx.no-ip.biz:81/~webpage/avr/tiny10/test/tn10_pwm_test.asm
10:47 PM Tom_L: do it in asm :)
10:48 PM rue_shop1: you didn't set TCC02A
10:48 PM rue_shop1: if there is one
10:48 PM Tom_L: that's what i was saying
10:48 PM Tom_L: maybe both those come off timer0?
10:48 PM Tom_L: i don't remember
10:48 PM rue_shop1: OC0A and OC0B do
10:49 PM Tom_L: what about OC2A 2B?
10:50 PM rue_shop1: TCCR2A = 1 << COM2A1 | /* not inverted */
10:50 PM rue_shop1: 0 << COM2A0 |
10:50 PM rue_shop1: 1 << COM2B1 | /* not inverted */
10:50 PM rue_shop1: 0 << COM2B0 |
10:50 PM rue_shop1: 1 << WGM21 | /* fast pwm */
10:50 PM rue_shop1: 1 << WGM20 ; /* fast pwm */
10:50 PM rue_shop1: working ....
10:50 PM rue_shop1: on...
10:50 PM Tom_L: so i just forgot to put the init in for 2
10:50 PM rue_shop1: yea, this looks like a copy-pasta job
10:51 PM Tom_L: odd i left the OC in
10:52 PM rue_shop1: I cant beleive that after 8 months he didn't just buy a new $20 cordless
10:52 PM Tom_L: heh
10:52 PM rue_shop1: the divider for 2 is different
10:53 PM rue_shop1: we go thru the same conversation each time about battery types and voltages and capacities
10:53 PM rue_shop1: I'm glad he's still kicking tho!
10:53 PM Tom_L: you should record it and just play it back
10:54 PM Tom_L: how old is he?
10:54 PM rue_shop1: oh I forgot to change TCCR0B to TCCR2B when I copy-pasta's
10:54 PM rue_shop1: oh I forgot to change TCCR0B to TCCR2B when I copy-pasta'd
10:54 PM rue_shop1: he's, 87?
10:54 PM rue_shop1: or so...
10:54 PM Tom_L: ahh, well i'd cut him some slack then
10:55 PM rue_shop1: I was patient when I re-explained it again }:|
10:55 PM rue_shop1: he's a DIY guy
10:55 PM Tom_L: and that's a problem?
10:55 PM rue_shop1: meduim heavy capacity
10:55 PM rue_shop1: no
10:55 PM rue_shop1: he was a journeyman electrician, has a shop that (did) have lathe
10:56 PM rue_shop1: he didn't stop doing things, he just gets other people to do the doing now
10:56 PM Tom_L: http://tom-itx.no-ip.biz:81/~webpage/avr/servo_pwm/test_pwm2/
10:56 PM Tom_L: you could look at that one too
10:56 PM rue_shop1: ok, all 4 channels are working
10:57 PM rue_shop1: funny thing, at this point I only need 2 channels
10:57 PM rue_shop1: I worked out a way I dont need to use a timer to clock the processor
10:57 PM rue_shop1: :)
10:57 PM rue_shop1: but I wanted the demo working
10:57 PM Tom_L: are the timer2 regs the same?
10:57 PM rue_shop1: tiem for more tea and to put on supper
10:58 PM Tom_L: i just forgot to add them i guess
10:58 PM Tom_L: sleep here
10:58 PM rue_shop1: https://paste.debian.net/1155556/
10:58 PM Tom_L: eyes won't focus anymore
10:59 PM rue_shop1: ok! with that tested I can go edit up stuff blindly
11:00 PM rue_shop1: I have to use gcc to make me code I can produce an assembly file with
11:00 PM Tom_L: look over the tiny10 asm
11:00 PM Tom_L: it's probably the same thing
11:01 PM rue_shop1: dedicated 60Hz sine wave pwm generator in 2 channels for positive and negitive half
11:01 PM rue_shop1: gcc will generate most of what I need and I can clean it up and get what I need
11:01 PM Tom_L: http://tom-itx.no-ip.biz:81/~webpage/avr/tiny10/test/tn10_pwm_test.asm
11:02 PM rue_shop1: :)
11:03 PM Tom_L: i did a couple asm for it but gcc supports the tiny10 in c now
11:13 PM rue_mohr: I have to do this in asm because the load and write operations MUST be 2 cycles, gcc tries to do optimization things that messes it up and gets random results
11:18 PM rue_mohr: ok, I need to set the processor divisor to 64
11:19 PM rue_mohr: and set the pwm clock source to external
11:19 PM rue_mohr: T0...
11:22 PM rue_mohr: guess I can test that now too
11:22 PM rue_mohr: supper still cookin
11:30 PM rue_shop1: ok, what I got here is a glitch filter
11:31 PM rue_shop1: oh maybe its the edge detector
11:36 PM rue_shop1: ok, their edge detector is based on the cpu clock, so I can clock the counter at 8Mhz and run the cpu at 15Khz
11:37 PM rue_shop1: grrr
11:37 PM rue_shop1: I'll look at the other times
11:38 PM rue_mohr: 2 says its asynchronous
11:41 PM rue_mohr: yea
11:41 PM rue_mohr: ASSR:AS2
11:42 PM rue_mohr: yup
11:42 PM rue_mohr: ok
11:56 PM rue_mohr: huh, there is a possability that this wont work
11:57 PM rue_mohr: timer 2 IS asynchronous, HOWEVER they state that the cpu clock must be more than 4x faster than the timer clock
11:57 PM rue_mohr: which is extremely not true for this app
11:59 PM rue_mohr: hmm
11:59 PM rue_mohr: even at 20Mhz, I cant use the mega8 / 88 as a 17 bit counter (for 8Mhz)