#avr | Logs for 2014-09-06

Back
[00:01:52] <rue_shop3> this is a test question, the first person to answer dosn't get kicked from the channel
[00:02:57] <rue_shop3> atmega32 at 6Mhz, timer 1 with a divisor of 256, how many counts in 1ms, 2.5ms and 5ms
[00:05:06] <rue_shop3> I get 23, 58, and 116
[00:05:13] <rue_shop3> yay! I dont get kicked
[00:05:27] <rue_shop3> I'm busy, so I'll kick everyone else later
[00:06:35] <Casper> I get 23 59 117
[00:07:03] <rue_shop3> iiiiinteresting
[00:08:14] <Casper> 23.4375 = 23, 58.59375 = 59, 117.1875 = 117
[00:08:36] <rue_shop3> root@freebee5:/files/programming/c/avr/atmega32/Smokingprogress/IRRecieve1# calc "(1/1000)/(1/(6000000/256))"
[00:08:36] <rue_shop3> (1/1000)/(1/(6000000/256)) -->> 23.255814
[00:08:36] <rue_shop3> root@freebee5:/files/programming/c/avr/atmega32/Smokingprogress/IRRecieve1# calc "(2.5/1000)/(1/(6000000/256))"
[00:08:36] <rue_shop3> (2.5/1000)/(1/(6000000/256)) -->> 58.139535
[00:08:36] <rue_shop3> root@freebee5:/files/programming/c/avr/atmega32/Smokingprogress/IRRecieve1# calc "(5/1000)/(1/(6000000/256))"
[00:08:38] <rue_shop3> (5/1000)/(1/(6000000/256)) -->> 116.279070
[00:09:44] <rue_shop3> close enough for the robots I go with.
[00:10:15] <Casper> o.O you did the math too complicated
[00:10:24] <rue_shop3> what do you mean
[00:10:30] <rue_shop3> 1/1000 is 1ms
[00:10:43] <rue_shop3> and 1/(6Mhz/256) is time
[00:11:11] <rue_shop3> I like my command line calculator :)
[00:11:29] <Casper> (6e6/256) / 1000
[00:11:33] <rue_shop3> the new version gives you 42 for any operation it cant do
[00:11:55] <rue_shop3> the old version just used 3
[00:12:18] <rue_shop3> root@freebee5:/files/programming/c/avr/atmega32/Smokingprogress/IRRecieve1# calc 4^3
[00:12:18] <rue_shop3> 4^3 -->> 3.000000
[00:12:36] <rue_shop3> the old version has a bug
[00:13:27] <rue_shop3> root@freebee5:/files/programming/c/avr/atmega32/Smokingprogress/IRRecieve1# calc 10-10+10
[00:13:28] <rue_shop3> 10-10+10 -->> -10.000000
[00:13:40] <rue_shop3> it goes from right to left
[00:13:43] <rue_shop3> :)
[00:14:03] <Casper> ... shall use bc
[00:14:14] <rue_shop3> use a variable in bc
[00:14:22] <Casper> bed time, nite
[00:14:25] <rue_shop3> calc 2*Pi
[00:14:25] <rue_shop3> 2*Pi -->> 6.283185
[00:14:39] <rue_shop3> I can do evil things
[00:15:07] <rue_shop3> calc "A+B((A=3)(B=8))"
[00:15:07] <rue_shop3> A+B((A=3)(B=8)) -->> 11.000000
[00:15:17] <rue_shop3> the brackets are done first
[00:15:32] <rue_shop3> which means when it gets to A+B, they are already defined
[00:16:07] <rue_shop3> which is nice if you have an ugly formula you want to play with values in
[00:18:31] <rue_shop3> it collapses the string as it parses
[00:19:09] <rue_shop3> I need to figure out how to get functions into it tho
[00:20:08] <rue_shop3> I suppose if I hit a ( while reading a variable name, I change course
[00:20:33] <rue_shop3> tho the current method knows what its looking at from the first few characters
[00:28:45] <rue_shop3> ok, now I just mash this code into the other code, and with a little bit of blind faith....
[00:28:48] <rue_shop3> oh whatever
[02:58:32] <rue_shop3> I should have clued in when looking at the scope, the times are not 5ms, 2.5ms and 1ms, they are 2.5ms, 1ms, and 0.5ms
[06:36:14] <anasver> hey there, i was wondering what all those files created by avr-gcc are for?
[06:38:13] <anasver> for example .hex ; .eep.hex ; .map ; and .lss
[06:39:40] <antto> if you want your program to be flashed onto the uC - you need some of those files
[06:39:48] <antto> the .hex for example
[06:42:02] <twnqx> .hex is the flash image, .eep.hex should be the eeprom image
[06:44:09] <bezoka> hello
[06:45:47] <anasver> so i could program the eeprom, too? But what about the .map and the .lss ?
[07:59:22] <Lambda_Aurigae> .map is debugging stuff
[07:59:55] <Lambda_Aurigae> .lss is an assembly list file.
[08:00:40] <Lambda_Aurigae> it has things like the C code in comments to make it easy to follow and learn from...
[08:03:46] <eatyourguitar> how hard would it be to program an attiny in assembler to be a 4 bit parallel out ADC?
[08:04:05] <Lambda_Aurigae> does it have an ADC built in?
[08:04:14] <eatyourguitar> yeah I think they all do
[08:04:14] <Lambda_Aurigae> and do you have enough pins?
[08:04:21] <eatyourguitar> 8 pins is enough
[08:04:30] <Lambda_Aurigae> reset, 4 i/o, gnd, vcc, and analog in.
[08:04:34] <eatyourguitar> 2 for power, 1 for analog in, 4 pins out
[08:04:50] <Lambda_Aurigae> 1 for reset, unless you have a high voltage serial programmer.
[08:04:55] <eatyourguitar> ok so reset makes 8 pins
[08:05:08] <eatyourguitar> I don't want to reprogram it
[08:05:11] <eatyourguitar> just program it
[08:05:22] <Lambda_Aurigae> but if you goof it first time around you need to reprogram it.
[08:05:24] <eatyourguitar> but even so thats enough pins
[08:05:38] <Lambda_Aurigae> will need to play with the software a bit and tweak it most likely.
[08:05:38] <eatyourguitar> I was thinking about paying someone
[08:06:08] <Lambda_Aurigae> you need to write a program that reads the ADC, converts it to whatever value range you need, and output it.
[08:06:13] <eatyourguitar> so I guess there is enough pins either way
[08:06:28] <eatyourguitar> I just need MSB 4 bits
[08:06:53] <Lambda_Aurigae> could easily be done in C...an hours work or so.
[08:07:13] <Lambda_Aurigae> do you need any kind of i/o to trigger it to read or just constant update so many times per second?
[08:07:31] <eatyourguitar> power on and read
[08:07:37] <eatyourguitar> it does one thing
[08:07:46] <Lambda_Aurigae> read once? read with constantly updating?
[08:07:49] <eatyourguitar> I can't buy a 4 bit parallel dac in dip8
[08:07:53] <eatyourguitar> streaming
[08:08:00] <eatyourguitar> as fast as possible
[08:08:11] <eatyourguitar> but I don't have any requirements for samplerate
[08:08:20] <eatyourguitar> I will take what the hardware gives me
[08:08:22] <Lambda_Aurigae> I'm sure someone here would do it for you for cash.
[08:08:28] <eatyourguitar> yeah
[08:08:44] <eatyourguitar> this is to see if its feasable
[08:08:54] <eatyourguitar> then maybe a month from now I can pay
[08:09:00] <Lambda_Aurigae> my dev environment isn't setup at the moment as I'm relocating all my electronics from the dungeon to the big workshed.
[08:09:02] <eatyourguitar> so I'm just getting info now
[08:09:18] <eatyourguitar> I can program if someone can code
[08:09:19] <Lambda_Aurigae> if I were to do a custom programming job, usually 50 dollars an hour.
[08:09:30] <eatyourguitar> it seems pretty straight forward what I need
[08:09:38] <eatyourguitar> oof
[08:09:46] <Lambda_Aurigae> I would consider it a 1 hour minimum job.
[08:09:54] <eatyourguitar> I was gonna bid it for $20 and see if I can get it from someone
[08:10:04] <Lambda_Aurigae> you probably can.
[08:10:10] <eatyourguitar> or I can learn C
[08:10:16] <eatyourguitar> or just use arduino
[08:10:20] <Lambda_Aurigae> that's even better,,,then worse.
[08:10:21] <eatyourguitar> 10sps is ok
[08:10:28] * Lambda_Aurigae is an arduino hater.
[08:10:44] <eatyourguitar> arduino in attiny
[08:12:52] * Lambda_Aurigae shudders at the thought of torturing the poor attiny that way.
[08:15:32] <Lambda_Aurigae> http://www.marcelpost.com/wiki/index.php/ATtiny85_ADC
[08:15:41] <Lambda_Aurigae> basic attiny85 adc reading routine.
[08:16:00] <Lambda_Aurigae> you just need to put your output code in place of the if() section in the main()
[08:28:09] <bezoka> how to use c library in asm?
[08:28:40] <Lambda_Aurigae> hmm...that one is beyond me...maybe google can be of assistance?
[08:29:22] <bezoka> oh, sorry I only search on my language not in english :)
[08:29:31] <Lambda_Aurigae> http://www.nongnu.org/avr-libc/user-manual/assembler.html
[08:30:35] <Lambda_Aurigae> avr how to use c library in asm
[08:30:39] <Lambda_Aurigae> was my google search.
[08:30:49] <Lambda_Aurigae> just about word for word your question in here only I added avr to it.
[08:31:12] <Lambda_Aurigae> and that link was the second one...the first was a FAQ from the same site.
[08:31:32] <bezoka> okay, thanks :)
[08:31:54] <bezoka> sorry for that stupid question
[08:32:17] <Lambda_Aurigae> not stupid.
[08:32:30] <Lambda_Aurigae> just trying to show you how I find things when others don't know.
[08:32:38] <Lambda_Aurigae> or, more often, when I don't know.
[08:33:34] <bezoka> I was looking for it, but in my language
[08:34:05] <bezoka> and only what I found is how to use asm in c
[08:35:10] <Lambda_Aurigae> google seems more responsive in english I guess.
[08:35:19] <Lambda_Aurigae> and the main avr-libc site is in english.
[08:50:59] <bezoka> Lambda_Aurigae: this is asm in c? I want clear asm :)
[08:51:41] <Lambda_Aurigae> that was asm using the standard C libs.
[08:52:11] <Lambda_Aurigae> if you want to use C routines in asm you have to have the whole C wrapper around your asm.
[08:53:21] <bhearsum> i'm having some issues with sleep + waking up via watchdog timer. the problems happens to be on an Arduino board (atmega32u4), but i don't _think_ it's arduino-specific. is it okay to ask about it here?
[08:53:54] <Lambda_Aurigae> you can ask.
[08:54:06] <bhearsum> thanks
[08:54:39] <bhearsum> the hfuse bit on my chip reads as d8, which appears to have WDTON unset - despite that, whenever the watchdog timer fires to bring my device out of sleep, it resets instead. my sleep code is pretty simple, i think: http://pastebin.com/aRcatF4m
[08:54:59] <bhearsum> when that runs, the led on pin 12 turns on, then off, the device sleeps for ~8s, and then repeats -- i would've expected the led on pin 11 to come on after sleep finished
[09:02:29] <bhearsum> according to http://www.engbedded.com/fusecalc, d8 means WDTON is unprogrammed...which means i should be able to override the mode in WDTCSR - is that right?
[09:11:10] <bhearsum> hm, it looks like my settings for WDTCSR aren't taking. when i print out that register in the start of loop(), it reads as 00101001 (WDP3, WDE, WDP0)
[09:11:47] <eatyourguitar> Lambda_Aurigae thanks for the link
[09:40:44] <bhearsum> turns out my problem was that i wasn't handling the interrupt, whoops!
[11:20:50] <rue_more> eatyourguitar, did anyone actually give you an answer?
[11:20:59] <rue_more> adc -> 4 bits is easy
[11:21:54] <rue_more> you can use the conversion complete interrupt to write the values to a port and put the adc into continious conversion mode
[11:22:13] <rue_more> InitADC();
[11:22:30] <rue_more> while(1) { NOP(); }
[11:22:46] <rue_more> ISR(ADC_vect) {
[11:23:21] <rue_more> PORTA = ADC & 0x0F;
[11:23:22] <rue_more> }
[11:23:48] <rue_more> I think thats just sketchy enough on the important details
[11:24:09] <rue_more> eatyourguitar, test, 1, 2, can you hear me... test test, 1, 2, 1, 2
[11:57:25] <Jartza> hmmh
[11:57:37] <Jartza> the smartest way to "reboot" attiny85 would be using watchdog?
[11:58:35] <antto> if there is a smartest way, i'd say it would have to be via "magic" ;P~
[14:19:26] <mheld> hey y'all
[14:20:07] <Jartza> hi
[17:09:14] <mheld> what's the benefit of using avr-libc + toolchain over atmel studio?
[17:12:04] <specing> mheld: what do you think Atmel has been selling you?
[17:28:15] <Casper> it would have been nice if atmel would have put 3-4 PWM channels on the tiny85
[17:40:01] <The_Coolest> yay finally another project I'm actually going to build which uses an AVR
[17:40:22] <The_Coolest> only thing that sucks is the time it will take for the PCBs to get here
[17:40:24] <Casper> The_Coolest: oh? what is it? a led flasher?
[17:40:32] <The_Coolest> nope
[17:40:35] <The_Coolest> a DAC
[17:40:45] <The_Coolest> the AVR will be there to control the volume
[17:40:51] <specing> Casper: and modulate what, GND and VCC?
[17:40:57] <specing> lol
[17:41:18] <The_Coolest> Casper http://img.techpowerup.org/140906/Capture1523.png http://img.techpowerup.org/140906/Capture1524.png
[17:41:55] <The_Coolest> specing it has 6 IOs, 3-4 PWM should be easy :P
[17:42:17] <The_Coolest> Casper have you looked at tiny88?
[17:43:24] <specing> The_Coolest: you didn't get it, did you?
[17:43:28] <Casper> The_Coolest: no, but the 45 have a pll that interessed me
[17:44:04] <The_Coolest> Casper ah i see
[17:44:16] <The_Coolest> specing yeah I noticed a wooshing sound
[17:45:36] <Casper> specing: the 45 is a dip8, with 6 gpio (5 if you keep reset alive)
[17:45:51] <Casper> so there is "plently" of io pins for more pwm
[17:48:09] <Casper> hmmm the tiny45 could be a very interressing part to replace the thermostat in my small refrigerator... the stupîd thermostat there is not great...
[17:48:22] <Casper> it have onboard temp sensor...
[17:48:30] <Casper> or I could use the adc and an ntc...
[17:49:04] <tpw_rules> i need to have two different interrupts do the same thing. both can be interrupted but they can't interrupt each other
[17:50:46] <The_Coolest> Casper dunno, I wouldn't rely on the internal sensor too much
[17:51:16] <tpw_rules> can i just check if (busy) return; at the start?
[17:52:50] <tpw_rules> alternate question: when an interrupt wakes the cpu from sleep, interrupts are disabled, correct?
[17:53:23] <tpw_rules> no they remain enabled it seems
[18:08:09] <Lambda_Aurigae> mheld, atmel studio uses the avr-gcc toolchain and avr-libc....so the benefit would be not being locked into having to use microsoft visual studio as a frontend to avr-libc toolchain.
[18:47:55] <tpw_rules> anybody have experience with the ultimate gps?
[18:48:57] <Lambda_Aurigae> I have experience with block 1 and block 2 gps satellites, does that count?
[18:49:12] <tpw_rules> nah it's something weird the output is doing
[18:49:23] <tpw_rules> it's only outputting like .8v on PPS
[18:49:45] <tpw_rules> if i enable pullups, i get like a 200mv pulser
[18:54:44] <tpw_rules> does the uart let the tx go tristate when the tx is disabled? doesn't seem that way
[18:55:11] <tpw_rules> i'm trying to do input on the tx pin and i think the uart is holding me down
[19:04:02] <Lambda_Aurigae> dunno..never bothered to test that.
[19:04:05] <Lambda_Aurigae> I suspect not.
[19:04:38] <tpw_rules> the data sheet says it does
[19:05:10] <Lambda_Aurigae> well there ya go then.
[19:05:19] <tpw_rules> yet it doesn't work
[19:06:55] <tpw_rules> what could i do that would pull a pin down?
[19:07:40] <tpw_rules> it's input and not a pullup
[19:09:08] <Lambda_Aurigae> no clue here.
[19:10:24] <Casper> tpw_rules: for your 2 interrupts....
[19:10:40] <tpw_rules> well that's not important if i can't get the interrupt source working
[19:10:57] <Casper> there is a solution, but it's uglyish
[19:11:03] <tpw_rules> i think i have it
[19:11:51] <Casper> use a global variable, interrupt call a function, the function check that variable, then reenable the interrupts (they are disabled when you get in an interrupt)
[19:11:53] <tpw_rules> but the avr seems to be pulling the pps input down
[19:12:00] <tpw_rules> yeah that's what i'm doing
[19:12:51] <tpw_rules> what about with ISR(){ in c? do those start with interrupts enabled? the way surrounding code is written, they do
[19:13:20] <Casper> I beleive that for tx you still need to set the avr DDR to output, else the uart hardware control the pullup only
[19:13:27] <tpw_rules> i want it to be an input
[19:13:43] <tpw_rules> and it's being pulled down
[19:13:54] <Casper> oh input, ddr is default to input...
[19:13:57] <tpw_rules> when in programming mode, pps is 3v. when not, it's .8
[19:14:14] <Casper> what is pps?
[19:14:20] <tpw_rules> pulse per second from my gps module
[19:15:13] <Casper> ok...
[19:15:25] * Casper is unsure of your setup...
[19:15:50] <Casper> do you want a pulldown? or mysteriouysly have a pulldown?
[19:16:03] <tpw_rules> something in my code is forcing it low but i don't know what. the bit in ddrd is 0, the bit in portd is 0, TXEN in ucsr0b is 0
[19:16:09] <tpw_rules> it is mysteriously happening
[19:16:39] <Roklobsta> is the PPS CMOS/TTL or open collector?
[19:17:23] <tpw_rules> i'm not sure to be honest. while my programmer is programming the chip, it outputs ~3v3 as expected
[19:17:54] <tpw_rules> but once the chip is running, the output drops down to 0.9v
[19:18:43] <Casper> tpw_rules: ground /reset, mesure the resistance between the pin and ground...
[19:18:50] <Casper> then pin to vcc...
[19:18:54] <Casper> well
[19:18:59] <Casper> do it with voltage...
[19:19:03] <Casper> not resistance
[19:19:06] <tpw_rules> why? the rest of the chip's progvram works
[19:19:16] <tpw_rules> oh ok
[19:19:17] <tpw_rules> i see
[19:19:17] <Casper> there is a chance of hardware damage
[19:19:44] <Casper> might want to try with a pullup and pulldown to see if you can actually "move" that pin
[19:20:16] <tpw_rules> when /reset is low the gps outputs as expectred
[19:20:36] <tpw_rules> i can move it with the internal pullup, then it becomes 200mv hump
[19:20:39] <Casper> so, basically act as if it was not internally connected?
[19:21:18] <tpw_rules> i want it to be an input
[19:21:41] <tpw_rules> i can't figure out why it is grounding the pps output a little bit when the chip isn't in reset
[19:21:41] <Casper> yes, an input act as if it wasn't connected internally
[19:22:04] <Roklobsta> what do you want to do with the pps signal?
[19:22:08] <Casper> reset force "all" pin to be input, so acting as if it was disconnected
[19:22:12] <tpw_rules> trigger an interrupt
[19:22:19] <tpw_rules> but i don't know why tx isn't being an input
[19:22:48] <tpw_rules> i never transmit any data and the transmit bit is disabled. according to the datasheet: "When disabled, the Transmitter will no longer override the TxDn port."
[19:24:44] <tpw_rules> if i program the chip with while(1) i get expected input
[19:25:48] <Casper> is your code in C and not too long? if so, pastebin?
[19:26:02] <tpw_rules> it's big
[19:26:10] <tpw_rules> i just wish to know what registers could affect the pin
[19:27:41] <Casper> DDRx PORTx, writting 1 to PINx (toggle it's output state), any peripherical on that pin (like uart)
[19:28:04] <Casper> hmmm
[19:28:28] * Casper passes finger on top right corner of his keyboard... "what's that bump" ... "oh... it's a power switch!"...
[19:35:09] <tpw_rules> oh
[19:35:13] <tpw_rules> it was my programmer
[19:36:56] <tpw_rules> wait perhaps it was not
[19:38:14] <Casper> programmers can do that too...
[19:39:13] <tpw_rules> hm, i think it was a false alarm caused by the reset when removing the programmer
[19:43:47] <tpw_rules> according to the datasheet, those are the only things
[19:43:50] <tpw_rules> i don't know why it won't work
[19:51:31] <Casper> might want to flash a test program
[20:02:43] <tpw_rules> the test program works
[20:02:56] <tpw_rules> i am now attempting to install a debugger
[20:04:40] <Casper> man one project I'm thinking about will be soooo inneficient :D
[20:04:48] <Casper> I'll use FLOAT !
[20:11:09] <Casper> ... if I can find back the formula...
[22:51:49] <tpw_rules> why do some datasheet registers have two numbers like 0x1b (0x3b)?
[22:51:54] <tpw_rules> is one read and one write or something?
[23:45:05] <Casper> has anyone tried to count how much cycle it take to do "ln" under an avr?