#avr | Logs for 2014-10-11

Back
[04:43:51] <Fleck> hey, is there a faster way to get 1/4 of a integer?
[04:43:58] <Fleck> like - some kind of binary operation
[04:44:27] <Fleck> that is faster than division by 4
[04:57:55] <Jartza> Fleck: depends of the compiler and cpu and stuff, but you can try (x >> 2)
[04:58:28] <Jartza> where x is the number you want the 1/4 from
[05:00:20] <Jartza> Fleck: but for that you should use unsigned int :)
[05:01:33] <Jartza> as you will not get the result you want if the number is negative :P
[05:07:50] <pacopad> Hi All i got a question , i compiled a soft and sended it to my atmel 2560
[05:07:57] <pacopad> just after my computer crashed
[05:08:26] <pacopad> i could nt save source modifications
[05:08:48] <pacopad> is there a way to retreive modifications with eeprom dump ?
[05:10:35] <twnqx> eeproms don't contain code, so no
[05:12:31] <pacopad> ok thank you, i’ll try to remember what i done : )
[07:03:13] <Fleck> Jartza: right, how about /12 ?
[07:11:37] <kastein> Fleck: that works for /4 because it is a power of two
[07:12:04] <Fleck> I know
[07:12:10] <Fleck> that's why I ask about /12 :)
[07:12:28] <Fleck> maybe some weird bin magic is possible also for /12 :)
[07:12:36] <kastein> the best multiply by 3 trick i know is for x86, using the LEA instruction, but i dont know avr assembly enough to tell you an analogue
[07:14:27] <Fleck> and how do I tell, how much cycles will /12 use ?
[07:15:55] <kastein> check the manual? i am honestly not sure
[07:16:06] <kastein> have been sticking to c so far unless i need to, lol
[07:17:58] <Fleck> well I can do some benchmarks I guess but... hmm
[07:18:37] <Fleck> I don't even see division instruction :D so I guess C does it for me with loop or smthn
[07:19:52] <kastein> yeah, noticing that now
[08:22:58] <Jartza> Fleck: well, check what kind of asm it generates
[08:23:09] <Fleck> sure
[09:44:07] <Earlo> Hello. I am using AVR isp, and trying to program ATMega32 from Ubuntu. I got my code ready, how do i compille it on device?
[09:52:19] <Fleck> Earlo: you don't compile it on device
[09:52:25] <Fleck> you compile it on PC/ubuntu
[09:52:34] <Fleck> then just upload .hex usually
[09:53:56] <Earlo> ah, yeah
[09:54:04] <Earlo> I got make file, and .hex there
[09:54:19] <Fleck> avrdude is the tool I use
[09:55:13] <Earlo> ah, thanks. I will look on how to use it.
[10:21:45] <Tom_itx> Earlo, http://tom-itx.no-ip.biz:81/~webpage/how_to/atmega168/using_avrdude_index.php
[10:22:08] <Tom_itx> will be slightly different on Ubuntu but not much
[10:22:22] <Earlo> thanks Tom_itx.
[11:09:56] <ecilop> My Atmega16 (DIP40) eats 60mA...
[11:10:09] <ecilop> Erased, int RC at 1MHz
[11:10:29] <Tom_itx> too much unless you have alot of load on the pins
[11:10:37] <Tom_itx> ie: 200 leds
[11:11:22] <ecilop> no loads..
[11:11:31] <ecilop> chip is alone
[11:11:44] <ecilop> it's not onboard
[11:11:56] <ecilop> It's broken?
[11:12:05] <ecilop> *Is it broken?
[11:12:26] <Lambda_Aurigae> 60mA you say?
[11:12:29] <Tom_itx> it isn't very happy
[11:12:35] <Lambda_Aurigae> is that measured before or after the regulator?
[11:12:47] <Tom_itx> unless you have something wired wrong and are shorting
[11:13:11] <ecilop> http://www.aktakom.ru/kio/index.php?ELEMENT_ID=7041 - my power source
[11:13:13] <Tom_itx> all GND are to GND
[11:13:19] <Tom_itx> all VCC are to VCC
[11:13:53] <ecilop> Tom_itx: chip is not onboard now
[11:14:07] <ecilop> But it eats..
[11:14:22] <Tom_itx> the board or the chip?
[11:14:29] <ecilop> chip is alone
[11:14:53] <Tom_itx> how are you powering it if it's not on a board?
[11:15:04] <ecilop> wires
[11:15:14] <Tom_itx> all GND are to GND
[11:15:17] <Tom_itx> all VCC are to VCC
[11:15:19] <Tom_itx> ?
[11:15:52] <Tom_itx> not just one pin each in most cases
[11:16:27] <ecilop> Pinout shows 1 Vcc abd 2 GNDs.. 1 GND connected only
[11:16:36] <Tom_itx> connect both
[11:16:44] <Tom_itx> that's just the way it is.
[11:17:02] <Lambda_Aurigae> also connect avcc to vcc even if you aren't using the ADC.
[11:17:16] <ecilop> I don't think so. But I'll try
[11:17:26] <Tom_itx> maybe too late
[11:17:33] <Lambda_Aurigae> AVCC is the supply voltage pin for Port A and the A/D Converter. It should be externally con-
[11:17:33] <Lambda_Aurigae> nected to V
[11:17:34] <Lambda_Aurigae> CC
[11:17:34] <Lambda_Aurigae> , even if the ADC is not used. If the ADC is used, it should be connected to V
[11:17:34] <Lambda_Aurigae> CC
[11:17:34] <Lambda_Aurigae> through a low-pass filter.
[11:17:38] <Lambda_Aurigae> that right from the datasheet.
[11:18:27] <Lambda_Aurigae> and always have both GND pins connected to GND.
[11:18:57] <Tom_itx> some have multiple GND and VCC pins
[11:19:02] <Tom_itx> they must all be connected
[11:19:15] <Lambda_Aurigae> reset should be pulled high with a 10K to 100K ohm resistor.
[11:21:44] <twnqx> unless the chip has a pullup internally.
[11:22:05] <Lambda_Aurigae> also, to reduce current consumption, all i/o pins set as input should be connected either high or low...to Vcc or GND, through a pullup/pulldown resistor.
[11:22:12] <Tom_itx> never trust internal pullups!
[11:22:23] <Lambda_Aurigae> floating pins will cause more current consumption.
[11:23:03] <Lambda_Aurigae> a clean erased chip will not turn on the internal pullups anyhow...those get turned off at reset and have to be turned on in code.
[11:23:46] <Lambda_Aurigae> so, yeah, a plain base atmega16 with no code, set to factory defaults, might pull quite a bit of current.
[11:24:19] <Tom_itx> not normally...
[11:24:35] <Lambda_Aurigae> I would say 60mA is a bit excessive though.
[11:24:53] <Lambda_Aurigae> 20mA wouldn't be unusual I don't think if you dont do anything with the input pins.
[11:26:20] <ecilop> 60mA
[11:26:31] <ecilop> GND to GND. AVcc to Vcc
[11:26:47] <ecilop> Is chip broken?
[11:26:50] <Lambda_Aurigae> dunno what to tell you....
[11:27:23] <ecilop> It works placed onboard. But makes some warm
[11:27:32] <ecilop> Internal RC at 8MHz
[11:28:01] <ecilop> It ates 200mA onboard :(
[11:28:28] <Tom_itx> no good
[11:28:38] <Lambda_Aurigae> try another.
[11:28:45] <Lambda_Aurigae> make sure you get the GND
[11:28:46] <Lambda_Aurigae> s
[11:28:54] <Lambda_Aurigae> and the VCC and AVCC hooked up first time.
[11:29:09] <ecilop> Another is not in DIP package :) I must remake schem
[11:30:00] <Lambda_Aurigae> for those who might care,,and those who don't,,netflix on ubuntu works well..just use chrome and nothing to install additionally.
[11:30:09] <ecilop> On output pin is 3.6Volts nearly, not 5
[11:30:54] <ecilop> Something broken in this chip :-|
[11:31:05] <ecilop> rats :(
[11:31:45] <Tom_itx> never order just one of anything unless it's a house or a car
[11:31:55] <Tom_itx> (or bride)
[11:32:05] <Lambda_Aurigae> even then, a spare is always good.
[11:32:15] <Tom_itx> good point on the latter :D
[11:32:16] <Lambda_Aurigae> in case one burns, breaks down, or runs away.
[11:33:40] <ecilop> This chip I used for test often. Today it died.
[11:34:08] <ecilop> It works with warm and low output voltage
[11:34:23] <ecilop> CPU is not dead :)
[11:41:45] <Lambda_Aurigae> I would test all the i/o pins to make sure none of those is dead.
[11:49:27] <ecilop> All i/o pins works bad. Low output voltage, not 5V
[11:50:00] <Tom_itx> chip is dead
[11:50:25] <ecilop> Thanks for council. Bye
[11:50:35] <Tom_itx> you did ask
[12:04:52] <samktri1> hello! i am using usbtinyisp to program attiny85 and am getting the following error: "avrdude: verification error, first mismatch at byte 0x0140 0xbf != 0x65 avrdude: verification error; content mismatch". these mismatch values keep on changing for different programs and also change if I change some content of the same code. what could be the issue ?
[12:09:18] <LeoNerd> Sounds like it's not properly writing the flash consistently.. What voltage? I find my usbasp doesn't work properly at 3.3V, I have to use the full 5V
[12:11:10] <samktri1> well, i am using the sparkfun programmer, so, i guess it will be using 5V ? not sure but guessing...
[12:12:31] <Lambda_Aurigae> don't guess
[12:12:35] <Lambda_Aurigae> measure
[12:13:10] <Lambda_Aurigae> usbtinyisp is based on vusb which is not exactly production quality.
[12:13:47] <Lambda_Aurigae> what frequency is the attiny85 running? what voltage is it running when programming?
[12:14:53] <samktri1> 8 MHz. i actually don't have a meter right now, but since its on usb, it should be using 5v right ?
[12:15:04] <Lambda_Aurigae> nope.
[12:15:24] <samktri1> besides, it was working fine a few days back. now it can program sometimes and sometimes it throws this error...
[12:15:51] <Lambda_Aurigae> you can get 5V from the usb port, yes, but doesn't mean the programmer is running at that voltage.
[12:16:47] <samktri1> hmm but what about ^^ ?
[12:16:58] <Lambda_Aurigae> what is ^^??
[12:17:24] <samktri1> oops, i meant my previous comment, it was working fine before, so could that be a voltage issue ?
[12:17:41] <Lambda_Aurigae> the same attiny85?
[12:17:52] <xrlk> i got my LEDs today, still waiting on the programmer
[12:18:14] <samktri1> not exactly the same one, but i tried 3-4 of them on this one now
[12:18:23] <Lambda_Aurigae> same computer?
[12:18:26] <samktri1> yup
[12:18:41] <Lambda_Aurigae> sounds like your programmer is faulty then.
[12:19:08] <samktri1> hmm ok
[12:19:21] <Lambda_Aurigae> without any more information, that's all I got.
[12:19:53] <samktri1> ok
[12:20:30] <Lambda_Aurigae> as I've said in the past,,,vusb based avr programmers cause more problems than any other programmer out there.
[12:21:09] <samktri1> ok, so is programming using an arduino better ?
[12:21:17] <samktri1> i'll try that then...
[12:21:23] <Lambda_Aurigae> no clue. I've never touched an arduino.
[12:21:53] <samktri1> ok. so what method for programming would you suggest ?
[12:22:05] <Lambda_Aurigae> I have 2 programmers here that have never failed me.
[12:22:24] <Lambda_Aurigae> an stk200 clone that hooks to the parallel port and one I bought from Tom_itx a couple years back.
[12:22:49] <samktri1> okay
[12:22:51] <Lambda_Aurigae> the one from Tom_itx has a USBAVR and is lufa based.
[12:23:13] <Lambda_Aurigae> my stk200 clone is my primary one and has been working for me for,,,10 years now.
[12:23:14] <samktri1> let me try my luck some more times with this programmer, else i'll have to make a move to something else...
[12:33:47] * Tom_itx has a good something else in mind
[12:34:54] <Tom_itx> just finished up a fresh batch of blue ones :D
[13:07:38] <twnqx> LeoNerd: are you leo0nerd on youtube?
[13:39:21] <LeoNerd> twnqx: nope
[13:39:41] <twnqx> too bad
[19:00:27] <xrlk> https://tools.usps.com/go/TrackConfirmAction.action?tRef=fullpage&tLc=1&tLabels=LZ134046185US https://tools.usps.com/go/TrackConfirmAction.action?tRef=fullpage&tLc=1&text28777=&tLabels=LN163615935US USPS makes me so salty
[19:07:39] <timemage> xrlk, salty?
[19:08:16] <xrlk> salty tears
[19:11:42] <Lambda_Aurigae> well, that makes it clear as mud.
[19:11:50] <Lambda_Aurigae> tears of happiness, tears of sorrow?
[19:13:34] <timemage> so, it's not just me.
[19:14:30] <Tom_itx> he's just a big cry baby
[19:15:51] <Lambda_Aurigae> timemage, it is just you...all your fault somehow I'm certain.
[19:16:18] * timemage hangs his head.. sniffles.
[19:16:38] <Lambda_Aurigae> don't get snot on your keyboard.
[19:16:54] <timemage> you're mean.
[19:17:01] <Lambda_Aurigae> thank you.
[20:40:11] <[w_w]> I see CALL id PC<-k and RET is PC<-STACK... so in order to call a routine i would push the return address followed by arguments. the routine would then consume the arguments do some work and be left with the return address on the stack just before returning.
[20:41:18] <[w_w]> So to return something i would first pop the return address off the stack, then push the return vals and then push the address back on just before returning?
[20:44:18] <Lambda_Aurigae> long as the last thing on the stack is the return address.