#avr | Logs for 2016-04-28

Back
[03:45:37] <WormFood> Fuckin' finally got an Internet connection again. This should be a lot more stable than the last one I had.
[03:45:48] <GeneralStupid> Hi can anyone tell me how ASF has implented the rs-232 flow control?
[03:46:38] <WormFood> GeneralStupid, can you be more specific? What do you want to know?
[03:47:12] <GeneralStupid> WormFood: ok
[03:50:09] <GeneralStupid> WormFood: i wanted to implement RTS/CTS FlowControl on my own but then i recognized that the ASF set DSR to 1. but there is no "DSR signal" function in ASF.
[03:51:00] <GeneralStupid> WormFood: long story short i need a documentation for that software. or at least a chart which gives me the flow which they implemented...
[03:54:46] <cehteh> did you check the ASF source?
[03:55:28] <GeneralStupid> cehteh: partially, yes. But i dont find any dsr signal.
[03:56:05] <WormFood> Then how can it set DSR to one, if it doesn't have any DSR signal?
[03:56:12] <cehteh> i have no idea, my guess would be just implement it with a gpio, maybe pcint and directly disabling the transmitter
[03:56:25] <GeneralStupid> cehteh: really, if i had to read their crappy source i think i would be faster to implement my own - or switch to avr32 and use lufa
[03:56:33] <WormFood> Are you sure you need DSR?
[03:57:02] <cehteh> wb WormFood btw :D
[03:57:07] <GeneralStupid> WormFood: i dont need it, but something changes then. I think I HAVE TO use DSR / DTR signal flow...
[03:57:20] <GeneralStupid> WormFood: it works fine until DSR gets high and then i stuck
[03:57:31] <WormFood> Are you communicating with a really old piece of equipment?
[03:57:51] <WormFood> I thought most modern serial communications use software flow control, if needed
[03:58:13] <GeneralStupid> WormFood: i write both sides of communication by myself. The Atmel should act like a DCE
[03:58:14] <cehteh> which has its own issues
[03:58:16] <GeneralStupid> (modem)
[03:58:53] <WormFood> I gotta go to the store with the girlfriend. I'll chat with you guys later. Good luck with it GeneralStupid
[03:58:54] <GeneralStupid> WormFood: i really think about throwing that all away and use software. But the ideas of having signals for that looked easier (at the beginning)
[03:59:03] <GeneralStupid> WormFood: Thank you :D
[04:00:02] <GeneralStupid> the fact that really annoys me is just that behaviour of ASF. i had so many little issues just because there is no real documentation
[04:05:04] <cehteh> i think you are the only one here using ASF :D .. or maybe the only one comeing here with problems
[04:06:54] <GeneralStupid> i think your right.
[04:07:16] <GeneralStupid> i had some locking issues too (like some guys on the avrfreaks page)
[04:07:40] <GeneralStupid> it turns out that there could be some endless loops, because they use goto its hard to see...
[06:40:54] <phinxy> im driving a solenoid for 5ms on a pin and it should not be over max. current rating. It worked fine on my prototype for half a year continuous but on this new micro ive burned two io outputs in a day
[06:41:15] <phinxy> the max rating is 40mA and the solenoid should be around 30mA
[06:41:58] <phinxy> it's a new solenoid too so maybe it has other characteristics
[06:43:09] <cehteh> you do it wrong :D
[06:43:19] <cehteh> do you have a flyback diode?
[06:43:31] <phinxy> Nothing, straight to the solenoid from the pin
[06:43:47] <cehteh> then it will destroy the µC .. sooner or later
[06:43:53] <phinxy> was thinking of adding a current limiting resistor in series
[06:44:02] <cehteh> you need a flyback diode
[06:44:12] <Tom_itx> do you have a diode on the solonoid?
[06:44:26] <cehteh> current limiting resistor might help too .. but the diode is vital
[06:44:29] <Tom_itx> faster the better
[06:45:02] <cehteh> [11:15] <cehteh> CubicEarth: http://tinyurl.com/glff63h
[06:45:16] <cehteh> .. posted that on #arduino earlier today
[06:45:22] <cehteh> remove the cap
[06:45:35] <cehteh> switch on/off and see what happens
[06:45:51] <cehteh> http://tinyurl.com/jgpjd7q
[06:45:54] <cehteh> improved version
[06:46:06] <cehteh> .. then remove the diode and see what happens then
[06:46:39] <cehteh> avr's are rated 5v5 not 5k5v :)
[06:48:36] <Tom_itx> maybe for a very short time
[06:53:26] <phinxy> Can a zener diode do the job?
[06:54:48] <cehteh> why zener?
[06:55:12] <cehteh> rather shottky
[06:56:50] <cehteh> but just normal 4148 will do
[06:58:22] <cehteh> if you need to order some .. bat42
[07:02:01] <phinxy> What about a LED light?
[07:03:24] <aandrew> phinxy: as a general rule you never drive inductive loads directly from an I/O pin
[07:04:30] <aandrew> a $0.10 mosfet can handle sometimes 1000x the current and its geometry is so much larger that it's far better at handling inductive kickback/ESD than any micro pin could ever hope to
[07:06:37] <cehteh> i have some relays which are specially made to be driven by io pins :D
[07:06:59] <cehteh> phinxy: leds need resistor or something else to limit the current
[07:07:01] <aandrew> cehteh: yes, there are all kinds of specialized components if you're willing to lock yourself to a particular vendor/model. :-)
[07:07:11] <phinxy> im using the AZ850 relay
[07:07:45] <aandrew> cehteh: nice falstad sim to demonstrate the point, we should add that to the list of helpful links
[07:08:03] <aandrew> inductive kickback is a concept a lot of people struggle with
[07:14:53] <phinxy> that falstad example looks extreme, the voltage goes haywire when there is no diode
[07:16:03] <lorenzo> http://electronics.stackexchange.com/questions/115857/flyback-diodes-and-relays/115859#115859
[07:16:14] <lorenzo> had this in my bookmarks
[08:04:11] <LeoNerd> Bah.. once *again* I spend ages trying to debug a weeeeeird set of behaviour on a board that's powered by a long power cable, that suddenly disappears when I just add a bigger decoupling cap on the far end of it
[08:04:16] <LeoNerd> You'd think I'd learn after a while, but noooo
[08:05:22] <cehteh> LeoNerd: interesting would be if you now enable the brownout detector and check if it resets w/o those caps
[08:07:14] <_ami_> Hi
[08:08:13] <_ami_> i am reading a book named "Make: AVR programming". this book teaches about avr programming on Atmega168
[08:09:02] <_ami_> i was reading about Interrupts.
[08:09:21] <LeoNerd> cehteh: oooh, mmmm I wonder if that's what it was. It;s a tiny85 driving three sets of LEDs on pwm pins
[08:09:41] <_ami_> the registers EIMSK and EICRA are used for this. it works well for Atmega168.
[08:10:30] <_ami_> but when i compile this code for Atmega16A, it does not compile. since EIMSK & EICRA are not found. rightly so as these macros are not defined in iom16a.h
[08:11:04] <_ami_> I am aware that atmega16a supports External interrupts (INT0..2)
[08:11:44] <cehteh> _ami_: interrupts are sometimes slightly different named on different chips, you have to read the docs
[08:11:45] <_ami_> why registers are different for ext. interrupts in between atmega168 and atmega16a?
[08:12:05] <cehteh> http://www.nongnu.org/avr-libc/user-manual/group__avr__interrupts.html
[08:12:41] <cehteh> plus datasheets
[08:13:19] <cehteh> same for register names
[08:13:56] <_ami_> cehteh: ok, thanks
[08:14:26] <cehteh> LeoNerd: you mean the BOD reset the tiny already?
[08:14:41] <_ami_> now i understand why its hard to maintain code across different platforms. cehteh already told abt that to me earlier. :)
[08:15:44] <cehteh> its somewhat simple .. if the compiler prints an error, it is almost always right, maybe you cant decipher it but there is something wrong in your code, no excuses :D
[08:16:04] <cehteh> after some time you learn what errors mean
[08:17:16] <LeoNerd> cehteh: I don;t know. hard to say what happened. I wanted to watch the io pins on my scope but the problem went away the moment I connected up my scope ground wire to the board. Hence my suspiscion about the power rail
[08:18:42] <LeoNerd> I'm not going to dwell on it. I now have under 48 hours to have the thing finished and cased up. It works now. I don't need to spend time analysing why right now
[08:18:58] <cehteh> ok
[08:19:28] <cehteh> well enabling BOD is prolly not a bad idea, sure you may see spurious resets, but better than undefined behaviour
[08:20:21] <LeoNerd> Is bod default on a tiny85?
[08:21:48] <LeoNerd> In related news: using phase-correct pwm does indeed give me true off if I set the OCRx registers to zero
[08:22:00] <LeoNerd> Unlike in pwmfast mode where it glitches
[08:31:42] <LeoNerd> Oooh wait a moment... does the overflow interrupt now only happen half as often?
[08:31:59] <LeoNerd> I'll have to recalculate my ticker delays
[08:55:51] <cehteh> haha yes phase correct is half speed
[08:56:11] <cehteh> or rather fastpwm is fast because twice as fast
[08:56:23] <cehteh> and no, BOD is off by default
[08:56:57] <cehteh> when voltage drops cpu may do crazy things which eventually cause a crash/reset/lockup
[09:09:29] <geri> hi
[09:09:42] <geri> i have a slightly offtopic question: hi, what is the diff between scaling coefficients and wavelet coefficients referring to the wavelet transform? the scaling coefficients implement a low pass filter?
[09:10:26] <LeoNerd> /slightly/ offtopic?
[09:11:05] <cehteh> maybe there is a ##math channel
[09:12:45] <LeoNerd> Hmm. OK so my timijg is even more screwed than I thought. It's 4 times too fast.
[09:13:14] <LeoNerd> Because: I was foolish and relied on CKDIV8 fuse rather than setting prescaler explicitly
[09:13:16] <cehteh> you dont use 16mhz from PLL?
[09:13:49] <LeoNerd> So new chip is 8 times too fast because fuses, but then different pwm mode makes it half that
[09:14:09] <LeoNerd> Moral: I should set MCUSR at startup
[09:14:26] <cehteh> ah yes i always set it, with the nice side effect that i plan to add a F_OSC to my source which can either caclulate F_CPU or when F_CPU is given adjust the prescaler
[09:14:32] <cehteh> or just barf if no match
[09:14:46] <LeoNerd> I usual;y rely on the fuses
[09:15:13] <LeoNerd> But I switched from tiny84 to 85 here and couldn't be bothered to recalculate them, so I left it at chip default
[09:15:47] <cehteh> me too, but having the option just to compile with different F_CPU and main sets the correct speed is nice, for slower debugging or corner case tests on timing
[09:16:25] <cehteh> defaults are iirc the same, but maybe i am wrong
[09:16:40] <cehteh> i am pretty sure the PLL at least is not enabled by default
[09:17:32] <cehteh> and CLKDIV8 is also standard .. or? perhaps not for some USB chips or xmegas
[09:19:34] <LeoNerd> It is default but usual;y I turn it off
[09:20:42] <LeoNerd> So my fuse values turn it off... and my code presumes it off. On my tiny85 I got lazy and decided not to bother with fuses, so adjusted my code to presume it set, so 1MHz instead
[09:21:24] <LeoNerd> In my frustration of "why doesn;t this work??" I did make install FUSES=1 which burned my tiny84 fuse values onto the tiny85.
[09:22:23] <LeoNerd> Lucky I didn't break it entirely; but it now means the fuses is off but my code presumes it on
[09:37:06] <geri> cehteh: math?
[10:19:59] <lorenzo> http://www.amcnicoll.com/avr-liberty-dox/ds2482_8c.html
[10:20:05] <lorenzo> does anyone know / use the "avr liberty" set of libs?
[10:20:10] <lorenzo> they seem to have some interesting stuff
[10:21:18] <WormFood> never heard of it before.
[10:22:17] <WormFood> lorenzo, are you using an iButton, or something using the same interface?
[10:22:42] <lorenzo> uh no. just got some ds2482, was trying to figure out how to use them to talk to some ds18b20 sensors
[10:22:48] <cehteh> ibutton is onewire
[10:22:49] <lorenzo> I could use 1-wire directly, but I wanted to step up the fun :D
[10:22:58] <LeoNerd> 1wire is interesting
[10:23:07] <cehteh> on my todo list too
[10:23:13] <LeoNerd> Real Dallas is actually quite nice.. unlike that stupid-as-fuck WS2812 rubish
[10:23:52] <cehteh> ack
[10:24:25] <cehteh> well ws2812 was designed for big displays where it works well
[10:24:40] <cehteh> who could have forseen that hobbyists make all kinds of tools from it
[10:25:10] <lorenzo> if anyone is interested, at work I was asked to run 5 DS18B20 sensors for a day and graph the output
[10:25:22] <lorenzo> result was fun :D
[10:25:31] <lorenzo> http://i.imgur.com/7Lrq3pA.png
[10:25:50] <lorenzo> (y temperature, x time)
[10:27:01] <cehteh> close together or at different places?
[10:27:06] <lorenzo> close together
[10:27:11] <cehteh> ok
[10:27:14] <lorenzo> different batches
[10:27:24] <cehteh> i guess one should calibrate them
[10:27:35] <cehteh> cheap china crap :D
[10:27:50] <cehteh> someone already told me that there are a lot bad calibrated ones available for cheap
[10:28:14] <lorenzo> we've tried ~15 sensors
[10:28:24] <lorenzo> texas instruments, sensirion, meas, honeywell
[10:29:09] <lorenzo> and a few Silabs and Analog Devices
[10:29:10] <lorenzo> looks like the more you spend, the better it is :D who could have told lol
[10:29:32] <lorenzo> most accurate ones turned out to be Sensirion, but they're > 6-7 eur each
[10:29:38] <cehteh> but the difference looks just like offsets mostly
[10:29:43] <cehteh> could be easily calibrated
[10:30:01] <cehteh> i forgot are these user recalibrateable?
[10:30:10] <cehteh> i know the datasheet says factory calibrated
[10:30:28] <lorenzo> I don't think you can save the calibration data in the sensor
[10:30:49] <cehteh> factory calibration prolly does that
[10:30:53] <lorenzo> anyway I need to understand if the offset is constant or not
[10:31:00] <cehteh> but maybe with some undocumented interface or in a PROM
[10:31:12] <lorenzo> like, if it's really just +0.5C all the time, or if the offset starts growing at higher or lower temeprature
[10:31:24] <lorenzo> e.g. what happens at 40C
[10:31:30] <lorenzo> or 10C
[10:31:33] <cehteh> yes
[10:31:36] <lorenzo> but I don't have a controlled oven :(
[10:31:54] <cehteh> put them into a temperature controlled paraffine bath .. lab equiment
[10:32:02] <cehteh> i have a controlled oven
[10:32:16] <cehteh> controlled by .. DS18B20 :D
[10:33:00] <lorenzo> :D
[10:33:14] <lorenzo> another thing that most people leave out in "demo" PCBs / breakout boards are cutouts
[10:33:25] <cehteh> another thing someone suggested me: use 1n4148 as temperature sensor . they have a quite linear temperature curve over a wide range
[10:34:12] <lorenzo> to minimize heat transfer
[10:34:20] <lorenzo> cehteh: yeah I'm pretty sure TI makes some "remote" temperature sensors
[10:34:32] <cehteh> there are plennty good temperature sensore
[10:34:35] <lorenzo> which you attach to a PN junction
[10:34:39] <cehteh> but not for 4 cent :)
[10:34:59] <lorenzo> yeah, I've figured out the best stuff starts at 6-7 eur per sensor
[10:35:22] <lorenzo> HTU21D was pretty accurate for humidity too, but again, it's 10 EUR :-)
[10:35:32] <lorenzo> you can get I think ~20 DS18B20 for 10 eur these days, so..
[10:35:39] <cehteh> well even bad ds18b20 are good enough for many things .. as long you can compensate them
[10:36:18] <lorenzo> they're still good for relative measurements, that is, this thing "about this" hot
[10:36:20] <lorenzo> and now it's hotter
[10:36:41] <lorenzo> but there are analog solutions better suited for that kind of thing I think
[10:41:18] <cehteh> the advantage is 1 pin .. many sensors
[10:42:02] <cehteh> and more than 10bit res for cheap
[10:42:06] <lorenzo> and long distance
[11:05:26] <LeoNerd> Huh.. the tiny841 has a /real/ SPI module, and an I²C slave-only... So you can't do I²C master from it?
[11:05:29] <LeoNerd> Not even a USI
[13:12:40] <cehteh> yay .. uart with blocking io works on first try :) ... pauses current I/O job, schedules something else
[13:13:47] <LeoNerd> Mmm
[13:14:45] <cehteh> meany printing lots of data, with very small (2 bytes) uart queue
[13:23:34] <cehteh> ah doh .. still some gotcha, working on it
[13:45:12] <RikusW> hi megal0maniac
[14:19:49] <megal0maniac> RikusW: Hey
[14:20:00] * RikusW is in CT
[14:20:21] <megal0maniac> Enjoying our lovely weather? ;)
[14:20:22] <RikusW> still settling in though
[14:21:03] <RikusW> heh
[14:21:28] <RikusW> at least the air is not as hot and dry :)
[19:19:46] <WormFood> http://git.lochraster.org:2080/?p=fd0/usbload;a=tree <-- this particular project uses unused interrupt vectors for regular code. They're using a custom linker file, but I can't figure out how it works, or how to make it work with a current GCC. Anyone have any clue about that?
[19:20:23] <WormFood> For a bootloader, the extra 30 or so bytes it gives me, could be really helpful.
[19:59:51] <Casper> I remember years ago, when I started, to have toyed with that
[20:00:00] <Casper> but I forgot how I did it...