#avr | Logs for 2016-03-24

Back
[00:25:00] <Jartza> so. I reported bug at atmel.com website. they responded that they forwarded the bug report to web team. I just received email "Can we close the case now?"
[00:25:11] <Jartza> solution was to shut down atmel.com website? :)
[00:25:18] <Jartza> at least it doesn't answer for me
[00:27:30] <cehteh> works for me, they only blacklisted you
[00:28:28] <Casper> don'T work here
[00:29:03] <cehteh> ah my proxy had it in cache
[00:29:09] <Casper> it work, just very slow
[00:29:18] <Jartza> d'oh
[00:30:01] <Casper> I'm testing the speed
[07:11:31] <twnqx> WHY ALWAYS ME
[07:11:41] <twnqx> type a text for work, BOOM
[07:11:49] <twnqx> laptop switches off & not on again
[07:13:57] <stephe> do you guys use screen to get serial output?
[07:14:17] <twnqx> normally i use minicom
[07:14:30] <theBear> you mean screen as in screen -r ctrl a-c ctrl a-w ctrl a-2 ctrl a-d ?
[07:15:12] <theBear> in which case i would have to say naaaah man, that always seemed like abusing the most awesome possible creation of console-land EVER, BAR NONE, in all times past and any possible future times
[07:16:19] <twnqx> Did you ever try tmux? :P
[07:17:19] <stephe> hmm, minicom, never heard of it
[07:21:33] <twnqx> sigh, vmception
[07:21:47] <twnqx> now i have to run a windows vm inside a linux vm inside linux
[07:22:33] <theBear> have to is a state of mind... sounds like yer letting "the man" "get you down" "brother"
[07:26:39] <twnqx> well, there is no other sane way to run ms word
[07:26:50] <twnqx> and using openoffice just doesn't cut it
[07:33:23] <darsie> hey
[07:33:42] <darsie> Can I use arduino libs for plain avr?
[07:33:54] <theBear> heh, i'm not sure there was ever a sane way to run that word thing... i remember in the very earliest days of my discovering the "magical world of a gui facade for a computer", with a whopping 2mb of windows 3.0 visible/accessible memory, INCLUDING the first 640k and the gap that at best a few tsrs could maybe use for a tiny tiny few k's of themselves to float around in, and being up all night trying to type something the typewriter woulda done in
[07:33:55] <theBear> minutes, by the end knowing it by memory and able to beat it out on the keyboard in single-digit minutes kinda times, as the stupid horrible monster of a thing kept crashing over and over at the most inopportune times, and of course i was young, awnd things like "auto-save" or even "regularly save your work" had never gone thru my ear-holes before
[07:34:01] <darsie> Like, for an RFID module.
[07:34:35] <theBear> darsie, sure, or you could be more awesome and use less stupid/more kickass libs for a more appropriate langauge like sensible regular-C
[07:39:27] <darsie> ok, I found stuff. thx.
[07:40:06] <theBear> that's the spirit
[07:40:18] <stephe> i guess ill just start using cat to read serial output, better than screen at least :P
[07:40:45] <darsie> I'd use minicom (on linux).
[07:40:52] <theBear> cat can do that ? wowee !
[07:42:05] <theBear> if yer being all traditional and not-gui about it, i spose kermit is the most traditional way i can rememberm well, or telix/teletype in the dos lands (in an age when you still needed a machine bigger than most family cars to run a 'real os' :-)
[07:43:20] <theBear> tho depending what yer doing, i found a few handy ones i liked in linux-gui land over the years, usually for some specific purpose-related reason, like adjustable columns/groupings of raw hex or selectable-various-formatted viewing, perhaps with adjustable split in/out window-sections or some fancy input thing that made typing non-ascii easier
[07:46:48] <stephe> yep, seems cat can do it
[09:05:40] <LeoNerd> https://twitter.com/cpan_pevans/status/712997193637093382 I needed MOAR SOCKETS
[09:07:39] <LeoNerd> And now I have to go round some of my equipment fitting IEC inlets because some things have stupid captive cables
[09:07:42] <LeoNerd> like my solder station :(
[11:04:34] <julius> hi
[11:05:19] <julius> stephe, i use cat too. works well
[11:07:13] <stephe> julius: yup, simple and easy :)
[11:48:29] <cehteh> https://pbs.twimg.com/media/CeU4GP_WIAAWRsV.jpg:large .. i like small breadboards :D
[11:53:49] <lorenzo> what's that?
[11:54:55] <cehteh> tiny84 (invisible) uln2003, RC-Receiver .. and the wires on the left go to usbasp and logic analyzer
[11:55:44] <cehteh> and one 5V led per output just for fun
[12:06:24] <stephe> cehteh: which logic analyzer?
[12:06:47] <cehteh> just cheap saleae clone
[12:06:56] <cehteh> $1
[12:06:58] <cehteh> $15
[12:33:14] <stephe> cehteh: ah
[12:33:28] <stephe> i actually have one of those small breadboards too, need to work up the courage to use it :D
[12:50:28] <cehteh> i have even smaller ones
[12:50:51] <cehteh> https://cdn.itead.cc/media/wysiwyg/Products/Breadboard/IM121129001.jpg
[12:53:46] <stephe> cehteh: you just use a single one of those?
[12:55:34] <cehteh> nah making each brick a single functional unit, like VREG, sensor, voltage divider, I/O port etc and then connect that stuff together
[12:58:28] <julius> says 4x50w http://de.aliexpress.com/item/TDA7850-4X50W-4-Channel-Car-Audio-Amplifier-Board-12V-AV-Interface-DIY-AMP-Board/32623722985.html there, but only 4 connectors for 2 boxes?
[12:59:21] <lorenzo> julius: there's 4 connectors
[12:59:42] <lorenzo> out1, out2, out3, out4
[12:59:46] <lorenzo> then rca inputs and power
[13:02:24] <julius> rca?
[13:03:24] <cehteh> chinch
[13:03:29] <julius> aH
[13:04:25] <julius> so the blue connectors with screws are l/r for 4 pairs of boxes. and the cinch are input for left and right?
[13:04:44] <cehteh> 4 channel input
[13:04:57] <cehteh> and what are the blue boxes in the center?
[13:05:25] <cehteh> is that a class-D amp?
[13:05:42] <lorenzo> cehteh: capacitors I guess
[13:06:01] <cehteh> input decoupling possibly
[13:06:08] <lorenzo> http://www.st.com/st-web-ui/static/active/en/fragment/product_related/rpn_information/product_circuit_diagram/circuit_diagram_12882_thumbnail.png
[13:06:09] <lorenzo> correct
[13:06:19] <cehteh> ah class a/b ...
[13:06:58] <cehteh> old scool pizza oven :D
[13:07:15] <julius> the datasheet also says: output power 13.2v with total harmonic distortion of 1% = 16-19w so its more like a 16watt amplifier
[13:07:59] <cehteh> bit expensive for what it does
[13:08:23] <cehteh> and i bet it gets hot
[13:08:57] <cehteh> i'd look out for a good class D one (there are a lot crappy class D too)
[13:09:40] <julius> any hints for what to check=
[13:09:42] <julius> ?
[13:11:34] <cehteh> reviews?
[13:11:52] <cehteh> you need it for a car actually?
[13:12:21] <julius> yes
[13:12:35] <julius> maybe first for a raspberry
[13:12:39] <julius> http://www.nxp.com/documents/data_sheet/TDA8950.pdf
[13:12:53] <julius> this one can do 2x100w woth 0.5%thd
[13:13:20] <julius> de.aliexpress.com/item/Free-shipping-TDA8950-120W-120W-Class-D-Amplifier-Board-High-Power-Amplifier-Board/2053357802.html
[13:14:44] <cehteh> big heatsink for class d :D
[13:15:08] <cehteh> do you need 120W?
[13:15:21] <julius> no
[13:15:27] <julius> just got the basic boxes
[13:15:32] <julius> they do maybe 20w
[13:15:42] <cehteh> http://de.aliexpress.com/item/New-Digital-Amplifier-Board-20W-20W-Small-Class-D-2-Channel-Stereo-Audio-High-Power-Amplifier/32532198855.html?spm=2114.010208.3.58.UPOkEY&ws_ab_test=searchweb201556_0,searchweb201602_2_10036_10035_10034_507_10032_10020_10001_10002_10017_10010_10005_10011_10006_10003_10021_10004_10022_10009_10008_10018_10019,searchweb201603_9&btsid=10f63df2-a99f-4a81-841c-27c12e05c9ba
[13:16:02] <julius> if its made for 20w, it will perform at its maximum....that cant be good
[13:16:07] <cehteh> no :)
[13:16:09] <cehteh> joke
[13:16:16] <cehteh> but class d can be quite small
[13:16:22] <julius> also to reduce clipping one should buy a bit more power so the boxes wont get fried
[13:16:31] <cehteh> something 50-100W should be fine
[13:16:45] <cehteh> and crappy classD have a lot ringing and artifacts
[13:16:51] <julius> for ~16€ im gonna take it
[13:17:02] <julius> lets just calculate its tdp
[13:17:29] <julius> assuming 90% efficiency and about 100w of output, 10w would go out as heat?
[13:19:09] <cehteh> yea
[13:20:15] <cehteh> and with class d thats somewhat linear with the power, means usually it wont thet warm at all
[13:21:01] <julius> still, 10w is a lot as i saw a few days ago when i used a 10w led on a old cpu cooler (probably dual core)
[13:21:22] <julius> without active heat sink 10w did easily make that think ~30C
[13:21:43] <cehteh> the class A/B certainly has much more heat
[13:22:22] <julius> good tip
[13:23:18] <julius> according to this: http://www.audioholics.com/audio-amplifier/amplifier-classes/ABtoDEfficiency.jpg/image_view_fullscreen
[13:23:39] <julius> at 20w load, its like 80% effective. meaning 20w in heat
[13:24:08] <cehteh> 80% is way too much
[13:24:16] <cehteh> i'd expect 50-70%
[13:24:59] <cehteh> ah class a/b i meant
[13:25:20] <cehteh> anyway for staying cool and conserving battery you need class D
[13:25:35] <cehteh> and good class D have excellent characteristics
[13:25:47] <cehteh> *but* there are a lot black sheeps
[13:27:37] <julius> ah wait. the 80% effectivity means 20% heat, 20/5 = 4watt heat?
[13:27:47] <julius> 20w output power
[13:29:17] <cehteh> something along that
[13:30:13] <cehteh> you should be able to get a class D with 85-90% efficiency
[13:30:26] <cehteh> 80% would be the lower end
[13:30:42] <cehteh> and that that end, evey single % matters
[13:31:06] <cehteh> 90% at 20W would be only 2W heat instead 4W at 80%
[13:31:09] <julius> yeah that picture was about amplifiers in general
[13:31:30] <Emil> Well, I got my motor controller working for steppers and 3 phase motors
[13:32:02] <julius> congratz
[13:32:07] <julius> what does it "step" ?
[13:32:27] <Emil> the problem is that it still eats 3A@12V=36W at low pulse speed and the minimum I have gotten to it still eats ~15W :D
[13:32:41] <Emil> julius: it is a motor tester
[13:32:45] <cehteh> you pwm it?
[13:32:47] <julius> must be some kind of load on it
[13:32:50] <Emil> no
[13:32:55] <cehteh> you should
[13:32:56] <Emil> cehteh: I do it the shitty way
[13:33:02] <cehteh> no wonder then
[13:33:39] <Emil> julius: adding load would only increase power consumption
[13:33:43] <julius> cehteh, for 15€ i do no expect wonders
[13:33:58] <julius> so no load and it eats 3a?
[13:34:16] <Emil> julius: the coils have a resistance of around 1Ohm
[13:34:25] <Emil> julius: if I don't drive it at high speeds
[13:34:43] <Emil> I'll do a video
[13:35:57] <julius> oh yes, videos
[13:36:39] <julius> i = u / r = 12v / 10ohm = 1.2a?
[13:36:57] <Emil> julius: actually 3Ohms, sorry
[13:37:30] <Emil> But it's per coil
[13:37:38] <Emil> So each coil wants to suck up as much power as possible
[13:39:23] <Emil> julius: well, no video then
[13:39:57] <julius> no, now i want the video
[13:40:00] <julius> dont take that for me
[13:40:00] <Emil> But it spins, which is nice
[13:40:19] <cehteh> just add some pwm and done
[13:43:00] <Emil> cehteh: what pwm settings would you recommend, then
[13:43:43] <Emil> I need variable pulse length and variable frequency
[13:43:53] <cehteh> why variable frequency?
[13:44:35] <Emil> Because, in no particular order: frequency determines speed of rotation?
[13:44:39] <Emil> and power consumption
[13:45:24] <Emil> pulselength because I can't beging to drive at small pulses because the motor wont care
[13:45:30] <cehteh> you have a much higher pwm frequency than your rotation
[13:45:43] <Emil> cehteh: tried, it won't work if I simulate sinewave
[13:46:10] <cehteh> well then try to make up some sine table
[13:46:23] <Emil> cehteh: Have you ever driven motors before?
[13:46:41] <twnqx> theBear: https://narf-archive.com/pix/eba14a112ac316f7beef107e728392233e772473.png
[13:46:47] <cehteh> i know the brushless stuff from copters, but not stepping
[13:47:22] <RikusW> steppers don't use sine
[13:47:35] <cehteh> startup is kindof stepping, but as soon the get emf sense back its just free spinning commutation
[13:47:37] <LeoNerd> "Father forgive me, for I have sin()ed"
[13:47:44] <WormFood> I need my AVR to output 0, 0.6, and 3.3 volts. How would you guys accomplish that? With PWM, or some other technique? I'm currently using a diode, and a resistor, as a crude regulator to 0.6 volts. I figure if I let it float, it will output 0.6, and if I drive it high or low, 3.3 or 0 volts (assume a 3.3 volt source for the avr)
[13:47:50] <cehteh> RikusW: some use, microstepping
[13:48:02] <Emil> cehteh: how much do you actually know from copters, I mean, do you just slap the ESC there and be done with it or have you actually done the drivers?
[13:48:07] <julius> Emil, let me dig out some code
[13:48:12] <Emil> RikusW: you can use sinewaves
[13:48:22] <Emil> julius: tgabjs!
[13:48:22] <julius> ah crap, different pc...one sec
[13:48:23] <cehteh> Emil: i worked on the code
[13:48:30] <Emil> thanks*
[13:48:38] <cehteh> maybe in the long run i make my own flight software
[13:48:49] <Emil> The problem is that I don
[13:48:54] <Emil> don't have any feedback
[13:49:30] <cehteh> the brushless gimnbals work that way. 3 phase motor, microstepping/sine
[13:49:32] <Emil> I can't sense when the motor is ready for the next pulse, sadly
[13:50:07] <julius> Emil, http://pastebin.ca/3410280
[13:50:35] <cehteh> WormFood: volts or drawing current?
[13:50:45] <WormFood> volts
[13:51:00] <WormFood> it only needs to supply minimal current. It's a sense voltage
[13:51:02] <cehteh> how about just some voltage divider with resistors then?
[13:51:07] <Emil> julius: that's variable frequency and pulselength?
[13:51:07] <Emil> Fucking A if it is!
[13:51:24] <julius> Emil, im still new, but yes thats what i figured
[13:51:25] <cehteh> maybe opamp when you need current
[13:51:46] <julius> WormFood, for minimal current...some resistors would be a easy solution
[13:51:50] <Emil> WormFood: just use voltage dividers : )
[13:52:24] <WormFood> cehteh, yeah, I suppose I could use a simple resistor voltage divider, since I'll have a 3.3 volt regulator in it anyways (the voltage source on the input ranges from 5 to 12 volts, which is why I'm currently using a diode (no VRM))
[13:52:50] <julius> Emil, from a eletronics perspective running the motor at 1khz would be optimal....but you can hear the motor whine at that frequency....at 25khz you have more switching losses but wont hear the motor....well the pwm part at least
[13:52:57] <WormFood> I was also thinking about using PWM, since that would allow me to adjust the output voltage, in software.
[13:53:14] <cehteh> julius: 16-20khz are usually ok
[13:53:15] <WormFood> I mean, not just 0/0.6/3.3 volt steps
[13:53:39] <WormFood> fuck! I need an o-scope
[13:53:52] <WormFood> I wonder how cheaply I could get a used one for.
[13:53:57] <julius> WormFood, hantek 6022be - 20mhz, 48ms, usb
[13:54:04] <julius> ~70e
[13:54:05] <Emil> julius: you mean 1kHz as in rotations?
[13:54:14] <julius> Emil, 1khz as in pwm frequency
[13:54:24] <WormFood> julius, but doesn't that software only work on Winblows?
[13:54:27] <julius> Emil, period is 1/1000hz = ...
[13:54:33] <cehteh> 1khz is way too low
[13:54:52] <julius> WormFood, good answer, but they actually have one called openhantek on sourceforge
[13:55:24] <cehteh> sigrok has some support for oscopes
[13:55:27] <julius> WormFood, i actually bought that scope...just got some problems with compining. but the software looks good. anyway a fallback would be a win7 install on my old laptop
[13:56:03] <cehteh> http://sigrok.org/wiki/Supported_hardware#Oscilloscopes
[13:56:16] <WormFood> compining?
[13:56:44] <julius> cehteh, i just read that 1khz is a good choise if the motor is far away: https://www.mikrocontroller.net/articles/Motoransteuerung_mit_PWM#Wahl_der_PWM-Frequenz
[13:56:49] <julius> compiling
[13:56:53] <julius> im on linux
[13:57:01] <WormFood> ooohhh
[13:57:04] <WormFood> I see now
[13:57:23] <julius> so i would also prefer a linux software
[13:57:27] <cehteh> i'd place the controller close to the motor
[13:57:38] <cehteh> then serve input voltage and signal
[13:57:44] <Emil> cehteh: julius: yes, the motor is close to the controller
[13:58:11] <cehteh> Emil: check out some brushless gimbal firmwares
[13:58:17] <cehteh> there are open source projects
[13:58:22] <julius> WormFood, https://sourceforge.net/p/openhantek/discussion/1153137/thread/3440aa9e/ as soon as they answer that i can tell you more about the software
[13:58:38] <cehteh> simonk once made slow spinning with a normal BL motor too
[13:59:26] <WormFood> What is this software?
[13:59:33] <WormFood> sigrok
[13:59:46] <cehteh> thats what i use for the logic analyzer
[13:59:56] <cehteh> but they support other hardware too
[14:00:10] <cehteh> commandline and QT based. .. works well on linux
[14:00:15] <WormFood> yeah, I'm seeing all kinds of stuff on that list, like VOMs
[14:00:17] <cehteh> but you should build from git, less bugs
[14:00:46] <cehteh> http://public.pipapo.org/logic_analyzer.png thats the 'pulseview' gui from sigrok
[14:01:42] <julius> looks quite nice
[14:02:07] <cehteh> havent done analog stuff with it but i am using it constantly
[14:02:14] <cehteh> has some bugs, but generally works
[14:03:36] <WormFood> I'm checking it out
[14:03:42] <WormFood> I expect I can buy one locally
[14:04:08] <cehteh> electronics wonderland :D
[14:04:18] <cehteh> where in china are you?
[14:04:34] <WormFood> 深圳
[14:04:40] <WormFood> near 华强北
[14:04:52] <cehteh> wow .. at the source
[14:04:59] <WormFood> yup
[14:05:32] <WormFood> I walked to huaqiangbei, and found the cable I wanted. Paid about 60 cents for it, and was home in less than an hour (I walked home too)
[14:05:35] <cehteh> how do you deal with quality issues when you buy locally there? go shopping with a baseball bat?
[14:06:00] <WormFood> Just pay attention. I've taken stuff back before.
[14:06:43] <WormFood> In fact, I'm about to take back my Quick Charge 2.0 battery pack, that suddenly stopped working in QC 2.0 mode (works in regular mode fine)...but honestly, I suspect I may have damaged it.
[14:07:07] <cehteh> haha
[14:07:29] <julius> is it a lot of small stores or just a few impossible big shops?
[14:07:29] <Emil> julius: I have a feeling that your code, sadly, doesn't scale the frequency
[14:07:37] <WormFood> I'm manipulating the QC 2.0 aspect of it. I'm making it give me 12 volts out, on a barrel connector
[14:07:45] <julius> Emil, could be. what makes you think that?
[14:07:51] <cehteh> julius: where you ever at some asian market/warehouse?
[14:07:52] <WormFood> julius, it's a million tiny shops
[14:07:58] <WormFood> thousands of medium sized shops
[14:08:00] <julius> cehteh, no
[14:08:05] <Emil> julius: I need individual control over the frequency and pulse length
[14:08:05] <WormFood> and a handfull of big shops
[14:08:13] <cehteh> somewhat awesome .. scary .. strange .. wtf
[14:08:18] <julius> Emil, you sid that you found a error in my code?
[14:09:18] <cehteh> julius: like the biggiest shopping mall you can imagine .. stuff with 1000's of very tiny shops, all competing against each other
[14:09:21] <Emil> julius: I need four channels
[14:09:25] <Emil> or three but eh
[14:09:36] <RikusW> WormFood: so does the small shops specialize of have a mix ?
[14:09:42] <cehteh> usually you are completely lost there :D
[14:10:04] <WormFood> Bunnie (Andrew Huang...who I actually met in person once, here), wrote up an excellent blog post on hua qiang bei
[14:10:25] <WormFood> RikusW, that depends on where you are.
[14:10:30] <Emil> hmm, though, they can be tied together but then I need a phase ofset
[14:10:43] <Emil> julius: also, how can you have 308 in your registers? OCR1B and OCR1A are both 8 bit registers
[14:10:43] <julius> Emil, why will you not answer my question?
[14:10:55] <RikusW> sounds like electronics heaven :)
[14:11:04] <julius> Emil, let me chcek
[14:11:23] <WormFood> First off, HQB is a really big place. Technically, it's an area. There is a fairly big shopping mall there, that doesn't do shit with computers or electronics (It's called "women's world"). There are many buldings there, dealing with electronics and computers.
[14:11:52] <Emil> julius: I need all, OCR0A, OCR0B, OCR2A and OCR2B to control four outputs without additional cpu overhead
[14:12:42] <WormFood> Most of the electronics places specialize in one type of part, or a family of parts. Like for example, the place I got my cable from, also has jacks. They mostly do on-board sockets, that mate with the cables they sell. Mostly for laptops, but fuck, it seems they have everything. That was the first place I went, to get the cable I wanted, and they had it.
[14:13:19] <WormFood> The computer places, are similar. The really small shops usually specialize in one part, or family of parts, usually related.
[14:13:55] <WormFood> There is a relatively large "little shop" (It's 2 or 3 booths), that sells exclusively quadcopter parts. Frames, batteries, motors, props, etc.
[14:13:58] <RikusW> makes some sense
[14:14:15] <WormFood> That's for DIY quadcopter.
[14:14:36] <WormFood> I should try to get some pics (no pics allowed...or so the signs say)
[14:14:39] <cehteh> https://twitter.com/CehtehCt << scroll down .. that DIY :D
[14:15:04] <RikusW> Why don't they want pictures taken ?..
[14:15:33] <cehteh> possibly they dont have a license or sell counterfeit stuff :D
[14:15:39] <julius> Emil, http://www.atmel.com/images/doc2503.pdf page 87, ocr1a is a 16bit register
[14:16:03] <Emil> julius: ah, yeah, sorry about that
[14:16:15] <julius> Emil, no problem, as i said. that code might be completely bogus
[14:16:18] <WormFood> RikusW, not sure. The place is called "seg plaza", and you can find plenty of pictures inside.
[14:16:22] <cehteh> Emil: what mpu do you use? having enough ram?
[14:16:26] <julius> but youre right, you cant use that if you need all 4 pins
[14:16:48] <Emil> I use Timer0 and Timer2, though
[14:16:48] <Emil> which are 8 bits
[14:16:56] <Emil> but that still doesn't solve the issue with having 4 (3 actually, just doing it the bad way is good enough for steppers)
[14:17:05] <Emil> but 3 for 3 phase motors
[14:17:16] * cehteh thinks about some table/interpolation where you update each pwm register on the overflow interrupt
[14:17:29] <Emil> cehteh: atmega328p-pu
[14:17:43] <cehteh> should have plenty ram to spare
[14:17:49] <Emil> cehteh: I can place shit on program memory if it becomes an issue
[14:18:09] <cehteh> yes but reading that in an ISR has some overhead
[14:18:28] <Emil> well, if I use C the fucking ISR overhead is like 30-40 cycles anyway : (
[14:18:37] <cehteh> mhm not more than ram nevermind .. but needs special instructions
[14:18:43] <aandrew> there should be ways around that with compiler pragmas
[14:19:01] <julius> Emil, http://www.avrfreaks.net/forum/atmega328p-4-pwm-outputs mayb post #2 helpf
[14:19:02] <cehteh> you can use naked interrupts and global variables/registers only
[14:19:04] <julius> helps
[14:19:13] <cehteh> that makes C ISR's a lot slimmer
[14:19:44] <Emil> I only use global variables
[14:20:06] <WormFood> fuuuck. I gotta get up early, and go to Hong Kong tomorrow (I don't want to go). I gotta go to bed now (It's almost 3am here). Chat later.
[14:20:11] <Emil> julius: that's where I initially stole my PWM code :D
[14:20:16] <julius> night
[14:20:29] <julius> ah good
[14:20:32] <cehteh> n8
[14:20:33] <Emil> but it's just for fixed frequency
[14:20:43] <Emil> Good night WormFood
[14:20:56] <cehteh> methinks fixed frequency should work too, but i havent done that yet
[14:21:07] <julius> there was another way to use ICR1 or something to change frequency instead of OCR1A
[14:21:11] <cehteh> anyway .. cppm driver for muos now .. bbl too
[14:21:23] <julius> cu
[14:21:33] <Emil> I can, of course, resort to fucking around with OSCCAL but calibrating it for serial everytime I change it is pain
[14:21:44] <Emil> cehteh: night
[14:21:54] <cehteh> using osccal would be bad for that
[14:22:05] <cehteh> not night .. just other window .. programming :D
[14:22:10] <Emil> lol
[14:22:10] * cehteh is still here :D
[14:22:17] <Emil> cehteh: it's actually not half bad
[14:22:27] <Emil> I did an t85 fm transmitter with it
[14:22:35] <cehteh> i know that stuff
[14:23:01] <Emil> it's all over the place with rf without any filtering but okay on a scope and timing
[14:23:01] <cehteh> i use it here for the cppm to syncronize the µC frequency with the 27ms rc receiver frames
[14:24:42] <Emil> julius: hmm, I think taking a look at avr signal generators will prove fruitful
[14:25:02] <julius> hm, youre way more experienced than i am
[14:28:35] <cehteh> i am just modulating 2 pwm signals over each other, fading leds. was just a test for my circruit here
[14:32:14] <Emil> cehteh: if I use all global variables can I do anything wrong with ISR_NAKED?
[14:32:56] <cehteh> just dump asm and check what it does
[14:33:27] <cehteh> if the compiler decides to introduce temporary variables/registers but didnt save them then you are hosed
[14:33:50] <cehteh> often it works
[14:34:08] <cehteh> but its a good way to shoot yourself into the foot too
[14:35:03] <cehteh> i once written code in C .. made the ISR naked, generate asm ... and used that asm as inline asm then, further refining it manually
[14:35:23] <cehteh> that procedure should be reasonable stable
[15:06:51] <Emil> hmm
[15:10:22] <stephe> when i first connect with serial (using cat) it seems to pause the code for a second, is that normal?
[15:18:01] <Emil> stephe: check your interrupts
[15:22:15] <cehteh> stephe: what chip/board?
[15:22:31] <cehteh> --- arduinos reset by default on serial connect (DTR is wired to reset)
[15:23:37] <stephe> ahhh
[15:23:58] <cehteh> you can remove that trace or the cap from DTR to reset
[15:28:31] <stephe> cehteh: and then i need to do a manual reset after programming?
[15:28:57] <cehteh> no before programming :D
[15:29:08] <cehteh> do you use the bootloader?
[15:29:19] <RikusW> Arduino uses the reset to enter the bootloader which timeouts after 1s or so and jumps to the app
[15:29:55] <cehteh> for my 'development' arduino nano i left it connected, programming resets the board automatically
[15:30:20] <cehteh> but for some other arduino controlling a oven i have it disconnected because i want to unplug usb there
[15:32:23] <stephe> cehteh: yea, using the bootloader
[15:32:49] <cehteh> what arduino do you use?
[15:33:02] <cehteh> if you keep the serial connection open then it wont reset
[15:33:57] <cehteh> iirc its also possible to configure the serial port not to send DTR
[15:34:30] <cehteh> stty -cdtrdsr
[15:34:55] <cehteh> but i never used that :D
[15:38:49] <stephe> cehteh: using an uno
[15:39:22] <cehteh> should work there too
[15:42:14] <stephe> doesnt seem to support this -cdtrdsr setting
[15:43:07] <cehteh> man stty
[15:43:33] <cehteh> stty /dev/ttyUSB0 -cdtrdsr
[15:43:35] <cehteh> or so
[15:43:46] <cehteh> stty -F /dev/ttyUSB0 -cdtrdsr
[15:43:51] <cehteh> ... try it :D
[15:44:55] <cehteh> anyone of you know a simple way to filter spikes out of some sampled data?
[15:45:14] * cehteh just experimenting with some logarithmic filtering
[15:46:21] <eszett> hi
[15:48:16] <cehteh> http://public.pipapo.org/lfilter.png
[15:48:32] <cehteh> looks ok .. i buy it
[15:54:39] <stephe> cehteh: Hmmm, tried "stty -f /dev/tty.usbmodemFD121 -cdtrdsr" and got stty: illegal option -- -cdtrdsr
[15:55:02] <cehteh> -F
[15:55:37] <stephe> stty: illegal option -- -F :D
[15:55:47] <cehteh> mmh
[15:55:56] <cehteh> then you have some other stty than me
[15:55:59] <cehteh> what os?
[15:56:12] <stephe> osx
[15:56:27] <cehteh> ah ok
[15:56:30] <cehteh> linux here
[15:56:33] <cehteh> well dunno then
[15:57:00] <cehteh> i usually use 'screen' to connect not 'cat'
[15:58:00] <stephe> hmm, why do you prefer screen?
[15:59:10] <cehteh> depends on what i am doing but usually that gives me a commandline then
[15:59:25] <cehteh> having some cli on the avr
[16:00:31] <cehteh> cat to the avr can easily overrun buffers when you are not careful
[16:00:44] <cehteh> (copy pasting into a screen too)
[16:03:21] <stephe> cehteh: yeah that sounds nice, right now im just running cat and piping to the tty :P
[16:03:42] <stephe> but then i have to exit screen when programming since avrdude needs to access the tty too
[16:03:48] <cehteh> yes
[16:05:10] <cehteh> make upload && screen /dev/ttyUSB0 .
[16:06:49] <stephe> true
[16:11:12] <julius> cehteh, if you have the data as a csv/text file you could run python with a regex over it. killing all values about xyz
[16:11:39] <cehteh> eh what?
[16:11:51] <julius> above
[16:12:01] <cehteh> on avr of course
[16:12:05] <julius> filterin out spikes
[16:12:39] <cehteh> its more the difference to the last value than absolute values
[16:13:04] <cehteh> receiving data from RC transmitter which are the stick positions
[16:13:46] <julius> does your data center around a value and is mostly in some range but you got spikes that go way off?
[16:13:51] <cehteh> if there is a glitch (much too fast change) i want to filter that out, but still follow the stick movements precisely
[16:14:14] <julius> ah, change
[16:14:19] <julius> ok thats more complicaed
[16:14:22] <julius> complicated
[16:14:22] <cehteh> simple lowpass may do already
[16:14:30] <cehteh> but it has some latency
[16:18:31] <cehteh> http://public.pipapo.org/lfilter2.png that looks good now
[16:19:01] <cehteh> bit too much
[16:19:31] <cehteh> but can be tuned
[16:20:13] <cehteh> you see the slow movement between 20-40 is closely followed but bigger steps are filtered out
[16:21:19] <cehteh> bit to aggressively around 80
[16:22:15] <Emil> cehteh: a simple one pole IIR
[16:23:17] <cehteh> i tihnk thats what i am doing
[16:24:12] <Emil> https://en.wikipedia.org/wiki/Low-pass_filter#Discrete-time_realization
[16:24:12] <Emil> And then to get it into fixed points
[16:24:54] <cehteh> well actually simpler, more like with a crowbar :D
[16:25:27] <Emil> http://www.rowetel.com/blog/?p=1245
[16:26:18] <cehteh> just calculating the difference to the last measurement and then substracting the difference²/factor
[16:26:45] <Emil> https://kiritchatterjee.wordpress.com/2014/11/10/a-simple-digital-low-pass-filter-in-c/
[16:26:45] <Emil> or there
[16:26:47] <Emil> that's fine, too
[16:27:18] <cehteh> not really .. i dont want latency, thats the problem
[16:27:20] <Emil> But I'd still lowpass because that preserves the DC
[16:27:32] <cehteh> too simple filters have some latency/shift the phase
[16:27:37] <Emil> well, if you use the fixed point IIR I proposed it is fast
[16:28:38] <cehteh> yes that may work but is more complicated i think, even in a simple implementation
[16:28:59] <cehteh> but i give it a try later
[16:33:20] <julius> thats from a oscilloscope?
[16:38:39] <Emil> cehteh: eh?
[16:38:50] <Emil> it is super easy
[16:39:34] <cehteh> julius: no tcc -run test.c | quickplot
[16:39:58] <cehteh> Emil: i meant i have problems with the phase shift of these filters
[16:41:06] <Emil> is that phase shift something is really noticeable or just something you "think" will matter?
[16:41:14] <Emil> Because the latency introduced is also minimal
[16:44:22] <cehteh> when controlling a RC model you'll notice when then controls lag behind your inputs more than lets say 50ms
[16:45:10] <cehteh> data is sampled at 27ms intervals
[16:47:17] <Emil> well
[16:47:17] <Emil> samples faster?
[16:47:17] <Emil> sample*
[16:47:41] <cehteh> wont do, thats the frame length the receiver outputs
[16:48:36] <Emil> Well, there's nothing you can really do about it, then. The only possible way to proceed is by just taking the difference and applying it by some factor to the output
[16:49:39] <cehteh> nothing i can do with the filters you proposed
[16:49:45] <cehteh> http://public.pipapo.org/lfilter3.png see
[16:50:14] <cehteh> that has very little lag but spikes are fitlered out
[16:50:25] <Emil> I can see noticeable spikes everywhere
[16:50:59] <cehteh> sure but they are reduced
[16:51:10] <cehteh> also i made the spikes extreme in this example
[16:51:17] <Emil> Which an IIR filter, or even just an FIR one would have perfectly done for you
[16:52:12] <cehteh> but includes this phase shift iirc
[16:53:19] <Emil> not noticeable with a fast response
[16:53:38] <cehteh> ok trying that later
[19:06:52] <eszett> hmm
[19:14:02] <eszett> does someone know how to append with avrdude?
[19:14:32] <Lambda_Aurigae> append?
[19:14:42] <eszett> I mean for example "avrdude -c USBasp -p m32u4 -U efuse:r:efuse.txt:b" appending the new content to the old content of an existing efuse.txt file
[19:14:49] <Lambda_Aurigae> avrdude can read the flash, eeprom, and fuses...and it can write.
[19:15:19] <eszett> it creates the efuse.txt with each reading command new.. but i dont want that
[19:15:19] <Lambda_Aurigae> aahh...no clue.
[19:15:24] <eszett> hmmmpf!
[19:15:29] <Lambda_Aurigae> I would do it with two commands.
[19:15:37] <Lambda_Aurigae> run the avrdude command first
[19:15:43] <eszett> yes?
[19:16:01] <Lambda_Aurigae> then cat the file and append it to a collective file.
[19:16:15] <eszett> yea that would be possible. ok
[19:16:34] <Lambda_Aurigae> cat efuse.txt >> efusecollection.txt
[19:17:37] <Lambda_Aurigae> assuming you are using linux or osX or some other unix like OS
[19:18:02] <Lambda_Aurigae> or some addon for windows that supports unix commands and structure.
[19:19:01] <eszett> win7. im currently googling what is the "cat" equivalent command on windows
[19:19:56] <Lambda_Aurigae> type
[19:20:07] <Lambda_Aurigae> not sure about the >> working on windows though.
[19:21:20] <Lambda_Aurigae> it apparently works with echo so might work from command line.
[19:23:52] <eszett> yea, my batch works now. its this:
[19:23:53] <eszett> avrdude -c USBasp -p m32u4 -U lfuse:r:lfuse.txt:b -U hfuse:r:hfuse.txt:b -U efuse:r:efuse.txt:b
[19:23:53] <eszett> type lfuse.txt > fuses.txt
[19:23:53] <eszett> type hfuse.txt >> fuses.txt
[19:23:53] <eszett> type efuse.txt >> fuses.txt
[19:25:05] <eszett> not the most smart & elegant method to do it, but whatsoever *shrug*
[19:27:31] <Lambda_Aurigae> I don't see anything wrong with it.
[19:46:29] <eszett> ye
[20:56:17] <eszett> hmmmm