#avr | Logs for 2012-10-06

Back
[02:15:24] <OndraSterver> Casper, ?
[02:16:08] <Casper> OndraSterver: !
[02:16:39] <OndraSterver> <Casper> vu meter do not need high sampling rate
[02:16:39] <OndraSterver> <Casper> all it need is some hardware
[02:16:50] <OndraSterver> the more samples the more data to work with
[02:16:58] <OndraSterver> for FFT
[02:17:13] <Casper> depend how you make it, do part in hardware
[02:17:29] <Casper> plain vu meter are damn easy...
[02:17:32] <OndraSterver> by whoknowswhos law you should have more than twice the sampling rate of the signal's frequency
[02:17:36] <OndraSterver> well
[02:17:41] <OndraSterver> a) I want it to be as small as possible
[02:17:45] <OndraSterver> b) it will be on an OLED display
[02:18:03] <Casper> opamp to increase the voltage, diode, RC, slow ADC (like 10sps)
[02:18:31] <OndraSterver> and filter out each frequency range?
[02:18:47] <Casper> vumeter normally don't have frequency
[02:18:58] <OndraSterver> so what did I think of?
[02:19:17] <OndraSterver> showing the level of 0 - 20Hz, 20 - 200Hz, 200Hz - 2kHz etc
[02:19:18] <Casper> I don't know the exact term
[02:19:38] <Casper> FFT graph maybe, dunnot
[02:19:48] <Casper> but in that case, go software
[02:19:58] <OndraSterver> sure it will be as much software as possible
[02:20:00] <OndraSterver> FFT
[02:22:14] <OndraSterver> hmm they can do it on 16MHz atmega in basic
[02:22:45] <OndraSterver> so I think that 32MHz xmega should be okay
[02:41:26] <r00t|home> more like graphical equalizer than vu-meter... vu-meter just displays the overall signal level
[02:41:57] <megal0maniac> < OndraSterver> by whoknowswhos law
[02:42:09] <megal0maniac> That's Nyquist
[02:43:40] <megal0maniac> OndraSterver: If you're keen, might be worth taking a look at Rockbox's implementation of VU meter and FFT and Oscilliscope. It's all in C iirc
[02:46:44] <OndraSterver> yes, Nyquist was the dude I thought of
[02:46:58] <OndraSterver> well there is FFT library for AVR
[02:47:00] <OndraSterver> in ASM :P
[02:47:01] <creep> its <0.5 euro/m for the cat5-e patch cable, and the solid is cheaper
[02:47:02] <OndraSterver> for 100% speed
[02:47:08] <Richard_Cavell> The STK600 has a 32 kilohertz crystal output on it. Is this used for keeping a real-time clock? Is there any other common use for it?
[02:47:18] <OndraSterver> it is for RTC
[02:47:25] <megal0maniac> Richard_Cavell: If it's 32.768khz, then yes
[02:47:34] <Richard_Cavell> yes it is
[02:47:46] <megal0maniac> That's not the same as 32khz ;)
[02:47:52] <Richard_Cavell> is 32768 some sort of standard?
[02:47:55] <OndraSterver> yes
[02:47:56] <OndraSterver> watch xtal
[02:47:59] <Richard_Cavell> I realize it's a power of 2
[02:48:18] <Richard_Cavell> so how come crystals are so much more accurate than RC?
[02:48:31] <OndraSterver> xmega has both 32.768kHz @ 0.5% calibrated or 32kHz Ultra Low Power at.. 2%?
[02:48:36] <OndraSterver> because xtals are precise RC
[02:48:51] <OndraSterver> R and C drift a lot
[02:49:09] <Richard_Cavell> OndraSterver: oh you're saying the xmega has an on-chip 32.768 crystal?
[02:49:10] <Richard_Cavell> cool
[02:49:18] <OndraSterver> no, RC, but it is tuned
[02:49:57] <OndraSterver> to such precisions
[02:50:12] <OndraSterver> and you can actually use the 0.5% 32.768kHz to calibrate the both 2MHz and 32MHz xtals
[02:50:18] <OndraSterver> which is a neat feature :P
[02:50:34] <Richard_Cavell> does it have an on chip crystal at all?
[02:50:44] <OndraSterver> no, just four RC oscillators
[02:50:50] <OndraSterver> xtal is not usually put into chips
[02:50:50] <megal0maniac> OndraSterver: xmega starts on 2mhz and only switches to 32mhz (or whatever other clock source) through firmware, right?
[02:50:56] <megal0maniac> xtal is BIG
[02:50:57] <OndraSterver> yes
[02:50:58] <OndraSterver> no more fuses
[02:51:01] <megal0maniac> Neat :)
[02:51:08] <OndraSterver> no more fuses for clocks*
[02:51:14] <OndraSterver> there still are fuses for other stuff
[02:51:19] <megal0maniac> I'm realising more and more that xmega is like mega, rev 2
[02:51:26] <megal0maniac> Or version rather
[02:51:26] <OndraSterver> pretty much, yes
[02:51:35] <OndraSterver> it is an evolution of mega
[02:51:50] <OndraSterver> I do wonder at which process are they manufactured. 90um?
[02:52:04] <megal0maniac> Yeah, I saw the others when I got PDI working. Lots of production signatures and user bytes and such
[02:52:10] <OndraSterver> ye
[02:52:14] <OndraSterver> so PDI works. Good! :D
[02:52:20] <OndraSterver> the only pins I did not try out for soldering issues :D
[02:52:26] <megal0maniac> With an overclocked U2S :P
[02:52:34] <OndraSterver> actually I did try them out, sorry
[02:52:43] <OndraSterver> or didn't... don't remember
[02:52:44] <megal0maniac> Pins 3 & 4 might be loose
[02:52:45] <OndraSterver> I am JTAG guy
[02:52:53] <OndraSterver> 3 & 4?
[02:53:04] <megal0maniac> Yes. The NC pins which you can't test :P
[02:53:07] <OndraSterver> ..
[02:53:12] <OndraSterver> I ment the QFN soldering
[02:53:31] <megal0maniac> Ah. Do you know anything about "bed of nails" testing?
[02:53:36] <OndraSterver> sure
[02:53:49] <OndraSterver> I am using poor man's version of it :P
[02:54:05] <OndraSterver> row of bargraphs
[02:54:08] <OndraSterver> to test all the IOs
[02:54:13] <OndraSterver> and JTAG is tested when flashing bootloader
[02:54:25] <OndraSterver> I am testing PDI too now
[02:54:50] <OndraSterver> and USB is tested when flashing the demo code (which tests the IO pins)
[02:55:23] <OndraSterver> meh, I am awake for an hour and a half
[02:55:24] <OndraSterver> I shall get up
[02:55:43] <megal0maniac> I'm at work already :P/
[02:55:45] <OndraSterver> heh
[02:55:59] <megal0maniac> What the hell smiley was that?? Sorry
[02:56:01] <OndraSterver> I am going to party today... one of my girl friends is having 20 yo bday party
[02:56:02] <OndraSterver> :D
[02:56:13] <OndraSterver> notice the sad space between girl and friend :
[02:56:14] <OndraSterver> :D
[02:56:58] <OndraSterver> GETTING UP!
[02:57:05] <megal0maniac> GOOD LUCK!!
[02:58:46] <creep> quartz crystals are machined to have an exact mechanical resonance frequency within a few ppm, like +-10ppm for watch crystals, resistance and capacitance depends more on temperature, and 1-10% precise components are common.
[02:59:20] <megal0maniac> creep: Even less that 1% on an xtal, often
[02:59:33] <creep> 10ppm is less than 1%.
[02:59:36] <megal0maniac> 10% is unusable for USB or even UART
[02:59:53] <creep> 1% is for R and C
[03:00:19] <megal0maniac> Oh. You said "1-10%"
[03:00:38] <megal0maniac> You meant ppm? :)
[03:00:55] <creep> no, standard resistor accuracy
[03:01:14] <creep> 1 kiloohm +-10%.
[03:01:18] <megal0maniac> I thought you were talking about the xtal
[03:01:22] <megal0maniac> I understand!
[03:01:29] <creep> xtal vs RC osc.
[03:02:17] <megal0maniac> Yes, but by components, I thought you meant xtals. Misunderstanding.
[03:03:14] <megal0maniac> And then when you said "R and C," I heard RC (osc)
[03:03:30] * megal0maniac needs to go back to sleep
[03:08:48] <OndraSterver> 10ppm = 10*10^-6
[03:08:55] <OndraSterver> 10% = 10*10^-2
[03:09:08] <OndraSterver> thus <creep> 10ppm is less than 1%.
[03:09:10] <OndraSterver> by far :P
[03:09:48] <OndraSterver> ppm = parts per milion
[03:09:57] * megal0maniac knows
[03:10:00] <OndraSterver> so for 32.768kHz xtal it is really, really little
[03:10:19] * megal0maniac just misunderstood, because me is tired
[03:10:21] <OndraSterver> or is it "ppm" as "per value"
[03:10:31] <OndraSterver> sometimes the names do not reflect what they mean
[03:10:46] <OndraSterver> (eg when you go to apple store to buy an apple, but all they have are phones and tablets and laptops)
[03:11:18] <OndraSterver> breakfast + Fringe time.
[03:11:20] <OndraSterver> for me
[03:11:43] <megal0maniac> I'm doing what I did with the datasheets, with the xmega appnotes
[03:11:49] <megal0maniac> Downloading 'em :)
[03:11:52] <OndraSterver> heh
[03:11:54] <megal0maniac> (Bulk)
[03:46:58] <OndraSterver> Mike has just uploaded xray teardown part 1 :)
[04:02:47] <megal0maniac> Done. Always takes longer than I think it should...
[04:16:17] <megal0maniac> It seems that PDI and TWI are nearly interchangable terms
[04:16:26] <OndraSterver> huh?
[04:16:31] <OndraSterver> they work completely different
[04:17:13] <megal0maniac> One of the appnotes talks about an xmega128a1 having a TWI bootloader
[04:17:19] <OndraSterver> yes
[04:19:47] <megal0maniac> I was under the impression that TWI was for attiny devices without SPI
[04:19:54] <OndraSterver> TPI*
[04:19:54] <OndraSterver> :)
[04:20:01] <megal0maniac> OOH
[04:20:03] <OndraSterver> TWI = I2C
[04:20:03] <megal0maniac> Mkay
[04:20:08] <megal0maniac> Doh.
[04:20:11] <megal0maniac> I knew that :/
[04:20:12] <OndraSterver> which is almost SMBus
[04:20:22] <OndraSterver> they are compatible the way that SMBus is a subset of TWI
[04:22:25] <megal0maniac> TPI and PDI are similar :P
[04:22:30] <megal0maniac> That much I know
[04:33:53] <megal0maniac> The simulator is very cool. Although you need another screen to watch IO and such..
[04:34:17] <Richard_Cavell> why do you need a simulator for AVR?
[04:34:23] <Richard_Cavell> It's really easy to get your hands on an actual AVR chip
[04:34:37] <megal0maniac> Because debugging.
[04:35:35] <megal0maniac> I have lots of AVR chips, I don't have a dragon / JTAGICE / AVRONE etc
[04:36:17] <Steffanx> Who needs a debugger when you have LED and/or a buzzer?
[04:36:26] <Steffanx> *a LED
[04:36:40] <megal0maniac> Steffanx: Someone who wants to figure out AVR debugging :)
[04:36:51] <Steffanx> Oh and don't forget printf of course
[04:37:02] <megal0maniac> mmm.
[04:37:56] <megal0maniac> I'm also looking at the changes in the registers while the chip starts up / clock source changes etc.
[04:38:47] <megal0maniac> OndraSterver: What did you change to get 80mhz? I want to try 64mhz, and I know that PLL is already at max
[04:38:56] <megal0maniac> Just in the blinky demo
[04:39:18] <megal0maniac> Steffanx: *an LED
[04:39:20] <megal0maniac> ;)
[04:39:20] <OndraSterver> set the PLL source to RC32
[04:39:23] <OndraSterver> instead RC2M
[04:39:29] <Steffanx> I pronounced it as led :P
[04:39:40] <OndraSterver> it gets downscaled to 8MHz for base
[04:39:43] <Steffanx> and i still do
[04:39:46] <OndraSterver> and then you can do 8*1-31
[04:39:53] <OndraSterver> or further /2 and get 4MHz steps
[04:40:39] <OndraSterver> I am afk
[05:21:01] * megal0maniac is testing xmegaduino
[05:31:41] <megal0maniac> OndraSterver: akafuino_x ~= xboard mini
[05:33:46] <BorgCuba> hi, is there some 8051 channel on freenode (besides #8051)?
[05:36:26] <Xark> BorgCuba: Not that I have seen. I have been paying with 8051 recently...
[05:36:35] <Xark> playing even. :)
[05:37:49] <OndraSterver> megal0maniac, nope, he has xmega32a4, I have 32a4u :P
[05:37:50] <OndraSterver> with onboard USB
[05:37:54] <OndraSterver> and he prices it at $49.99
[05:37:55] <OndraSterver> lmao
[05:38:06] <OndraSterver> and I will be having there SMPS (on arduino that is)
[05:38:14] <megal0maniac> That's why ~= and not == :)
[05:38:21] <OndraSterver> ah
[05:41:09] <BorgCuba> Xark, same for me. I bought this cy7c68013 (ezusb) board some time ago and want to write some firmware in order to use it with the ols (open logic sniffer) java firmware
[05:41:55] <Xark> BorgCuba: Cool. I have OpenLogic sniffer board (great stuff).
[05:42:44] <BorgCuba> so far I was able to log some UART data but since I am not yet using timers to get a constant well defined recording rate the software displays a wrong baud rate (and the first maybe 10bytes of data are messed up)
[05:42:58] <OSterver> megal0maniac, hmm he is using diodes + resistors
[05:43:01] <OSterver> but the wrong way!
[05:43:02] <OSterver> lol
[05:43:04] <megal0maniac> OndraSterver: Wow. I downloaded his "fork" of Arduino, but it doesn't include support for any non standard stuff (i.e. xmega)
[05:43:11] <OSterver> eh
[05:43:31] <megal0maniac> Thought it might be useful. Obviously not. What's he doing with diodes and resistors?
[05:43:37] <OSterver> clamping
[05:43:37] <BorgCuba> Xark, indeed the client is pretty good. I dont own a ols board though
[05:43:38] <OSterver> but the wrong way
[05:43:44] <Richard_Cavell> Is there any point in learning Arduino for someone who already knows AVRs?
[05:43:48] <OSterver> you should have resistors and THEN diodes
[05:44:12] <OSterver> I suppose I could add bulk resistors on the smaller xboards - not the breadboard ones and probably nor the ultra
[05:44:14] <Amadiro> Richard_Cavell, not really, unless you want to create a board that is arduino compatible
[05:44:16] <OSterver> there is just not enough space
[05:44:18] <Xark> BorgCuba: So you are setting UART baud rate timers correctly?
[05:44:21] <megal0maniac> He's the guy who's currently maintaining the xmega arduino clone. But it's only for the 128a1 and the 32a4
[05:44:30] <OSterver> hmm
[05:44:38] <OSterver> well what is a4 compatible runs on a3
[05:44:44] <OSterver> same for a1 except EBI and the remaining ports
[05:44:46] <OSterver> and second DAC
[05:44:56] <megal0maniac> Might be worth looking at
[05:45:05] <megal0maniac> There's no PORTR so I couldn't test :P
[05:45:10] <OSterver> heh
[05:45:13] <Richard_Cavell> So what's everyone up to today?
[05:45:18] * Richard_Cavell has been studying all day
[05:45:22] <Amadiro> Richard_Cavell, all arduino gives you is a (very shitty) IDE for easy programming and a bunch of library functions that make programming easier at the cost of some speed & flexibility
[05:45:27] <OSterver> I do wonder what resistor value is he using
[05:45:31] <OSterver> 10k probably
[05:45:41] <Amadiro> Also studying.
[05:45:44] <Richard_Cavell> Amadiro: I don't find anything difficult about programming using the avr-gcc toolchain
[05:45:48] <Richard_Cavell> suits me just fine
[05:45:55] <Xark> BorgCuba: Also, you are saying that after the first 10 bytes, it then transmits reliably? Sounds like some kind of framing error...
[05:45:57] <Richard_Cavell> Amadiro: what are you studying?
[05:45:59] <Amadiro> Richard_Cavell, then you won't really get anything out of arduino as a user.
[05:46:10] <Amadiro> I'm studying algebraic topology.
[05:46:13] <OSterver> you don't need the diodes since it is clamped in the xmega itself internally
[05:46:20] <OSterver> and if you put big enough resistor it does not damage the chip
[05:46:27] <Richard_Cavell> Today I'm playing Crysis and Toki Tori. Learning ECG interpretation and general anatomy, watching a Windows tutorial and reading the C89 draft
[05:46:37] <BorgCuba> Xark, actually my la firmware waits for the "run" command and then I wait for the uart line to become low (fixed trigger). When this trigger condition is met I read 2k from port b and send it back to the client.
[05:47:16] <BorgCuba> The data I am logging comes from a ft232 via "cat some.txt > /dev/ttyUSBn"
[05:47:42] <Xark> BorgCuba: I see. So your 8051 isn't doing the acquisition, just relaying the data.
[05:48:02] <Amadiro> Richard_Cavell, why not C99 instead, it's much prettier
[05:48:21] <Xark> BorgCuba: I bet a OLS would help you to diagnose this problem. :)
[05:48:33] <RikusW> Richard_Cavell: seems ECG interpretation is as much a art as a science ?
[05:49:04] <BorgCuba> Xark, the 8051 is indeed recording the data from its port b and the transmitting it to the client
[05:49:06] <Richard_Cavell> LOL well there are some basics to learn
[05:49:16] <Richard_Cavell> Amadiro: I'm going in chronological order
[05:49:59] <BorgCuba> Xark, I want to make this recording more sophisticated i.e. I want to capture at a fixed rate using a timer and I want to do this in inline asm
[05:50:11] <RikusW> Richard_Cavell: wouldn't it be possible to write an AI app to do ECG analysis ?
[05:50:41] <Richard_Cavell> RikusW: Sure. Modern ECG machines do give interpretations
[05:50:42] <Amadiro> Richard_Cavell, if you're going in chronological order, you can just read the diffs (I'm sure someone has put them up on the internet)
[05:51:07] <Xark> BorgCuba: Hard for me to say what might be going wrong. Sounds like it is "mostly" working. I am not sure exactly why using a timer would be required for reliable UART data transmission (although I can see you wanting to use a timer that to capture good data with reliable timing).
[05:51:10] <Amadiro> after all they don't change that much between the standards
[05:52:03] <BorgCuba> Xark, not reliable UART data transmission but for the data acquisition at a fixed rate
[05:52:11] <megal0maniac> OSterver: If you want to take a look... OSC.PLLCTRL = OSC_PLLSRC_RC32M_gc | 16; // prepare PLL. PLL = Phase Locked Loop. It basically multiplies some
[05:52:23] * megal0maniac rage
[05:52:30] <Xark> BorgCuba: Right. But I am saying, I am not sure why you would get 10 garbage bytes (and how a timer would help that).
[05:52:33] <megal0maniac> http://pastebin.com/p2qJVNjB
[05:52:47] <OSterver> megal0maniac, with what?
[05:52:54] <RikusW> megal0maniac: just don't break some AVR into pieces :-P
[05:53:41] <megal0maniac> OSterver: I pasted part of your code demo instead of the pastebin link :)
[05:53:43] <Xark> BorgCuba: However, timer is pretty easy if you want to use it.
[05:53:51] <RikusW> megal0maniac: there was a guy that enabled DWEN and later broke his AVR in half...
[05:53:52] <OSterver> megal0maniac, I know
[05:54:02] <BorgCuba> Xark, true. I dont know how the ols UART analyzer works in detail, but maybe a fixed rate would help
[05:54:13] <megal0maniac> I think if you just change the pin definitions, you should be able to at least make a .hex file for coco
[05:54:20] <BorgCuba> Xark, here is my code: http://pastebin.com/vsuxPfP0
[05:54:44] <megal0maniac> RikusW: You told me about that. I sent my AVR to the post office, which it seems is equally dangerous
[05:54:44] <BorgCuba> the asm must be faulty, it never finishes
[05:55:30] <BorgCuba> Okay, I am aware of one fault, I dont reload the timer value but I think I will switch to 8bit timer automatic reload (mode 2?) anyway
[05:56:11] <RikusW> megal0maniac: lets hope it arrives here sometime soon
[05:58:33] <Xark> BorgCuba: Ok. Also, I am unclear how DPTR is updated. I see you inc dph, but not DPTR or dpl...
[05:59:18] <Xark> BorgCuba: Wait...that is commented out (sorry, hard for me to see...I am tired). :)
[05:59:27] <BorgCuba> yes! I though maybe movx @r0, A is equivalent to "[dph:ro] = A" ???
[05:59:59] <Xark> BorgCuba: No. AFAIK, that can only read 0-0xff. You need to use @DPTR
[06:00:06] <Xark> (and inc DPTR)
[06:00:20] <BorgCuba> okay, let me see if this fixes it
[06:03:58] <BorgCuba> okay, I changed it to this: http://pastebin.com/MbQqtsWv
[06:06:23] <BorgCuba> Xark, the trigger condition is the problem (it never gets past line 28)
[06:07:50] <Xark> BorgCuba: So you want to wait until bit 1 is true for your trigger?
[06:08:40] <BorgCuba> actually I want bit 1 to become 0 (I think UART is high on idle), this trigger works: "while (1) { b = IOB; if ((b & 0x02) == 0x00) break; }"
[06:09:03] <Xark> BorgCuba: Hmm, are you missing a "#"?
[06:09:14] <BorgCuba> indeed, let me check
[06:09:31] <Xark> BorgCuba: Probably using contents of location zero...
[06:10:00] <Xark> (which I think is reset vector)
[06:10:03] <BorgCuba> Xark, perfect, thank you!
[06:10:47] <BorgCuba> the problem was this: "anl A, #0x02" it works with #0x02 instead of 0x02
[06:11:05] <Xark> BorgCuba: Ahh, you were missing a couple. :)
[06:11:50] <OndraSterver> BLOODY INTERNET
[06:11:54] <BorgCuba> you mean also for "cjne" (the second argument?)
[06:12:28] <Xark> BorgCuba: Yes. Don't you want literal zero there too?
[06:13:31] <BorgCuba> yes, indeed, I fixed that too.
[06:13:36] <Xark> BorgCuba: BTW, I think you can save a few cycles by directly jumping based on the ACC.1 bi using 8051 feature (bit addressable memory). :)
[06:13:42] <Xark> bit*
[06:14:09] <Xark> Like: jbc ACC.1, 00001$
[06:14:25] <Xark> (and omit the AND)
[06:14:30] <Xark> anl*
[06:14:33] <BorgCuba> okay, I think you are right
[06:14:57] <Xark> BorgCuba: No worries. I have been coding a bit-banged VGA video driver, so I am sensitive to cycles. :)
[06:15:28] <BorgCuba> but are you sure? I thought it means "jump on bit set + clears bit afterwards"
[06:15:43] <Xark> BorgCuba: http://imgur.com/a/Jtr2C#1
[06:16:18] <Xark> Hmm, I may have the wrong opcode...
[06:16:28] <BorgCuba> Xark, nice :-)
[06:16:30] <Xark> However, there is just JB or something.
[06:16:35] <BorgCuba> http://www.keil.com/support/man/docs/is51/is51_jbc.htm
[06:17:09] <BorgCuba> but I think "jnb" should work
[06:17:17] <BorgCuba> (http://www.keil.com/support/man/docs/is51/is51_jnb.htm)
[06:17:31] <Xark> BorgCuba: Yes, sorry. I am on my 2nd glass of wine and headed for bed. :)
[06:17:33] <RikusW> Richard_Cavell: http://www.dpd.cdc.gov/dpdx/HTML/ImageLibrary/Babesiosis_il.htm
[06:18:03] <BorgCuba> Xark, okay :-) But thank you for the great help!
[06:18:40] <Xark> BorgCuba: NP. Fun to meet a fellow 8051 coder on freenode. :)
[06:18:58] <Richard_Cavell> RikusW: never heard of Babesia
[06:19:08] <Xark> BorgCuba: In #avr no less. :)
[06:19:31] <BorgCuba> yes, indeed
[06:20:05] <BorgCuba> but there seems to be no serious 8051 channel
[06:20:06] <RikusW> Richard_Cavell: a tick parasite that destroys RBCs somewhat similar to malaria
[06:20:18] <Richard_Cavell> I already don't like it
[06:20:51] <Xark> BorgCuba: Right. I guess ##asm would be the "proper" channel (all architectures welcome - and I lurk there too). :)
[06:21:15] <BorgCuba> next time, I'll go there
[06:21:21] <megal0maniac> This pin mapping is friggin confusing...
[06:21:41] <RikusW> Richard_Cavell: ever worked with blood smears ?
[06:23:01] * RikusW needs some Giemsa stain....
[06:23:19] <Richard_Cavell> Did a few in med school
[06:24:52] <RikusW> I did a few of my own
[06:25:47] <RikusW> Hematology is fascinating
[06:31:13] <megal0maniac> OSterver: Interrupts on all coco pins?
[06:36:30] <megal0maniac> http://pastebin.com/cHpYWEdk
[06:36:36] <megal0maniac> That's what I've got so far.
[06:36:56] <megal0maniac> If anything there makes you laugh, let me know
[06:42:03] <theBear> lol, /me tries to control himself
[06:42:10] <theBear> i find chromatography fascinating tho
[06:43:24] <theBear> megal0maniac, seriously ? i'm too drunk to read it before i comment, but umm, i feel there is a LOT of redundancy there
[06:43:57] <theBear> holy crap ! just got to the end, are you serious ? oh wait ! it's a pindef ?
[06:43:59] <theBear> i am too drunk
[06:44:05] * theBear excuses his comments and himself
[06:45:04] <megal0maniac> theBear: The original is redundant too, and it was FAR fewer pins :/
[06:46:02] <theBear> hehe :) that's cool, i assumed it was code
[06:55:44] <megal0maniac> What do you do if solder won't stick to a wire?
[06:55:51] <OSterver> megal0maniac, yes
[06:55:53] <OSterver> interrupts on any pin
[06:55:59] <OSterver> each port has one or two async, the rest is sync only
[06:56:04] <megal0maniac> Make the iron hotter or colder?
[06:56:23] <megal0maniac> OSterver: I found the "Pinout and pin functions" section and printed it :)
[06:56:29] <OSterver> :)
[06:56:33] <megal0maniac> So I know where I2C/SPI is
[06:56:38] <OSterver> everywhere :D
[06:56:43] <megal0maniac> Well. Yes
[06:56:49] <OSterver> I suggest using UART over SPI
[06:56:51] <OSterver> UART in SPI mode that is
[06:56:54] <OSterver> it can work with DMA :P
[06:56:59] <OSterver> SPI can work with DMA only as a slave
[06:56:59] <megal0maniac> No SPI on PORTD though, because of USB
[06:57:05] <OSterver> ^
[06:58:06] <megal0maniac> I'm just mapping pins
[06:58:12] <OSterver> as a note - you can use the second SPI (on the upper nibble) just as UART without rewiring - you can in software switch the two pins
[06:58:23] <megal0maniac> Using E for SPI
[06:58:24] <OSterver> XCK with RXD or something
[06:58:58] <OSterver> and it feeeeelsss... good!
[06:59:10] <OSterver> afk, bath time
[07:22:17] <OSterver> Simple question with two possible answers: Do you wear a beard? Answers - YES or NO
[07:22:28] <OSterver> (Wondering if the electronic guys do or don't)
[07:23:23] <RikusW> Ayes short
[07:23:33] <OSterver> mkay
[07:23:41] <RikusW> you ?
[07:23:42] <OSterver> I am making a survey whether I should keep it or take it down.. again
[07:24:04] * RikusW is not feeling like shaving every day...
[07:24:29] <OSterver> I shaved on 15th or 17th of July
[07:24:30] <OSterver> last time
[07:24:38] <OSterver> well, I cut some odd pieces there and there
[07:24:40] <OSterver> but keep the main part
[07:25:30] <RikusW> thats a while ago ;)
[07:25:39] <RikusW> must be longish now ?
[07:25:50] <OSterver> something about 2.5cm
[07:25:55] <OSterver> it slows down after a month or so
[07:25:57] <OSterver> almost stops
[07:26:07] * RikusW wonders why
[07:26:16] <OSterver> beats me
[07:26:25] <RikusW> some length dectection genes ? :-P
[07:26:25] <OSterver> I just cut the above lips because it grows awfuly slow
[07:26:27] <OSterver> :D
[07:26:58] * RikusW had 3cm or so, a bit shorter now
[07:28:49] * megal0maniac just fixed a pair of headphones with some folded paper and sticky tape :)
[07:29:02] <OSterver> eww sticky headphones
[07:29:10] <megal0maniac> Well not yet
[07:29:16] <megal0maniac> And they aren't mine so meh.
[07:33:47] <megal0maniac> OSterver: Would you mind glancing over the pindefs at some stage?
[07:34:08] <OSterver> maybe, but not today
[07:34:10] <megal0maniac> Maybe a comment or suggestion here and there :P
[07:34:10] <OSterver> I am leaving in a bit
[07:34:33] <megal0maniac> Mkay
[07:35:20] <OSterver> leaving ya'll for some ... girls
[07:35:42] <megal0maniac> Heh. Partei zeit!
[07:35:52] <OSterver> ja wohl!
[07:35:55] <megal0maniac> Funkyzeit!
[07:36:14] <vsync_> MIT BRĂśNO!
[07:36:16] <vsync_> oooh
[07:38:37] <megal0maniac> nein
[07:38:44] <megal0maniac> keine br*no...
[07:39:30] <OSterver> what the hell is bruno
[07:40:03] <megal0maniac> ALI-G!
[07:40:09] <OSterver> huh?
[07:40:16] <megal0maniac> The Dictator?
[07:40:18] <megal0maniac> Borat?
[07:40:23] <OSterver> yes
[07:40:30] <megal0maniac> That guy. I assume
[07:40:37] <OSterver> what with him
[07:40:46] <megal0maniac> Funkyzeit.
[07:41:24] <megal0maniac> Analog comparator can be used as a constant current source??
[07:41:44] <OSterver> yep
[07:42:26] <megal0maniac> on mega as well?...
[07:43:09] <OSterver> that is how it works
[07:44:02] <megal0maniac> That's news to me
[07:45:48] <megal0maniac> I try not to act like a n00b, but the reality is that I'm one of the biggest ones on this channel :)
[07:46:01] <megal0maniac> (figuratively speaking. I'm only 62kg)
[07:46:40] <OSterver> I am 80kg
[07:46:41] <OSterver> .
[07:47:28] <megal0maniac> Most people will weigh more than me
[08:02:17] <megal0maniac> OndraSter: Enjoy the party
[08:04:32] <OndraSter> will do! :D
[08:04:32] <OndraSter> thanks
[08:06:44] <tld> 30 awg is… *sigh*
[10:07:41] <tld> I think Hell has a full factory, dedicated to forcing people to use 30awg on veroboard.
[10:22:30] <creep> and pic microcontrollers?
[10:23:21] <creep> and they speak spanish
[10:38:25] <theBear> lol, apart from spanish, spanish is cool
[10:38:37] * theBear est muy caliente !
[10:51:24] <tld> I understand PIC assembly is the kind of thing that makes grown men cry. What about PIC and C?
[10:52:04] <theBear> i err, thin kyer asking in the wrong end of town
[10:52:23] <theBear> pic doesn't make me cry, but everytime i hear a pic has been programmed, i shed a single tear, double for basic stamps
[10:58:53] <tld> basic… :(
[10:59:28] <creep> xilinx is almost there...
[11:00:09] <creep> we would need a free compiler that is not multi DVD and it would be much more usable
[12:11:39] <topi`_> hi. Is there a good chan for AVR ISP programmers? I have some problems with mySmartUSB
[12:44:52] <tld> topi`_: This place?
[12:44:59] <tld> topi`_: better to ask and see.
[12:45:12] <tld> I don't know the mySmartUSB specifically, but I know others, and some might know it.
[12:45:36] <tld> good chance it's a clone or workalike to something someone knows.
[12:46:11] <tld> my german is crap, but I think the web page says it works with AVR Studio, so probably an MK2-clone?
[12:51:37] <Casper> mysmartusb... sound like junk programmer
[14:19:43] <RikusW> Richard_Cavell: http://imgur.com/a/R1GLU
[14:20:10] <RikusW> Richard_Cavell: I don't think a bloodsmear's feathered edge is supposed to look like that....
[14:26:16] <Steffanx> What's the plan RikusW ?
[14:26:39] <RikusW> no plan yet
[16:27:25] <megal0maniac> How would one interface an AVR to a button matrix?
[16:28:00] <theBear> i dunno how he would do it, i'd tend to go classic style, i/o ports, maybe some diodes.... you wanna schem for reference ?
[16:28:02] <megal0maniac> As in, if you connected each pin in the matrix to an IO pin on the AVR, what would you have to do to "push buttons" ?
[16:28:15] <megal0maniac> If you have one, that'd be great]
[16:29:04] <theBear> megal0maniac, oh, what you do is, say you got 8*8 .... you 'drive' the first 8 pins, and read the 2nd 8, so first 8 is just a walking bit, like *2 style, 1 column at a time, and every step you read the other 'input' port to detect what is pressed
[16:29:14] <theBear> lemme find a schem almost as old as me... no avrs, but it should explain things
[16:30:51] <theBear> http://www.cykong.com/Synths/Roland%20MC-202/Files/Roland%20MC-202%20Schematics%20Digital%20Section%20Coloured.gif meh, not EXACTLY what i had in mind, but easier to find.... pretty sure you find the diodes are only added to allow 'bussing' with other stuff (in this case err, dram, pulldowns and err, some kinda fig 8 driver
[16:31:11] <theBear> but if those words and that picture aren't enough for you to work it out, well, you may never work it out
[16:31:19] <megal0maniac> I don't need to read the buttons, I just need to control them. The button matrix already exists. I just want to... automate stuff :)
[16:31:35] <Horologium> just need 16 i/o pins. cycle through 8 pins as outputs and on each step read the other 8 to see what inputs are.. 8x8 matrix, rows inputs are connected to one set of 8 and column outputs are connected to the other 8
[16:31:41] <theBear> oooooooh
[16:31:42] <theBear> sorry
[16:31:56] <Horologium> what do you mean, control them?
[16:31:59] <megal0maniac> Yes
[16:32:44] <theBear> megal0maniac, in that case, the 'simplest' way is to workout how they scan the existing matrix, somehow sync to that, then just drive the lines hi/lo as you wish (you don't 'short' anything, circuit just thinks you are pressing buttons), more part consuming but 'no thinking' would be something like a relay/transistor per button
[16:33:46] <megal0maniac> Hmmm... I think I'll just have to see how the existing one works. Just hope it doesn't run at 12V, but it probably does...
[16:34:42] <theBear> for example in my demo-schem, scanning is happening on err, pe (pb?) 8-15, you'd 'read' those lines, and at appropriate times drive db0-7 high, that example schem/program/circuit is actually a little more complex, 'cos you might have to think/process a bit to avoid interfering when it is talking to the dram chip
[16:34:48] <theBear> megal0maniac, what you interfacing ?
[16:36:01] <megal0maniac> Alarm system control panel. Want to hook it up to a remote control. At the moment, you manually type in the code and it gives you 3 minutes before it arms. Same applies when you re-enter the house. Not secure.
[16:36:27] <theBear> woah, 3minutes ? you wanna get the programming code and cut taht down a lot, but that aside
[16:37:34] <theBear> same kinda thing SHOULD apply, usually they have something between a generic micro doing the scanning -> alarm-proprietry-language -> cable stuff, and discrete logic doing the same job... at least they don't have extra peripherals and crap they trying to run off the same pins (at least none i ever seen)
[16:38:07] <theBear> even 'better' would be to workout the code/protocol it uses back to the main station and talk that, assuming it works bus style (most do, to support multiple panels)
[16:38:48] <megal0maniac> Well I'd have a remote control sending an "arm" signal to the AVR, which would "push" the buttons in order to arm immediately. I can read the state of the LEDs to check the alarm status, and thus what action to take if a remote signal is received
[16:39:03] <megal0maniac> But sniffing the wires to the main box isn't a bad idea either
[16:39:13] <theBear> also depending on what EXACTLY you wanna 'pretend to press' you may be able to achieve it with some kinda aux-input at the basestation-box (and maybe) some programming
[16:39:29] <megal0maniac> I think there are like 4 or 5, and two of them are probably power
[16:39:58] <megal0maniac> The thing is like 20 years old :) I'd like to add some "intelligence" to it
[16:40:04] <megal0maniac> i.e. programming
[16:40:04] <theBear> megal0maniac, erm, you saying you wanna lose the 3 min delay ? 'cos i hate to say, but that 'panel' is 'stupid' (assuming a 'real'/standard style alarm) .... the main box is doing the delay, not the panel
[16:40:25] <megal0maniac> theBear: There's an "instant" button on the panel..
[16:40:41] <megal0maniac> Which is useful if you're only arming the exterior sensors
[16:40:45] <theBear> a good friends brother (he's far away, pretty sure i can still contact easily tho) is an alarm-dude.... slightly above average, so he often can find tech manuals, programming manuals and/or secret/factory codes
[16:40:58] <theBear> ahh, got ya, yeah, code + instant when already outside works fgood
[16:41:57] <megal0maniac> theBear: I can't ask that of you without checking it out properly first :P All I've seen so far is that the buttons are on a matrix, and that there are 4 or 5 wires going to the box.
[16:42:17] <megal0maniac> Was just curious as to how I'd drive a matrix :)
[16:42:43] <theBear> megal0maniac, yeah, if you got an instant button it doesn't matter.... if you get 'stuck' and are looking for ANY info on programming mode/codes/what means what, or a potential (but rare) standard programming code for a unit/series, he's the guy
[16:43:12] <theBear> on reflection tho, if you aren't in the same country, it's unlikely any specific info will be handy, seems alarms are fairly location-specific
[16:43:27] <megal0maniac> Never seen another one of these ones
[16:43:33] <Horologium> even region to region in the same country.
[16:43:42] <theBear> only know so much/got interested 'cos i had a pair of them to hack/generally maintain at an old work
[16:43:45] <megal0maniac> I've noticed the same, though.
[16:44:24] <theBear> Horologium, to an extent, this is a 'big' country, but companies that make that kinda thing (alarm panels/systems or anything 'complex' and eletronical) are uncommon here, so most states share brands
[16:44:52] <megal0maniac> The box might already have a connector for a remote, but I sort of hope that it doesn't :) Making an AVR do it would be more fun
[16:45:43] <megal0maniac> Cool, I'm off to bed. Thanks for the info :)
[16:46:29] <megal0maniac> Will let you know what transpires
[16:46:35] <theBear> i'm quite fond of the cut-cable style that 'standard' alarms/sensors/horn/lights use too... havent' ever looked deeply into it or tried to draw my own schem, but the basic idea is to ALWAYS have a resistor across the sensor lines, from memory, feed the line 12v, 0v is 'alarm' (ie. open collector on pir/whatever) maybe 4-8v is 'ok/idle' (resistor on the line, but inside the whatever/after the 'cable') and 12v is cablecut/emergency
[16:46:39] <theBear> good luck :)
[16:48:18] <megal0maniac> Thanks
[16:49:10] <theBear> hehe, first week we moved into that warehouse (we fitted it out before we started working there) i foudn the 2nd old alarm base unit up in the roof, asked if it worked and got standard 'i dunno, can't do, we been coming in and out all week' ... ok i thought (never having dealt with alarms much before) ... start disconnecting this and that, pay a LITTLE attention so i can at least re-use cables/sensors/whatever... about 2 wires in WEEOOOOOOWEEEOOOOOOO WEEO
[16:49:11] <theBear> OOOOOOO MY GOD ~! the backup horn is RIGHT NEXT TO MY HEAD AND IT WON'T STOP AND I'M IN A BIG CONCRETE RESONANT AAAAHHHHHHHH
[16:49:23] <Horologium> also using resistive material for window break tape so if they try to short across the tape you get a different resistance, causing an alarm condition.
[16:49:51] <Horologium> sounds like fun!
[16:49:53] <theBear> psu ? grab it out of socket and throw it away, NOTHING ! random wires off, NOTHING ! pull other cover/lid off, OOOOOH ! disconnect gel cel
[16:49:55] <theBear> FWOOOOOO
[16:50:22] <theBear> hehe, i learnt 50% of what i needed to know about alarms in those paniced moments :)
[16:51:21] <Horologium> always carry a grenade to disarm the alarm.
[16:51:53] <theBear> but i had fun... had some success with a breadboarded ponyprog microwire interface for talking to the little eeprom in them, had some success messing with the non-installed unit, before i was finished tho, the installed one started to die, and well, it wasn't worth continuing... did learn a lot about 'how they REALLY work' and programming and programming without codes/reverse engineering etc etc
[16:51:58] <Horologium> open cover, pull pin, release spoon, insert grenade, close cover, duck.
[16:52:13] <theBear> it's called a spoon ? something new every day
[16:52:15] <theBear> hehe, what a silly name
[16:52:28] <Horologium> looks like a spoon, or did on the ones in ww-2.
[16:53:01] <theBear> hehe, i spose
[16:53:03] <Horologium> when the spoon flies up it releases a hammer which flips over and hits a firing cap just like in a .38 special round.
[16:53:24] <Horologium> under firing cap is a slow burning fuse material that burns down to the explosive inside.
[16:53:33] <theBear> ahh, got ya
[16:53:41] <theBear> always kinda wondered how that bit works
[16:53:42] <Horologium> as grenades age the slow burning fuse gets to where it burns faster.
[16:53:50] <theBear> also good to know :)
[16:53:58] <Horologium> so, new grenads, 3 seconds
[16:54:13] <Horologium> old grenades, like from vietnam era, 0.1 to 1 seconds
[16:54:17] <theBear> so hammer is spring loaded ? 'gentle' releasing of the spoon still lets it start the fuse right ?
[16:54:27] <Horologium> yes.
[16:54:28] <theBear> eek, .1 is a bit close for comfort
[16:54:49] <Horologium> once the spoon flips up a certain amount the hammer is released and POW.
[16:55:03] <theBear> hmm, all this talk of metal on metal 'hinged' stuff makes me think of the bucket of degreaser and pushbike parts in my kitchen that i'm avoiding again :)
[16:55:35] <Horologium> it is possible to take a grenade apart and shorten the fuse, even dramatically down to almost nothing.
[16:55:36] <theBear> so all that movie crap about grabbing the spoon after a second or two to 'pause' the fuse/countdown, is utter bullshit i guess ?
[16:55:43] <Horologium> which is good for making traps with them.
[16:55:57] <Horologium> once the spoon flips up there is a little click-pop.
[16:56:14] <Horologium> once that click-pop happens, mister grenade is no longer your friend.
[16:56:31] <theBear> yeah, makes sense... .wonder how many idiots have blown themselves up after seeing some hollywood movie, getting in a situation and deciding to grab a grenade/spoon a second before it explodes :)
[16:56:49] <Horologium> once that hammer hits you have the fuse burn time to get that thing away from you.
[16:57:00] <Horologium> saw an idiot rip his front tooth out with a grenade.
[16:57:06] <Horologium> pulled an idiot john wayne move.
[16:57:13] <Horologium> grabbed pin ring with teeth and yanked.
[16:57:23] <Horologium> the pin is a round ring attached to a cotter pin
[16:57:31] <Horologium> said cotter pin is folded over on the back side.
[16:57:44] <Horologium> it is HARD to pull out.
[16:57:52] <Horologium> harder than pulling out teeth.
[16:58:04] <theBear> ooooh, that'd make ya feel err, heh, well not good for sure :)
[16:58:24] <Horologium> in the movies they use fake grenades and/or straighten the pin FIRST.
[16:58:29] <theBear> cotter pin cotter pin, i should know what that is from my youth days hanging out at the metal workshops/yards.. hmmmm
[16:58:37] <theBear> oh, like a split pin ?
[16:58:41] <Horologium> yes.
[16:58:59] <Horologium> take flat piece of metal and fold it over so there is a loop in one end.
[16:59:20] <Horologium> http://www.globalindustrial.com/p/fasteners/Pins/Cotter-Pins/1-16x1-1-2-cotter-pin-zinc-06224PC?utm_source=google_pr&utm_medium=cpc&utm_campaign=Cotter-Pins-google_pr&infoParam.campaignId=T9F&gclid=COGrsvmu7bICFelFMgod1xAAwg
[17:00:03] <theBear> ahh, both got yer, and reminded of one of the most disturbing events in my youth.... got alarmed out of the metal ... damn, geting picked up in a minute.... later dudes :)
[17:00:05] <Horologium> now, if you yank the pin and don't let go of the spoon, the grenade is still fine. It is unsafetied but not fired.
[17:00:32] <Horologium> party hard or don't party at all!
[17:16:24] <tn1> this is bad.. having to define the PRTIM4 constant that should exist according to the atmega32u4 datasheet
[17:17:17] <tn1> (this could explain why i can't get the timer to work on first try)
[17:36:59] <Casper> tn1: if you have to define it, then you have another issue
[17:37:04] <Casper> it should have been defined already
[17:37:16] <tn1> yeah
[17:37:32] <Casper> you probably compiled for the wrong part
[17:38:34] <tn1> i'm actually using a teensy 2.0 (which uses this avr) and i have no prior avr experience ;) but the target is correct in the Makefile :x
[17:39:08] <Casper> so you selected teensy as the target? or the avr that's on it?
[17:40:26] <tn1> http://www.pjrc.com/teensy/index.html it's an easy-mode gateway into avr from what i can tell. arduino alternative (although it's arduino compatible, too)
[17:40:44] <tn1> proprietary bootloader, no need for a programmer
[20:15:22] <Xark> tn1: Interesting, when I look in the Teensy software include/avr/iom32u4.h (which I believe is for ATmega32U4), it does not define PRTIM4, only PRTIM0-3 (however, I do see it in the manual PDF). Does seem like a goofup (perhaps Teensy doesn't have official include or perhaps official include is missing the define).
[20:19:15] <Horologium> or perhaps it was not included in the data from atmel. It has been known to happen. So much data in those datasheets, and they have known to leave out a thing or three here and there.
[20:20:43] <Xark> Horologium: Sure. I heard there is a master XML definition (and also read about some previous mixups with it).
[20:21:22] <Horologium> I see it happen on the mailing lists for avr-libc and avrdude once in a while.
[20:21:24] * Xark checks latest AS6 header for yucks...
[20:23:15] <tn1> awesome, thanks for looking into it
[20:23:29] <tn1> i'm using WinAVR (which is from 2010-01-20) so i don't think it's particular to Teensy, yeah
[20:24:06] * Xark forgot about the special way AS6 executes directly off hard-drive feature (at least that is apparently what it is doing, based on the HDD light staying full-on...).
[20:26:37] <Horologium> isn't that just a windows feature?
[20:27:49] <Xark> Horologium: Yes, my bad. :)
[20:28:22] <Xark> tn1: Ok, just checked same problem with headers with "official" Atmel AS6 latest update. So I think it is just missing. :)
[20:29:18] <tn1> great (then it's something i'm doing wrong)
[20:29:20] <tn1> lol
[20:29:24] <Horologium> no.
[20:29:24] <Xark> Horologium: Very "impressive" how it can burn several GB or RAM and still need the HDD on continuously. :)
[20:29:37] <Xark> of*
[20:29:41] <Horologium> it's in the avr headers.
[20:29:47] <tn1> i mean, Timer4 is markedly more complicated. i can't get it to work yet
[20:29:52] <Horologium> tn1, it isn't you. it was an oversight.
[20:29:59] <Horologium> oh, that.
[20:31:26] <Xark> Horologium: Yes, in AS6 install I can see the XML "definition" files for all the parts. This file is missing PRTIM4 also.
[20:33:51] <Xark> tn1: You are probably fine (if you define your own missing register), but FYI Atmel has released a much more recent GCC toolchain (for Windows and Linux) -> http://www.atmel.com/tools/atmelavrtoolchainforwindows.aspx
[20:35:31] <Xark> (however, those headers also - updated Aug 2012 are missing PRTIM4 too)
[20:35:57] <OndraSter> daddy's home
[20:36:03] <OndraSter> what a ride home
[20:36:07] <OndraSter> I knew I should have gone by car
[20:36:10] <OndraSter> and just not drink there
[20:36:13] <OndraSter> would have been MUCH smipler
[20:36:15] <OndraSter> simpler
[20:36:31] <OndraSter> instead 2.5h drive by bus + tram + by foot I would just drive home in about 1 hour
[20:36:32] <OndraSter> ..
[22:07:24] <Richard_Cavell> Some guy on avrfreaks has a signature that says that main() must never return on an AVR. Has anyone tried returning from main()? What happens if you do?
[22:17:29] <Tom_itx> it quits running
[22:19:29] <Richard_Cavell> can that be a good thing?
[22:19:33] <Richard_Cavell> like a low-power stop?
[22:25:04] <Casper> Richard_Cavell: it's a busy loop
[22:25:13] <Casper> and yeah, main shouln't return
[22:25:19] <Richard_Cavell> but what if you do?
[22:25:24] <Richard_Cavell> is it equivalent to while (1) ;
[22:25:29] <Tom_itx> try it and find out
[22:25:55] <Casper> on older gcc, it was said to run the code after the main, then a busy loop, then I think it just reset
[22:29:19] <Richard_Cavell> I just assembled it using avr-gcc and it actually does a ret
[22:29:40] <Richard_Cavell> I'm not sure what that's going to do exactly, but it'll probably crash the CPU
[22:34:03] <Casper> chance is that it goes to bad_vector
[22:34:44] <Tom_itx> that's for interrupts
[22:34:54] <Tom_itx> if wdt is enabled it may reset
[22:35:31] <Casper> reset is an interrupt
[22:35:33] <Xark> On AS6 it goes to "__stop_program" which just does "rjmp .-2"
[22:35:34] <Casper> technically
[22:36:26] <Tom_itx> but if it falls off the end it will be trying to read unprogrammed hex bits
[22:38:51] * Xark notes save for WinAVR gcc (as expected)
[22:38:54] <Xark> same*
[22:39:31] <Richard_Cavell> so is our conclusion "just don't do it"
[22:39:35] <Richard_Cavell> it's undefined behaviour
[22:40:05] <Xark> Richard_Cavell: Correct. No good reason to do it.
[22:40:27] <Casper> microcontroller, a controller shouln't stop
[22:40:55] <Richard_Cavell> it's certainly a paradigm shift from my usual C experience
[22:40:59] <Richard_Cavell> main() is supposed to return
[22:41:04] <Richard_Cavell> and the value it returns can be used on the command line
[22:42:53] <Casper> yeah... actually, there is a push from the userbase to make gcc complain if the main return for avr... while the current situation is that gcc complain if it do not
[22:43:15] <Casper> and making it non-returnable can save some space
[22:43:42] <Casper> if it can return, it mean it should save some register at the start of it
[22:43:54] <Casper> and restore at exit time
[22:43:55] <Xark> Casper: I believe the C standard requires it to return an int (hence the issue).
[22:44:23] <Xark> Casper: Yes. Currently it "wastes" one stack return.
[22:44:34] <Richard_Cavell> C doesn't require a freestanding implementation to use main()
[22:44:41] <Richard_Cavell> A hosted one does
[22:44:46] <Richard_Cavell> But AVR is freestanding
[22:44:50] <Casper> Xark: possible, but avr are special case, and that standard should be violated, or atleast should be easier to violate...
[22:45:16] <Xark> Casper: Sure. I am all for bending the standard when --ffreestanding is used (e.g.)
[22:46:07] <Xark> However, the stack waste is really due to the init code. It could "jmp" to main (but then it is really undefined it if returns - now [with current libs] it just hangs "cleanly:).
[22:48:12] <Richard_Cavell> it is a waste to have the init code
[22:48:14] <Richard_Cavell> push r29
[22:48:16] <Richard_Cavell> push r28
[22:48:21] <Richard_Cavell> on a microcontroller every byte counts
[22:48:37] <Xark> Richard_Cavell: Well, if that is true, WTH are you using C. :)
[22:48:46] <Richard_Cavell> ha ha
[22:48:49] <Casper> yeah, hence why I say that the standards should have been bent more
[22:48:53] <Xark> Richard_Cavell: Also, simple enough to use your own custom init code.
[22:49:04] <Richard_Cavell> Well for most functions I think C is directly relatable to assembler
[22:49:19] <Richard_Cavell> for bit-twiddling ports and doing arithmetic etc
[22:49:25] <Xark> Casper: I get your point, but I can see the GCC folks not wanting to add a special "disallow return statement" error/warning for MCUs.
[22:50:17] <Casper> Xark: actually, the gcc folks need to be beaten up
[22:50:27] <Casper> they refuse to correctly optimise the stuff
[22:50:38] <Xark> Richard_Cavell: I agree, except you _will_ waste a few bytes vs asm (with a clueful coder). If you really care about stack waste, just use your own custom init code and don't return from main (problem solved).
[22:50:39] <Casper> gcc know the code will never exit
[22:50:43] <Casper> yet it set the exit stuff
[22:50:57] <Xark> Casper: The code _can_ return.
[22:51:09] <Casper> Xark: not if you put a while(1);
[22:51:09] <Xark> Casper: Even void functions can do that...
[22:51:25] <Xark> Casper: OK, then do that. Why does GCC folks need to care? :)
[22:51:48] <Casper> because the optimiser does detect it, but still setup useless stuff, failing to proprelly optimise
[22:51:53] <Xark> I believe it does support __attribute__ (noreturn) already.
[22:51:59] <Casper> yes it does
[22:52:23] <Casper> thing that should have been automatically detected and applied
[22:52:27] <Xark> Casper: Any I am just playing devils advocate (however, I think this issue is pretty trivial). :)
[22:52:31] <Xark> Anyways*
[22:53:52] <Xark> C is also "wasting bytes" clearing BSS and checking for ctors (even with C code). :)
[22:54:32] <Casper> -O3 should have took care of those
[22:54:44] <Casper> sadly, -O3 just break stuff
[22:55:15] <Xark> Hmm, no -O3 has no effect.
[22:55:34] <Xark> (it is already totally "minimal")
[22:56:26] <Casper> it does have an effect
[22:56:35] <Casper> but I found that -O2 does better
[22:56:39] <Casper> speed and size
[22:56:42] <Xark> Casper: Well, not on a trivial "return 0" test like I have. :)
[22:57:08] <Casper> man that akinator is surprising....
[22:58:15] <Xark> Neat, I hadn't heard of that...
[22:58:41] <Casper> akinator.com
[22:59:07] <Casper> with only a few question, it find out what you think (thing, animal, person, ....)
[22:59:21] <Xark> Obviously backed by the NSA. :)
[23:00:05] <Richard_Cavell> Can any AVR 8 bit run any type of operating system such as Linux?
[23:00:29] <Xark> Richard_Cavell: It is turning complete, so given enough memory (and time) it can compute anything computable. :)
[23:00:34] <Xark> Turing*
[23:00:53] <Xark> Richard_Cavell: However, not much call for AVR8 "operating systems".
[23:01:06] <Richard_Cavell> so you pretty much write your own?
[23:01:11] <Richard_Cavell> handle interrupts etc yourself?
[23:01:26] <Casper> Richard_Cavell: avr 8 bits no
[23:01:28] <Casper> but the 32 does
[23:01:43] <Casper> it would be stupid to put an os on an avr for almost all application
[23:01:46] <Richard_Cavell> Now when I type avr-gcc it produces a file called a.out. How do I get it to produce one of those .hex files?
[23:01:49] <Xark> Richard_Cavell: One fellow did get Linux running on AVR8. He did it by writing an ARM emulator, wiring up some DRAM and booting ARM Linux under emulation. :)
[23:02:10] <Richard_Cavell> I'm sure it's possible to get some sort of OS running
[23:02:37] <Casper> sure
[23:02:40] <Casper> there is some for avr
[23:02:43] <Casper> but it's stupid
[23:02:49] <Casper> it eat most of the ressources
[23:03:01] <Casper> and usually indicate that the user don't know how to code
[23:03:12] <Xark> Richard_Cavell: Of course. However, since all code is already in flash it generally doesn't make sense (however, the AVR can "flash itself").
[23:05:39] <Xark> Richard_Cavell: Handling a hardware interrupt isn't really any harder than dealing with a "signal" from an OS (and as Casper mentions, the OS layer is just "waste" on a MCU).
[23:06:28] <Richard_Cavell> could we at least create a hosted implementation?
[23:06:30] <Richard_Cavell> With string.h
[23:06:35] <Richard_Cavell> and some sort of display
[23:07:04] <Xark> Richard_Cavell: Sure. string.h should "work" (within 2K memory limits or whatever).
[23:07:34] <Richard_Cavell> And how do I make avr-gcc make a hex file?
[23:08:08] <Xark> Richard_Cavell: Plenty of types of "displays" from serial to video. Here is one I have worked on (plain 328p with two resistors) -> http://imgur.com/a/JO4Cq
[23:08:46] <Richard_Cavell> cool
[23:09:50] <Xark> Richard_Cavell: Gcc doesn't make, hex, but you convert elf to hex like this: avr-objcopy -O ihex -R .eeprom Blink.elf Blink.hex
[23:10:18] <Richard_Cavell> aha
[23:10:20] <Richard_Cavell> that works
[23:11:11] <Xark> Richard_Cavell: Also, if you want to see 100% of your program try, avr-objdump -d blink.elf (it will disassemble the code and you can see e.g., the code after main)
[23:11:35] <Richard_Cavell> yep
[23:11:41] <Richard_Cavell> you can also do avr-gcc -S prog.c
[23:12:06] <Xark> Richard_Cavell: That will only show *your* code. Disassembling the elf will also show library and init code.
[23:12:14] <Richard_Cavell> ok
[23:12:45] <Xark> Richard_Cavell: You can also use -save-temps and it will save all the intermediate steps (like code after pre-processor etc.)
[23:13:33] <Xark> Richard_Cavell: Often a good combo is "-save-temps -fverbose-asm" (which will cause GCC to add extra comments to .S which can be helpful following it).
[23:13:58] <Richard_Cavell> do most people use Atmel Studio or avr-gcc?
[23:14:11] <Richard_Cavell> I want to use OS X so I'd tend to use avr-gcc but I have a Windows machine
[23:14:20] <Xark> Richard_Cavell: Atmel studio is just a very bloated wrapper for avr-gcc.. :)
[23:14:47] <Xark> Richard_Cavell: Same compiler (more or less).
[23:15:32] <Xark> Richard_Cavell: If you have AVR debugging support (Dragon or whatnot) that is a good reason to use AS6.
[23:15:51] <Richard_Cavell> I'm not at a level where I'd need debugging
[23:15:59] <Xark> Richard_Cavell: Otherwise, it doesn't buy you that much IMO (unless you want to use Atmel libraries or something).