#avr | Logs for 2011-12-13

Back
[04:10:16] <lovre> hi all
[04:11:04] <lovre> can i execute instructions outside of functions in codevision avr? For example before main, when declaring global variable int glob; i want to do glob =2; ... Does this work?
[04:21:13] <norbi> guys, my avrisp mkii wont connect anymore
[04:21:39] <norbi> it says to verify the isp cable, then the clock to be 1/4 lower then the main device
[04:21:51] <norbi> this is suddenly
[04:21:55] <norbi> yesterday worked
[04:22:04] <norbi> i have done nothing since then
[04:40:28] <norbi> is there a way to look in the logs?
[04:40:33] <norbi> chat logs?
[04:43:31] <grummund> !thislog
[04:43:52] <grummund> !thislog
[04:43:52] <grummund> !thislog
[04:43:53] <tobbor> This one: http://rueshouse.dyndns.org:82/~ircjunk/irclogs/html/%23avr-2011-12-13.html
[04:43:53] <grummund> !thislog
[04:44:08] <grummund> norbi: ^^
[04:44:42] <norbi> :d
[04:44:44] <norbi> thnaks
[07:39:11] <Bushman> ave
[08:34:57] <tomatto_> hello
[08:35:08] <m4n14c> hello, anyone knows how to fix the ...avr/bin/ld: skipping incompatible (...)libm.a?
[08:36:10] <m4n14c> I trying to build the Blink example for Arduino the ide (arduino 022)....
[08:44:07] <karlp> make clean, make..
[08:44:17] <karlp> your libm was compiled for a different architecture
[08:57:25] <Bushman> lol, i've read that as "your limb was compiled..."
[08:57:50] <Bushman> the funny thing is it didn't seem out of place to me XD
[08:58:00] <Bushman> to much crazy IRC channels i must have been on
[09:23:32] <rue_house> make install
[09:23:42] <rue_house> grummund, odd...
[09:24:24] <rue_house> Tom_itx, the U2 board, the switch is?
[10:50:22] <norbi> hello guys, now im having good working serial comunication with my opengl app, i solved even the delay
[10:50:30] <norbi> now i can say is aprox real time
[10:50:32] <karlp> this willdo...
[10:50:42] <karlp> wrong window...
[10:50:54] <karlp> norbi: congratulations :)
[10:50:58] <karlp> busy few days?
[10:50:59] <norbi> but, i dont know the scaling
[10:51:06] <norbi> karlp: yea:D
[10:52:21] <norbi> i need now to figure out the physics
[11:08:22] <norbi> any idea how to calculate degrees from raw acc data?
[11:08:40] <norbi> i cant find a formula or anything that would work well with this
[11:09:04] <norbi> i coudl use some help in maths
[11:10:14] <OndraSter> isn't it just normal 3d math?
[11:10:21] <OndraSter> a bit of sin, a bit of cos and maybe a bit of tan?
[11:10:37] <norbi> OndraSter: probably but i know nothing about that
[11:11:19] <OndraSter> http://stackoverflow.com/questions/5464847/transforming-accelerometers-data-from-devices-coordinates-to-real-world-coordi ?
[11:18:42] <norbi> OndraSter: i have just accmeter
[11:18:45] <norbi> this combines
[12:02:40] <norbi> after normalized vector
[12:02:58] <norbi> i cant figure out what are the right formulas for x,y,z degrees
[12:34:17] <norbi> cos(sensor_value*conversion_constant / -g)^-1 = angle what is -g here?
[12:34:26] <norbi> conversion_constant i think is 180?
[13:06:21] <norbi> i have found this: http://www.freescale.com/files/sensors/doc/app_note/AN3461.pdf
[13:06:45] <norbi> but have nooo idea how to use it on adxl345, because adxl345 is is digiatl
[13:07:17] <norbi> digital, i dunno what are the original x,y,z when it is off
[14:42:26] <norbi> refering to this datasheet http://www.analog.com/static/imported-files/application_notes/AN-1057.pdf how can i get Ax,out?
[14:42:56] <norbi> it says, Ax,out[g]=1g * sin(angle)
[15:28:48] * dofidum apologises for firing some basic questions...
[15:28:51] <dofidum> am I right in saying that avr-libc is shipped with AVR studio?
[15:29:18] <dofidum> is there a official ATMEL library for AVR chips?
[15:29:20] <Tom_itx> not that i'm aware of
[15:29:25] <Tom_itx> not that i'm aware of
[15:30:01] <dofidum> Tom_itx, headers like avr/io.h etc, what library do these belong to?
[15:30:12] <OndraSter> library?
[15:30:24] <Tom_itx> they are part of avr-gcc i believe
[15:30:26] <dofidum> well it's not standard c/c++ so it must be some library
[15:30:38] <Tom_itx> that's the directory they're in anyway
[15:30:41] <OndraSter> if by library you mean few c -> asm..
[15:30:49] <OndraSter> or are they in real libs
[15:31:24] <dofidum> with library I mean any definitions/macros that are not in standard c/c++
[15:31:24] <OndraSter> actually
[15:31:27] <OndraSter> it is avr-libc
[15:31:28] <OndraSter> # if !defined(__COMPILING_AVR_LIBC__)
[15:31:29] <OndraSter> just found this
[15:31:50] <dofidum> OndraSter, so it does come with AVR studio?
[15:31:57] <OndraSter> it does with avr studio 5
[15:32:06] <OndraSter> avr studio 4 requires external avrgcc I think
[15:32:10] <Tom_itx> they combined it in 5 i guess
[15:32:13] <OndraSter> ye
[15:32:18] <Tom_itx> don't know much about 5. it sucks
[15:32:18] <Eduard_Munteanu> I somehow doubt there's something like that provided by Atmel, there's even an avr-gcc optimization guide written by them.
[15:32:31] <dofidum> OndraSter, I suppose that means ATMEL likes this library :)
[15:32:39] <OndraSter> :D
[15:33:06] <OndraSter> if you check program files\atmel\avr studio 5\avr toolchain\avr\lib\somechip\ you can see there libc.a file
[15:33:09] <OndraSter> just as libm
[15:33:45] <dofidum> OndraSter, I better get to know this library then :-)
[15:34:04] <OndraSter> this is more linux-y than I ever want to close to
[15:34:11] <OndraSter> I am fine that it works
[15:34:13] <OndraSter> and that's it ;D
[15:34:41] <Eduard_Munteanu> That's good...
[15:34:42] <karlp> avr-libc is a nice library
[15:34:53] <Eduard_Munteanu> But I wonder if the situation is the same with Atmel's FPGA-ish stuff.
[15:35:09] <dofidum> OndraSter, I don't mind linux-y. I don't suppose there is an "operating system"-like API akin to sys/bios for TI chips?
[15:35:15] <Eduard_Munteanu> There isn't really any FOSS FPGA toolchain AFAIK.
[15:35:29] <OndraSter> I would love to use AVR Studio with ARM chipsets too
[15:35:44] <Eduard_Munteanu> dofidum: TI? There are quite a few for AVRs.
[15:35:57] <OndraSter> I remember that when resetting the ARM AT91SAM7S chips at school when connected through USB (just as closing the communication app on PC)
[15:36:00] <OndraSter> the PCs sometimes resetted lmao
[15:36:03] <dofidum> Eduard_Munteanu, Texas Instruments.
[15:36:05] <OndraSter> (that would be XP SP3)
[15:36:11] <Eduard_Munteanu> dofidum: which chips?
[15:36:29] <dofidum> Eduard_Munteanu, C6000's or something.
[15:36:59] <Eduard_Munteanu> Hm... I think I had a C3000 board that I couldn't work with from Linux.
[15:37:12] <dofidum> I am just used to being able to spawn threads and use mutexes and the like, but have no idea how this kind of stuff can be done on an ATmega
[15:37:16] <Eduard_Munteanu> Other stuff might be different though.
[15:37:20] <OndraSter> oh and I am pissed on ATMEL for not supporting JTAG ICE on AVR Studio 5.0, just as not releasing updated firmware for newer chips :(
[15:37:42] <OndraSter> for jtag ice
[15:37:55] <Eduard_Munteanu> OndraSter: do they even publish/document JTAG instructions?
[15:38:02] <Eduard_Munteanu> I remember they didn't.
[15:38:03] <OndraSter> just the basic ones
[15:38:05] <OndraSter> nothing for debugging
[15:38:12] <Eduard_Munteanu> Yeah, that sucks :(
[15:38:25] <Eduard_Munteanu> But somebody reverse-engineered debugWire it seems.
[15:38:26] <OndraSter> a bit of playing with logic probe... :)
[15:38:29] <OndraSter> link?
[15:38:31] <OndraSter> I'd love that
[15:38:46] <Eduard_Munteanu> OndraSter: http://www.ruemohr.org/docs/debugwire.html
[15:39:01] <Eduard_Munteanu> I'm not sure if that's actually been implemented in any debugger, say gdb.
[15:39:04] <OndraSter> oh this
[15:39:08] <OndraSter> I've seen that
[15:39:37] <Eduard_Munteanu> By the way, can you even use gdb to connect to an AVR? (say JTAG)
[15:39:37] <OndraSter> but not sure if has been made into some avr jtag copy yet
[15:39:46] <OndraSter> avr studio uses gdb... or not?
[15:39:54] <Eduard_Munteanu> (Though I'm not planning on using a debugger right now)
[15:39:58] <Eduard_Munteanu> Hm.
[15:40:03] <dofidum> OndraSter, on windows?
[15:40:04] <Steffanx> Eduard_Munteanu afaik there is support for the jtagice mkii and avr dragon
[15:40:16] <OndraSter> dofidum, they have linux avr studio? :P
[15:40:29] <Eduard_Munteanu> Steffanx: but would that work for a custom board / debugger?
[15:40:47] <Steffanx> If you implement the jtagicem kii protocol :)
[15:40:57] <dofidum> OndraSter, I mean gdb is, as you say, "linux-y"... I can't see AVR studio using that...
[15:40:59] <Eduard_Munteanu> Uh :). I have a buspirate :P
[15:41:05] <OndraSter> dofidum, okay
[15:41:19] <OndraSter> like I said, too much linux-y, don't care how it works as long as it works :P
[15:41:38] <OndraSter> then I grab IDA and start getting known with it
[15:42:08] <Eduard_Munteanu> Anyway, I haven't connected my JTAG pins on this board to anything, it'd be a bit messy to do it now.
[15:42:21] <Steffanx> The same guy who did the major part of the reverse engineering of debugwire, also reverse engineerd the jtagice mkI fw Eduard_Munteanu
[15:42:34] <Eduard_Munteanu> Hm, nice.
[15:42:36] <Steffanx> mkI not MkII :)
[15:42:46] <OndraSter> mkI is old and knows only 10 chips
[15:42:51] <Steffanx> Yeah
[15:42:51] <OndraSter> which is driving me mad
[15:42:55] <Steffanx> Something like that
[15:43:04] <OndraSter> luckily atmega128a has the same signature and works fine with it
[15:43:07] <OndraSter> as atmega128/l
[15:43:33] <OndraSter> or should,... I have yet to make the board and connect it there :P
[15:44:11] * Eduard_Munteanu is happy he got this board designed alright so far... first attempt at making it (and using MCUs on my own outside school).
[15:44:29] <OndraSter> my first use was outside school, now I am working within school
[15:44:52] <Eduard_Munteanu> Yeah, I wanted to do that for quite some time, but couldn't be bothered :)
[15:45:48] <Eduard_Munteanu> Anyway, it's a bit more fun to do it without hooking a STK500 into AVR studio, but it takes quite a bit of effort.
[15:46:49] <Eduard_Munteanu> Now I just have to find a way to solder this QFN24 gyro safely :D.
[15:46:55] <OndraSter> :D
[15:46:59] <OndraSter> hotair gun )
[15:47:02] <OndraSter> :)
[15:47:27] <Eduard_Munteanu> Don't have one. I'm contemplating a visit to a friend who's got one, or pushing my luck with my soldering station.
[15:48:28] <Eduard_Munteanu> Well, the TQFP44 was a breeze, I'm sure QFN is a lot tougher.
[15:48:52] <OndraSter> have I shown you my schematics
[15:48:52] <OndraSter> http://clip2net.com/s/1oLRq
[15:49:01] <OndraSter> (1st)
[15:49:02] <OndraSter> http://clip2net.com/s/1oLRV
[15:49:05] <OndraSter> (2nd)
[15:49:16] <OndraSter> http://clip2net.com/s/1oLS3
[15:49:17] <OndraSter> (3rd)
[15:49:29] <OndraSter> actually on the third one will be Allegro A6275 instead those 595
[15:49:37] <OndraSter> but it was not in Eagle's library
[15:51:05] <Eduard_Munteanu> OndraSter: nice, what's the chip on the right? SRAM?
[15:51:09] <OndraSter> yeah
[15:51:11] <OndraSter> 1Mbit..
[15:51:14] <OndraSter> 128k*8
[15:51:21] <OndraSter> actually 128k was cheaper than 32k
[15:51:27] <OndraSter> and 64k's are not available at all lol
[15:51:39] <Eduard_Munteanu> I guess I could've connected all the pins to a header, but I tried to avoid it since routing was already a bit complicated.
[15:51:48] * Eduard_Munteanu has a lot of unconnected pins
[15:52:01] <OndraSter> I routed everything unconnected to headers
[15:52:06] <OndraSter> so I can connect external peripherals :)
[15:52:32] <Eduard_Munteanu> Ah, this board was supposed to be application-specific anyway.
[15:53:01] <OndraSter> this is too, but since I don't make this kind of boards per-piece...
[15:53:07] <Eduard_Munteanu> I don't even have a crystal. I figured I could do without it since I'm running at 3.3V and I can't get >10MHz anyway.
[15:53:11] <OndraSter> I would actually like having something really "breadbordish"
[15:53:17] <OndraSter> with just SRAM and the chip itself
[15:53:20] <OndraSter> and crystal
[15:53:31] <OndraSter> (and possibly the FTDI)
[15:53:35] <OndraSter> hmm arduino mega? :D
[15:54:06] <Eduard_Munteanu> Eh, I already have a FTDI 3V3 cable so I didn't want to complicate matters too much.
[15:54:29] <Eduard_Munteanu> OndraSter: you can find QFP and SOIC sockets though they're rather expensive.
[15:54:39] <OndraSter> I know
[15:54:46] <Eduard_Munteanu> I don't fancy spending ~ $400 on one :D
[15:54:53] <OndraSter> or I can find just the adapter from TSOP -> DIP :P
[15:55:03] <OndraSter> for 2 bucks
[15:55:04] <OndraSter> ebay ftw
[15:55:05] <OndraSter> :D
[15:55:26] <Eduard_Munteanu> I ended up ordering my board from BatchPCB.
[15:55:39] <OndraSter> pricing?
[15:55:39] <Eduard_Munteanu> 2 layers, although I could've done with more.
[15:56:02] <Eduard_Munteanu> $20-ish or something.
[15:56:09] <OndraSter> sounds quite good actually
[15:56:15] <OndraSter> US only I presume?
[15:56:28] <Eduard_Munteanu> No... I'm from Romania.
[15:56:55] <Eduard_Munteanu> I don't remember how much shipping was.
[15:57:23] <Eduard_Munteanu> Anyway, it was less than $30 overall, IIRC.
[15:58:11] <OndraSter> wow
[15:58:29] <OndraSter> I will see how much will Pragoboard (some czech near-prague company that does similar cheap stuff, with discounts for students) offer
[15:58:53] <Eduard_Munteanu> There's Olimex in Bulgaria, if it helps.
[16:00:00] <OndraSter> Olimex... sounds familiar
[16:00:19] <Eduard_Munteanu> But anyway, I went with batchpcb since they have lots of drill bits and my PCB was done in gEDA.
[16:00:28] <Eduard_Munteanu> I think Olimex prefers Eagle or something.
[16:01:39] <Eduard_Munteanu> OndraSter: http://www.olimex.com/pcb/index.html
[16:02:06] <OndraSter> I know Olimex from his HW projects probably
[16:04:38] <OndraSter> the batchpcb looks REALLY good man, thanks, Eduard_Munteanu :)
[16:05:36] <OndraSter> mine is a bit bigger PCB though
[16:05:38] <Eduard_Munteanu> OndraSter: it's not fast though, it can take a month until you get the PCB
[16:05:53] <OndraSter> about A5 or something between A5 and A4 :)
[16:05:56] <OndraSter> no problem with that
[16:06:08] <Eduard_Munteanu> Size?
[16:07:11] <Eduard_Munteanu> Mine looks a bit like a business card. Basically it's the AVR, voltage reg, a few pin headers, the QFN gyro and an XBee :)
[16:08:41] <OndraSter> yeah, size
[16:09:17] <Eduard_Munteanu> It's almost all SMD, well minus the pin headers... I figured there's no point in getting DIP stuff.
[16:09:41] <OndraSter> mine is almost all SMD except the 24 LED matrices :D
[16:10:06] <OndraSter> and caps might be normal, as I will be using some bigger elcaps
[16:10:13] <OndraSter> and I don't like soldering elcaps SMD
[16:12:11] <Eduard_Munteanu> The biggest I used here was 22uF, rather alright to solder.
[16:13:24] <OndraSter> I am not sure how would the power supply like sudden change from 100mA to > 2.1A and then back... out of nothing, over 160x per second...
[16:13:30] <OndraSter> so I will place some bigger cap on the input
[16:14:16] <Eduard_Munteanu> Ah, I see.
[16:20:57] * norbi wonders why nobody shares 3 axis accelero basic angle calculations
[16:21:20] <norbi> i found a lot of spi and i2c and serial implementation of accelero
[16:21:30] <OndraSter> but no calculations? :P
[16:21:36] <norbi> but not as much that actualy does something with the raw data
[16:22:32] <Eduard_Munteanu> You could read the datasheets and do it yourself.
[16:23:04] <norbi> ive found something that says, i need to scale it down to 1g, but if i multiply the raw data with 0.0078 the scale number, im getting some weird data, that is not even neir 1g
[16:23:22] <norbi> i did read the datasheets a gazzillion times
[16:23:30] <norbi> belive me i know them from my head
[16:23:50] <norbi> i can play them out from my head like ive been recording them
[16:23:53] <norbi> anyway
[16:24:29] <norbi> even in the small application note is not a detailed explanation how do they get the Ax,out[g] that are they working with
[16:25:22] <norbi> i understand that asin(x/y) and acos(...) gives me the angle, but x and y in g's how are they calculated?
[16:25:52] <norbi> then the angle is in radians, that means i have to multiply it with 360.0/2PI
[16:26:01] <norbi> to get degrees
[16:26:56] <norbi> this is all ive found usefull, everybody does it on its own way, there are people who normalizes the vector, but its not necessary
[16:27:14] <norbi> not if you arent using atan or atan2
[16:28:30] <norbi> you can calculate angle by using reference vector or not
[16:28:47] <norbi> but still cant figure out what the hell i do need to do with the raw data initially
[16:29:05] <norbi> this is the only thing i miss and i cant get any information about it
[16:29:30] <norbi> i think i will put this away for another 2 years
[16:29:52] <OndraSter> haha
[16:30:03] <norbi> ive spent the all day reading and coding, but nothing just theory
[16:30:15] <norbi> nothing that woudl work practically
[16:30:26] <OndraSter> I have right now about 5 projects I wanna make lmao
[16:31:25] <Eduard_Munteanu> norbi: the first thing to understand is what the raw data represents
[16:31:59] <norbi> if you have an idea guys, let me know, if not, i think i will change electronics engineering university with fishing, i will go to fish on seas
[16:32:08] <Eduard_Munteanu> :)
[16:32:50] <norbi> Eduard_Munteanu: (da stiu ce vrei sa zici, dar ma ia dracu deja) i think i know what raw data means
[16:33:00] <Eduard_Munteanu> norbi: take an easier example... you have an ADC, and it measures voltages between 0-5V. But it gives you a number between 0 and 255. A similar things could happen here.
[16:33:16] <Eduard_Munteanu> norbi: RO? Heh :).
[16:33:47] <norbi> first: at 8g there are 11 bits, so 8/1024
[16:34:23] <Eduard_Munteanu> 2^11 = 2048
[16:34:24] <norbi> if raw data means g's in binary, then 1g is raw data * 8/1024
[16:34:30] <norbi> yea, but signed
[16:34:33] <Eduard_Munteanu> Ah.
[16:34:43] <norbi> Eduard_Munteanu: you are Ro too right?
[16:34:49] <Eduard_Munteanu> Yeah.
[16:34:52] <norbi> k
[16:34:53] <norbi> :)
[16:35:26] <norbi> so until now this should be correct, right?
[16:36:28] <norbi> minimum read is 230 for z for example, that is nearly 2G, it means that there is acceleration on z
[16:37:22] <norbi> then, from here, after converted raw data to g's what is the next step?
[16:39:03] <norbi> ok, i wont kill you too with this, as how i see this is impossible for me to acomplish..
[16:39:16] <norbi> !thislog
[16:39:17] <tobbor> This one: http://rueshouse.dyndns.org:82/~ircjunk/irclogs/html/%23avr-2011-12-13.html
[16:39:52] <Eduard_Munteanu> norbi: what the range it measures?
[16:40:06] <Eduard_Munteanu> For instance, what's 1024?
[16:40:13] <Eduard_Munteanu> *what's
[16:41:29] <norbi> ?
[16:42:10] <norbi> it can take raw values up to 1024 or -1024
[16:42:19] <OndraSter> Eduard_Munteanu, wait, do they also do vias or do you have to let them be drilled and connect them manually...
[16:42:22] <OndraSter> on batchpcb
[16:42:32] <Eduard_Munteanu> OndraSter: sure they do, plated as well
[16:42:40] <OndraSter> kk thanks
[16:42:47] <norbi> Eduard_Munteanu: i dont understand the question
[16:43:35] <Eduard_Munteanu> norbi: ok, so you've got an accelerometer. When it returns 1023, what acceleration is it measuring?
[16:43:57] <Eduard_Munteanu> Oh, and mind that's -1024..1023 if it's 11 bits signed.
[16:44:07] <Eduard_Munteanu> (at least 2's complement)
[16:45:09] <norbi> Eduard_Munteanu: positiv acceleration, upwards
[16:45:22] <norbi> and on - it measures negative acc
[16:45:35] <norbi> down
[16:45:53] <Eduard_Munteanu> Yes, but what's the maximum acceleration it measures?
[16:46:05] <norbi> depends on scale
[16:46:09] <norbi> 8g
[16:46:13] <Eduard_Munteanu> Ah.
[16:46:28] <Eduard_Munteanu> So -8G...+8G?
[16:46:34] <norbi> yea
[16:48:41] <kcbanner> Hey all. Currently I'm doing poor-mans AM with an AVR by outputting my clock signal on two pins, and then toggling the input/output state of one of them to half the amplitude. Essentially adding the outputs. I built it this way with the parts I had at hand, how would I go about designing this using a variable gain amplifier?
[16:49:04] <norbi> Eduard_Munteanu: sorry, im looking at the datasheet, i was wrong, 8G is on 12bits signed
[16:49:08] <norbi> so 11bits value
[16:49:27] <norbi> 2248 is max value
[16:50:31] <norbi> 11 bits would be enough if i take the minimum scale that is 256LSB/g
[16:50:43] <norbi> but there is a max value that needs 12 bits
[16:51:07] <Eduard_Munteanu> 2048.
[16:51:19] <norbi> ah yea, sry
[16:52:08] <norbi> but max value gives me 2256
[16:52:40] <norbi> that means it even uses 13bits at 8G
[16:53:48] <norbi> anyway, scale is set to 11bits
[16:54:49] <Jagged> kcbanner: typically, what you have is a local oscillator and your message driving a mixer
[16:54:59] <norbi> im getting the g vector, ok, but then? withot reference vector how can i calculate the angle?
[16:55:44] <Jagged> kcbanner: AM isn't accomplished with a variable-gain amplifier
[16:55:57] <kcbanner> Ah, ok. I'm thinking about this wrong
[16:56:03] <Jagged> right
[16:56:12] <Jagged> you would use AGC to prevent saturation
[16:56:18] <Jagged> but not for modulation
[16:56:29] <kcbanner> In this case my AVR timer is the oscillator, and I have my digital signal as well (RS232 in this case), and I need to do AM with that.
[16:56:56] <Jagged> kcbanner: do you have any communications knowledge or experience?
[16:56:57] <norbi> anyway there is a reference vector, the x=0g, y=0g and z=1g
[16:57:17] <kcbanner> Jagged: yea I do from an academic standpoint
[16:58:05] <kcbanner> its just the practical implementation of this which I'm getting blocked on
[16:58:18] <Jagged> and the transition from digital to analog
[16:58:23] <Jagged> because you have two square waves
[16:58:56] <Jagged> if you wanted rudimentary 'AM' you could do on-off-keying
[16:59:00] <norbi> so asin(x/1g)
[16:59:21] <Jagged> use your digital signal to turn on and off the clock carrier
[16:59:36] <kcbanner> Jagged, yea, thats almost what I am doing now
[16:59:38] <norbi> would give me the angle between horizont and x axis
[17:00:49] <kcbanner> Jagged: I'm doing a really hacky method of outputting my carrier on two pins, and then turning off/on one of them with my digital signal
[17:01:06] <Jagged> two pins?
[17:01:22] <kcbanner> Jagged: yea, the A and B compare pins on one of the timers
[17:01:24] <Jagged> what are you trying to do with this thing?
[17:01:51] <norbi> so angleX=asin(rawdata*0.0078) should give me the angle in radian
[17:02:02] <Jagged> as in... what medium is this going through
[17:02:03] <kcbanner> Jagged: transmit a digital signal over audio
[17:02:06] <Jagged> and what is your receiver
[17:02:06] <kcbanner> line level audio
[17:02:11] <Jagged> kcbanner: oh, is that it?
[17:02:16] <kcbanner> ya
[17:02:18] <norbi> angleXDegrees=angleX*360/2PI?
[17:02:19] <Jagged> kcbanner: FSK is what you wank
[17:02:20] <Jagged> *want
[17:02:43] <Jagged> BPSK would also work
[17:03:11] <Jagged> but yeah... you'll need some ADCs and DACs to make everything play nice
[17:03:12] <kcbanner> Jagged: I found that I couldn't get the speeds I wanted using FSK with the sample rate on the receiving end
[17:03:16] <Jagged> square waves make a lot of noise
[17:03:20] <Jagged> oh yeah?
[17:03:25] <Jagged> what data rate were you going for?
[17:03:30] <kcbanner> or rather, I couldn't accurately decode frequencies using my receiving device
[17:03:34] <kcbanner> maybe ASK
[17:03:46] <Jagged> what algorithm were you using for decoding?
[17:03:56] <Jagged> timing recovery is also a significant problem
[17:04:01] <Jagged> what were you doing for timing recovery?
[17:04:24] <norbi> in 3 axis mode angleTilt=atan(angleX/angleY)
[17:04:25] <kcbanner> I was trying to hit 9600 baud
[17:04:31] <Jagged> that's doable
[17:04:33] <kcbanner> decoding, I was counting 0 crossings
[17:04:47] <kcbanner> time between zero crossings*
[17:05:13] <Jagged> ok
[17:05:16] <Jagged> and timing recovery?
[17:05:36] <kcbanner> I had trouble with that
[17:05:39] <Jagged> yeah
[17:05:44] <Jagged> that's the hard part :P
[17:05:47] <kcbanner> my digital signal is just rs232, so I was trying to sync on start bits
[17:05:52] <Jagged> mmhmm
[17:06:03] <Jagged> and that requires significant oversampling to work
[17:06:09] <kcbanner> yea exactly
[17:06:12] <Jagged> (that's how a UART recovers timing)
[17:06:13] <kcbanner> so FSK didn't work
[17:06:37] <kcbanner> and I have my software decoding of my crappy AM working great at the moment
[17:06:48] <kcbanner> I just wanted to optimize my generation of the AM signal to be a little less silly
[17:06:49] <Jagged> so what's the problem then?
[17:06:53] <Jagged> oh
[17:06:54] <Jagged> well
[17:06:56] <Jagged> if it works...
[17:07:16] <kcbanner> haha, yea. its a bit goofy but it does work.
[17:07:18] <Eduard_Munteanu> norbi: why not work with the angle in radians?
[17:07:36] <Eduard_Munteanu> norbi: note math functions usually work with radians so you won't be able to use degrees
[17:07:41] <norbi> because in opengl is set to degrees
[17:07:46] <Eduard_Munteanu> Ah.
[17:07:53] <norbi> i can change it to radians, no problem of that
[17:07:57] <Eduard_Munteanu> norbi: what are you doing, really?
[17:08:02] <Jagged> kcbanner: anyways... there's some DIP package IC's that function as both PLL and tone detectors
[17:08:08] <Eduard_Munteanu> The OpenGL bit sounds intriguing.
[17:08:13] <Jagged> and those would make your job a lot easier
[17:08:20] <Jagged> I can't remember the part numbers off the top of my head
[17:08:34] <norbi> Eduard_Munteanu: i just try to simulate the 3d space in graphics
[17:08:41] <kcbanner> Jagged: for receiving?
[17:08:47] <Jagged> yeah
[17:08:57] <kcbanner> Jagged: unfortunetly I don't ahve control over the hardware in the receiver (consumer device)
[17:09:12] <norbi> not big deal, just want to see how this accmeter works simulated
[17:09:26] <norbi> and besides of that, i have another problem
[17:09:27] <Eduard_Munteanu> Ah.
[17:09:32] <norbi> im usign avr isp mk2
[17:09:42] <norbi> there are times when it wants to connect
[17:09:47] <norbi> and when it dont
[17:09:59] <norbi> now, i cannot connect to the chip
[17:10:01] <norbi> it wont
[17:10:02] <Jagged> kcbanner: and with regards to your carrier, if you wanted to make it truly analog... it's not difficult at all to build an oscillator
[17:10:04] <norbi> dunno why
[17:10:21] <kcbanner> Jagged: I should look into that.
[17:10:28] <Jagged> kcbanner: google for a "relaxation oscillator"... it uses an opamp
[17:10:50] <Jagged> that will get you kind of a sawtooth output
[17:11:08] <kcbanner> Jagged: oh ok
[17:11:11] <Jagged> alternatively
[17:11:17] <kcbanner> Jagged: yea square does get super noisy
[17:11:21] <Jagged> you can use a square wave
[17:11:27] <Jagged> and build a filter
[17:11:39] <Jagged> to filter the fundamental
[17:11:46] <kcbanner> gotcha
[17:11:48] <Jagged> and reject all the odd harmonics
[17:12:02] <Jagged> because a square wave is just the sum of all the odd harmonics of a fundamental
[17:12:25] <Jagged> and at audio frequencies, you can use opamps to build active filters
[17:12:31] <Jagged> not so much at RF
[17:12:40] <kcbanner> gotcha, yea this is audio
[17:12:50] <Jagged> but at AF, you can have some gain to your filter device
[17:12:51] <kcbanner> I have this going through a simple RC filter just to bring it down to line levels
[17:13:10] <kcbanner> 5v peak-to-peak needs to be more like 1v peak-to-peak
[17:13:19] <kcbanner> so like -32ish dB
[17:13:31] <Jagged> -30 dB is 0.001
[17:14:00] <Jagged> (compared to 1, that is)
[17:14:17] <kcbanner> oh, I was doing 20log(Vout/Vin)
[17:14:29] <Jagged> -13.98
[17:15:15] <Eduard_Munteanu> Heh, if you go far enough into RF (read microwaves), there's a lot of black magic there
[17:15:30] <Jagged> but, nonetheless... at AF you can get away with a voltage divider to do that
[17:15:37] <kcbanner> oh ok
[17:15:45] <Jagged> at RF... resistors get funny
[17:15:51] <Jagged> actually.. everything gets funny
[17:16:07] <Eduard_Munteanu> There's lots of funny stuff that doesn't work at AF.
[17:16:14] <kcbanner> so digital -> small cap -> voltage div -> output ?
[17:16:22] <Jagged> what's the cap for
[17:16:39] <Jagged> if you want to make a sinusoid out of a square wave, send it through a BPF
[17:16:52] <Jagged> with sufficient Q to extract your carrier
[17:18:00] <kcbanner> oh ok
[17:18:09] <Jagged> Eduard_Munteanu: well... a lot of electronics is black magic :P you can just get away with murder at AF :D
[17:18:25] <kcbanner> I learned all this last term at school, but when its time to actually implement this its not as simple
[17:18:27] <Eduard_Munteanu> Heh, I guess so.
[17:19:09] <Jagged> kcbanner: basic intro to comm course, or analog circuits?
[17:19:35] <norbi> im goig to be
[17:19:36] <norbi> bed
[17:19:40] <norbi> bye bye!
[17:19:53] * norbi waves and thanks to everybody
[17:20:49] <kcbanner> Jagged: a signals course
[17:21:02] <Jagged> oh
[17:21:16] <Jagged> so like laplace and fourier and such
[17:21:17] <Jagged> ?
[17:21:27] <kcbanner> yea exactly
[17:21:36] <Jagged> yeah... there's a lot they don't tell you :P
[17:21:51] <Jagged> even in a senior-level digital comm course, they make no mention of timing recovery
[17:22:11] <kcbanner> we did some stuff like that in our digital comms course
[17:22:21] <kcbanner> with PLLs and stuff, but at a very high level
[17:22:53] <Jagged> interesting
[17:24:09] <Jagged> at VT, PLLs are only covered in a grad level course dedicated to PLLs
[17:24:54] <Eduard_Munteanu> PLLs aren't that complicated at a conceptual level.
[17:25:09] <Jagged> conceptually, no
[17:25:47] <Eduard_Munteanu> But yeah, I guess lots of analog stuff can get hairy if you get into the details.
[17:26:24] <Jagged> and even then... it's a matter of how detailed do you want to get
[17:26:34] <Jagged> I'm currently studying for my radio engineering final :|
[17:28:31] <kcbanner> yea the stuff we did was like "there should be a PLL here to synchronize this" and that was it
[17:28:50] <kcbanner> but this was only 3rd year so nothing to crazy yet
[17:29:31] <Jagged> yeah, when you said "with PLLs and stuff" I thought you meant you went into basic PLL design...
[17:29:42] <Jagged> :P
[17:29:42] <kcbanner> oh, nope
[17:29:44] <kcbanner> lol
[17:36:35] <kcbanner> oh. I think I can do this by just multiplexing my timer output (carrier) to one of two voltage dividers, one that is 2x of the other
[17:36:56] <kcbanner> using an analog switch
[17:37:19] <kcbanner> and then AC couple it on the way out and it should be good to go
[17:43:43] <kcbanner> does that sound plausible?
[17:49:51] <Jagged> ac coupling at AF is difficult to do
[17:50:06] <Jagged> you would need a transformer
[17:50:55] <Jagged> but yeah
[17:51:19] <Jagged> of you wanted to do a 2-level square wave that would be about the simplest method
[18:28:21] <kcbanner> cool
[18:30:09] <Jagged> kcbanner: by ac coupling you meant using coupling capacitors, right?
[18:31:08] <Jagged> those capacitors need to present a low impedance at the operating frequency (essentially a HPF with the corner freq << operating freq)
[18:36:23] <kcbanner> Jagged: yea thats what I meant
[18:36:41] <kcbanner> since my voltage div output is going to be from 0v-100mv not -50mv to 50mv
[18:37:33] <kcbanner> at 11kHz
[18:48:21] <Jagged> kcbanner: yeah it's doable... just realizing that you'll have some non-ideality with your coupling capacitor
[18:48:32] <kcbanner> gotcha