#avr | Logs for 2013-02-17

Back
[02:01:31] <ferdna> hey
[02:36:22] <jkkik> hello
[02:38:42] <jkkik> i'm making keyboard
[02:38:47] <jkkik> as avr
[02:38:49] <jkkik> help me plz
[02:53:06] <jkkik> T.T
[02:55:27] <specing> you're making a keyboard emulate an avr? :O
[02:56:14] <jkkik> specing, hello
[02:57:30] <jkkik> not emulate
[02:57:34] <jkkik> my pcb
[02:58:20] <jkkik> specing, do u know "v-usb" ?
[02:59:34] <jkkik> modded c64key(based on v-usb).
[02:59:43] <jkkik> but has few problem.
[03:00:32] <jkkik> Could you look at my source?
[03:00:37] <jkkik> T.T
[03:01:02] <specing> haven't worked with vusb other than flashing one of my chips to be an ISPMKII
[03:02:22] <RikusW> isn't that LUFA... ?
[03:02:49] <jkkik> yes
[03:03:00] <jkkik> http://www.obdev.at/products/vusb/index.html
[03:03:11] <jkkik> http://symlink.dk/projects/c64key/
[03:04:43] <specing> RikusW: the first one was tinyISPmkii or something
[03:04:53] <specing> the second one is LUFA-based
[03:05:07] <specing> not much faster though
[03:05:11] <jkkik> specing, could you look at my source?
[03:05:15] <jkkik> help me
[03:06:54] <jkkik> http://pastebin.com/daG3KefT
[03:07:33] <specing> doh 400 lines
[03:07:44] <specing> isolate the problem and fix it
[03:08:06] <jkkik> http://pastebin.com/V1QV3xiE
[03:08:49] <jkkik> matrix problem
[03:09:00] <jkkik> i want matrix : http://110.35.145.99/keymatrix.jpg
[03:09:23] <jkkik> T.T
[03:10:15] <specing> omfg wtf is that
[03:11:06] <jkkik> http://pastebin.com/jjKyGbRy
[03:11:29] <jkkik> i want result keymap http://pastebin.com/daG3KefT
[03:11:58] <jkkik> keymap now http://pastebin.com/jjKyGbRy
[03:11:59] <jkkik> T.T
[03:12:24] <jkkik> not row->col, col->row now
[03:12:58] <jkkik> How do i need to modify it?
[03:13:30] <jkkik> http://pastebin.com/daG3KefT
[03:13:35] <jkkik> 230 line
[03:16:12] <jkkik> link mis
[03:16:26] <jkkik> 1. i want keymap : http://pastebin.com/y5iSRNct
[03:16:37] <jkkik> 2. keymap now : http://pastebin.com/jjKyGbRy
[03:17:00] <jkkik> 3. main.c(row,col source) : http://pastebin.com/daG3KefT
[03:19:14] <jkkik> link mis
[03:19:16] <jkkik> 2. http://pastebin.com/V1QV3xiE
[03:19:19] <jkkik> lol
[03:19:20] <jkkik> help me
[03:27:27] <wakko> lol
[03:55:25] <RikusW> at AVR we don't do other's homework :-P
[03:56:46] <specing> OndraSter: fixed that mobo?
[03:56:57] <OndraSter> :D
[03:57:55] * RikusW don't particularly like vusb either...
[03:58:15] <RikusW> get a proper usb avr....
[04:00:08] <OndraSter> no
[04:00:08] <OndraSter> it will go on the wall
[04:00:08] <OndraSter> of fame
[04:00:08] <OndraSter> I fixed the windows installation instead
[04:00:09] <OndraSter> and booted it on the new hardware
[04:04:10] <OndraSter> hehe
[04:04:10] <OndraSter> I am tempted to port v-usb onto the xmega D series
[04:04:11] <OndraSter> xmega16d4 is much cheaper than atmega8u2
[04:04:50] <RikusW> heh
[08:28:04] <creep> "there are more paths going towards the black hole than paths moving away"
[08:30:36] <Tom_itx> none are return paths?
[08:35:31] <creep> there are return paths outside the event horizon
[08:36:28] <creep> beyond that point, escape velocity is larger than speed of light, so light falls back
[08:40:04] <creep> hmm found some interesting read http://en.wikipedia.org/wiki/Black_hole http://en.wikipedia.org/wiki/Event_horizon http://en.wikipedia.org/wiki/Warp_drive http://en.wikipedia.org/wiki/Alcubierre_drive http://en.wikipedia.org/wiki/Wormhole http://en.wikipedia.org/wiki/Spacetime
[08:41:10] <creep> Tom_itx<< it is interesting to realize space being warped and you are not heading the direction you think you are
[08:41:27] <Horologium> creep, happens to me all the time.
[09:02:08] <jadew> yey \o/ http://dumb.ro/files/boxes.jpg
[09:04:33] <jadew> paid about 50 cents for each unit
[09:08:14] <Horologium> nice
[09:10:19] <jadew> only problem is that I didn't find dividers for them
[09:18:47] <Tom_itx> a little big for mt
[09:18:52] <Tom_itx> smt
[09:19:46] <Tom_itx> too bad dx doesn't still have those smt boxes
[09:19:53] <Tom_itx> i got a bunch of them and really like em
[09:22:50] <Tom_itx> http://dx.com/p/configurable-storage-toolboxes-3-pack-4727
[09:22:58] <Tom_itx> they still have the big ones
[09:24:25] <jadew> I'd like some smt ones too
[09:24:28] <Tom_itx> http://dx.com/p/14-section-diy-parts-configurable-storage-toolboxes-color-assorted-44542?rt=1&p=2&m=2&r=3&k=1&t=1&s=58753&u=44542
[09:24:35] <Tom_itx> not quite as nice but the same idea
[09:27:25] <jadew> it's weird that I can't find any veritcal ones, like the ones I just got
[09:29:28] <Tom_itx> i got a couple fishing tackle box things that stack
[09:30:17] <jadew> don't they open from the top tho?
[09:30:38] <Tom_itx> yeah
[09:30:49] <Tom_itx> divided bins with a lid
[09:31:38] <Tom_itx> i like those for setting around the desk
[09:31:44] <Tom_itx> while i'm working
[09:31:54] <jadew> I have something like this at all times on my desk: http://dx.com/p/15-compartment-plastic-storage-box-for-electronic-components-small-gadgets-44494?rt=1&p=2&m=3&r=2&k=1&t=1&s=4580&u=44494
[09:32:14] <jadew> I keep the most common things in there, in order to try stuff
[09:32:21] <Tom_itx> same thing
[09:33:08] <jadew> I actually love the dx one, since it's transparent
[09:33:44] <jadew> well, mine is transparent too, but the guys who made it (or rebranded it) where stupid enough to put their brand on a sticker that goes across the entire lid
[09:33:44] <Tom_itx> yeah
[09:33:55] <jadew> and can't be taken off with out leaving glue and paper behind
[09:34:32] <Tom_itx> those first ones i linked... the smaller ones are clear lid as well
[09:34:32] <Tom_itx> and won't spill 0603
[09:35:18] <Tom_itx> they snap together so i can keep all of one project together
[09:36:32] <Tom_itx> http://www.youtube.com/watch?v=IrTYpKur9hk
[09:36:34] <Tom_itx> haha
[09:36:39] <Tom_itx> someone made a video of them
[09:36:59] <jadew> they look really nice
[09:47:52] <Tom_itx> http://www.priceangels.com/Configurable-Storage-Toolboxes-3-pack--s70142.html
[09:49:58] <jadew> heh, looks a lot like dx
[09:50:03] <jadew> for a moment there I thought it's the same site
[09:50:15] <Tom_itx> yep but i found the small ones
[09:50:51] <Tom_itx> you should grab a few, they're nice
[10:16:22] <OndraSter> yay Tom_itx nice find!
[10:16:28] <OndraSter> are they a good website?
[10:16:44] <OndraSter> legit website
[10:17:52] <tld> OndraSter: you know about DX' sister sites?
[10:18:51] <Tom_itx> OndraSter, not sure.. i just found em
[10:19:22] <Tom_itx> i do like the small ones better
[10:42:11] <OndraSter> tld, not really
[11:30:54] <creep> what amplifier would you put for headphone output? a simple 10-20mA output current opamp?
[11:31:21] <creep> i have read 90-120dB/mW output sound levels ;/
[11:32:02] <creep> but that seems very extrapolated
[11:33:16] <jacekowski> 761
[11:33:17] <jacekowski> or 731
[11:33:31] <jacekowski> something with 7 and 1
[11:33:45] <jacekowski> 741
[11:34:46] <creep> so you think like 0.5V and 10mA is enough to drive a headset? probably around 32 ohm
[11:35:26] <creep> i saw transistor output current boost schematics all around the web for headphone output
[11:35:39] <jacekowski> i though headsets are closer to 300ohms
[11:35:52] <creep> hm i have some here, i'll measure it right now
[11:41:43] <Horologium> how about the lm386 ??
[11:41:58] <jacekowski> it will do
[11:42:11] <Horologium> great little amplifier chip.
[11:42:15] <Horologium> been around forever too.
[11:42:24] <jacekowski> every single opamp have enough bandwidth for that
[11:43:15] <jacekowski> just don't use any high bandwidth opamps
[11:44:03] <Tom_itx> OndraSter you gonna get some of those boxes?
[11:44:14] <jacekowski> a lot of people get those £10/piece opamps as samples
[11:44:24] <jacekowski> and build headphone amps around those
[11:44:39] <jacekowski> and it sounds shit because they can't hear that it's oscillating
[11:47:15] <jacekowski> if you are using anything that has more than ~1MHz bandwidth you have to be absolutelly sure that everything above 1MHz is properly filtered and you have negative gain in that frequency range
[11:47:20] <jacekowski> otherwise it will oscillate
[11:50:31] <creep> bah, 39mV makes sound in my favorite headphone
[11:50:41] <creep> it is ~40 ohms, like the other one.
[11:52:11] <creep> that is 38uW
[11:52:50] <creep> lm386 is a piece of crap
[11:53:05] <creep> maybe good enough for a telephone
[11:54:07] <creep> but i have tested my headphone with 1mA of current right now... it is like normal speak level
[11:54:41] <creep> a tl072 has 10-20mA output capability
[11:54:59] <creep> (or most standard opamps)
[11:56:45] <creep> Horologium<< check out tl072, ne5532, lm833, opa2134 specs
[12:00:31] <creep> ok well tl072 may need output transistors
[12:00:41] <jacekowski> lm386 has 500kHz bandwidth
[12:00:44] <jacekowski> more than enough
[12:09:39] <Horologium> I remember the 386 was the first amp I ever played with some 30ish years ago.
[12:09:52] <creep> lol
[12:09:53] <creep> http://www.ti.com/lit/ds/symlink/lm386.pdf
[12:09:59] <Horologium> ripped it out of a record player that my brother broke.
[12:10:11] <Horologium> at least I think it was a 386
[12:10:13] <creep> check out the distortion (THD) vs frequency graph then
[12:10:41] <creep> it will go straight up above 5kHz -> shit
[12:11:13] <creep> 1% THD is a lot, especially for headphone
[12:14:41] <creep> this is the best they can do http://www.ti.com/product/opa2134 with 0.00008% THD
[12:18:53] <jacekowski> and 100* the price
[12:19:18] <creep> approx
[12:20:16] <creep> but lm358 for example has crossover distortion
[12:20:35] <creep> you get that for $0.1
[12:20:46] <jacekowski> 0.96USD for opa2134 or 0.22 for that LM
[12:22:05] <creep> it is more like $10
[12:22:23] <creep> $1.5 is 1-5k unit price
[12:22:40] <Horologium> free sample!
[12:22:45] <creep> yeah
[12:23:09] <Horologium> hmm...ti isn't sampling that one though.
[12:23:13] <creep> i see none right now for this though ;<
[12:23:24] <creep> too good
[12:23:27] <Horologium> as for the lm386,,,rip it out of any of a couple dozen different dead devices laying around.
[12:23:47] <Malinuss> abcminiuser, you have a few to hear about some unexplainable avr compiler sourcery?
[12:24:07] <abcminiuser> Sure
[12:24:22] <creep> Horologium<< so if you don't mind hiss, and a little distorted voice in your walkie-talkie than all good
[12:24:42] <creep> *then
[12:24:46] <Horologium> yup.
[12:24:47] <Horologium> works for me.
[12:25:01] <Horologium> I listen to AM 540 classic country station anyhow.
[12:25:07] <Horologium> so am used to hiss and distortion.
[12:25:08] <creep> hmm
[12:25:30] <creep> you might want to try out some better stuff, maybe less hiss
[12:25:31] <Horologium> and anybody listening to anything from the 70s and 80s should be used to distortion too as they used to distort music on purpose.
[12:25:46] <creep> haha sure
[12:25:55] <Horologium> the station I listen to still has,,and uses,,an old turntable and plays 45rpm vinyl.
[12:26:02] <creep> those guitar distortion devices
[12:26:42] <creep> but i like some music too ;/
[12:27:10] <Horologium> I like very little music...mostly 50s to 70s country and 50s to 60s rock.
[12:27:28] <creep> the industrial type has samples haha http://www.ti.com/product/opa2132&lpos=See_Also_Container&lid=Alternative_Devices
[12:27:40] <creep> if you want to check out free
[12:29:53] <creep> btw this is like $0.3 http://www.ti.com/product/lm833 and still good Total Harmonic Distortion: 0.002%
[12:30:03] <Malinuss> abcminiuser, so I have this line in my code: for(int a =7;a>-1;a--){ ... it works fine... now to preserve space, I change it to a unsigned char - this results in undefined bahaviour (the uC doesn't work)... Now some more interesting stuff: changing it to signed char results in the same size as with the int, which made me look in the disasm. And it shows that signed char=int!!! http://i.imgur.com/BbaKo5D.png left top = for(int a =7;a>-1;a--)
[12:30:03] <Malinuss> right top= for(char a =7;a>-1;a--) left buttom= for(signed char a =7;a>-1;a--)
[12:31:33] <creep> check out THD vs frequency graph http://www.ti.com/lit/ds/symlink/lm833.pdf
[12:31:43] <creep> page 11
[12:32:05] <Malinuss> abcminiuser, the same for uint8_t/int8_t (the same as for signed/unsigned char)
[12:32:24] <abcminiuser> Might be some wonky implicit int conversions
[12:32:44] <jacekowski> you are saying it like THD is a bad thing
[12:33:01] <jacekowski> people use valve based amplifiers to get more THD
[12:34:52] <creep> i dislike the hiss noise for example
[12:35:04] <jacekowski> high end onkyo amplifiers have 1% THD
[12:35:17] <creep> sure that is hifi
[12:35:19] <abcminiuser> Could also be the optimizer being forced to generate more code based on the adjusted code (for example with unsigned char it might have thrown some code out, since it could not be executed)
[12:38:03] <Malinuss> abcminiuser, what would you sugest to do, to preserve space + go around this issue?
[12:38:27] <abcminiuser> Don't use signed chars
[12:38:36] <abcminiuser> Use unsigned
[12:38:59] <abcminiuser> for(unsigned char a =8;a!=0;a--)
[12:39:12] <abcminiuser> Then subtract one from a inside the loop when using it
[12:42:34] <Malinuss> for(unsigned char a =8;a!=0;a--) still results in the same binary size as for(int a =7;a>-1;a--).....
[12:43:11] <Malinuss> abcminiuser, you have to admit, this is a bit weired :)
[12:43:27] <abcminiuser> Yup :P
[12:43:34] <abcminiuser> What's the entire loop fragment?
[12:49:12] <abcminiuser> 448 bytes on my machine (prerelease toolchain)
[12:50:41] <Malinuss> abcminiuser, I have it on "release", but otherwise default, attiny13a: Program Memory Usage : 576 bytes 56,3 % Full
[12:53:50] <abcminiuser> Try
[12:53:51] <abcminiuser> for(uint8_t a = 0; a < 8; a++){
[12:53:51] <abcminiuser> if (byte2 & 0x80)
[12:53:51] <abcminiuser> send_1();
[12:53:51] <abcminiuser> else
[12:53:51] <abcminiuser> send_0();
[12:53:53] <abcminiuser>
[12:53:57] <abcminiuser> byte2 <<= 1;
[12:53:59] <abcminiuser> }
[12:54:10] <abcminiuser> That seems to optimize better, I wonder what's causing the other code to generate crap output
[12:54:10] <Malinuss> roger
[12:55:06] <creep> hmm, i listen to music on my 2x40 ohm headphone at 2x1mW 0.2V/5mA rms and i don't feel like i want more
[12:57:32] <abcminiuser> Ah, it's synthesizing barrel shifts
[12:57:52] <abcminiuser> Since you are using "a" as the loop counter, it needs to shift 1 left "a" times using a loop and some temporary registers
[12:57:55] <Malinuss> it what a what?
[12:58:18] <Malinuss> abcminiuser, but the code you just send, it optimzes it? right?
[12:58:24] <abcminiuser> Yes
[12:58:44] <abcminiuser> Since with my one it doesn't need to make an inner loop to convert "a" into a bitmask
[12:59:08] <abcminiuser> It should be optimizing to what I wrote, but apparently it can't for some reason
[12:59:14] <abcminiuser> In any case, the above will work
[13:00:50] <abcminiuser> Also this, which is what the optimizer SHOULD be transforming it to:
[13:00:51] <abcminiuser> for (uint8_t mask = (1 << 7); mask > 0; mask >>= 1) {
[13:00:51] <abcminiuser> if (byte1 & mask)
[13:00:51] <abcminiuser> send_1();
[13:00:51] <abcminiuser> else
[13:00:51] <abcminiuser> send_0();
[13:00:52] <abcminiuser> }
[13:01:41] <abcminiuser> That version is better, since it doesn't destroy the byte variables afterwards
[13:02:45] <Malinuss> abcminiuser, okay I use that one then
[13:03:04] <abcminiuser> Is it really shifted out MSB first?
[13:04:13] <creep> Horologium<< :) http://www.tubecad.com/2009/02/09/headphone%20amplifier%20circuit.png this would be better with a tl072 than your lm386
[13:05:29] <Malinuss> abcminiuser, I belie so, can't remember which one is which, but those are my receiver functions: http://pastie.org/6205245
[13:06:00] <abcminiuser> Yep that's MSB first
[13:06:19] <Malinuss> well then yes it is really shifting out MSB first :)
[13:19:03] <Malinuss> abcminiuser, for(uint8_t a = 0; a < 8; a++){ if (byte2 & 0x80) byte2 <<= 1; that works....... the one you send a couple of minutes ago for (uint8_t mask = (1 << 7); mask > 0; mask >>= 1) { doesn't work
[13:20:52] <abcminiuser> Well as long as you don't care about it destroying the variable contents after the loop the first version will be fine
[13:21:33] <Malinuss> abcminiuser, well, thanks, no idea what is going on, but it took the size down 11%, and it works...
[13:22:12] <Malinuss> abcminiuser, just so confusing. Typical, when you think "hey I've got this", then you hit on a issue like this, where you have no idea what is going on
[13:22:37] <abcminiuser> Welcome to engineering :)
[13:25:17] <Malinuss> abcminiuser, fiy: using that simple "malinuss encoding" I'm abel to transmit 20bytes/s at a distance of 25m, trough 3 walls, with a packet loss of under 1%, using the ebay cheap 1.2$ 315mhz transmitter/receiver kit...
[13:25:32] <abcminiuser> Holy crap
[13:27:12] <Malinuss> abcminiuser, I was planning to do manchester encoding instead, but this works so well, and since changing a int to char can give me so much trouble I'm afraid to try anything new, haha
[13:28:17] <Malinuss> abcminiuser, btw. gotta admit that atmel have some really nice .pdf's out there about a lot of different topics. Well written and "on a hobbyst understanding level"
[13:29:21] <abcminiuser> Can't take credit for those I'm afraid, but I agree
[13:30:20] <Malinuss> I don't know if TI would do anything like it, I guess PIC/atmel are just more hobby-minded
[13:33:51] <creep> hmm http://amplifierlab.com/op-amp-radio-circuit/2010/05/24
[14:05:01] <OndraSter> Tom_itx, after my credit card will have more than 0.5€ :)
[14:05:05] <OndraSter> 'sup abcminiuser
[14:05:55] <abcminiuser> Heyo OndraSter
[14:06:15] <abcminiuser> Writing my new bootloader
[14:06:26] <OndraSter> yay
[14:06:30] <OndraSter> need any help with USB? :P
[14:09:32] <OndraSter> my bootloader will have few commands: a) upload, b) write, c) copy to bootloader (and some others)
[14:09:40] <OndraSter> it will be self updatable
[14:09:43] <abcminiuser> This is a bit of a horror, but fun to do
[14:09:47] <abcminiuser> It's a printer class bootloader
[14:09:56] <OndraSter> ohh that one
[14:09:59] <OndraSter> yeah, I remember it :)
[14:10:06] <OndraSter> scanner one is next?
[14:13:06] <Tom_itx> OndraSter, lemme know how that site is to order when you do
[14:15:43] <OndraSter> ok
[14:42:35] <Posterdati> hi
[14:42:35] <tobbor> hi Posterdati.
[14:43:19] <OndraSter> hi
[14:43:27] <Posterdati> I'm facing a strange behaviour of the atmega328 timer2, I programmed it as ctc with ocr2a as top value, but writing a value to it doesn't change the period of the irq
[14:44:23] <OndraSter> code
[14:44:25] <OndraSter> show us
[14:44:26] <OndraSter> NOW!
[14:45:49] <Posterdati> http://pastebin.com/ACMyRMSx
[14:45:54] <Posterdati> NOW!
[14:49:07] <Posterdati> OndraSter: then?
[14:51:55] <abcminiuser> Goddam Mongolains
[15:06:46] <Posterdati> I'm facing a strange behaviour of the atmega328 timer2, I programmed it as ctc with ocr2a as top value, but writing a value to it doesn't change the period of the irq
[15:12:51] <turutk> how can i read bytes from eemem? i can use eeprom_read_byte and eeprom_write_byte but eemem does not work for me
[15:14:29] <Tom_itx> that's how you do it
[15:15:03] <turutk> using eeprom_read_byte?
[15:15:10] <Tom_itx> i believe so
[15:15:12] <turutk> how do i know the address?
[15:15:40] <Tom_itx> http://tom-itx.dyndns.org:81/~webpage/abcminiuser/articles/avr_eeprom_index.php
[15:21:38] <turutk> i have been learning from that article but i cannot apply those things to my case
[15:23:25] <Tom_itx> you're not after progmem are you?
[15:23:34] <Tom_itx> http://www.nongnu.org/avr-libc/user-manual/group__avr__pgmspace.html
[15:24:38] <turutk> no. i am trying to learn eeprom
[17:55:19] <yunta> well, I had to run it in some crappy vm....
[19:04:48] <yunta> OndraSter: yep, it was timing issue
[19:04:54] <yunta> I couldn't make out anything from atmel code
[19:05:37] <yunta> but I checked calibration data I was getting, and it seems I fucked up my implementation of offsetof......
[19:05:43] <yunta> so, thanks for help!
[19:08:39] <OndraSter> np :)
[19:08:39] <OndraSter> yeah
[19:08:39] <OndraSter> timing is a bitch
[19:08:40] <OndraSter> it took me many hours to get all the stuff working properly
[19:08:41] <OndraSter> (all the reading of NVM etc)