#avr | Logs for 2013-10-03

Back
[10:45:28] <Peanut> Hi, I've been wondering - imagine I have two ATtiny chips, and connect them together over one of their IO ports. Could I somehow set things up that I can both send state information (0 or 1) from the one to the other, and simultaneously read the output state of the pin on the other chip?
[10:47:15] <DrLuke> Anybody got an idea why the SPI SPIF flag wouldn't set itself? This is the code I use: http://pastebin.com/XM5k8Mk5 and the device is an atmega1284p
[10:47:27] <DrLuke> Peanut: You'd need a protocol for that
[10:47:51] <DrLuke> so each device knows when the other is sending data, and don't do so at the same time
[10:48:34] <Peanut> DrLuke: Yes, if I can synchronise them, I could do some kind of TDM. But I'm looking for something stateless, using just simple resistors/diodes between them, and really only using one pin on each AVR. Just interested to see if that's possible.
[10:48:43] <DrLuke> It could be relatively simple though: just check if the other device is currently writing, and if yes, wait for the end-signal, if no start writing
[10:49:23] <DrLuke> but you definitely can't read and write at the same time
[10:49:37] <Peanut> Ok, thanks, I guess that answers my question.
[10:49:52] <DrLuke> all you'd read is what you've written, as output and input are tied together electrically by the pin
[10:50:13] <Peanut> I'd 'write' by putting the port in Open-Collector or not, perhaps?
[10:50:45] <DrLuke> you're still manipulating the voltage level
[10:50:50] <DrLuke> resulting in a false read
[10:50:52] <Peanut> Or rather, send one state by setting the port as input.
[10:51:21] <DrLuke> you can't detect if a pin is highz that easily I think
[10:51:41] <Peanut> *nod* I couldn't quite work it out. I'll have to make a simple protocol then, and switch directions all the time.
[10:51:55] <DrLuke> really not that hard in my opinion
[10:52:09] <DrLuke> all you need is a fixed end-code or signal
[10:52:38] <DrLuke> or tell the receiving device how many bytes it has to expect before the line is free again
[10:53:14] <Peanut> DrLuke: in itself it isn't, but I'm aiming for lowest part-count and cost, and it has to 'communicate' with a few of them. I'll keep on doodling, thanks.
[10:53:39] <DrLuke> Peanut: basically you'd have a zero part count that way
[10:53:46] <DrLuke> if you have the same voltage levels on all devices
[10:54:13] <Peanut> DrLuke: correct, just a somewhat more complicated firmware.
[10:54:26] <DrLuke> yup
[10:54:36] <DrLuke> might have to sacrifice a timer for it
[10:54:56] <DrLuke> unless you can repurpose another timer
[10:55:57] <DrLuke> I wonder if anyone is going to help me with my problem :(
[10:57:16] <Peanut> Had a look at it, but I'm not used to using C on these, sorry.
[11:15:30] <Peanut> DrLuke: Have you set the DDR for that pin?
[11:15:39] <DrLuke> Peanut: yes
[11:21:37] <DrLuke> What the hell, I just rewrote the code, and now it works
[11:21:38] <DrLuke> oh well
[11:21:42] <DrLuke> must've had an error somewhere :/
[11:23:36] <Peanut> Congrats :-)
[13:11:06] <WormFood> ok, I've updated my avrbaudcalc page. If anyone notices any problems, please give me a shout.
[14:52:00] <malinus> Tom_itx, is the recent update to the usbtiny, just to make it work with atmel studio 6, or also some other changes?
[16:21:32] <Tom_itx> malinus, just a minor version update to satisfy studio 6
[16:31:03] <malinus> okay. I'll won't bother then
[16:38:06] <Tom_itx> features haven't changed for quite a while other than minor rev updates for 6
[17:08:42] <TechIsCool> I have a question about progmem. If I have a static variable like a pwm location stored in progmem why can't I target it like normal?
[17:09:36] <N1njaneer> Because it's in progmem :)
[17:09:57] <N1njaneer> AVR is a Harvard architecture device, which means that RAM is seperate from code.
[17:09:59] <TechIsCool> but I should be able to say pgm_read_word and get a value that I could set correct
[17:10:17] <N1njaneer> You can only read it, not set it.
[17:10:33] <N1njaneer> If you need it to be persistent but alterable, you'd have to put it into EEPROM
[17:10:44] <malinus> TechIsCool, if you wanted to change it, you would actually be reprogramming the chip while it runs
[17:11:02] <TechIsCool> ok but say I have a location for a pwm channel like TCC0.CCA
[17:11:07] <N1njaneer> Anything in progmem has to be marked and treated as const data.
[17:11:32] <TechIsCool> If I understand correctly its just a uint_16t correct with a location in memory on how to update th value correct
[17:12:00] <TechIsCool> typed that wrong woops uint16_t
[17:12:38] <TechIsCool> #define TCC0 (*(TC0_t *) 0x0800)
[17:12:55] <malinus> TechIsCool, that's just a constant, what does it have to do with progmem?
[17:13:17] <N1njaneer> pgm_read_word() is a function that would return a short.
[17:13:52] <TechIsCool> const unsigned int PROGMEM led_channel_location[] = { TCC0.CCB,TCC0.CCA,TCC0.CCD TCC0.CCC};,
[17:13:57] <TechIsCool> so I have that
[17:14:11] <TechIsCool> I am trying to say read the led_channel_location[2];
[17:14:28] <malinus> ah yeah, you can't do that
[17:14:41] <TechIsCool> why not if its a constant
[17:15:02] <malinus> I'll need to think, but something about pointers, haha
[17:15:10] <TechIsCool> ok
[17:15:12] <malinus> maybe somebody else can explain, actually
[17:15:43] <malinus> I just remember wanting to do something similar, and it wasn't really possible.
[17:15:57] <malinus> Can't get my head around it right now
[17:16:07] <TechIsCool> ok
[17:16:15] <N1njaneer> Tech: Which AVR device?
[17:16:28] <TechIsCool> Xmega32a4u
[17:21:45] <malinus> TechIsCool, which board? I'm just curious :)
[17:22:20] <TechIsCool> malinus: Custom but I have a mt-x4 as well
[17:22:36] <malinus> you made it yourself?
[17:22:40] <TechIsCool> Correct
[17:22:59] <malinus> cool
[17:23:41] <N1njaneer> Tech: It seems like there are easier ways of doing this, but assuming you are looking at writing to the special funciton registers, you'd have to store their addresses as actual numbers (in progmem) then cast them to volatile pointers to hit those registers directly. I'm not 100% following what you are specifically trying to do with that notation, though.
[17:23:43] <malinus> TechIsCool sorry I wasn't to much more help. But try reading this: http://www.nongnu.org/avr-libc/user-manual/pgmspace.html
[17:23:57] <TechIsCool> malinus: http://techiscool.com/Pictures/index.php?cmd=image&sfpg=UHJvamVjdHMvMTB3X2xlZC8qUHJvamVjdCBGYW4uanBnKmUzMzkwZjFlZmYzNDhhZTQ0YWUzZjFmN2IzNzhmMjBh
[17:23:59] <malinus> iirc theres is some example with similar problems
[17:24:42] <malinus> TechIsCool, lol ,what? Why on a radiator?
[17:24:57] <TechIsCool> 10w RGB Led on an old intel heatsink
[17:25:11] <malinus> oh that's one big LED
[17:25:18] <malinus> I was going to ask what it is
[17:26:40] <malinus> TechIsCool, looks like you could just do channel_pos = pgm_read_byte(&(led_channel_location[2]));
[17:26:50] <malinus> and that should actually give you the value, and not the adress
[17:27:06] <TechIsCool> Error 5 lvalue required as left operand of assignment
[17:27:26] <malinus> read what I linked and play around with it :)
[17:27:33] <TechIsCool> I will
[17:27:47] <N1njaneer> Tech: What is it that you're trying to do in general? The only reason to really invoke PROGMEM anyhow is if you are storing large amounts of data and can't afford it being in RAM. Unless you have those reasons, drop PROGMEM use and just use it outright.
[17:28:26] <malinus> ^very important. What you normally would store in PROGMEM is like N1njaneer said, long strings. Or stuff like bitmaps etc.
[17:28:34] <TechIsCool> N1njaneer: Alright lets see if that works I am just used to doing it this way
[17:28:34] <malinus> music ;D
[17:28:42] <N1njaneer> It will also run far faster without PROGMEM usage, as there's a lot that goes on behind the scenes to read flash, cast, and act on the data.
[17:29:26] <N1njaneer> What you want to do is technically possible, but you have to straighten out some of your casts and such, and there's going to be a hell of a lot of overhead.
[17:29:38] <TechIsCool> ok
[17:29:51] <TechIsCool> make sense so I should try to keep them in ram if at all posible
[17:30:00] <N1njaneer> What switching driver are you using on that board, if I may ask?
[17:30:25] <TechIsCool> N1njaneer: https://d3ffynyi1lxfcp.cloudfront.net/datasheets/1192/2013-09-21-21-38-34/PT4115E.pdf
[17:32:27] <N1njaneer> Nice. Yeah, those will work well provided you don't need really low-end dimming or are expecting to run super-short pulses on them :)
[17:33:04] <TechIsCool> I have been running them at 16bit pwm and get them all the way down the be able to look direct at them
[17:33:27] <N1njaneer> What frequency?
[17:33:42] <TechIsCool> not sure can't remember since its been a while
[17:34:23] <N1njaneer> Sounds like fun :)
[17:34:27] <TechIsCool> malinus: This is the board that I am working on right now. http://techiscool.com/Pictures/index.php?cmd=image&sfpg=UHJvamVjdHMvbGVkX2tpdGNoZW4vKkFpcndpcmUgSXNzdWUuanBnKmNhYWIwYTVjOWNmMTZmZDE2ZmJhMzY2ZTljYzg4OTI5
[17:34:49] <Tom_itx> TechIsCool, http://tom-itx.dyndns.org:81/~webpage/abcminiuser/articles/progmem_basics_index.php
[17:36:19] <malinus> looks nice
[17:38:05] <N1njaneer> And good job on ACTUALLY decoupling the processor well!
[17:38:52] <N1njaneer> Always amusing when people completely ignore the 0.1uf's and MAYBE you're lucky if they stick on one somewhere close to the device. :)
[17:39:32] <TechIsCool> N1njaneer: Thanks had some awesome help from some people in here and around irc. The led board was my first board I have ever made and this is my second I took it slow and everything works correctly. If find if you read the tech sheets they give huge amounts of insight
[17:40:15] <N1njaneer> Very nice clean layout for your first few attempts! Congrats. :)
[17:41:42] <N1njaneer> I always hand-route all of my designs. Takes longer, but I can always compress them down and beat the pants off the autorouter, plus they always look much nicer. And signal integrity is always generally far better, too, and less EMI.
[17:42:45] <TechIsCool> Funny thing I was talking about my design and someone metions an autorouter and I was done with my first board. I was like what this can be done automatically. Save file rip up all traces let the auto router at it and went glad I did it myself
[17:45:21] <N1njaneer> Yeah, unless you're doing like 8+ layer boards, the autorouter will generally just make a huge mess out of it :)
[17:46:07] <TechIsCool> Thats what I find and when I talk to people in the actual industry they let the auto router out on a short leash in a small area and then modify what they don't like
[17:50:33] <N1njaneer> I've also had to do exotic multilayer boards that followed complex spline-paths that were absolutely as compact as could be physically fabriated by the board-house with copper-to-edge requirements. That required actually doing the trace layouts in AutoCad to do compound offsets, exporting tens of thousands of sets of arcs in as templates, and then stitching everything back together. :)
[17:51:07] <N1njaneer> The autorouter would have layed like three traces and given up!
[17:51:28] <TechIsCool> Ugh sounds like so much fun. So true about the autorouter
[17:52:24] <N1njaneer> Large boards had to be fabbed on the hypotenuse inside of a since 20" x 20" panel - kinda big. Jigging them for pick and place and reflow was fun.
[17:52:44] <N1njaneer> +single
[17:53:09] <TechIsCool> lol, never had the pleasure of setting up a pick and place run. I am the pick and place...
[17:53:23] <N1njaneer> But the CAD files look beautiful. :)
[17:53:42] <N1njaneer> Pick and place setup is generally pretty quick when you export Centroid data if the parts are already loaded.
[17:53:49] <TechIsCool> I like to think that all motherboards and large devices are just works of part
[17:54:02] <TechIsCool> Art not part lol
[17:54:05] <N1njaneer> That they definately are!
[18:04:10] <TechIsCool> I hate pointers but I still have to learn how they work more. so got the code working. Found an google article from some awesome searching. http://www.edn.com/electronics-blogs/embedded-basics/4402130/Pointer-arrays---Part-1--A-timer-driver
[18:07:09] <N1njaneer> Tech: Here's one I did 5-6 years ago that I still think is very aesthetically pleasing in layout! https://www.dropbox.com/s/83crkxnauta0yg5/RTInProgress3-256.png
[18:08:32] <N1njaneer> And all routed in only 2 layers as well.
[18:08:40] <TechIsCool> 4mil traces?
[18:08:58] <N1njaneer> That should be all 8
[18:09:03] <bss36504> PCB Layout-porn time?
[18:09:09] <TechIsCool> lol
[18:09:20] <N1njaneer> bss: Yes, show us your naughtness in copper!
[18:09:33] <bss36504> ooh baby. hang on
[18:09:40] <TechIsCool> lol :p
[18:09:44] <N1njaneer> Well, >= 8 as there's some pretty fat traces on there :)
[18:10:08] <TechIsCool> so why a linear regulator? was it just to clean up power?
[18:11:11] <N1njaneer> In particular, I like my 3-trace spiral that carries GND, 3.3V, and 2.5V to the pins on the 208-pin FPGA. Anything else with those these days I do on 4-layer, but this was a hack of a board to run 128 LEDs individually dimmed with 100% duty cycle, and so signal integrity really wasn't an issue :)
[18:11:39] <TechIsCool> way to cool
[18:11:50] <N1njaneer> Tech: Yes, to clean up incoming 6-7V and bring it down to 5V, 3.3V, and 2.5V
[18:12:12] <N1njaneer> Some nice fat 100uf tantalums on there and under the FPGA, too :)
[18:12:37] <N1njaneer> Especially useful due to the long traces on the spiral :)
[18:13:16] <TechIsCool> So what software are you using
[18:13:17] <N1njaneer> I generally keep everything on the top of the board unless we're space-constrained or have other needs, since it requires two passes through production to mount both sides.
[18:13:23] <N1njaneer> Altium
[18:13:28] <bss36504> N1njaneer: http://i.imgur.com/hTNl4DD.png
[18:13:39] <TechIsCool> :( I hate they don't have a student version
[18:13:53] <N1njaneer> Yeah.
[18:14:06] <TechIsCool> bss36504: nixie clock?
[18:14:23] <N1njaneer> bss: Nice!
[18:14:37] <N1njaneer> Lesse, what else can I post that's not under NDA XD
[18:14:57] <bss36504> TechIsCool: Interesting guess. No its actually a super basic schematic, but it's a high speed interconnect board for connecting 16 memory chips in parallel to the tester
[18:16:46] <TechIsCool> I found 2 extra via's
[18:17:22] <bss36504> I really enjoy doing copper art as much as possible. I made a board recently that needed a lot of space for mechanical reasons, so I put our BAMC logo in giant exposed gold on the top side. Looks so pretty. If you can get ENIG boards, I highly recommend it.
[18:17:30] <bss36504> TechIsCool: was that to me?
[18:18:05] <N1njaneer> bss: Just did ENIG last week with matte black, in fact. They look spectacular
[18:18:14] <bss36504> They are probably ground stitching. the board actually copper filled around the traces, but you cant see shit when it's filled.
[18:18:16] <TechIsCool> bss36504: yes. all the way at the end you will see a trace between the two round circles. no reason to go up and back unless its for ground plane
[18:18:57] <TechIsCool> yup make sense but it so much harder to see traces with the ground plane visible
[18:19:26] <N1njaneer> bss: And when you start stiching thermal vias and then remembered you forgot to turn off loop removal when they start spontaneously disappearing... :)
[18:19:46] <bss36504> N1njaneer: Yeah for our small boards or one-offs we use OSHPark (I highly recommend btw, $5 square inch, but you get three boards, purple soldermask, ENIG finish) and they look pretty awesome. Unfortuneately the big one was just regular green. The gold plating under the soldermask makes the whole board shine.
[18:20:01] <bss36504> Oh see I use eagle, so I dont have those fancy features.
[18:20:08] <bss36504> Eagle*
[18:20:32] <bss36504> Is your job PCB layout, N1njaneer?
[18:20:43] <N1njaneer> I fab everything through Advanced out of Colorado, or PCBUniverse out of Seattle, unless we have really specific needs. There are some guys in Chicago doing some amazing metal-core multi-layer hybrids :)
[18:21:04] <N1njaneer> bss: A bit of everything when you run two smaller companies :)
[18:21:22] <N1njaneer> We do special effects and LED lighting products.
[18:22:35] <bss36504> We use Avanti Circuits from (I think) Arizona. Pretty much $300 no matter what if it's under 11"x15". Since am the whole applications department, I end up doing pretty much the whole design flow for any sort of widgets I make. Circuits, PCB, software.
[18:22:47] <bss36504> Since I am*
[18:22:52] <N1njaneer> Yeah, same here
[18:23:16] <bss36504> It's fun wearing different hats, keeps things interesting.
[18:23:42] <TechIsCool> N1njaneer: I love DMX and all the lighting control. I am an Electrician and love doing House lighting and all the control wiring. First thought when I heard what your board was could I re wire all my cans to be LED controlled...
[18:23:52] <bss36504> My first ever 4 Layer. There were so many I/Os and we needed power supply stability, hence the 4 layers: http://i.imgur.com/vEQDawa.png
[18:24:30] <N1njaneer> Tech: Yeah, good stuff. I've been doing DMX items for the past 12 years or so. :)
[18:25:49] <bss36504> Thats pretty cool (also something I have very little knowledge of). What's your layout tool?
[18:25:49] <N1njaneer> So if you ever have any DMX questions, feel free to fire away.
[18:25:59] <N1njaneer> bss: Altium
[18:26:01] <bss36504> Will do!
[18:26:32] <TechIsCool> N1njaneer: you ever seen this site? http://doityourselfchristmas.com/
[18:26:33] <bss36504> I'd love to try it. I understand it's somewhat of the standard, but the learning curve is a tad steep from what I've heard.
[18:27:00] <N1njaneer> Tech: Yeah, have heard of it but not really looked at it :)
[18:27:24] <TechIsCool> seems like the most active community using DMX without NDA if you know what I mean.
[18:27:49] <N1njaneer> bss: Altium is certainly that, but there's practically nothing you CAN'T do with it. In particular, though, I could absolutely not live without the 6DOF SpaceMouse support for the layout editor. Doing board layout without one is like trying to route with one hand cut off.
[18:28:36] <N1njaneer> DMX is a completely free ESTA-managed protocol, no NDAs involved :)
[18:28:44] <N1njaneer> As is ArtNet.
[18:29:14] <TechIsCool> ah ok
[18:29:24] <bss36504> N1njaneer: You just blew my mind with the SpaceMouse
[18:29:40] <N1njaneer> Heck, VID numbers are free from ESTA - just email them any tell them you want one. They'll even let you pick if it's avaliable, unlike USB SIG.
[18:29:50] <bss36504> I do it all with a regular person mouse, no autoroute, no via and trace pushing, all manual.
[18:30:32] <N1njaneer> bss: I use a trackball on my right hand and Spacemouse on the left. The Spacemouse does navigation and speed tool selection with the buttons, trackball does the trace routing :)
[18:31:04] <bss36504> That is badass.
[18:31:04] <N1njaneer> bss: Being able to assign fingertip buttons for initiating routing, layer changing, etc saves a LOT of time.
[18:31:20] <N1njaneer> They are amazing for Solidworks and similar, too.
[18:31:27] <bss36504> I dabble in that as well.
[18:31:31] <N1njaneer> Because really for board routing it's only 3DOF translations.
[18:31:47] <bss36504> You'd probably slam your face on a pencil if you tried Eagle
[18:32:13] <N1njaneer> bss: http://www.ebay.com/itm/NEW-3D-Connexion-3D-Motion-Control-SpacePilot-USB-Space-Mouse-SP1USB-/200961398881?pt=Mice&hash=item2eca3b9861 -- have a couple of those kicking around here. Older model, but work well, and will often show up for around $100-$120
[18:32:54] <N1njaneer> Ahh yes, one up for $124.95!
[18:33:17] <N1njaneer> Tech: You really don't need the VID code for normal DMX stuff unless you start doing RDM.
[18:33:21] <bss36504> I may have to consider that sometime, or just make work pay for it.
[18:33:43] <N1njaneer> Be warned that once you use one you'll never want to be without one.
[18:33:53] <N1njaneer> For 3D stuff especially they are amazingly choice.
[18:41:06] <N1njaneer> A Solidworks friend of mine recommended one to me years back, and like he said, life would never be the same :)
[18:41:54] <bss36504> They look pretty awesome
[18:42:42] <N1njaneer> The newer ones look nicer, but the older ones are waaaay cheaper second-hand on eBay :)
[18:55:53] <N1njaneer> Wow, gotta love it when Molex doesn't make a wire-crimp mate to their own products.
[18:56:37] <bss36504> Ha! that's super nice
[18:56:49] <N1njaneer> But found the match from Tyco
[19:42:02] <Bird|lappy> N1njaneer, was reading up and caught your comment on decoupling
[19:42:23] <Bird|lappy> my problem with some of my designs is that I stick my bypass caps so close to my ICs that it causes assembly difficulties
[22:12:28] <TechIsCool> Bird|lappy: LOL there are keepouts for a reason.
[22:22:25] <Bird|lappy> TechIsCool, yep