#avr | Logs for 2012-04-24

Back
[08:04:10] <rvsjoen> using avr2025 there are functions to get the time through pal_get_current_time(), but does anyone know a way to enable setting the time ? I can't seem to find any functionality. the function for getting the time is here http://dpaste.com/736789/ and i'm wondering if I could somehow simply reverse its operation to provide a pal_set_current_time() function
[09:07:04] <rue_house> thats the read dead time, its not adjustable
[09:30:44] <MichaelMalus> Odd issue here - Reality not matching (AVR sudio 4) emulator/debugger.
[09:31:36] <karlp> reality must be wrong then :)
[09:33:25] <MichaelMalus> Polling Timer/Counter 1 high byte, and outputting it to an LED display on Port C.
[09:33:59] <MichaelMalus> The emulator shows (I think) expected behaviour.
[09:34:20] <MichaelMalus> The hardware shows expected behaviour when reading the low byte, but not the high one.
[09:34:30] <rue_house> yes every emulator is perfect, have th real world corrected immediatly
[09:34:45] <rue_house> no, the emulator shows you what workds in the emulator
[09:34:50] <rue_house> DO NOT USE EMULTORS
[09:34:54] <rue_house> cmon already
[09:35:07] <rue_house> just make hardware tests and develop ON the avr already
[09:35:37] <rue_house> unless you plan to never use your code on a real world avr, DONT USE EMULATORS
[09:36:21] <karlp> no way man, the real hardware is doing the wrong thing.
[09:39:22] <MichaelMalus> rue_house: Any _useful_ suggestions?
[09:45:32] <MichaelMalus> (ATmeaga8535)
[10:21:12] <MichaelMalus> ...I want a hardware engineer and a flamethrower.
[10:32:18] <Ritchie> .
[10:38:33] <karlp> didn't like the ritchie nick?
[12:26:00] <JyZyXEL> are yall sure attiny2313 can do 9600 with its external crystal, because im getting missed char's
[12:27:24] <karlp> are you a) using the external crystal and b) what speed external crystal, and c) servicing interrupts properly and not overflowing/underflowing.
[12:27:31] <karlp> or, in shorter words, yes, we're sure
[12:27:47] <JyZyXEL> internal
[12:27:49] <JyZyXEL> i meant internal
[12:29:01] <karlp> that's part dependent, you've gota pretty high tolerance on the internal oscillator.
[12:29:30] <JyZyXEL> my lfuse is 0xe4
[12:29:41] <JyZyXEL> i think thats 8MHz divided by 8
[12:29:56] <impulze> heya, i'm trying to find out which wires on my usb-to-serial cable represent tx/rx/vcc/gnd, any pointers on how to find out? i've got minicom, seyon setup and the proper driver loaded and /dev/ttyUSB=
[12:30:02] <impulze> *0
[12:30:08] <JyZyXEL> im not using interrupts at all
[12:30:27] <JyZyXEL> its just a while(1) switch (USART_Receive())
[12:31:18] <JyZyXEL> should i change to 2400 bauds?
[12:31:41] <JyZyXEL> or is it always gonna be unstable and i should just use an external crystal=
[13:50:04] <feurig_> morning
[13:50:36] <feurig_> anyone have the assembly to disable the wdt in the init section?
[13:55:10] <Casper> why not just put wdt_disable(); as the first line of your main?
[14:04:13] <feurig_> thats what I am trying.
[14:04:47] <feurig_> I need the arduino bootloader to be watchdog aware.
[14:05:11] <feurig_> Casper: good call since that would be the macro for the assembly
[14:05:22] <feurig_> thanks
[14:23:36] <Tom_itx> feurig_ i may
[14:27:24] <Tom_itx> ; Turn off WDT
[14:27:24] <Tom_itx> cli ; Turn off global interrupt
[14:27:24] <Tom_itx> wdr ; Reset Watchdog Timer
[14:27:24] <Tom_itx> in r16, MCUSR ; Clear WDRF in MCUSR
[14:27:24] <Tom_itx> andi r16, (0xff & ~(1<<WDRF))
[14:27:24] <Tom_itx> out MCUSR, r16
[14:27:25] <Tom_itx> ldi r16, WDTCSR ; Write logical one to WDCE and WDE
[14:27:25] <Tom_itx> ori r16, (1<<WDCE) | (1<<WDE) ; Keep old prescaler setting to prevent unintentional time-out
[14:27:26] <Tom_itx> sts WDTCSR, r16
[14:27:26] <Tom_itx> ldi r16, ~(1<<WDE) ; Turn off WDT
[14:27:27] <Tom_itx> sts WDTCSR, r16
[14:27:27] <Tom_itx> sei ; Turn on global interrupt
[14:30:29] <feurig_> thanks Tom_itx
[20:55:13] <Essobi_> Sup
[20:55:52] <Essobi_> Welp... Time to build a DAPA again, I'm thinking.
[21:00:03] <ThersiT> still can't find your stuff?
[21:00:04] <CapnKernel> What a DAPA? (You were itching for someone to ask that, weren't you)
[21:02:30] <Essobi_> ThersiT: hell no.. :( Been looking for over a month now.. been through every box atleast twice. :(
[21:02:44] <Essobi_> CapnKernel: really cheap programmer
[21:03:24] <Essobi_> *sigh* Means all my environmental sensors are gone too thou... and my RS-485 gear. :(
[21:04:05] <ThersiT> Oh that super sucks.
[21:06:14] <Essobi_> Yap. About $200 worth of sensors. :(
[21:07:03] <Essobi_> I've been re-thinking it recently thou... and examining what's on the market now. I think I can build it a lot less complicated now, and more OTS stuff thrown together.
[21:07:06] <ThersiT> Well it turns out I didn't have a burnt pin after all. It was just that I suck a programming.
[21:07:14] <Essobi_> :D
[21:07:22] <Essobi_> Shit happens.
[21:07:40] <ThersiT> Yea it's just time to upgrade is all.
[21:08:03] <Essobi_> I had a typo in the shell script that was 1 letter off what I was using. :D
[21:08:21] <Essobi_> Made all kinds of crazy shit happen on my 328p, but it still ran.
[21:08:39] <Essobi_> I was completely confused for days over that one.
[21:08:54] <Essobi_> ThersiT: So what kind of stuff you working on?
[21:11:01] <ThersiT> I just wanted to learn about circuit design and a little programming. So I'm trying to make a computer for my kegerator.
[21:11:25] <Essobi_> Haha, nice.
[21:11:29] <ThersiT> Seems like as good a project as any to get started with.
[21:12:01] <Essobi_> I've been tinkering with mcu's off and on since the early 90s. Computer Engineer by day.
[21:13:19] <Essobi_> Are you building a hysteresis thermostat or something to monitor temps?
[21:14:38] <Essobi_> /2
[21:16:53] <ThersiT> Yea lots of temp monitoring don't want to get into the thermostat yet (want to build that myself) But mainly it'll have a pair of GLCDs to give you info like how much beer is left, temps, pressures, and maybe the name and ABV.
[21:17:31] <ThersiT> Oh and I'd like it to tell bar jokes when you walk by. ;)
[21:18:24] <Essobi_> haha
[21:18:30] <Essobi_> umm.
[21:18:38] <Essobi_> Beer left by weight?
[21:19:11] <Essobi_> that's probably the cheapest way to do it.. IR level detection sensors are pricey as hell compared to a weight sensor.
[21:19:34] <ThersiT> Yea I salvaged a pair of strain gauges out of a bathroom scale.
[21:20:18] <Essobi_> Good idea.
[21:20:25] <ThersiT> I wanted some liquid level sensors but I don't want anything inside the kegs.
[21:21:16] <Essobi_> ya, liquid level sensors that make contact actually taint things due to slight electrolysis.
[21:21:37] <Essobi_> Which is why I mentioned the IR ones.. they don't touch the liquids.
[21:21:58] <Essobi_> I know a bit or two about stilling/brewing.
[21:22:16] <Essobi_> Sort of live in the middle of the bourbon belt.
[21:24:19] <ThersiT> Yea I'm wondering how much of a problem that'll be because I do want temp from inside the keg. So I'm thinking to get the signal out from inside the sealed keg I'll use the stainless steel body as a conductor.
[21:24:20] <nevyn> there's also ultrasonic ones
[21:24:38] <ThersiT> Wonder if that'll mess with the taste.
[21:25:23] <ThersiT> Would IR or ultrasonic work from outside the keg?
[21:26:41] <Essobi_> ThersiT: Hmm.. IDK about under that kind of pressure but in the fermenting/cooking vessels you'd use like a 1-wire temp sensor embedded in a stainless steel tip, or a K-type thermo in the same body depending on which one you're doing and the temp ranges.
[21:28:57] <ThersiT> Guess that would be the safest. Just drill the side, insert temp probe, like a brew kettle?
[21:30:29] <Essobi_> Yurp.
[21:30:41] <Essobi_> Make sure the sealers are food safe.
[21:31:01] <Essobi_> and sound for that ammount of pressure.
[21:31:25] <Essobi_> I've played with 1-wire quite a bit... I love that gear.
[21:33:29] <ThersiT> That might be better. However till I get the computer all built I'm planing on just attaching a thermistor to the side with duct tape.
[21:34:59] <Essobi_> :D
[21:35:03] <Essobi_> That works too.
[21:35:22] <Essobi_> You can get a good accurate thermo
[21:35:31] <Essobi_> and use the offset method to figure it out...
[21:35:40] <Essobi_> check the side, and check the internal temp..
[21:35:54] <Essobi_> And figure out what your average offset it.
[21:36:10] <Essobi_> Shouldn't drift much as long as the outside is insulated from ambient air temps.
[21:36:43] <Essobi_> I'm reading about how to make cornmash for whiskey. :D
[21:37:57] <ThersiT> Yea, the temps are mostly for me wanting to know everything. The main goal it to make the screens pretty and flashy.
[21:39:24] <ThersiT> Hell yea. I haven't gotten in to distills much. just beer and I'm looking into wine.
[21:43:00] <Essobi_> ThersiT: It's lovely for turning wine into brandy. :D
[21:46:47] <ThersiT> One of my buddies want's me to distill this beer I made. It's 15% ABV.
[21:47:10] <ThersiT> Nice dark stout.
[21:47:49] <Essobi_> good lordy
[21:48:09] <Essobi_> Turbo yeast?
[21:51:18] <ThersiT> It was spost to be 10%. It was one of the first beers I made, and I bottled it with out realizing it had stalled. So I opened all the bottles up and put them back in the fermenter with some WP100 and dropped it another like 20 points on the hydrometer.
[21:51:25] <ThersiT> heh heh
[21:51:58] <ThersiT> It's bout 3 years old now and still tastes great.
[21:57:10] <CapnKernel> With that ABV, and the hops, and if kept out of the light, then it will keep a long long time.
[21:58:30] <Essobi_> Nice.
[21:59:01] <ThersiT> I hope so. Every couple of months I get in to them and I'm always worried on that first sip.
[22:19:21] <ThersiT> Boy, something as simple as getting PWM setup has really been a pain in the ass.
[22:21:01] <Casper> because you didn't read the datasheet?
[22:21:14] <Tom_itx> http://tom-itx.dyndns.org:81/~webpage/how_to/atmega168/mega168_pwm_index.php
[22:21:55] <ThersiT> Na, I've read over and over the data sheet.
[22:22:16] <Tom_itx> also, read dean camera's articles off the menu here: http://tom-itx.dyndns.org:81/~webpage/index.php
[22:25:09] <ThersiT> I've got the same settings on OC0 and OC2. OC2 is working but OC0 is not??
[22:29:01] <Casper> you sure you didn't forgot to change the registers? or forgot to set the pin as output?
[22:31:21] <ThersiT> TCCR0A = 0x83; TCCR0B = 0x04; DDRB |= (1<<PB3); OCR0A = 0x80;
[22:31:46] <ThersiT> on a 644p that's all it should take. I think.
[22:57:19] <Essobi_> Derp da derp.
[22:57:25] <Essobi_> Hmm.
[22:59:29] <ThersiT> Damn it, same damn coding error as last night.
[23:00:02] <ThersiT> I think I'm gonna get a book about C and read it. :)
[23:00:08] <Essobi_> Hmm.. I wonder how many soft serials I can put on a 328p...
[23:00:46] <clever> if your only going to tx one at a time, as many as you have pins
[23:01:07] <clever> if you want to rx, then things start to actualy have cpu based limits
[23:01:26] <clever> depends on baud rates and clock freq
[23:01:38] <Essobi_> ThersiT: Oooo.. https://www.atlas-scientific.com/sensors.html I see brewed things.
[23:02:55] <Essobi_> clever: Hmm.. Yea.. It's all RX pretty much. Sensor data collection.. they stream serial.
[23:03:09] <Essobi_> 9600,8,n,1, iirc
[23:03:34] <clever> Essobi_: how many sensors?
[23:04:08] <clever> i was working on a similar idea a few months back, the bastards want $400 for a nmea hub
[23:04:21] <clever> that simply buffers serial data and repeats it out other serial ports
[23:04:49] <ThersiT> Essobi_: Very nice.
[23:04:50] <Kevin`> it's too bad they don't have i2c or 1-wire sensors like.. normal embedded sensors
[23:04:57] <Essobi_> oh no wait..
[23:05:08] <Essobi_> It's 38400,8.n,1.
[23:05:24] <Essobi_> clever: ewww. $400? that's rape.
[23:05:37] <Essobi_> Kevin`: 1-wire would be nice.
[23:05:56] <clever> the last soft serial i saw used an interupt for the start bit
[23:06:03] <clever> and a timer for the sampling
[23:06:10] <clever> which limits you to the number of timers you have
[23:06:27] <clever> but you can also use the hardware uart as a 'free' rx channel
[23:06:40] <Essobi_> hmm
[23:06:48] <clever> your other option is to have a higher speed timer, and a purely interupt (edge change) soft serial
[23:06:48] <Essobi_> I like 1-wire stuff...
[23:06:55] <clever> that looks at the timestamp of the last edge change
[23:07:08] <clever> and works out how many bits since the last change, at the given baud
[23:07:16] <clever> being purely IRQ based, it can share a timer
[23:07:29] <Essobi_> but no one in the ph/orp/do/etc type sensors make anything 1-wire. :(
[23:07:35] <clever> then you just need enough clock cycles to handle each edge change
[23:08:09] <clever> your othr option is just get an attiny with softserial->spi with interupt
[23:08:16] <Essobi_> Frankly, the weather enthusiast is the only reason you can get any decent 1-wire physical sensors. :|
[23:08:17] <clever> and stick an attiny on every sensor
[23:08:24] <Essobi_> *enthusiasts
[23:08:49] <Kevin`> Essobi_: there's always the option of having a few more of these $2 microcontrollers, one for each group of sensors, for however many hardware interfaces you need. then have them talk to a master device with a more sane protocol
[23:08:54] <Essobi_> clever: That's a thought. An RS-485 multidrop network would be sweet.
[23:08:55] <clever> each sensor would have an irq line that the tiny raises, and a chip-select to enable spi or whatever else you want
[23:09:19] <clever> if you use a cheap enough uc at the sensors (tiny), you can afford to stick one at every sensor
[23:09:31] <Essobi_> Kevin`: I'm tunneling the info to a 2.5W *nix box. :D
[23:09:49] <Kevin`> if you use the most expensive microcontroller reasonably available you can you can still afford one for every sensor
[23:10:13] * Essobi_ looks over at his desk with 8 328ps in a tube.
[23:10:13] <clever> Kevin`: thats why nmea hubs wind up costing 400 :P
[23:10:19] <clever> that, and nobody else makes them
[23:10:25] <clever> fork over 400 or do without! :P
[23:10:29] <Essobi_> Derp.
[23:10:48] <Essobi_> Necessity is a mother. :D
[23:11:32] <Essobi_> Hmm.. serial is unreliable on the internal oscillator, ya?
[23:11:34] <clever> and dad wont even let me wire it up because he doesnt want to fry the $500 parts its connecting to :P
[23:11:46] <Essobi_> clever: lulz
[23:11:51] <clever> Essobi_: depends on the baud rate
[23:11:55] <Kevin`> Essobi_: it normally works, but if you want guaranteed and the full operating range, no.
[23:12:41] <clever> http://www.raymarine.com/ProductDetail.aspx?SITE=1&SECTION=2&PAGE=1011&PRODUCT=3113
[23:12:42] <Essobi_> Hmm.. Perhaps a powered 1-wire bus. :D
[23:12:48] <clever> ok, my memory was a bit off, $199.99
[23:13:02] <Kevin`> it actually doesn't depend on the baud rate, except that certain rates will be exact multiples of the clock frequency and others won't be. all that matters is the frequency accuracy
[23:13:04] <Essobi_> Still..
[23:13:05] <clever> Essobi_: ive heard that the state engine to make a software 1-wire slave is a nightmare
[23:13:26] <clever> http://www.raymarine.com/ProductDetail.aspx?SITE=1&SECTION=2&PAGE=1011&PRODUCT=3119
[23:13:34] <Essobi_> clever: Ya, I've looked at it.
[23:13:34] <clever> and to adapter the private protocol to nmea, you need a $50 adapter
[23:13:46] <Essobi_> Eww.
[23:13:49] <clever> plus a second adapter, because neither device speaks nmea
[23:13:55] <clever> both speak private protocols
[23:14:22] <Essobi_> Now if I can find a decent PAR sensor, I think I'll have every environmental covered.
[23:14:52] <clever> http://www.sparkfun.com/products/10972 38400 baud, i think i know exactly what your using
[23:15:27] <clever> and on a closer look, that board has a pic16 on it, lol
[23:16:00] <Kevin`> clever: well of course, something has to read the actual sensor and generate the data stream ;p
[23:16:03] <clever> ph sensor->pic->attiny->spi->central avr, got enough uC's? :P
[23:16:21] <Essobi_> Yo dog.
[23:16:25] <clever> if you could get firmware from them, you could just rewrite it to do spi itself
[23:16:26] <Essobi_> I heard you like uC's.
[23:16:38] <clever> or just not get firmware and make your own from scratch
[23:16:51] <Kevin`> clever: or just the documentation to reliably sample the sensor
[23:16:51] <clever> its probly still read/write, just chip erase
[23:16:53] <Essobi_> Actually, I'd like to just build some damned boards but appearently this type of electronics is hard. :D
[23:16:57] <Kevin`> analog stuff is a bit different if you aren't used to it though
[23:17:26] <clever> Kevin`: if you have a ready made board, with a uc already on it, it cant be that hard to look and see which ADC pin its using
[23:17:26] <Essobi_> super sensitive amps and what not.. board layout matters a ton, and cables and etc..
[23:17:33] <Essobi_> $90 looks like an easy buy out
[23:17:33] <clever> then chip-erase and sample the pin
[23:18:05] <clever> the 5 unpopulated pins along the edge feel like an ISP header
[23:18:13] <Essobi_> Heh
[23:18:34] <Kevin`> clever: well they have to program the chip themselves. there's always going to be one of those, at least on test points
[23:18:37] <Essobi_> That totally is a pic
[23:18:40] <clever> probly just double-sided, grab a datasheet and a pic programmer and you can try hacking it up
[23:18:41] <Kevin`> I wouldn't want to disassemble it though
[23:18:50] <Kevin`> (the software, that is)
[23:19:07] <clever> Kevin`: ive heard that some sites like digikey will provide the chips pre-flashed, on the reel
[23:19:13] <Kevin`> i'd rather just write it from scratch following docs for the sensor
[23:20:04] <Essobi_> That board looks rather simple thou..
[23:20:32] <clever> the worst that can happen, is you brick a single interface board
[23:20:49] <clever> they probly put a lock on the code so you cant read it, which means you need to erase the chip
[23:20:52] <Essobi_> That's a TI op amp
[23:21:03] <clever> and if you cant get it to work, it wont ever be back to original conditions
[23:21:31] <Essobi_> blank it, order a new one, and say the board didn't work. :D
[23:21:40] <clever> 2 pins clearly go directly to the bi-color led, and i can see atleast one of the 'ISP' pins going to the pic
[23:22:31] <clever> middle pin on the ISP conn, cant see where its going
[23:23:08] <clever> seems to go into a filter cap and vanishes into the silkscreen
[23:23:31] <clever> but 3 of them clearly go directly to the pic
[23:24:24] <clever> http://www.microchip.com/wwwproducts/Devices.aspx?dDocName=en546902
[23:26:17] <clever> ICSPCLK
[23:26:18] <Essobi_> interesting
[23:26:35] <clever> ICSPCLK ICSPDAT MCLR/Vpp VDD VSS, 5 pins
[23:27:31] <clever> ICDCLK clearly goes to the top pin on the 5 pin header
[23:27:43] <Essobi_> Remind me to never show you pictures of my boards. :D
[23:28:01] <Kevin`> Essobi_: why, did you lay them out horribly? ;p
[23:28:20] <Essobi_> That too
[23:28:33] <Essobi_> Hmm.
[23:28:42] <clever> MCLR/Vpp is clearly the bottom of 5 pins
[23:29:11] <clever> vdd/vss are routed under the chip, but if you have one in your hand you could just ohm it out
[23:29:31] <clever> page 6 of the pic datasheet shows the exact layout
[23:29:44] <clever> page 331 tells you which pins are needed
[23:30:03] <clever> then you just need to hotwire your AVR into a pic programmer and you can cross the line :P
[23:30:57] <Essobi_> Hmm.. phidgets makes one as well. ~$100 too.
[23:31:54] <clever> the comments on sparkfun also say you can buy the bare 'stamp' from the source company
[23:32:13] <clever> so you could just get a spare one to format, and not risk having none left
[23:32:40] <clever> but you would be diving headfirst into the pic pool
[23:33:14] <Kevin`> pic16 is kind of annoying to write code for, at least in c
[23:33:21] <Kevin`> limited compiler options
[23:35:58] <Essobi_> yea I worked on pic12s ages ago
[23:38:38] <clever> i assume the pics also have the usual fuses to block reads?
[23:38:57] <clever> to protect the existing firmware
[23:42:22] <clever> ok, my laptop doesnt like hibernate-ram!
[23:42:25] <clever> no video!!
[23:43:47] <Essobi_> clever: yup, settable fuses
[23:44:08] <clever> Essobi_: and you can read the whole flash if they arent locked?
[23:44:21] <Essobi_> could on the 12s
[23:44:26] <Essobi_> I assume as much on the 16s
[23:44:41] <clever> so it cant hurt to check the fuses and try to read your existing sensors
[23:45:03] <clever> then plan from there
[23:45:22] <Essobi_> fair enough
[23:45:45] <clever> if you had a firmware backup, then its pretty much 100% safe to mess arround with reflashing it
[23:46:36] <Essobi_> I'd assume it's locked.
[23:47:03] <clever> but you can pray its not
[23:47:47] <Essobi_> This same company has DO/TDS sensors too.
[23:48:03] <clever> do/tds?
[23:48:51] <Essobi_> dissolved oxygen, total dissolved salts... They're all selective ion sensors.
[23:49:03] <clever> ah
[23:49:12] <clever> only thing i was thinking of was pool water
[23:49:25] <Essobi_> basically all the things you need to control a fishtank/aquaponics system. Pools too if you want to be really anal.
[23:49:49] <clever> i was thinking of bypassing the monthly trips to the pool shop with a bucket of water
[23:49:53] <Essobi_> applies to fertigation controllers too
[23:51:09] <Essobi_> and water treatment plants
[23:51:33] <Essobi_> but yea, you could use it to control a ph/chlorine dosing system too.
[23:51:37] <Essobi_> easily
[23:52:14] <Essobi_> people make the mistake of assuming ORP/TDS has nothing to do with the effectiveness of their chlorine thou.
[23:52:41] <Essobi_> real pool controllers for commercial systems do PH and ORP minimally.
[23:52:52] <Essobi_> bbiafm
[23:56:28] <Essobi_> Christ it's cold out there.
[23:56:32] <clever> lol
[23:56:38] <clever> it was actualy snowing here, ~2 days ago
[23:57:51] <Essobi_> ugh
[23:58:01] <Essobi_> Can't spring, sprung already?
[23:58:18] <clever> the snow quickly returned to rain
[23:58:25] <clever> which made an inch of slush everywhere
[23:58:38] <Essobi_> ugh
[23:58:49] <Essobi_> I hate cold weather... i keep threatening to move.
[23:58:51] <clever> its since melted
[23:59:10] <clever> ive got a DS18B20 hanging out a hole in the wall, let me see what the outside temp is
[23:59:27] <clever> 4.00
[23:59:34] <Essobi_> hehe
[23:59:50] <Essobi_> I <3 1-wire gear