#avr Logs

Apr 16 2018

#avr Calendar

12:18 AM rue_mohr: not yet
12:22 AM rue_mohr: hows the mixer?
12:28 AM polprog: Didnt change much since last time we talked :D
12:50 AM * polprog yawns
12:51 AM _ami_: polprog, getting bored in class?
12:51 AM polprog: not yet
12:51 AM polprog: getting bored on the train. and being already late :P
01:43 AM polprog: https://youtu.be/7Ty8mNFM358
01:45 AM Thrashbarg: hehehe
01:47 AM Thrashbarg: polprog: https://youtu.be/7Ty8mNFM358 <-- lotsa swearing but pretty funny
01:48 AM Thrashbarg: (Aussie)
01:50 AM Thrashbarg: crap wrong one xD
01:51 AM Thrashbarg: https://youtu.be/6NN7J-BpHGw
01:57 AM Haohmaru: bit shifting.. https://godbolt.org/g/7dGe5q
01:58 AM Haohmaru: so it's not as bad as i thought
02:02 AM polprog: did you expect it to do a bunch of LSLs?
02:02 AM polprog: do you even shift bro?
02:07 AM Haohmaru: i didn't know what to expect, i assumed that there's a nifty instruction that shifts N times for one clock cycle, till someone said that's not the case
02:19 AM polprog: not on atmegas i think
02:19 AM polprog: in theory you could use MUL
02:19 AM polprog: if your core supports it
02:25 AM Haohmaru: xmega i think has multiplication
02:33 AM * Haohmaru begins writing a template function to copy bits from one array to another..
02:33 AM Haohmaru: template <
02:33 AM * Haohmaru thinks.........
02:33 AM Haohmaru: who am i kidding
02:45 AM polprog: not writing assembly subroutines
02:45 AM polprog: you arent trying hard enough
02:55 AM Haohmaru: then you'd have to write N versions of the same routine
03:06 AM polprog: i know
03:07 AM Haohmaru: by the time you're done with that, u gon b as old as me
03:08 AM Haohmaru: what if you switch to a different chip/instructionset?
03:08 AM Haohmaru: oh noes
03:14 AM polprog: we need to write in a LLVM, we would only have to switch backends then
03:15 AM * polprog yawns again
03:44 AM Haohmaru: isn't that gonna be as complex and low level as writing ASM?
03:46 AM polprog: joking
03:47 AM polprog: is there any reason not to mix cpp and c?
03:49 AM _ami_: damn, whats the search text for finding 12vAC AC-to-AC adapter on aliexpress
03:53 AM polprog: transformer?
03:55 AM _ami_: sure, i could buy transformer.. is it covered? safer to use
03:55 AM _ami_: i don't wanna take any risk while playing with AC main.
03:56 AM _ami_: polprog, you beauty!! that was the word. https://www.aliexpress.com/item/Electric-Converter-Adapter-to-Voltage-Transformer-DC-96V-72V-64V-60V-48V-TO-12V-20A-Current/32599934698.html
03:56 AM _ami_: oh they sell it in nice cover
03:56 AM polprog: :)
03:56 AM _ami_: oops again its DC
03:59 AM Haohmaru: polprog i don't think so, but if you can, you can simply just write in C++ instead
03:59 AM _ami_: https://www.aliexpress.com/item/110-220V-12V-60W-Halogen-Dimmable-LED-Lamp-Electronic-Transformer-Power-Supply-Drive-Adapter/32828005868.html
03:59 AM polprog: yeah Haohmaru
04:00 AM _ami_: is this really 12v AC?
04:02 AM Haohmaru: well it says "AC 12V"
04:03 AM _ami_: yeah i know. but i don't trust them. :P
04:03 AM _ami_: 60W so upto 5A current.
04:04 AM Haohmaru: trust is a completely different thing
04:05 AM Haohmaru: i ordered some 8GB of ram sticks from ebay.. still waiting for them
04:06 AM Haohmaru: i want to believe the picture and description is correct.. but.. i'll only know when they arrive
04:19 AM Emil: Haohmaru: why
04:19 AM Emil: Haohmaru: yu get 100% shit
04:20 AM Haohmaru: eh?
04:21 AM day: if something is unclear on ebay, it is meant to be unclear
04:22 AM Haohmaru: yeah, this one looked promising
04:22 AM day: i hope it works out. you can always paypal rape them
04:23 AM _ami_: its just that you should check and verify all items from ali/ebay
04:23 AM _ami_: as soon as possible.
04:25 AM _ami_: i even check passive items like pots.
04:26 AM _ami_: potentiometers
04:26 AM Haohmaru: i check everything of course
04:29 AM Haohmaru: i've only had a problem with stuff bought from ebay once, it was some american screws.. what arrived was not screws but something slightly different that didn't work
04:29 AM Haohmaru: i didn't bother "paypal raping" them
04:29 AM Haohmaru: i just gave them bad feedback on the listing description
04:29 AM Emil: Eh?
04:29 AM Emil: it's super simple to use the ebay money back program
04:29 AM Haohmaru: for a small bag of nuts?
04:29 AM Emil: yeah
04:29 AM Emil: for anything
04:29 AM Emil: takes 1 minute
04:29 AM Haohmaru: iirc it was like 1 euro probably
04:29 AM Haohmaru: not worth it IMO
04:29 AM Emil: >30€/h?
04:29 AM Emil: I'll take that free moneys
04:31 AM * Haohmaru sends <moneys.jpg> to Emil
04:31 AM Haohmaru: here, print yourself some moneyz
04:31 AM Haohmaru: u b rich
04:35 AM Emil: lets do avr cryptocurrency
04:35 AM Emil: ico moneyz here I come
04:47 AM polprog: we should use CPUs as a currency in a computing driven future
04:48 AM polprog: or cpu time
04:49 AM _ami_: polprog, interesting. based on quantity?
04:49 AM polprog: no idea really, this just came to my mind.
04:50 AM polprog: would make a cool cyberpunk fantasy world
04:50 AM _ami_: so its your brain fart? :P
04:50 AM _ami_: govt. did/does not like these crypto-currencies.
04:52 AM polprog: if i was govt i wouldnt like them too
04:52 AM polprog: ttyl
05:08 AM Haohmaru: make a cryptocurrency that relies on serial processing speed, not parallel
05:09 AM Haohmaru: pics are not gonna go far with their lousy 1 instruction per 4 clocks
05:10 AM thardin: don't you already have this with ~cloud~ things?
05:20 AM Haohmaru: i don't know
05:38 AM polprog: pics in the cloud
05:38 AM polprog: you get a hardware client and microshits server executes your program*
05:39 AM polprog: * t&cs apply. recommended connection 100base-t ethernet.
05:50 AM Haohmaru: the microshit server executes your program.. if it's in the mood
07:41 AM MrFahrenheit: you know, saying microshit just makes it sound like you're 14
07:48 AM Haohmaru: * microchip
07:49 AM Haohmaru: it was a typo, honestly!
07:49 AM Haohmaru: it's VERY easy to mistype it
07:50 AM theBear: oh wow, is "microshit" now an ambiguous modified-for-insult-proper-noun ? i suppose it is... i forgot what channel this was and didn't for a moment think of microchip <grin>
07:50 AM theBear: and i'd buy microship, but microshit is a pretty effin big typo on the last letter ;-)
07:53 AM Haohmaru: i also mistype it as microship
07:55 AM MrFahrenheit: I wish parcel tracking included gps coordinates
07:57 AM Haohmaru: maybe if you order a gps transmitter ;P~
07:59 AM MrFahrenheit: note to seller: turn on datalogging before you ship it
07:59 AM Haohmaru: theBear when i intend to write "sh*t" i put an asterisk
08:00 AM Haohmaru: and polprog has an excuse too, he's 14
08:01 AM theBear: hehe, microship sounds cute to my ears... makes me think of things like ship-in-a-bottle, only a really really small bottle instead of some big old lab jar thing <grin>
08:02 AM theBear: heck, with a name that funny in the simple-wordplay dept (my favourite dept i suspect) polprog can do whatever he wants far as i concerned <grin>
08:02 AM theBear: hehe, gets a smile and a giggle outta me every time i read it
08:03 AM Haohmaru: while my humour is darker?
08:03 AM Haohmaru: more edgy
08:04 AM theBear: assuming you always wear a white sequined jumpsuit while you on irc, you too MrFahrenheit get my unconditional permission to do whatever you see fit... heh, if yer kind tell me you do, even if it isn't true... it'll bring me so very much joy in the future
08:04 AM theBear: heh, and maybe that yer computer keyboard sits atop the keyboard of a grand piano that you sit at while computering
08:09 AM polprog: Haohmaru: >:(
08:09 AM polprog: microship, ill make model boats
08:10 AM Haohmaru: polprog i thought you're 14-ish
08:10 AM Haohmaru: or 18-ish
08:10 AM Haohmaru: somewhere below 20-ish
08:11 AM polprog: im 18
08:11 AM polprog: its Mr Polprog now
08:22 AM Haohmaru: Mr Polprogovski
09:11 AM Jartza: evening
09:11 AM _ami_: wow, less learned. LM358 distortion fix is to add a resistor at output: https://pbs.twimg.com/media/Da6NNlXU0AAA2hj.jpg vs https://pbs.twimg.com/media/Da6M81uUMAE6qMr.jpg
09:11 AM _ami_: in case of AC signals.
09:11 AM _ami_: pulldown resistor actually.
09:12 AM _ami_: http://www.ti.com/lit/ds/symlink/lm158-n.pdf - 7.3 section explains it.
09:12 AM _ami_: i wonder if its a silicon bug
09:13 AM thardin: resistors at op outputs is quite a common solution
09:17 AM _ami_: thardin: oh, did not know.
09:17 AM _ami_: is it applied to modern op-amps too?
09:18 AM Haohmaru: doesn't that tell you to pull the output towards the "middle" with a resistor?
09:18 AM Haohmaru: "ground" == "middle" (and not the negative supply rail)
09:19 AM _ami_: its just single power supply.
09:19 AM _ami_: not dual power supply.
09:19 AM _ami_: i was trying to achieve pwm DAC using lm358 sallen key LPF.
09:22 AM polprog: i need to experiment with sallen key filters
09:23 AM thardin: _ami_: it applies to all op amps that can see some larger capacitive loads I believe
09:23 AM _ami_: but still LM358 is not good enough for doing this pwm dac thing.
09:24 AM _ami_: bad choice for this task.
09:24 AM thardin: why not use a dac?
09:24 AM * _ami_ waits for his FAST op-amps to arrive
09:24 AM thardin: I use a max504 in a project, it's quite easy to use
09:24 AM _ami_: thardin: just to understand how different filter works.
09:24 AM _ami_: yes, i have few DACs too MCP4725
09:25 AM thardin: fair enough
09:25 AM _ami_: polprog: check out videos of analog devices
09:25 AM polprog: sure!
09:25 AM _ami_: they have a playlist for filters and sallen key.
09:26 AM polprog: i just got home from school. looks like a good plan for this afternoon
09:26 AM polprog: (cause fuck history test)
09:27 AM _ami_: polprog: start from here: https://www.youtube.com/watch?v=ftk9C45F_bo&list=PL64A193CF0B94C5D3
09:27 AM polprog: ty!
09:27 AM polprog: okay maybe i will revise for history a little
09:27 AM polprog: as well
09:31 AM Haohmaru: short history lesson: trump pressed the big red button, then russia pressed the big red button, then everybody ded, only IRC survived thanks to a few servers still running in some bunkers. the end
09:31 AM Haohmaru: play with opamps while you can ;P~
09:32 AM Haohmaru: preferably in a bunker
09:33 AM _ami_: :P
10:09 AM nuxil: arg.
10:12 AM APic: Argl.
10:13 AM nuxil: why cant they ffs stick to ISR name. i was looking at exmples on howto get a isr timer to trigger on compA
10:13 AM nuxil: it used to be
10:13 AM nuxil: SIGNAL (SIG_TIMER0_COMPA)
10:13 AM nuxil: then changed to
10:13 AM nuxil: ISR(TIMER0_COMPA_vect)
10:13 AM nuxil: and then changed again to
10:13 AM nuxil: ISR(TIM0_COMPA_vect)
10:13 AM nuxil: arg. annoying :p
10:19 AM nuxil: whats the point the the last namechange?
10:20 AM nuxil: *in the
10:26 AM Jartza: I've been wondering too why in some AVR they are TIM and in some TIMER
10:27 AM Jartza: the ISR() macro change is very old already and that I understand, SIGNAL is misleading
10:27 AM Jartza: but why not use TIMER in all of them
10:28 AM Jartza: I haven't checked if there is some logic behind that but still annpying
10:28 AM Jartza: annoying*
10:29 AM Jartza: maybe something like 8bit timers are TIM and 16bit ones TIMER or smthng
10:47 AM cehteh: Jartza: yes its annoyung, but these timers have also little differnent semantics, it was not 8 vs 16 bit but something else, so its good to have some slightly different name to be reminded
11:20 AM JanC_ is now known as JanC
11:43 AM antto: if ya want bett0r consistency -> xmega
11:43 AM antto: if ya want less -> pic
11:54 AM theBear: meh, i'm still miles from forgiving the reasons pic/micro pissed me off way waaaaay back, so i don't gotta choose consistancy... avr's are just my only option in that area... who knows, maybe when i'm 60, or 80, i'll manage to let it go and try programming a pic or two... i have gotten over a few VERY long-held strong feelings in other areas in recent years
12:08 PM Jartza: cehteh: well, the _interrupt_ still is interrupt, even if the tier is different
12:18 PM polprog: if you want top consistency write to the vector table yourself :p
12:58 PM MrFahrenheit: made tuscan tuna fillet... tasted pretty good
02:22 PM nuxil: if i setup a ISR(INT0_vect) {foobar} routine. do i need to reinit the isr with MCUCR or GIMSK ?
02:23 PM nuxil: i have set my MCUCR = 0x01; //(1 << ISC00); and my GIMSK = 0x40; //(1 << INT0);
02:23 PM nuxil: the interrupt triggers. but only once
02:23 PM nuxil: from high to low. or low to high, but not high low high. or low high low. etc.
03:01 PM nuxil: hmmf
03:02 PM nuxil: i dont get it, what am i missing.
03:03 PM nuxil: maybe i should try PCIE instead of INT0
03:27 PM nuxil: much better :)
03:47 PM nuxil: new problem.. :D
03:47 PM nuxil: https://pastebin.com/XRSTcZFd
03:48 PM nuxil: why is this blinking around 2.2hz instead of around 10hz
03:48 PM nuxil: the fuses on my atiny13 is (E:FF, H:FF, L:6A) which should be stock and include div8
03:51 PM polprog: yo// (1 << COM0A1); // Clear Timer on Compare Match i dunno from the top of my head but that bit name seems to be with the pin toggling?
03:51 PM polprog: i think those were WGM1-3 bits or somethin
03:52 PM nuxil: thats pwm stuff iirc.
03:53 PM nuxil: im just woundering why my tim0 is like 5x times slower than what it should be :p
03:54 PM polprog: page 72
03:55 PM polprog: its TCCR0A |= (1<<WGM1)
03:55 PM nuxil: i dont want pwm
03:55 PM nuxil: im not working with pwm
03:55 PM polprog: yeah but thats not PWM. i mean that could be used for PWM but it also clears the timer on compare match
03:55 PM polprog: PWM enables if you set some of the pin contolling bits
03:56 PM polprog: page 71 if you leave COM01 and COM00 then the port is left untouched
03:58 PM nuxil: hmm
03:59 PM polprog: i think some dude yesterday or on sunday was trying to get that to work as well
04:01 PM nuxil: i will try
04:02 PM nuxil: thanks for pointing it out :)
04:03 PM polprog: :D
04:03 PM polprog: R
04:03 PM polprog: T
04:03 PM polprog: F
04:03 PM polprog: M
04:03 PM polprog: :D
04:03 PM nuxil: stfu :P
04:09 PM nuxil: wtf
04:10 PM nuxil: it works :D
04:10 PM polprog: 23:00 < nuxil> stfu :P
04:10 PM polprog: :DDDDDDDDDD
04:10 PM nuxil: but why? why was my method so slow ?
04:10 PM nuxil: compared to this?
04:10 PM polprog: you werent clearing the timer i think
04:10 PM Emil: https://www.youtube.com/watch?v=c2niS9ZRBHo
04:10 PM nuxil: hmm.
04:11 PM Emil: https://www.youtube.com/watch?v=vaCVh2SAZY4&t=57s
04:11 PM polprog: and it was overflowing, and then the compare ISR was firing
04:11 PM nuxil: ah. yea that makes more sense.
04:11 PM polprog: Emil: whats that?
04:11 PM Emil: https://www.youtube.com/watch?v=vaCVh2SAZY4 without the starttime
04:11 PM Emil: polprog: digikey kicad tutorial
04:11 PM Emil: polprog: digikey recently released a parts library for kicad
04:11 PM polprog: nice
04:12 PM nuxil: Emil, i tried to install that some months ago. it was a epic fail.
04:12 PM nuxil: might work now.
04:12 PM Emil: nuxil: months?
04:12 PM polprog: i had the same experience with FreeCad
04:12 PM Emil: It was released some weeks ago
04:12 PM nuxil: Emil, the digikey stuff?
04:12 PM Emil: nuxil: yeah
04:13 PM nuxil: hmm it might been a 3rd party lib i installed then
04:13 PM polprog: i installed the repo version (0.16 vs 0.17) and it works flawlessly
04:13 PM Emil: nuxil: oh my mistake
04:13 PM Emil: https://github.com/digikey/digikey-kicad-library
04:14 PM Emil: apparently it is a few months
04:14 PM nuxil: yea that link.. and it was even you who posted it in here :p
04:15 PM nuxil: so i whent and tried installed it :D
04:15 PM Emil: but not that many months ago!
04:15 PM Emil: I swear
04:15 PM Emil: :D
04:15 PM nuxil: 2 or something :)
04:16 PM Emil: God damn it
04:16 PM Emil: 2018-02-22 01:22:40 +0200< Emil> https://github.com/digikey/digikey-kicad-library/
04:16 PM Emil: Time apparently fucking flies :D
04:16 PM nuxil: haha
04:16 PM Emil: I thought it was like 2 weeks ago
04:16 PM Emil: nuxil: what failed?
04:17 PM nuxil: i dont remember now. but i could not get it working. didnt mess around to much with it. i just left it alone when i could not get it working.
04:18 PM nuxil: maybe i should give it another try if there has been updates.
04:21 PM Emil: naw
04:22 PM Emil: I don't see updated on the repo
04:31 PM polprog: lol
04:32 PM nuxil: no more code in my main while loop :)
04:38 PM nuxil: updated my simple fan controller code once more. :) from having all in main (while) to having a mix of isr and main while. to finally just isr's :)
04:39 PM nuxil: https://pastebin.com/3BLd66ky i guess there is still room for improvements.. spot any obviouse ones ?
04:40 PM nuxil: TIMEOUT = 10 is just a test value i used.
04:40 PM nuxil: should be much higher
04:40 PM nuxil: ofc.
04:45 PM polprog: looks good
04:46 PM polprog: id rewrite setfanstate to set / unset both bits at once
04:46 PM polprog: but it doesnt really matter
04:48 PM nuxil: :)
04:49 PM nuxil: atm its whopping 370 bytes. gonna try crunch it down a bit :)
04:52 PM Emil: Good night
04:53 PM nuxil: good night.
04:55 PM nuxil: 326 bytes. only managed to optimize if 44 bytes :\
04:55 PM nuxil: *it
04:59 PM polprog: -flto xD
05:00 PM polprog: 320 bytes is quite small for a program. beautiful
05:00 PM polprog: you could write the hexfile down on a notebook sheet
05:00 PM nuxil: heh
05:01 PM nuxil: i already used -flto :)
05:01 PM MrFahrenheit: it would fit in a tweet if you used unicode hacks
05:01 PM polprog: true
05:01 PM polprog: you could also encode it in an image
05:02 PM polprog: like the ps3 or xbox cd keys iirc
05:02 PM polprog: those colorful flags
05:05 PM MrFahrenheit: you mean the dvd encryption keys?
05:05 PM MrFahrenheit: https://en.wikipedia.org/wiki/AACS_encryption_key_controversy
05:09 PM MrFahrenheit: this one is also interesting, someone encoded an "illegal" c function into a prime number https://en.wikipedia.org/wiki/Illegal_prime
05:10 PM polprog: illegal c function o_o
05:14 PM polprog: absurd
05:14 PM MrFahrenheit: more absurd than an illegal number?
06:32 PM nuxil: hmmf.
06:33 PM nuxil: timeing in my code is way off. i mean way off.
06:37 PM nuxil: when i set TIMEOUT = 500; its off by like 30 sec..
06:43 PM nuxil: ok not 30 sec. but observing. 7min. 56 and some ish sec. instead of 8min ,16 sec
06:47 PM nuxil: arg no wounder.. darn internal Rc. f_cpu = (prescalar * counter) * f_timer -> 1024 * 97 * 10,504 = 1043361 HZ.. thats just with stopwatch
07:02 PM cehteh: sure you dont have any races? and any chance to sync the internal rc osc with some external signal?
07:06 PM cehteh: and eh, pcint ... do you now filter the input or do you get one interrupt for each pwm cycle
07:10 PM nuxil: cehteh, the code is posted above
07:10 PM cehteh: i meant the sense input is that filtered by a cap?
07:10 PM nuxil: no. its that the f_cpu will not be running presice at 1mhz
07:11 PM nuxil: so all the small errors each sec will accumelate.
07:11 PM cehteh: i just wondering if you get shitloads of interrupts from the heaters pwm
07:12 PM cehteh: of course internal RC osc isnt much precise either
07:13 PM cehteh: but having the mpu unter constant interupt fire isnt a good idea either
07:13 PM nuxil: i dont have code in main that can be affected
07:13 PM cehteh: instead PCINT i'd just poll the input pin in the main loop
07:14 PM nuxil: meh. do not want no ugly main while loop :p
07:14 PM cehteh: heh
07:14 PM cehteh: i think your code is ugly :D
07:14 PM nuxil: it is
07:16 PM cehteh: you can still use PCINT if you really want, but once fired you should set up a timer for lets say 100ms disabling pcint, and reenabling it after expired
07:17 PM cehteh: PCINT has higher prio than timer interrupts iirc, maybe the constat pcint fire makes your timekeeping drift as well
07:17 PM cehteh: dunno at what freq your pwm runs
07:18 PM nuxil: this are tests i did on the breadboard just by pulling the line low/high
07:18 PM nuxil: simulate the signal
07:18 PM cehteh: huh? isnt your heater PWM controlled?
07:18 PM cehteh: i mean at 10khz or something
07:21 PM nuxil: i said its pwming. never thats its 10khz. its more like <10hz or something. real slow. its just on/off to keep the temp on. havent mesured the duty or anything with my scope. it stays high until temp reached. 100% duty. then goes on toggeling on/off. and
07:21 PM cehteh: ah ok
07:22 PM cehteh: i just didnt know
07:22 PM cehteh: well temperature is slow, my oven has 0.1hz for the heater, software PWM
07:22 PM nuxil: besides. i was testing when the heater is off. thats when the counter should happen. and turn off the fan after n min. so i just simulate on breadboard that the heater has been turned on and off. to activate the counter.
07:25 PM cehteh: why do you store the pin_state and why do you check it? dont you want to reset the counter unconditionally when the heater is on
07:29 PM nuxil: well. i check it in ISR(TIM0_COMPA_vect) because when the "pin" has gone from low to high the heater is turned off. and when the heater is off. start a counter, and shut down the fan after given time.
07:29 PM nuxil: ISR(PCINT0_vect) updates the change
07:30 PM nuxil: and turns on the fan if line goes low
09:02 PM _ami_: morning people!
10:08 PM rue_shop3: _ami_, workin on anything good?
10:37 PM _ami_: rue_shop3, nah! waiting for a movie to watch at theater. "Rampage" and then good nice dinner at steakhouse :D
10:38 PM _ami_: damn, i used "good" and "nice" together. i am excited for today! :)
11:18 PM vishwin60 is now known as vishwin
11:44 PM polprog: hello rue
11:44 PM polprog: hello everyone ;)