#avr | Logs for 2012-08-05

Back
[00:00:26] <Kevin`> PlastyGrove: I meant that you need asm on the ones without ram
[00:00:35] <Kevin`> PlastyGrove: but most of the attiny range has reasonable resources
[00:01:59] <PlastyGrove> ah okay - I guess I'm pretty safe with C in that case, I plan to stick with the atmega328 at least until I get the hang of it
[03:07:54] <specing> PlastyGrove: GCC generates horrible code
[03:08:07] <specing> A bunch of 32-bit LDS/STS
[03:08:25] <specing> and unneded andi and push/pop
[03:14:03] <PlastyGrove> specing: But much easier than asm right? And still better than the Arduino IDE
[03:14:21] <PlastyGrove> in terms of size of hex file etc
[03:16:01] <specing> I'd say gcc is about 1/4 of the way from arduino to asm
[03:16:29] <specing> PlastyGrove: Have you ever worked with HD44780-style (character) LCDs?
[03:17:19] <PlastyGrove> really? doesn't seem like that seeing how much effort I'm putting in the C o_O
[03:17:30] <PlastyGrove> No I havne't
[03:18:15] <PlastyGrove> what about them?
[03:19:43] <specing> Pfleaury's C library for them is about 344 bytes
[03:20:14] <specing> my barebones one (with GCC inline assembly) is 66 bytes
[03:20:38] <PlastyGrove> 66 bytes!!!
[03:20:56] <PlastyGrove> my blinky takes ~260 bytes!
[03:21:03] <specing> indeed.
[03:22:03] <specing> my blinky takes 8 bytes ;P
[03:22:27] <PlastyGrove> dam
[03:22:32] <specing> that is without the crt0
[03:22:42] <PlastyGrove> but again, I've got about 32K with the atmega328 - I don't see hitting the ceiling on that anytime soon
[03:23:06] <specing> GCC's init blob is around 100 bytes
[03:23:20] <specing> It does horrible, unnedeed things
[03:23:41] <specing> like it initializes the STACK PTR when the chip already does that for you at startup
[03:24:05] <PlastyGrove> maybe some chips don't?
[03:24:15] <specing> PlastyGrove: You may have 32K flash but you aren't running it at 100MHz
[03:24:24] <specing> PlastyGrove: indeed some dont
[03:24:41] <PlastyGrove> i suppose gcc is more about making it standard across all chips, hence some give and take
[03:24:48] <specing> #ifdef HAVE_CHIP_INIT_STACK
[03:24:58] <specing> would be appropriate here-.-
[03:25:18] <PlastyGrove> hmm, I see your point
[03:25:30] <specing> nop. the crt code hasn't been touched in like 10 years
[03:25:42] <specing> atleast.
[03:26:51] <specing> ALso you may notice that each chip has its own crt<chipnum>.o
[03:26:51] <PlastyGrove> let me ask you something directly -
[03:27:21] <PlastyGrove> it took me 3 days to get i2c working using C, how long will it take me to get the same thing working under asm
[03:27:38] <specing> PlastyGrove: Dont do that ;P
[03:28:00] <specing> I code the prototype in C and then I optimize it with inline assembly ;P
[03:28:09] <PlastyGrove> woah
[03:28:19] <specing> By inline I mean
[03:28:33] <PlastyGrove> how do you do that? wouldn't gcc generate the fluff for you already?
[03:28:44] <specing> asm volatile ("inst. data,data\n\t" :::);
[03:29:54] <specing> I don't like coding in pure assembly like OndraSter for example
[03:30:19] <specing> because your assembly code regains flexibility of C if you put it inline
[03:30:40] <PlastyGrove> and this is possible in atmel studo? could you give me a complete code example? I'm not sure I follow completely
[03:30:53] <specing> You can have conditional instantiation (macros, #if)
[03:31:24] <specing> And the most importantly, you don't have to decide what register to use or where the data you are operating on came from
[03:31:30] <specing> GCC handles that for you
[03:32:40] <specing> http://www.cs.mun.ca/~paul/cs4723/material/atmel/avr-libc-user-manual-1.6.5/inline_asm.html
[03:35:01] <PlastyGrove> like reading latin
[03:35:17] <PlastyGrove> i've done a bit of x86 asm, this looks like a whole new language :P
[03:35:44] <specing> ugh x86 ...
[03:35:57] <specing> most horrible assembly I've ever seen in my life
[03:36:35] <PlastyGrove> well, since that's the only asm I've ever done, I don't have much to compare it against :)
[03:37:47] <specing> avr asm is *very* simple
[03:37:57] <specing> the only simpler would be the PIC one
[03:38:06] <specing> but that one is just horrible due to banking
[03:39:21] <PlastyGrove> looks similar - mov to register, call instruction, read register
[03:39:35] <PlastyGrove> avr and x86 i mean
[03:40:04] <PlastyGrove> just going through avrbeginners
[03:41:22] <specing> except the only thing you would be doing in inline asm is the call instruction part
[03:41:36] <specing> GCC would handle the registers
[03:42:07] <specing> you just do the heavy lifting in asm and let gcc take care of the rest
[07:26:51] <OndraSter> I have dumped the 16Kbit EPROM... no strings inside :(
[07:26:52] <OndraSter> bummer
[07:27:16] <PlastyGrove> specing: Apologies, power cut earlier, got cut off
[07:32:10] <PlastyGrove> I'm starting out with asm for the atmega328, any links for code examples - blinky etc? I tried looking around and couldn't find any that were very helpful
[07:32:53] <PlastyGrove> specifically, looking for complete working examples
[07:34:13] <PlastyGrove> I understand there's some .inc file I need to include and a particular structure I need to follow i.e. .main etc, but hard to find any clear explanation of the same
[07:40:52] <specing> OndraSter: maybe they are encoded differently ;P
[07:41:12] <OndraSter> obviously not ascii
[07:41:26] <OndraSter> I am trying to remember what is this EPROM ftom
[07:41:28] <OndraSter> from
[07:41:39] <specing> PlastyGrove: Use gcc inline assembly
[07:41:52] <specing> PlastyGrove: normal one is just too time consuming if you ask me
[07:42:22] <PlastyGrove> specing: definitely, but the link you provided earlier requires me to know at least a little assembly
[07:42:42] <specing> And how is that different from gcc inline assembly?
[07:43:34] <PlastyGrove> well, it looks very confusing, I put that down to not knowing anything about assembly. So perhaps a little assembly and then move onto inline assembly
[07:44:10] <PlastyGrove> you mean I don't need to do assembly for inline gcc?
[07:44:15] <specing> do this:
[07:44:43] <specing> asm volatile ("
[07:44:51] <specing> <put your assembly here>
[07:44:57] <specing> ":::);
[07:46:50] <PlastyGrove> okay, but what asm do I put in that? like something about ldi to register and out to pin or something - have no clue about that
[07:47:08] <specing> yup
[07:47:28] <specing> My work cycle goes like this:
[07:47:56] <specing> 1) create a bulky prototype in C
[07:48:11] <specing> 2) analize generated assembly (objdump -S)
[07:48:29] <specing> 3) replace C code with hand-written assembly
[07:48:43] <specing> 4) goto 1
[07:49:42] <theBear> PlastyGrove, maybe you wanna do some reading about basic asm concepts/programming
[07:49:51] <theBear> without the basics it's all nonsensical
[07:50:10] <theBear> just generically, not avr specific
[07:50:21] <theBear> concepts like registers and memory locations and stuff
[07:50:37] <PlastyGrove> theBear: I've worked briefly with x86 asm, so I'm familiar with registers, addresses and the lot
[07:51:02] <PlastyGrove> just not sure how to put it all together for the avr
[07:51:14] <theBear> mmmk, so umm, apply those concepts to a micro... a port is just a byte of memlocation
[07:51:15] <PlastyGrove> specing: that sounds interesting, I'll give it a shot
[07:52:37] <OndraSter> well, x86 hasn't got "ports" really
[07:52:47] <OndraSter> it has got 82xx chip that does three PIOs :)
[07:52:55] <OndraSter> but those are still not the ports
[07:52:56] <OndraSter> as on micro
[07:53:17] <PlastyGrove> theBear: I understand, but there're varying versions of asm floating around. I've seen ldi 0x04, 0b0100000, ldi PortB, 0b01000000, with .main, without .main ....
[07:53:20] <theBear> think of a port like a parport on x86
[07:53:35] <theBear> the .inc can 'alias' things, like 'PortB'
[07:53:45] <specing> PlastyGrove: ldi only works for upper registers
[07:53:52] <theBear> but that's more compiler side than 'real' asm
[07:54:36] <theBear> and you know what 'includ'ing something means right ?
[07:54:44] <theBear> err, 'include'ing
[07:55:28] <PlastyGrove> I do, but is there a standard include for the atmega328? the manual says I can do ldi r16, (1<<PB5)
[07:55:40] <PlastyGrove> but doesn't tell me where PB5 showed up from!
[07:55:48] <theBear> well that's where my ancient experience kinda fails you
[07:56:12] <PlastyGrove> specing: upper registers? you mean r16-31?
[07:56:59] <PlastyGrove> I feel like I'm floating around with half knowledge and half ignorance without enough to put everything down together :)
[07:57:58] <specing> PlastyGrove: yup
[07:58:19] <specing> there is a 200-page instruction reference on atmel's site
[07:59:07] <theBear> for any arch/processor at least browsing the asm ref. is a real good start
[07:59:21] <theBear> and hints are often dropped thruout it
[07:59:37] <theBear> vs a raw 'this is what each instruction does'
[08:00:18] <specing> You can learn much more from reading gcc dumps than by learning about each instruction individually ;P
[08:00:36] <theBear> i said browse :)
[08:03:45] <Xark> It is nice the Amtel AVR Instruction Set PDF at least gives a semi-plausible example snippets for the instructions (but -save-temps and -fverbose-asm are also quite handy for example instruction sequences in asm).
[08:04:45] <PlastyGrove> specing: is it possible to get the dump in atmel studio
[08:05:07] <specing> I have no idea
[08:05:14] <theBear> hehe, that's what i woulda said
[08:05:15] <specing> I use the Scons build system
[08:05:36] <Xark> PlastyGrove: It is still gcc AFAIK, so I suspect -save-temps would work...
[08:05:39] * Xark checks...
[08:06:05] <specing> objdump -S gives you asm intermixed with C code
[08:06:19] <specing> from the elf file
[08:07:02] <Xark> specing: Yes, however IME if you optimize the code it tends to get horribly confused (i.e., incorrect about what source generated what asm).
[08:11:54] * PlastyGrove gets the instruction pdf, now goes hunting for objdump program
[08:18:18] <Xark> PlastyGrove: OK, this works fairly well. In AVR studio, do properties on the project and on Toolchain|Miscallaneous add the following "-save-temps -fverbose-asm". If you want an assembly listing also add "-Wa,aln=listing.lst".
[08:18:58] * Xark notes there is probably some way to make the listing file be <targetname>.lst, but I couldn't guess it.
[08:19:51] <Xark> PlastyGrove: objdump should be included in any GNU toolchain (often named avr-objdump).
[08:20:53] <PlastyGrove> Xark: Thanks! I'll try that in the studio. I didn't install any toolchain separately, so trying to find where atmel studio puts it
[08:23:33] <Xark> PlastyGrove: If you turn on verbose compile, you can see it calls objdump itself. E.g. on my AS 6.0 it does "C:\Program Files (x86)\Atmel\Atmel Studio 6.0\extensions\Atmel\AVRGCC\3.4.0.65\AVRToolchain\bin\avr-objdump.exe" -h -S "blink_tiny2313.elf" > "blink_tiny2313.lss" when I rebuild.
[08:23:54] <PlastyGrove> Xark: Is that -Wa,aln=listing.lst with a comma?
[08:24:17] <PlastyGrove> i'm getting can't open aln=listing.lst
[08:24:41] <Xark> PlastyGrove: Actially, ",-". A bit of a special case when you are getting gcc to pass other arguments to sub-processes.
[08:25:13] <Xark> (if you don't have the comma, gcc will try to interpret the argument instead of passing it to [in this case] the assembler)
[08:25:18] <PlastyGrove> Xark: Ah, it works! Lots of output now
[08:25:41] <PlastyGrove> Yup, you're right, it does call objdump.exe
[08:25:50] <Xark> PlastyGrove: Cool. The ".ii" is the C file after preprocessing (often useful to diagnose macros gone bad).
[08:26:12] <PlastyGrove> Xark: So, that's the one with the assembly code?
[08:26:43] <Xark> PlastyGrove: No, you should have assembly in .S (what the compiler output) and in the .lst (what the assembler generated from the compiler output).
[08:27:42] <Xark> PlastyGrove: You can contrast the .lst file with what objdump -d --source gives you (similar, but both have their uses).
[08:27:50] <PlastyGrove> Xark: Ah! I see it thanks so much!
[08:28:09] <PlastyGrove> source for that would be the hex file or the elf file?
[08:28:29] <Xark> PlastyGrove: elf. hex is mostly only good for uploading via avrdude.
[08:29:11] <PlastyGrove> Got it! Thanks so much! Will need to dig into this to see what's happening. I think I've got my work cut out for tonight
[08:29:13] <PlastyGrove> :)
[08:29:45] <atiti> ping
[08:30:25] <Xark> PlastyGrove: You also might try "avr-size" on the elf (to show segment sizes) or "avr-nm --size-sort --reverse-sort foo.elf" to show symbols/functions sorted by size.
[08:31:07] <PlastyGrove> Xark: okay, willl try it out.
[08:31:31] <Xark> PlastyGrove: OK. Enjoy the wonders of the GNU toolchain. :)
[08:35:56] <atiti> guys
[08:36:22] <atiti> im seeing weird symptoms at upload to a custom board (atmega1284p)
[08:36:32] <atiti> the upload seems to break in the middle: http://pastebin.com/PLdDVZKB
[08:38:22] <atiti> anyone seen similar?
[08:38:37] <Xark> atiti: That is "not good" (and I don't have that issue on my 1284p breadboard). Is that anything that would interfere with the upload (other things on RX/TX perhaps)?
[08:38:50] <Xark> s/that/there/
[08:39:29] <atiti> im trying it with a usb-serial through a max232
[08:39:30] <specing> Switching to Linux could be a great idea.
[08:40:02] <atiti> nothing else is on the uart
[08:42:28] <atiti> it occurs randomly
[08:42:37] <atiti> sometimes it uploads and verifies fine
[08:42:53] <atiti> but a lot of times it fails somewhere in the middle, from 8% to 96%
[08:43:38] <atiti> ive also tried optiboot and ATmegaBOOT
[08:44:57] <Xark> atiti: Are you using an external oscillator?
[08:45:25] <atiti> yes
[08:45:34] <atiti> 16Mhz + 22pF caps
[08:46:34] <Xark> The fact it "can work" is interesting. Could you have some noise issues or something (a few .1uf caps to smooth things out)?
[08:47:40] <atiti> also tried to follow the "AVR design considerations" docs for the reset and the power supply decoupling
[08:48:31] <atiti> im also thinking its some noise, but have no idea where it could come from
[08:50:25] <atiti> i thought maybe it could be that the reset line gets some noise and it resets during programming
[08:53:01] <atiti> also tried lower baudrates with the same result :/
[08:59:17] <Xark> How flaky is it? It works 1 out ot N times?
[09:00:48] <Tom_itx> on a breadboard?
[09:00:57] <Tom_itx> maybe it's the breadboard connections
[09:01:14] <atiti> 1 out of 10ish
[09:01:22] <atiti> no, its a custom pcb
[09:01:25] <atiti> home etched
[09:01:28] <Xark> I have had some issues overclocking 1284P (not as flexible there as 644), but I haven't had any trouble at all uploading to it (with FTFI or USB2Serial [atmega8u2]).
[09:01:35] <Xark> FTDI*
[09:02:55] <atiti> weird thing is, ive got 3 boards printed, and they all behave the same way
[09:10:31] <atiti> do you guys have a cap on the reset line?
[09:10:55] <atiti> the reset has to be active low on programming right?
[09:20:03] <donjoe> hi, In my code I want to add 4 uint8_t to yield another uint8_t, but avr-gcc/cpu treats < 0x7f as negative values
[09:20:21] <donjoe> well > 0x7f
[09:21:25] <donjoe> well, actually 0x1f + 0xc0 + 0x00 + 0x00 yields 0xbf
[09:23:59] <donjoe> here it is: http://pastebin.com/dQWcVSkV
[09:26:35] <Tom_itx> atiti a 10k pullup on reset. no cap
[09:28:51] <donjoe> if I compile the same code with my native gcc I get the expected correct results
[09:30:07] <atiti> hm
[09:30:42] <atiti> it seems that most of the time, the response avrdude gets at the protocol error is actually the first couple of bytes sent by the application
[09:30:50] <atiti> so it seems to reboot in the middle of the upload
[09:31:11] <donjoe> I am using avr-gcc 4.5.3 btw
[09:32:26] <donjoe> atiti, you pulled reset pin high?
[09:32:40] <atiti> yes
[09:32:44] <atiti> there is a 10k pullup
[09:32:56] <atiti> and a cap to GND
[09:33:08] <donjoe> okay, I guess while avrdude is in control it will drive the reset line correctly anyway
[09:33:35] <atiti> but does it supposed to hold the reset low throughout programming?
[09:33:38] <atiti> or just a pulse?
[09:34:05] <atiti> i guess its a pulse to boot the bootloader
[09:34:05] <donjoe> I am not sure, you could look it up in the code
[09:35:43] <donjoe> but even if it is a pulse, it will set it to some definite level afterwards and not floating, or not?
[09:36:08] <donjoe> what hardware do you use?
[09:36:27] <atiti> custom, home made :)
[09:36:40] <atiti> atmega1284p @ 16Mhz
[09:36:47] <donjoe> parport or something else?
[09:37:18] <atiti> serial programming with optiboot
[09:37:34] <donjoe> I am currently using ft232 breakout board
[09:38:07] <atiti> im using a usb-serial + max232
[09:38:31] <donjoe> havent used max232 since years
[09:38:43] <atiti> and a capacitor in serial on the reset line with the max
[09:39:46] <donjoe> I am also using a serial bootloader and my ft232 board, works perfect here
[09:39:48] <donjoe> no max232
[09:40:48] <OndraSter_> wait
[09:40:50] <OndraSter_> why the max232?
[09:40:53] <donjoe> are you sure your usb-serial adapter requires these +/-12 or 15v ?
[09:41:37] <atiti> OndraSter_, because i had a couple laying around :)
[09:41:43] <OndraSter_> but why?
[09:41:52] <OndraSter_> would you use it
[09:44:07] <donjoe> atiti: try without max232, whats the chip on you usb<->serial? ft23x or pl23xx?
[09:44:45] <atiti> pl23xx
[09:44:59] <atiti> in ubuntu btw
[09:45:12] <donjoe> I am also on ubuntu
[09:45:27] <OndraSter_> how do you have it connected?
[09:45:32] <OndraSter_> usb-serial -> mega I thope?
[09:45:35] <OndraSter_> *-t
[09:46:07] <donjoe> I have successfully hooked up pl23xx to mcu serial ports without max232 (actually I think the last time I used a max232 was when I still had a computer with build in serial port ;-) )
[09:46:35] <OndraSter_> MAX232 has nothing to do in the equation!
[09:48:50] <donjoe> OndraSter_: do you have any idea why adding "uint8_t" values on the avr doesnt work in the sense that they get treated as signed? (while the same code works perfectly on my pc)
[09:49:22] <OndraSter_> do you see the "u" on the beginning?
[09:49:30] <OndraSter_> or did I misunderstood you?
[09:49:55] <donjoe> me?
[09:50:17] <OndraSter_> well I am not sure if you mean that "why they work as unsigned" or "why they work as signed"
[09:51:07] <donjoe> I expect them to get treated as unsigned since they are declared as "uint8_t" but the result I get suggests that they are treated as signed (which I dont want).
[09:51:25] <OndraSter_> oh
[09:51:28] <OndraSter_> it is weird
[09:51:45] <donjoe> here is the code: http://pastebin.com/dQWcVSkV - on the PC (using gcc) I get the expected result
[09:53:45] <donjoe> well, the asm code looks correct to. I downloaded the instruction set manual for avrs and there seems to be only one add instruction (so nothing like add signed / unsigned)
[09:54:02] <OndraSter_> there is only add and adc
[09:54:25] <donjoe> yes
[09:55:25] <donjoe> for 0x1f + 0x80 +0x00 + 0x00 I get 0x7f (avr) 0x9f (pc)
[09:56:00] <OndraSter_> impossible!
[09:56:46] <donjoe> yes, let me check something
[09:58:51] <OndraSter_> http://clip2net.com/s/2batH
[09:58:53] <OndraSter_> like I said
[09:58:54] <OndraSter_> IMPOSSIBLE
[10:02:50] <Xark> donjoe: There is no difference between signed and unsigned arithmetic, only in how you interpret the result (so it makes sense there aren't extra opcodes).
[10:03:18] <donjoe> I might have itr
[10:04:20] <donjoe> I have it
[10:04:59] <donjoe> the problem was fetching the uint32_t from the uart using my getc() which returned char instead of uint8_t
[10:05:16] <Xark> donjoe: Cool. That makes sense. :)
[10:05:17] <donjoe> so the actually the input was different
[10:05:31] <donjoe> thanks guys :-)
[10:07:01] <rhumbot> hi all, ive got a problem: http://pastebin.com/Ca9PvJSZ
[10:07:54] <rhumbot> i define an array of arrays and want to use one of them in a function. but for some reason the used array is not identified properly
[10:08:07] <rhumbot> sorry for my horrible english :/
[10:08:08] <RikusW> donjoe: just make sure you're fetcing it in the right byte order from uart ;)
[10:09:29] <donjoe> yes, I checked that before already but with 0x12131415 as a test value
[10:10:00] <RikusW> good idea
[10:10:43] <RikusW> its probably little endian right ?
[10:10:49] <RikusW> 0x15 first
[10:19:57] <PlastyGrove> Xark: My brain is about to explode with all this asm :(. Maybe I should space it out a bit and take it slowly
[10:20:43] <RikusW> asm isn't that hard :)
[10:21:14] <RikusW> anything in particular that you don't understand ?
[10:21:32] <PlastyGrove> RikusW: I wish! I just searched on how to get a delay and ended up with a utility that will generate code for you!
[10:21:32] <Xark> PlastyGrove: I understand. :) No worries if you want to take it slow. Anything specifically giving you trouble? :)
[10:21:57] <PlastyGrove> I just wrote a program that will turn on the LED and turn it off. Now to put it in a loop with a delay
[10:22:17] <RikusW> The loop is the delay....
[10:22:35] <RikusW> doing a delay is rather easy
[10:22:42] <PlastyGrove> RikusW: No, I mean .main and .loop
[10:22:46] <RikusW> doing it cycle accurate is slightly more work
[10:23:10] <PlastyGrove> RikusW: Yea, I searched for it and got results using hardware timers and stuff
[10:23:12] <PlastyGrove> :(
[10:23:21] <RikusW> use a simple loop
[10:23:31] <RikusW> say one loop takes 16 clocks
[10:23:49] <RikusW> then 1000 loops take 16000 clocks and at 16MHz you have a 1ms delay
[10:24:34] <PlastyGrove> hmm ... okay, so I need to loop it sufficient number of times to get the delay I desire
[10:24:46] <PlastyGrove> but again, wouldn't that become a 16bit integer, I'll need to figure out how to compare that
[10:24:49] <RikusW> then call that loop from another loop in DelayMS function
[10:25:02] <RikusW> simple
[10:25:08] <RikusW> add adc and cpi cpc
[10:25:19] <RikusW> why a 16 bit ?
[10:25:27] <RikusW> I used two nested loops
[10:25:37] <PlastyGrove> ah
[10:25:50] <PlastyGrove> elegance in simplicity!
[10:26:50] <PlastyGrove> let me give that a shot
[10:27:34] <RikusW> http://pastebin.com/GnCjZ13Z
[10:27:45] <RikusW> for 8MHz
[10:28:18] <RikusW> this should help ? ;)
[10:28:57] <RikusW> you'll need to do some cycle counting, look at the avr instruction set reference for that
[10:29:14] <RikusW> (if you want to understand the code that is)
[10:29:20] <PlastyGrove> shucks! I was gonna do it myself, you ruined it for me!
[10:29:31] * PlastyGrove is so relieved
[10:29:39] <PlastyGrove> :)
[10:30:07] <PlastyGrove> RikusW: Yup, I've got the instruction set reference with me, will go through it
[10:30:11] <PlastyGrove> I'll give your code a shot
[10:30:13] <PlastyGrove> thanks so much!
[10:30:17] <RikusW> :)
[10:31:19] <RikusW> http://pastebin.com/ZLbCpXF0 4us delay loop
[10:32:16] <RikusW> Next you can try using timers for delays ;)
[10:32:27] <RikusW> but a simple loop is simpler
[10:32:42] <RikusW> though it eats a lot of mcu cycles
[10:33:51] <PlastyGrove> yup, I'll get to that
[10:34:08] <RikusW> then interrupts....
[10:34:33] <RikusW> its fairly simple once you understand it
[10:35:30] <RikusW> use cbi/sbi to turn the led on/off
[10:35:34] <donjoe> RikusW: btw, do you know how many cycles it takes from the interrupt event to the 1st instruction of the handler for AVRs? (just curious)
[10:35:58] <RikusW> about 10 iirc
[10:36:17] <donjoe> okay, I guess thats not bad
[10:36:32] <RikusW> if you need high speed sampling rather use polling
[10:36:37] <OndraSter_> isn't it 4 cycles?
[10:37:13] <RikusW> iirc its 10 for the irq + iret
[10:37:15] <donjoe> I am not that familiar with the avr. So does this involve pushing things on the stack or not?
[10:37:26] <blight> it's not a fixed amount of cycles
[10:37:39] <RikusW> if you modify a register you need to push it first, same for SREG
[10:37:40] <blight> iirc it's like 4-6 until the first instruction of the ISR is ran
[10:38:01] <blight> it's well specified but as i said, not fixed
[10:38:14] <donjoe> does the avr have multiple vectors or a single one where you have to check for the event and branch accordingly?
[10:38:27] <blight> there is some fixed delay and finishing the current instruction will take anoth 0-2 or 0-3 cycles i think
[10:38:30] <RikusW> multiple in flash
[10:38:35] <donjoe> okay
[10:38:50] <RikusW> it starts at 0 (reset) and then the rest
[10:39:04] <donjoe> so like for the cortex arms in contrast to armN
[10:39:35] <RikusW> for things like pin change interrupt you have to determine the pin, its in groups of 8 bits
[10:39:47] <donjoe> alright
[10:40:24] <RikusW> donjoe: do you have avr datasheets ?
[10:40:32] <donjoe> yes
[10:40:49] <RikusW> look in ther interrupt chapter
[10:41:14] <donjoe> well, I was only curious because I was looking that up recently for some other mcu
[10:41:58] <RikusW> AVR32 is single vector I think, not sure
[10:42:14] <RikusW> its more like ARM then AVR8
[10:42:59] <donjoe> the cortex m3s also have this array of interrupt vectors now
[10:43:06] <blight> does it have anything to do with 8bit AVR other than the 3 lett0rz {A,V,R} ?
[10:43:09] <blight> :p
[10:43:41] <donjoe> too much offtopic? ;-)
[10:43:50] <donjoe> I am sorry
[10:44:35] <donjoe> ohh, you mean the AVR32?
[10:44:55] <RikusW> AVR32 is very different from AVR8
[10:45:17] <RikusW> though some of the instructions seems to be the same more or less
[10:45:33] <donjoe> some for the pics where the pic32 actually is a mips
[10:45:34] <Steffanx> more less than more :P
[10:46:03] <RikusW> :-P
[10:47:20] <RikusW> donjoe: sometimes theres plenty of ARM discussions here ;)
[10:48:39] <RikusW> sometimes it even becomes the Automotive Vehicle Repair channel too :-P
[10:51:26] <Steffanx> Or All RikusW random-stumbledupon-links :P
[10:52:55] <RikusW> that too :-D
[10:53:05] <RikusW> usually electronics related
[10:53:16] <Steffanx> Arh, No V in that
[10:53:46] <Steffanx> but we have an errata for that
[10:53:56] <RikusW> Any Vhere Random :-D
[10:54:57] <RikusW> so don't complain again when I paste another AVR link :-P
[10:57:21] <RikusW> errata ? /kick RikusW ? :-P ?
[12:49:03] <specing> PlastyGrove:
[12:49:16] <PlastyGrove> Hey specing
[12:50:22] <specing> ldi r25, upper
[12:50:26] <specing> ldi r24, lower
[12:50:37] <specing> sbiw r25:r24, 1
[12:50:46] <specing> brne .-4
[12:52:10] <PlastyGrove> for 16 bit values?
[12:52:41] <specing> yep
[12:53:22] <PlastyGrove> great thanks, this will come in handy
[12:53:46] <PlastyGrove> and you were right abt the unnecessary stuff that GCC includes
[12:53:52] <specing> And while RikusW is still using nested 8bit loops, I jsut looked at the dissasm of _delay_ms () from util/delay.h
[12:54:31] <PlastyGrove> i believe that uses a hardware timer?
[12:54:43] <PlastyGrove> that's why we set the F_CPU
[12:54:50] <specing> no
[12:55:05] <specing> it uses F_CPU to compute accurate delays
[12:55:22] <specing> open util/delay.h
[12:58:27] <PlastyGrove> yup
[12:58:30] <PlastyGrove> opened
[13:00:37] <PlastyGrove> I'm looking at _delay_ms(), but not sure I understand a whole lot
[13:00:58] <specing> inline assembly ha?
[13:02:23] <PlastyGrove> looks like regular C - __ticks_dc = (uint32_t)(ceil(fabs(__tmp)));
[13:02:50] <PlastyGrove> am I looking at the wrong file?
[13:02:57] <PlastyGrove> include/util/delay.h
[13:03:45] <PlastyGrove> a lot of preprocessor directives, but not much asm
[13:10:38] <specing> PlastyGrove: #include <util/delay_basic.h>
[13:12:21] <PlastyGrove> ah, i see now, delay_loop_1 and 2
[13:12:43] <PlastyGrove> specing: very cool
[13:13:07] <PlastyGrove> what is brne 1b
[13:13:09] <PlastyGrove> ?
[13:13:17] <PlastyGrove> branch if not equal to where?
[13:17:53] <specing> 1b: 1 backwards
[13:17:59] <specing> 1f: 1 forward
[13:18:02] <specing> 1: code
[13:24:50] <PlastyGrove> specing: that makes sense
[17:30:21] <donjoe> keep on programming your AVRs guys, good night! :-)
[18:47:53] <OndraSter_> damnit I need to finish writing the theory of working about my "human" assembler
[18:48:07] <OndraSter_> it has got bit manipulation support in rather easy way
[18:48:15] <OndraSter_> PORT(bit) <- 0
[18:48:22] <OndraSter_> :P
[18:52:32] <OndraSter_> hmm I could also do
[18:52:39] <OndraSter_> PORTA(bit1) <- PORTB(bit2)
[18:52:48] <OndraSter_> which will expand to BLT and BST
[18:59:02] <izua__> that might not always assemble in a single instruction
[18:59:27] <izua__> also, pimps and organ traders would be pretty interested in your human assembler
[19:03:49] <OndraSter_> I know
[19:03:54] <OndraSter_> there will be "shortcuts" for some stuff
[19:03:55] <OndraSter_> like
[19:04:02] <OndraSter_> R1 <= R2 ? k
[19:04:08] <OndraSter_> (where k will be number/name to where to jump)
[19:04:39] <OndraSter_> I always hate looking through instruction set manual and looking for the BR* instruction I need
[21:09:14] <OndraSter_> just a reminder
[21:09:16] <OndraSter_> 1.5 hours
[21:09:20] <OndraSter_> till rover's landing on the mars
[21:10:35] <Tom_itx> on tv?
[21:11:11] <OndraSter_> http://www.ustream.tv/nasajpl
[21:11:19] <OndraSter_> right now there is running some talk
[21:12:54] <Tom_itx> will it be live there?
[21:13:00] <Tom_itx> or as live as can be..
[21:13:39] <Landon> I don't think there will be video of it if that's what you're asking
[21:13:51] <OndraSter_> there will be live stream of _something_
[21:13:53] <OndraSter_> of the landing
[21:15:10] <Landon> from wikipedia: "Nonetheless, confirming a successful landing may take "several hours or even days"."
[21:15:18] <Landon> so it may leavea bit to be desired :P I think I'd rather sleep
[21:15:47] <OndraSter_> it is 0404 right now
[21:24:14] <grummund> how long does it take the signal to reach earth?
[21:24:50] <Landon> ~15 minutes
[21:25:32] <OndraSter_> yep
[21:26:33] <grummund> not sure i can stay awake till then
[21:27:19] <OndraSter_> 0416 here
[21:27:23] <OndraSter_> 0530 happening it
[21:27:34] <OndraSter_> (in the night)
[21:27:55] <grummund> u r 1hr ahead of me
[21:28:16] <OndraSter_> well if you are in the UK you should stay awake just fine :D
[21:28:21] <OndraSter_> fins have it even worse
[21:49:02] <smeding> heh
[21:49:08] <smeding> it's at 7:30 for me
[21:49:10] <smeding> but i have holidays
[21:54:00] <Blecha> So what do you guys think of getting a Dragon and some attiny85s to start my quest into avr programming?
[21:54:08] <Blecha> was thinking of getting both from newark http://www.newark.com/jsp/search/productdetail.jsp?SKU=68T2063&CMP=AFC-GB100000001
[21:54:11] <OndraSter_> :)
[21:54:32] <OndraSter_> if you want debugging - grab the dragon
[21:54:34] <OndraSter_> but why newark?
[21:54:39] <Blecha> google
[21:54:40] <OndraSter_> isn't digikey or mouser cheaper?
[21:55:20] <Blecha> Im going to start by getting some attiny 85s and using my arduino to program them
[21:55:33] <Blecha> but eventually i think i will want the dragon
[21:55:35] <Tom_itx> OndraSter_ usually yes
[21:56:15] <Blecha> So much stuff to get... new dremel, copper clad, etchant, chips, a programmer, and all the goodies to attach to the boards.
[21:56:17] <Tom_itx> Blecha you may find you don't need it
[21:56:49] <Blecha> yeah im going to start small for now, but i would like to learn more about embedded programming to see if its my niche
[21:57:24] <Blecha> Alot of the electrical engineering stuff i dont like, but I do like coding and building stuff
[21:57:28] <Tom_itx> why a tiny85?
[21:57:58] <Blecha> Its small, cheap, and I dont need a lot of I\O to play with
[21:58:15] <Blecha> If I do it will be a good experience with shift registers :D
[21:58:48] <Blecha> Also what are some good wireless transievers to mess with?
[21:59:07] <OndraSter_> I have got here lying NRF24L01
[21:59:14] <OndraSter_> waiting to be used :)
[21:59:50] <Blecha> I saw some really cheap transmit recieve paired stuff on digikey
[22:00:12] <OndraSter_> you won't connect these to tiny85 though
[22:00:15] <OndraSter_> they require more IOs :P
[22:00:57] <Blecha> ah, im just looking for basic duplex serial
[22:01:21] <Blecha> I fail at analog stuff, thats the electrical engineering I fail at
[22:01:29] <Blecha> digital I can rock all day
[22:01:48] <Blecha> but I can't make a 555 radio work :(
[22:19:32] <jadew> are you guys awake for the landing?
[22:20:04] <OndraSter_> I thought I will
[22:20:09] <OndraSter_> it should start in 22 minutes
[22:20:17] <OndraSter_> but another website says in 52 minutes
[22:20:21] <OndraSter_> I am getting REALLY sleepy
[22:21:17] <jadew> yeah, I think it's up to an hour, we'll see
[22:21:31] <jadew> there's no audio on their feed tho
[22:21:51] <jadew> where are you following it?
[22:22:08] <jadew> it's 6am in here
[22:22:12] <jadew> but I'm gonna stay awake
[22:23:10] <OndraSter_> probably on ustream
[22:23:13] <OndraSter_> I will watch it
[22:23:16] <OndraSter_> there is nothing yet
[22:23:23] <jadew> http://www.nasa.gov/externalflash/mars/curiosity_news3.html
[22:23:47] <OndraSter_> :)
[22:24:14] <OndraSter_> hmm at 0900 is the stuff probably then
[22:24:23] <OndraSter_> I have got 1 less hour than you do
[22:24:36] <OndraSter_> I actually got up today at 1200 lol
[22:25:24] <jadew> I think it's worth watching, just to be able to brag that you watched it live
[22:26:04] <OndraSter_> :D
[22:34:38] <Kevin`> a
[22:37:30] <jadew> btw, look what I found: http://www.buyincoins.com/new_en/details/new-dht11-digital-temperature-and-humidity-sensor-product-6732.html
[22:37:44] <OndraSter_> yep, I looked at dht11 quite a long time ago
[22:38:01] <jadew> seems great, ordered a few
[22:39:59] <OndraSter_> for that price yep
[22:40:24] <OndraSter_> but goes only 0 - 50C
[22:40:29] <OndraSter_> you are screwed during the winter :D
[22:40:44] <jadew> hope it won't get that cold in my room
[22:40:56] <OndraSter_> I ment more like outside use
[22:41:01] <jadew> heh, yeah
[22:41:33] <OndraSter_> mmm DHT22 is better
[22:41:36] <OndraSter_> much better range
[22:41:39] <OndraSter_> -40 - 125C
[22:41:44] <OndraSter_> and humidity 0 - 100%
[22:41:50] <OndraSter_> dht11 does only 20 - 80
[22:42:01] <jadew> oh, that kinda sucks
[22:42:04] <jadew> didn't notice that
[22:42:08] <OndraSter_> but
[22:42:11] <jadew> DS18S20+ does better temp
[22:42:11] <OndraSter_> I do wonder how much it costs
[22:42:25] <OndraSter_> yep
[22:42:27] <jadew> nasa started streaming stuff
[22:43:04] <jadew> http://www.buyincoins.com/new_en/details/dht22-am2302-digital-temperature-and-humidity-sensor-replace-sht11-sht15-2-product-11568.html
[22:44:08] <OndraSter_> hmm
[22:44:10] <OndraSter_> not worth it :)
[22:44:28] <jadew> yeah, kinda expensive
[22:44:56] <jadew> I think you can use DS18S20+ for temp and dht11 for humidity
[22:44:56] <OndraSter_> $5.39 on ebay
[22:45:01] <OndraSter_> yep
[22:46:37] <jadew> got 5 of those, planning to plant one in my next power source
[22:47:01] <OndraSter_> 18b20?
[22:47:04] <jadew> yeah
[22:47:08] <OndraSter_> I got 5 as well
[22:47:09] <OndraSter_> samples :D
[22:47:25] <jadew> nice!
[22:47:30] <jadew> I need to try that sometime
[22:47:35] <OndraSter_> :D
[22:47:49] <OndraSter_> ADI has great sampling service
[22:47:51] <OndraSter_> just as TI
[22:48:07] <OndraSter_> hell I wrote TI that my project is for school and that I am a student
[22:48:22] <OndraSter_> monday night (around midnight here) ordered
[22:48:29] <OndraSter_> wednesday morning = FedEx ringing the bell :)
[22:48:36] <jadew> hah, nice
[22:48:39] <OndraSter_> note that I live on the other side of the world
[22:48:55] <OndraSter_> it was shipped from the US
[22:49:05] <jadew> they really want future engineers to use their stuff, eh?
[22:49:10] <OndraSter_> yap
[22:49:19] <OndraSter_> but I ain't switching to MSP430 :P
[22:49:37] <jadew> I haven't checked yet what that thing can do
[22:49:49] <OndraSter_> if I were to go to something better, it would be ARM
[22:49:53] <jadew> "less than 2 hours from curiosity landing"
[22:50:35] <jadew> so far, for my needs, AVRs were just fine
[22:50:50] <jadew> if I need more power I connect the thing to a real PC
[22:51:23] <OndraSter_> :)
[22:51:48] <jadew> not to mention that I like the cheap factor :P
[22:51:53] <OndraSter_> aye
[22:52:04] <OndraSter_> some LPCs from NXP are REALLY cheap though
[22:52:34] <jadew> LPC?
[22:52:46] <OndraSter_> yes, LPC series
[22:52:52] <jadew> ah
[22:52:57] <jadew> don't know them
[22:53:01] <OndraSter_> cortex m0 are the cheapest
[22:53:12] <OndraSter_> they go for about an 1.3€
[22:53:16] <OndraSter_> for 1 pcs
[22:53:42] <jadew> that's pretty cheap, but atmega8 goes for less than 1e
[22:53:54] <OndraSter_> 8kB flash, 2kB RAM
[22:53:58] <OndraSter_> 50MHz
[22:54:03] <jadew> oh, that's nice
[22:54:05] <OndraSter_> aye
[22:55:15] <OndraSter_> 10bit ADC (8 channels), two SPI, I2C, WD, two 32bit counters and two 16bit counters
[22:55:17] <OndraSter_> and UART
[22:55:37] <jadew> neat
[22:55:41] <OndraSter_> aye
[22:56:58] <Blecha> Might be a bit late to add to the discussion, but you should file for a ficticious name
[22:57:10] <Blecha> basically the bare minimum for a small buziness
[22:57:16] <Blecha> Then you can get way more free samples :D
[22:57:19] <OndraSter_> :D
[22:57:23] <OndraSter_> I am using my domain
[22:57:25] <OndraSter_> ondraster.cz
[22:57:40] <Blecha> I run a small 3d printing company so I try to maximize that
[22:57:55] <Blecha> I have a domain but no email or website
[22:59:18] <OndraSter_> I like the idea of LPC4330... it is dualcore - Cortex M4 + M0 :)
[22:59:59] <OndraSter_> for about 7.5€
[23:00:03] <OndraSter_> @ 1 pcs
[23:00:12] <OndraSter_> 5,86€ at 100pcs
[23:00:19] <OndraSter_> 264MHz
[23:00:36] <Blecha> I will have to wait for arm development
[23:00:51] <Blecha> learning C/RISC/AVR stuff for now
[23:00:57] <OndraSter_> :)
[23:01:05] <Blecha> C has always been a language I tried to learn, but gave up on
[23:01:31] <Blecha> but I finally sat down and learned a language properly(python) and did some open source stuff
[23:01:39] <Blecha> so now im ready for the big dogs :P
[23:01:47] <OndraSter_> python is nothing like C
[23:01:53] <OndraSter_> python is used by lazy programmers
[23:01:59] <OndraSter_> because they can't be bothered writing { and }
[23:02:07] <Blecha> I know, its the multi-platform visual basic
[23:02:08] <jadew> C it's worth giving up on :D unless you're doing avr coding
[23:02:24] <Blecha> also, its suprising how much of the avr stuff is targeted to windows users
[23:02:30] <Blecha> I figured most would be linux
[23:03:02] <jadew> big companies don't like to piss off their programmers by forcing linux on them
[23:03:13] <Blecha> Yeah but I mean forum posts and such.
[23:03:33] <OndraSter_> well they have Visual Studio shell
[23:03:35] <OndraSter_> :P
[23:03:40] <jadew> yeah
[23:03:47] <Blecha> pfff
[23:03:57] <jadew> and all the cool electronics related software is on windows
[23:04:06] <OndraSter_> well
[23:04:14] <OndraSter_> I found it always disappointing :P
[23:04:18] <Blecha> all you really need is some kind of spice
[23:04:20] <OndraSter_> Quartus is huge stuff
[23:04:27] <OndraSter_> but the controls are awful IMHO
[23:04:41] <OndraSter_> what's up with not being able to use scroll wheel when picking up the part ?!
[23:04:47] <OndraSter_> it is regular tree listing!
[23:05:15] <Blecha> because scroll wheels are so 90s
[23:05:24] <OndraSter_> what do people use now instead of that?
[23:05:38] <Blecha> Well basically its like a scroll wheel that you shove up your ass
[23:05:47] <Blecha> its an apple product
[23:05:49] <OndraSter_> oh
[23:05:52] <OndraSter_> iWheel
[23:06:04] <Blecha> Yeah pretty much, still no right click option though
[23:06:18] <Tom_itx> OndraSter_ how well do you know python?
[23:06:23] <jadew> you know what's missing in terms of software?
[23:06:26] <OndraSter_> Tom_itx, only that it uses no { }
[23:06:30] <Tom_itx> have you ever messed with glade?
[23:06:34] <OndraSter_> jadew, automatic code generator?
[23:06:46] <OndraSter_> Tom_itx, I already said that I know only that it lacks { and } :)
[23:06:51] <jadew> an avr simulator that can also simulate analog circuits
[23:06:52] <Tom_itx> oh
[23:06:59] <OndraSter_> jadew, wasn't there one?
[23:07:03] <jadew> with an altium designer interface
[23:07:03] <OndraSter_> I don't remember the name ofc
[23:07:08] <Tom_itx> i was messin with it a bit this evening
[23:07:26] <Blecha> jadew hmmm I bet its possible to merge some existing stuff fairly easily
[23:07:33] <OndraSter_> blimey!
[23:07:34] <OndraSter_> http://eyes.nasa.gov/launch2.html?document=$SERVERURL/content/documents/msl/edl.xml
[23:07:36] <OndraSter_> requires java
[23:07:36] <jadew> OndraSter_, I don't think there is, or I don't know of it
[23:07:44] <Tom_itx> it makes for a quick gui interface generator
[23:07:53] <OndraSter_> Tom_itx, django?
[23:08:00] <Tom_itx> glade
[23:08:05] <Tom_itx> with python
[23:08:14] <OndraSter_> well django is for python as well
[23:08:22] <OndraSter_> and my boss uses it
[23:08:25] <Blecha> What about WX tom_it
[23:08:35] <Tom_itx> never heard of it
[23:08:47] <Tom_itx> anyway, just checking in before i sleep
[23:08:49] <Blecha> Its the same general idea
[23:08:58] <Blecha> easy GUIs in python
[23:09:03] <jadew> Tom_itx, not gonna follow the landing?
[23:09:14] <Tom_itx> you can tell me about it
[23:09:18] <jadew> haha
[23:10:05] <Blecha> Ive never used glade so not sure how it compares
[23:10:25] <Blecha> Its used in some open source tools I use and modded
[23:11:50] <Blecha> Well im finally off work
[23:11:57] <Blecha> So I will catch you cats later.
[23:14:03] * OndraSter_ is a cat!
[23:14:06] <OndraSter_> rawr!