#avr | Logs for 2014-03-31

Back
[00:17:42] <rue_more> mmhmmm
[01:33:42] <rue_more> wow, my amazing charlieplexing shut everyone up
[01:34:01] <rue_more> I'v wow'd you all to silence
[01:35:21] <rue_more> https://www.youtube.com/watch?v=uPml5xC_I00
[01:35:26] <rue_more> charrrlieeeee
[01:35:31] <rue_more> chaaaaarlieeeee
[01:36:00] <rue_more> maybe next weekend I'll see ifI can get the solar controller working
[01:36:48] <anton02> do any reliable battery companies like duracell or energizer sell li-ion rechargeable batteries?
[01:36:54] <anton02> i checked websites cant find any
[01:38:25] <rue_more> no, I dont think they do
[01:38:40] <rue_more> but I'm not to sure they even make their own batteries anyhow
[01:38:42] <anton02> what are good battery companies besides them?
[01:39:08] <rue_more> there are none
[01:40:06] <anton02> are they good?
[01:40:14] <anton02> duracell and energizer i mean
[01:44:45] <anton02> rue_more: what makes you say that
[01:45:09] <rue_more> all batteries die
[01:45:20] <rue_more> its a conspiracy
[01:45:38] <rue_more> they just dont want to kill the industry with batteries that dont die
[01:45:49] <rue_more> gnight!
[01:55:28] <anton02> would it be a good idea to buy a rechargeable li-ion battery for my phone and use that in my RC car? i can then use my phone as a recharger
[01:56:03] <anton02> but just taking the battery out of my phone now, I see it has 3 metal contacts. i'm not sure what the 3rd would be for.
[01:57:03] <rue_bed> there is + - and sensors
[01:57:10] <rue_bed> the sensors are to make sure it dosn't explode
[01:59:01] <anton02> oh. temperature sensor?
[04:40:00] <phinxy> I got a temperature sensor (KTY81-210) wich basicly is a resistor 1k-2k depending on temperature. Do i hook this up directly between a ADC and Vcc or do i need another resistor?
[04:40:07] <phinxy> im gonna measure voltage
[04:44:11] <jacekowski> you need a voltage divider
[04:44:27] <jacekowski> but make sure that current is going to be low enough not to affect the readings
[04:52:28] <phinxy> jacekowski, so i hook up two resistors so make a divider.. and then the thermal resistor in between?
[04:52:45] <jacekowski> no, just one resitor
[04:57:42] <phinxy> jacekowski, http://www.repetier.com/w/wp-content/uploads/2012/08/schthermistor.png any idea why there is a cap and another optional resistor?
[04:58:04] <jacekowski> phinxy: calibration and filtering
[04:58:20] <phinxy> for measurements without ADC? like you charge up the cap and count how long time it takes for it to discharge?
[04:59:02] <jacekowski> that would be crazy
[04:59:11] <jacekowski> but with different circuit
[04:59:54] <anton02> what;s a really half-assed way to slightly stabilize the voltage coming from a battery? Just chuck a capacitor and indicutor in series and attach it to the positive terminal?
[05:01:57] <anton02> Are any of these easy to make? http://www.smps.us/topologies.html
[05:03:10] <jacekowski> all of them
[05:03:19] <jacekowski> all you need is just a controller chip
[05:09:29] <phinxy> what would be a reasonable resistor for a adc pin input?
[05:11:39] <phinxy> i dont get it why i need a resistor. i should be able to use Vcc as input
[05:18:08] <phinxy> admux is set to Single Ended Input for one adc pin. reference voltage is Vcc. i got a 680ohm resistor from Vcc to the ADC pin. between ADC pin and ground ive connected my thermistor
[05:33:02] <phinxy> Looks like its working :)
[05:37:26] <phinxy> im bad at math tough, could someone help me with converting my 0-255 range into Celcius?
[05:37:42] <jacekowski> easy
[05:37:57] <jacekowski> divide by a constant
[05:38:06] <jacekowski> and add/substract some value
[05:38:22] <phinxy> I got this resistor tough
[05:39:57] <jacekowski> so?
[05:40:03] <phinxy> ill figure it out. But i choosed to left align my adc so i get a 255 value instead of 10bits
[05:40:29] <phinxy> Is this how it works, or does values over 255 flow into the other bits?
[05:40:44] <jacekowski> it's always 10 bits
[05:41:19] <phinxy> then this article is lying http://www.avrfreaks.net/index.php?name=PNphpBB2&file=viewtopic&t=56429
[05:41:23] <jacekowski> but if you left align it and use higher 8 bits it will work for you
[05:41:27] <phinxy> search for ADMUX |= (1 << ADLAR);
[05:54:26] <phinxy> My thermistor was 1960 - 2040ohm range. How do i get better resolution?
[05:55:32] <phinxy> thats -50c - +150c
[06:18:57] <phinxy> "beta coefficient of the thermistor (usually 3000-4000)" my datasheet says Temperature coefficient (%/K): 0.79
[06:19:13] <phinxy> dunno how i would translate that for the code that converts resistance into temperature
[09:11:43] <rue_more> from what I'v experianced there are only 2 people in the world who understand what that code is doing
[14:42:10] <hotch> Is anyone in here using a serial bootloader, programming their AVR over serial (with avrdude)?
[14:46:33] <antto> me
[14:47:02] <antto> technically, over FTDI (usb<->serial) in my case
[14:47:39] <hotch> That is what I am looking for … it would be nice to just plug in serial only. Can I ask which bootloader you are using antto
[14:48:21] <LoRez> serial only? no power?
[14:48:53] <hotch> Well, with my ftdi, I have 3.3v and GND of course …
[14:49:02] <hotch> I didn’t mean it so …. literally LoRez :P
[14:49:26] <antto> hotch it's a modification of stk500v2
[14:49:38] <LoRez> how else was one supposed to take that?
[14:50:10] <hotch> anyway. antto link possibly?
[14:50:47] <antto> http://antonsavov.net/cms/projects/x0xb0x-cpumod.html#x0xb00t2.1
[14:58:20] <bss36504> Does Atmel release verilog behavioral models of their chips or portions thereof? Id love an EBI behavioral model.
[14:58:38] <hotch> Thx antto
[14:59:33] <antto> hotch what do you need specifically?
[14:59:57] <antto> ..cuz that bootloader is modified to suit the given device..
[15:00:08] <antto> it won't quite work on anything else
[15:00:13] <cider101_> hi all...i need some help to shrink my programm size
[15:01:06] <hotch> antto: I’d like to be able to flat my atmega168 with a bootloader that let’s me self program over ftdi ...
[15:01:18] <cider101_> basacly i'm looking for a way to identify my "hotspots" - meaning which source-code part produce the biggest code
[15:01:38] <antto> hotch how much flash does it have? 16kB?
[15:01:43] <bss36504> cider101_: Remove string literals/store them in flash
[15:01:48] <hotch> yes antto
[15:02:14] <cider101_> is there an easy way to identify those parts ? i tried using obj-dump
[15:02:14] <antto> then that's not a good choice.. if you didn't notice - it's about 4kB already
[15:02:33] <hotch> yeah :/
[15:02:52] <cider101_> bss356504: all my strings are in the flash - flash is right now the problem - not the RAM
[15:02:55] <antto> you could try a bare stk500v2 or so, and then remove unneeded features till you get it down in size
[15:03:06] <bss36504> cider101_: I believe that is the way to see what you want to see.
[15:03:26] <bss36504> cider101_: What chop are you using?
[15:03:36] <bss36504> is it possible to go to a bigger brother of it?
[15:03:59] <cider101_> bss: you are refering to obj-dump ? chop ?
[15:04:07] <cider101_> whats chop ?
[15:04:16] <antto> maybe he meant chip
[15:04:18] <hotch> antto: yeah, looking now
[15:04:20] <bss36504> oh, mu bad, chip*
[15:04:23] <bss36504> my*
[15:04:29] <bss36504> I should just stop :P
[15:04:31] <cider101_> lol - sorry ;)
[15:04:50] <cider101_> thoughjt that was kind of slang ;)
[15:05:33] <cider101_> would be possible...but to be honest - i'm a newbie on embedded stuff
[15:06:02] <cider101_> what i need, is to get a feeling what code results in what size...
[15:06:14] <bss36504> cider101_: That is impossible
[15:06:37] <bss36504> since gcc is an optimizing compiler, things compress or expand rather unexpectedly
[15:06:50] <bss36504> it might recycle opcodes that you could never anticipate
[15:06:55] <cider101_> used oby-dump with disassembly - but i would have to count lines ...
[15:07:03] <bss36504> Are you using -Os?
[15:07:26] <cider101_> yes -Os, functions-sections, data-sections
[15:08:06] <cider101_> problem is, that my actual code is just a couple of lines (say 500) but i'm out of flash (328p)
[15:08:08] <bss36504> is there anywhere (or a lot of places) that you are using ints when you could use chars? Do you have massive structs that you could use -fpack-structs?
[15:08:28] <bss36504> I dont see how that is even possible unless you have a ton of strings or something.
[15:08:34] <bss36504> 500 is nothing
[15:08:47] <bss36504> (unless you dont put returns after semicolons :P )
[15:08:57] <cider101_> data-types (int etc) are/should fit
[15:09:14] <cider101_> not using pack-stucts
[15:09:36] <cider101_> well, probalby 90% of my code is within libs ;)
[15:10:02] <bss36504> Ohhhhh. different story
[15:10:12] <cider101_> lot of templates, using STL,
[15:10:24] <twnqx> surpeise it's getting big... not.
[15:10:25] <bss36504> Oh well step 1) stop using C++
[15:10:46] <cider101_> i take option b) ;)
[15:11:50] <cider101_> lol..thats why i said, i would like to analyze to code...seeing what code is generated - where are the hotspots etc...
[15:13:28] <bss36504> cider101_: What you are asking for is essentially impossible to say. The way the code breaks down from C++ to byte code may as well be magic. I’m pretty sure you’re only tool here is Obj-dump.
[15:13:31] <cider101_> is there some tools which list the "method" lenght from the disassembly ?
[15:13:55] <bss36504> like where the return instruction is from where it started?
[15:14:06] <bss36504> I bet you could write a script to tell you that stuff.
[15:14:29] <cider101_> well - i don't even realy understand that disasembly ;)
[15:14:47] <hotch> You could also just stop using some many libs? I use C++ also, long background as a programmer professionally - I found writing larger projects in C to be sloppy.
[15:14:50] <bss36504> oh well then that could be an issue
[15:15:48] <hotch> What libraries are you using cider101_ and what is the target mcu?
[15:16:13] <bss36504> My opinion is that you should not be using C++ as heavily on small systems simply because the higher-abstracted languages tend to inspire you to be less than careful with memory. If you are using libs, then it’s probably that the libs are not coded for maximal memory efficiency.
[15:16:36] <cider101_> well - what i mean is - i see that if i use route A it produces that many bytes/instructions in the disasembly and if i use route B that many...
[15:17:20] <bss36504> Like I said, I’m pretty sure you cant do that since there is not one linear relationship between the C/C++ and the opcodes.
[15:17:41] <cider101_> hotch: a little arduino (serial, digitalRead/Write), SGI-STL prorted for embedded...and a lot of own abstractions
[15:18:20] <bss36504> cider101_: Literally, a function used once might be inlined, maybe not. If you use it 3 times, it might be a jmp and a return, or the compiler might STILL decide to inline it.
[15:18:57] <bss36504> iif you want 1:1, turn of optimizing and inspect the disassembly.
[15:19:22] <cider101_> bss: thats what i "figured" out so far - i tend to decalre obnly once used libs as inline
[15:19:48] <bss36504> haha but even the inline compiler “directive” is basically a suggestion.
[15:20:17] <cider101_> i also reverted some of my templated code to more traditional code - the effects where 200 saved bytes - i was hoping for 1k or more ;)
[15:20:18] <bss36504> you could use the always Inline compiler directive that will force it, but thats a different story
[15:20:53] <cider101_> i know - with -Os the compiler checks what will produce bigger code
[15:21:21] <cider101_> if the functioncall is smaller, it will not be inlined...
[15:22:22] <bss36504> right, but unless you are a compiler, you wouldnt know that up front.
[15:22:53] <bss36504> if you’re willing, posting code/obj-dump/disassembly would be helpful
[15:23:52] <cider101_> yes, but funny thing was - just an hour ago - i started to declare some methods as inline (which wherent before) and it resulted in smaller code -
[15:23:56] <twnqx> libs won't be inlined anyway, cross-object inlining does not exist yet (obviously, if you put the code in the header and #include it... but please for sanity don't do that)
[15:25:00] <cider101_> i'll post my dissamlby in a cpouplde of minutes...where's the best place to do that ?
[15:25:31] <bss36504> pastebin
[15:25:34] <cider101_> so somethimes you have to give the complier a little hint ;)
[15:25:41] <megal0maniac_afk> cider101_: Right here is good
[15:25:56] <megal0maniac_afk> Under 1000 lines and nobody will mind :)
[15:26:02] <bss36504> megal0maniac_afk: NO! I dont want to read dissassebly in my client :O
[15:26:17] <megal0maniac_afk> bss36504: But why ever not? :P
[15:26:19] <bss36504> cider101_: nah, wherever is fine
[15:26:27] <bss36504> but pastebin is a local favorite
[15:26:42] <bss36504> the indiginous people of #avr like it
[15:29:43] <cider101_> any syntax coloring is should choose on pastebin ?
[15:32:45] <cider101_> grrr...size exceeded
[15:36:40] <cider101_> here is the first half http://pastebin.com/g2wtVFy9
[15:38:03] <cider101_> and here is part2 http://pastebin.com/2E1BhB60
[15:40:06] <cider101_> btw: it's the debug mode - therefore there are a hell of a lot of string literals
[15:40:34] <cider101_> which should not be present in the release mode
[15:52:47] <cider101_> bss36504: you still there ?
[16:01:39] <bss36504> sorry, I’m back.
[16:02:17] <hotch> Hey Tom_itx are you around?
[16:03:20] <cider101_> bss: no problem...
[16:06:13] <bss36504> cider101_: you mentioned you posted the debug mode. Any changes if you a) disable your strings, and b) compile for release.
[16:08:16] <cider101_> bss: sorry - i wan't very consise - debug means, my logger outputs a lot of strings. In Release - the logger expands to someting like if(0) Serial.print("myString"). compilerflags are the same.
[16:09:01] <bss36504> if(0) will still suck up code most likely. you should really use preprocessor directives #if DEBUG etc.
[16:09:16] <cider101_> size shrinks about 1-2k if in "release" mode (logging just errors) which matches my "feeling" about the amount of used strings
[16:10:43] <bss36504> cider101_: Here is the macro I use for serial debugging. I have a singe #define called DEBUG which I use to define this as it is, or just define it as empy space. here ya go: #define DBG_SERIAL1(msg) static const char CONCAT(_anon,__LINE__)[] PROGMEM = msg; for(int i=0;i<sizeof((CONCAT(_anon,__LINE__)));i++){buffer[i]=pgm_read_byte(&((CONCAT(_anon,__LINE__))[i]));} Serial.print(buffer);
[16:11:00] <cider101_> if(0) should be optimzed away because of unreachable code - i did check that earlier - but can do that again
[16:11:20] <bss36504> you will also need these: #define _CONCAT_(x,y) x ## y
[16:11:20] <bss36504> #define CONCAT(x,y) _CONCAT_(x,y)
[16:11:53] <bss36504> Sorry, IRC broke that message: #define _CONCAT_(x,y) x ## y
[16:11:54] <bss36504> #define CONCAT(x,y) _CONCAT_(x,y) Also, you know what they say about assuming… :P
[16:12:17] <cider101_> i know ;) just checking my pants ;)
[16:14:37] <bss36504> and can we all just look at that DBG_SERIAL macro? /me pats himself on the back
[16:14:50] <bss36504> I hate IRC sometimes.
[16:15:19] <cider101_> lol...
[16:15:55] <cider101_> just building the release - takes a minute
[16:17:51] <cider101_> yup...none of the log strings found anymore....
[16:19:02] <cider101_> so, logging seems not to be the source of code-bloat
[16:22:29] <cider101_> most of the stuff between line 130 and 630 is not present in the release build anymore
[16:24:56] <bss36504> hmm alright. I mean, it might not be bloat so much as it’s just how big the code is. You may have no choice other than to start stripping things out.
[16:29:29] <cider101_> do you programm in c oder c++ ?
[16:30:17] <bss36504> C mostly, but I know C++. Took a class last semester. I dont really like it as a language. If I’m on a micro, I’d probably use C. If I’m on a computer, I’d probably use Java.
[16:31:46] <cider101_> ok - i see...I never leally used C - mostly c++ and java
[16:33:48] <bss36504> I always thought it was weird that people learn an OOP language before learning an imperative language. I learned C first, and I think It would have made Java and C++ harder had I not.
[16:35:15] <cider101_> well, c++ and java are just c on stereiods ;) c++ was the first langguage i learned and i still look at it as my mother tongue ;)
[16:38:22] <cider101_> need to get some sleep - thanks for your help, bss36504!
[16:38:40] <bss36504> no problem, good luck with the issues
[17:20:21] <learath> ... java is not "c on steroids"
[17:20:33] <learath> unless you mean the "bleeding all over everything" kind
[17:35:16] <Casper> java is the worse language ever
[17:35:25] <Casper> and WAY overrated
[17:35:52] <Casper> it make me laught every time people talk about it...
[17:36:19] <Casper> one claimed that java was faster than well optimised ASM...
[17:36:26] <hotch> the WORST!
[17:36:47] <Casper> another one claimed it create smaller than ASM binary
[17:37:07] <hotch> The build environment too also the worst. Eclipse & it’s IDE are just awful.
[17:37:22] <Shavik> Does anyone know of a concise feature list / differences between the most common AVR chips? like the tiny85, 2313, 328, etc
[17:37:32] <Casper> another said that it used memory in a more efficient way than ASM because it support bit variables
[17:37:43] <Casper> Shavik: atmel parametric table
[17:37:57] <hotch> Speaking of IDEs: I know that AVRs have been around forever, but Arduino and DIY etc etc made it more popular to the general programmers … no chance of AVR Studio ever being on mac huh?
[17:38:09] <Shavik> oh wow
[17:38:10] <Shavik> cool
[17:38:34] <Casper> why would you want that POS on mac?
[17:39:48] <Shavik> Can you not show more per page?
[17:40:00] <hotch> As I’ve been learning, I see some instructionals making references to settings on avr studio or winavr etc and I don’t see a direct translation for a flag in a makefile. Casper
[17:40:34] <hotch> Yeah it definitely looks like a piece of shit, but one example is getting into programming over UART and setting up a bootloader, all references via that POS :)
[17:41:11] <Casper> normally, the only setting you care is the fuses and the optimisation level, the rest is normally fine by default
[17:43:04] <hotch> That’s right … “normally".
[18:11:34] <phinxy> Was gonna check my micro for stability this morning the power supply (phone charger) output 7,4V and climbing. its rated 5V. What happend?
[18:11:58] <phinxy> It could be my voltmeter too. since battery is starting to get bad but i doubt it
[18:13:13] <phinxy> 7,65V now..
[18:13:37] <phinxy> i hope i didnt blew my micro. 5.5 V instead of 4,5.
[18:18:39] <Casper> replace the batt first
[18:19:14] <Casper> mine do that when the low batt turn on<
[18:39:45] <learath> was it unplugged?
[18:39:50] <learath> (the power supply)
[18:41:32] <Lambda_Aurigae> Casper, your java .jar file can easily be smaller than a standalone assembly program....that doesn't take into account the size of the java bytecode interpreter, but,,,,
[18:43:38] <Casper> special case maybe
[18:43:49] <Casper> but again, hightly doubt so
[18:44:00] <learath> Lambda_Aurigae: that would be one *weird* java program...
[18:44:01] <Casper> have you seen those 64k bytes 3d demo made in assembly?
[18:44:02] <Lambda_Aurigae> the java jar "program" can be smaller but it's useless without the bloated bytecode interpreter.
[18:44:11] <learath> "program efficiency" is not something java is known for.
[18:44:32] <phinxy> learath, yeah but it seems like it was the voltmeter
[18:44:37] <Lambda_Aurigae> of course not...java was meant for rapid development, not development of rapid programs..
[18:44:49] <learath> phinxy: fixing the battery fixed it?
[18:45:04] <learath> Lambda_Aurigae: hah yes, it's critically important that we produce more bad programs
[18:45:13] <learath> I mean, *someone* has to compete with Microsoft!
[18:45:16] <phinxy> i dont have any 9V battery but i measured the USB and its the same problem there
[18:45:42] <Casper> phinxy: the way your multimeter work is by comparing it's reading with a reference voltage
[18:45:49] <Lambda_Aurigae> Casper, I remember a bootable program that fit on a 5.25 inch floppy back in the day that was a 3D game...no dos, no nothing but the game.
[18:45:54] <Casper> if your battery is low then the reference is too low
[18:46:01] <Lambda_Aurigae> but, yeah, I've seen the little assembly 3D apps and such.
[18:46:12] <Casper> so the "1 unit" is smaller... so it think there is more unit on the input
[18:46:44] <Casper> Lambda_Aurigae: have you seen The.product (fr-08) ?
[18:46:57] <Lambda_Aurigae> not that I know of.
[18:47:08] <Casper> http://www.theproduct.de/
[18:47:47] <Lambda_Aurigae> kinda reminds me of stuff that was being done on the amiga way back when.
[18:47:52] <Casper> it'S funny, a 63.5kB .exe file with a loader :D
[18:48:45] <Lambda_Aurigae> unfortunately I can't actually run those as I don't have windows active anywhere.
[18:49:00] <Lambda_Aurigae> but, yeah, people CAN write nice tight code when they want to.
[18:49:16] <Lambda_Aurigae> but modern programming languages have made programmers lazy.
[18:49:36] <Lambda_Aurigae> I got my assembly programming start on a commodore vic-20 and the 6502 processor.
[18:50:06] <Casper> yeah...
[18:50:21] <Casper> game in visual basic? why not! . . .
[18:50:24] <Lambda_Aurigae> man, I wish atmel had some higher performance chips in a dip package...
[18:50:35] <Lambda_Aurigae> visual basic hell....javascript!
[18:50:45] <Casper> Lambda_Aurigae: get a smd to thru-hole adapter
[18:50:56] <Lambda_Aurigae> extra cost and pain in the fingers.
[18:51:42] <Casper> our web site at our store is written in asp vb....
[18:51:48] <Casper> with spaggeti code
[18:51:56] <Casper> zero comment
[18:52:05] <Lambda_Aurigae> just found a 70 mips dspic with 48K of sram and 512K of flash in a 28pin dip package...complete with CAN, a quadrature encoder interface, motor control pwm, and 7.14ns pwm resolution.
[18:52:14] <Lambda_Aurigae> in a 16bit architecture.
[18:55:43] <Lambda_Aurigae> I want that in an AVR dangit!
[18:56:24] * Casper wants a 500W white led with exterior enclosure and dimmable and all, for less than 10$ :D
[18:58:17] <hotch> Is the guy that writes this blog: http://gizmosnack.blogspot.com/ in the channel? If you are sir, great work, love the writing on the nRF24L01+!
[18:59:46] <Casper> doubt so
[19:04:02] <hotch> Anyone ever watch that show “Continuum”? There was an episode today where they pulled a microchip supposedly of futuristic technology out of a dudes body and a cop asks to get it analyzed. It looked like an 8 dip attiny :)
[19:10:58] <learath> well maybe it's an attiny from 2300, and can calculate pi to the last digit in .00001 second :P
[19:17:22] <learath> Any usb gurus about?
[19:26:33] <hotch> hehe
[20:13:04] <Phantom> "Let's hack this atx psu!" *open it up* "WTH is that? is that a custom IC? and that one? another custom??? grrrr"
[20:22:26] <Tom_itx> Phantom, http://www.wikihow.com/Convert-a-Computer-ATX-Power-Supply-to-a-Lab-Power-Supply
[20:22:36] <Tom_itx> http://schmidt-walter.eit.h-da.de/smps_e/smps_e.html#sinn
[20:22:46] <Casper> not that kind of hack
[20:23:02] <Casper> changing the voltage and add current limiting
[20:23:14] <Casper> bbl
[20:26:20] <Casper> DIP20 "3528"... so weird