#avr | Logs for 2015-07-02

Back
[00:54:40] <jerware> hiya!!
[00:55:10] <jerware> I can't find my avr dragon under /dev/tty, but linux recognizes it under dmesg. http://codepad.org/JcOC7xM8
[00:58:32] <jerware> does the avr dragon need linux drivers?
[01:01:58] <Casper> some programmers don't show up as a serial port
[01:02:06] <Casper> which is the case for the mkii
[01:04:59] <jerware> so what do I pass to avrdude -P ?
[01:08:51] <jerware> -P usb
[01:09:22] <Casper> I forgot :D but something like that
[01:15:58] <jerware> linux found my avr dragon, but I now have a new error. http://codepad.org/7lhggEkP
[01:18:21] <jerware> I'm using the zif socket. pin 1 faced down.
[01:37:29] <jerware> according to http://www.avrfreaks.net/sites/default/files/AVR%20DRAGON.jpg there's 3 pins for VCC and GND each. Why 3? Does it matter which one I pick?
[01:37:33] <jerware> I can get 5v from my beaglebone
[01:37:35] <jerware> but I don't want to select the wrong pins if there's 3 just for 5 more volts
[01:38:05] <jerware> RSP_NO_TARGET_POWER is a dead giveaway from the error msg.
[04:48:37] <Jartza> hmmh
[04:48:53] <Jartza> has anyone used USI _much_ and knows deeply how it works? :)
[04:50:09] <Jartza> what I want to know is, can I only use the shift register and strobe it "manually" without using clock pin? :)
[04:52:01] <specing> I think you can
[04:53:13] <Jartza> so far I've tested it also pulses the clock if the clk pin is set to output
[04:53:24] <Jartza> but it might be I didn't get "something" in the datasheet
[04:54:45] <Jartza> maybe by setting the USI as slave and still setting the clock pin as output? :)
[04:55:06] <Jartza> yes, I would like to "misuse" the usi shift register functionality for something completely different
[04:55:41] <Jartza> and using only one pin
[05:02:57] <Jartza> ahh
[05:03:03] <Jartza> maybe I need to use "3 wire operation"
[05:03:12] <Jartza> The Data Output (DO) pin overrides the corresponding bit in the PORTB register.
[05:03:12] <Jartza> However, the corresponding DDRB bit still controls the data direction. When the port pin is
[05:03:16] <Jartza> set as input the pin pull-up is controlled by the PORTB bit.
[05:03:18] <Jartza> The Data Input (DI) and Serial Clock (USCK) pins do not affect the normal port operation. When operating as master, clock pulses are software generated by toggling the PORTB register, while the data direction is set to output. The USITC bit in the USICR Register can be used for this purpose.
[05:04:22] <Jartza> I need to test that
[10:57:56] <Hexum064> good morning all
[11:00:18] <DKordic> Good morning.
[11:02:48] <Hexum064> Someone here is alive!
[11:03:45] <LeoNerd> Many of us are
[11:03:51] <DKordic> :) logs can tell You more.
[11:06:14] <Hexum064> you could all be advanced chat bots.
[11:09:39] <Hexum064> I need some advice. I have a xmega128a4u hooked up to USB. I'm going to be pushing about 700kB/s to it that it needs to divvy up and push out to about 16 other MCUs. Would SPI be able to support those speeds or should I just go parallel?
[11:11:15] <LeoNerd> SPI can easily handle 10Mbit/sec or higher.
[11:11:37] <LeoNerd> Though don't forget that the SCK line has to be no faster than fCPU/4 on the receiving side
[11:12:15] <Hexum064> Oh that's right. Thank you for the reminder on that!
[11:12:49] <LeoNerd> Perhaps you can make use of the multiple SPI controllers though to spread that rate around?
[11:13:01] <Jartza> seems like USI misuse is indeed possible
[11:13:17] <LeoNerd> 16 slaves.. perhaps 4 on each of the 4 controllers, thus leaving only 175kbyte/sec per controller?
[11:13:27] <Jartza> using 3-wire
[11:13:28] <LeoNerd> Which us just a little over 1Mbit/sec. So well within capabilities
[11:13:33] <Hexum064> @LeoNerd, that may lead into my next question
[11:13:56] <Jartza> I only wanted to use the shift register with one pin
[11:14:06] <Hexum064> and @Jartza, in what way would it be missused?
[11:14:16] <DKordic> LeoNerd: So max bit rate is (/ F_PERIPHERAL 8)? 4 mega bit / second for 32MHz.
[11:14:23] <Jartza> Hexum064: see ^
[11:14:41] <Hexum064> yes
[11:14:42] <LeoNerd> /8? I thought it was /4? OR does that differ on the xmega vs. mega?
[11:15:52] <Tom_itx>  /4 on regular 8bit avr
[11:16:22] <DKordic> (SCK = F/4) and (SDA = SCK/2). So (SDA = f/8). Same on XMEGA except higher F.
[11:16:58] <Hexum064> So I was thinking I could use DMA to send the data out via SPI as the data was received via USB. Say, in 64 byte chunks. So. 1: Does that sound feasible/reasonable? 2: Would having 4 slaves on each of 4 separate controllers gain me anything?
[11:19:10] <Jartza> I just tried to first misuse USI in 2-wire mode, seems 3-wire mode is more flexible
[11:19:41] <Hexum064> @Jartza, just to be sure USI = universal serial interface?
[11:21:07] <DKordic> Hexum064: That is exactly what DMA is for. You mean 4 slave peripherals per device?
[11:22:41] <Hexum064> DKordic: Um, not really. Use 4 SPI controllers from the master with 4 slaved on each: 4x4
[11:23:24] <Hexum064> And, I've never tried to use DMA so I wasn't sure I correctly understood its intended usage yet.
[11:23:50] <LeoNerd> DMA is one of those specialised Xmega things, that probably not too many folks around here would know about... (I for one have no clue)
[11:24:00] <Hexum064> aan
[11:24:03] <Hexum064> aah*
[11:24:25] <Jartza> Hexum064: yeah, that's it
[11:24:26] <Hexum064> DKordic: your response about DMA is very encouraging.
[11:26:35] <DKordic> Hexum064: Give it a shot. If You can't use it, then it will wait like many other peripherals :D .
[11:27:49] <Hexum064> Ya, true. I just wanted some idea before I go chasing an idea down the wrong rabbit hole again.
[11:28:15] <Hexum064> So I appreciate it!
[11:28:24] <LeoNerd> 16 SPI-attached peripherals sure sounds like fun though ;)
[11:28:58] <Hexum064> Doing an LED display with those strips of ws2812b chips for burning man.
[11:29:30] <Hexum064> Got a nice little 16x16 PoC working but that's small enough to be directly driven off of the single xmega
[11:30:04] <Hexum064> (16x16 LEDs that is)
[11:35:42] <LeoNerd> Hmm
[11:35:47] <LeoNerd> You know that WS2812 isn't SPI, right?
[11:35:51] <LeoNerd> APA-102s are though :)
[11:35:57] <Hexum064> Ya, I know
[11:36:13] <Hexum064> The slave devices drive the WS2812s
[11:36:23] <LeoNerd> Ahhh righty
[11:36:28] <LeoNerd> You have an SPI->WS2812 bridge?
[11:36:37] <LeoNerd> I could have done with one of them a couple of months ago. Would have saved me much fuss
[11:36:53] <Hexum064> Well, I'll probably just use an atmega32
[11:36:59] <LeoNerd> Mmm
[11:37:07] <LeoNerd> I considered writing one on an ATtiny85
[11:37:14] <Hexum064> You could
[11:37:19] <LeoNerd> My problem was receiving DMX while talking to a long 2812 chain
[11:37:20] <Hexum064> totally
[11:37:31] <LeoNerd> I *could* but that really only moves the problem, doesn't fix it entirely
[11:37:41] <LeoNerd> Now, intead of receiving DMX while talking 2812, I have to receive SPI while talking 2812
[11:37:43] <Hexum064> your problem would be the timing
[11:37:46] <LeoNerd> Mhmm
[11:37:49] <Hexum064> exactly.
[11:37:51] <LeoNerd> Instead, my solution is much more cunning ;)
[11:38:07] <Hexum064> do tell
[11:38:10] <LeoNerd> I observe that the time to receive a byte over DMX512 is longer than the time to send a byte over WS2812
[11:38:34] <LeoNerd> I observe that the loop-unrolled version of WS2812 driver, on a 16MHz CPU, has 182 NOP instructions in it
[11:38:44] <LeoNerd> So I just weave the UART management code inbetween the WS2812 driver
[11:38:52] <Hexum064> nice
[11:39:23] <LeoNerd> I don't have to *process* that incoming DMX data, I just have to shove it into a buffer to process once I've finished one refresh round on the LEDs
[11:39:26] <Hexum064> I was going to see if I could interleave driving more than one display of 1024 WS2812s at a time
[11:39:40] <LeoNerd> Ah, my strip is only 120 LEDs long
[11:39:51] <LeoNerd> So I know I can write the whole refresh quicker than a DMX frame
[11:39:59] <Hexum064> true
[11:41:29] <Hexum064> The problem with the long chains becomes one of memory
[11:41:37] <LeoNerd> Mmm
[11:41:51] <LeoNerd> Are you aware of the Adafruit Fadecandy?
[11:41:56] <LeoNerd> It sounds like you're making something quite similar
[11:42:05] <Hexum064> You need to send it out all at once else you might hit that 50us refresh timeout for the WS2812
[11:43:14] <Hexum064> Probably. Just at a ton less expensive, custom, and a ton more educational.
[11:43:34] <Hexum064> Trading off some time and hard work for the experience
[11:45:00] <LeoNerd> :)
[11:45:18] <LeoNerd> Ohyes.. not suggesting "give up and buy one" - just useful to be aware of similar things, as a point of note
[11:45:21] <LeoNerd> could see how they implement it
[11:45:37] <Hexum064> Oh, I totally appreciate that!
[11:46:22] <LeoNerd> Can't easily make out from the photos what chip they use
[11:46:33] <LeoNerd> but it seems to be just one MCU, and possibly a separate level-converter chip
[11:48:26] <LeoNerd> Ah. "a Freescale Kinetis K20"
[11:48:32] <Hexum064> hmmm. ya looks like that
[11:48:33] <Hexum064> OOh
[11:49:10] <LeoNerd> Ah. ,which is 3.3V which explains that separate SOIC20 package next to it
[11:49:16] <Hexum064> yep
[11:49:19] <LeoNerd> I expect that is a level converter.. 74xx245 or such
[11:50:00] <Hexum064> btw, xmega is 3.3 and drives the data to the WS2812 just fine. Just FYI.
[11:50:09] <LeoNerd> Can depend on the LEDs
[11:50:15] <LeoNerd> Some are happy with 3.3, some aren't
[11:50:24] <LeoNerd> I have some of the 5mm diffused package ones.. they're odd
[11:50:43] <Hexum064> As long as the first one works, you're good. It'll drive the rest
[11:50:56] <LeoNerd> Hehe.. oh I hadn't thought of that.. Use the first one as a shifter :)
[11:51:02] <Hexum064> Oh, good to know about those 5mm
[11:51:17] <LeoNerd> The other thing about the 5mm ones is that the colours are in a different order
[11:51:28] <LeoNerd> RGB on them vs. GRB for the 5050 package
[11:51:29] <Hexum064> Really? That's weird
[11:51:56] <LeoNerd> Well, the WS281x controller die just has three PWM output pins. It's up to the chip manufacturer to wire them up to the three LED junctions directly
[11:52:08] <Hexum064> true
[11:52:23] <LeoNerd> One could argue that the RGB order of the 5mm diffused package is more "correct", and everyone else has done it wrong ;)
[11:52:44] <Hexum064> Well the RGB order is def more common
[11:53:16] <LeoNerd> It's annoying for my latest project. I have a tiiiiiny little chain of 2 such LEDs. A 5050 package on the main board, and a 5mm diffused one heatshrunk to a flying probe
[11:53:17] <Hexum064> aaaand. ROY G BIV for the rainbow
[11:53:31] <Hexum064> OOh man
[11:53:46] <LeoNerd> Accounting for that is a pain
[11:53:51] <Hexum064> Ya, you have to switch every thime
[11:54:25] <LeoNerd> https://github.com/scanlime/fadecandy/blob/fc64x8-rev-a/pcb/fc64x8/fc64x8-schematic.pdf
[11:54:32] <LeoNerd> Hah! As I said - a 74xx245 ;)
[11:57:50] <Hexum064> brb
[12:15:40] <Hexum064> back. had a meeting
[12:15:48] <Hexum064> Nice call btw!
[12:19:52] <Hexum064> OK, I have an actual EE question this time. I plan to send a sync pulse to all of the 16 slave devices (to signal them to draw their display). Think that will require a buffer?
[12:20:25] <LeoNerd> Depends on input impedence of each slave, how long cabling is, stray capacitance, etc
[12:21:26] <Hexum064> Basically just one GPIO from the master connected via a pcb trace to a GPIO on all of the slaves.
[12:22:08] <Hexum064> hmm. that does bring up a good point though...
[12:23:11] <Hexum064> This display will be 12 feet long. Would it be better to send out the data to the WS2812 over a long distance, or better to send the SPI signals and sync pulse?
[12:23:38] <LeoNerd> WS2812 being selfclocked probably travels that distance better than SPI
[12:23:58] <LeoNerd> SPI over a nontrivial distance suffers clock-skew issues, if you don't match the lengths/impedence/capacitance/etc.. of the lines just right
[12:24:12] <Hexum064> Really, really good point
[12:24:23] <LeoNerd> I've done WS2812 just fine over ~3m of totally unshielded cable in the middle of a busy stage
[12:24:25] <LeoNerd> Worked fine
[12:25:23] <Hexum064> and I might be able to move the controllers to the middle of the display which would cut the distance to a max of 2m
[12:25:44] <LeoNerd> But then you have to get your controlling USB signal in to the middle
[12:26:16] <Hexum064> True.
[12:27:04] <Hexum064> 10f USB cables, while outside the standard, are still pretty standard
[12:27:23] <Hexum064> And by that, I just mean it
[12:27:30] <LeoNerd> I've seen 5m ;)
[12:27:33] <Hexum064> it's* not too far
[12:27:36] <LeoNerd> That said I only use them for power
[12:36:41] <Jartza> ea
[12:36:51] <Jartza> finally got home and was able to test the USI
[12:37:20] <Jartza> in 3-wire mode I got it working like I wanted, so I can use just the shift register and "tickle" the bits into wire like I want
[12:37:44] <Jartza> saving very important cycles in place where it matters
[12:38:44] <Hexum064> what was your design/goal?
[12:39:44] <Jartza> stupid and useless, but just for fun because I'm on vacation
[12:39:48] <Jartza> outputting vga from attiny85
[12:39:54] <Hexum064> nice!
[12:39:59] <Jartza> I can use USI to draw single pixels :)
[12:40:16] <LeoNerd> Cute
[12:40:35] <Jartza> lack of pins forced me to use b/w only
[12:48:39] <Hexum064> Jartza: Can you explain here what your doing all together?
[12:48:51] <Hexum064> Im just curious.
[12:52:06] <Jartza> just trying to output decent vga pic from attiny85
[12:52:27] <Hexum064> using 3-wire?
[12:52:33] <Jartza> at minimum, vga needs hsync, vsync and image
[12:53:03] <LeoNerd> Do you ever need to output both h- and v-sync at the same time?
[12:53:24] <LeoNerd> If not, you could manage both with a single GPIO pin that you pull low or high, or let float about halfway
[12:53:26] <Jartza> hsync and vsync were easy part, just correct timing required and monitor stopped saying "no signal" and instead displayed black image
[12:53:50] <Hexum064> good to know!
[12:54:27] <Jartza> but now I need to output the visible image pixels to either red, green or blue pin of vga to get image
[12:54:32] <Jartza> and of course sync them somehow
[12:54:57] <Jartza> I actually just tied them together, so I'm basically outputting full red + green + blue, making white
[12:55:05] <Jartza> so far I've gotten black and white stripes :)
[12:55:14] <Hexum064> lol. It's something
[12:55:49] <Jartza> so now my plan is to use USI in 3-wire mode, because USI has shift register, which you can shift and output to pin using one opcode (just set one bit in usi register)
[12:56:19] <Hexum064> aaah
[12:56:38] <Jartza> I only actually want to use the 1 pin, but fortunately USI doesn't set the pin direction
[12:57:13] <Jartza> I want to misuse it to set pixel either on or off :)
[12:57:49] <Jartza> of course I still can't make full vga, but at least I would like to have some text on screen
[12:58:11] <Hexum064> yet...
[12:58:20] <Jartza> 640x480 vga has "pixel clock" of >25MHz, so outputting that resolution from 20MHz attiny is purely impossible
[12:58:37] <Jartza> because avr doesn't have opcodes that would take less than one clock cycle :D
[13:00:05] <Jartza> but USI can theoretically push CLK/2
[13:00:06] <Hexum064> well. not purely... You could try to overclock it
[13:00:29] <Jartza> yea, but I want to make it with "standard" speeds
[13:00:36] <Hexum064> gotcha
[13:00:38] <Jartza> overclocking is cheating :)
[13:00:53] <Hexum064> ya, I feel the same.
[13:01:06] <Jartza> anyway with 512 bytes of ram, aiming to full vga is a bit pointless
[13:01:24] <Jartza> what I really would want is at least 16*8 characters
[13:01:36] <LeoNerd> There's a Propeller-based VGA offload board I know of. It mostly just does text though
[13:02:02] <Jartza> the font can be in progmem and ram can be used as "text buffer"
[13:02:26] <Jartza> 32*12 would be supercool but I'm not sure how possible it is
[13:02:42] <specing> Jartza: get the new stm32f7 that has a 216 MHz clock: http://www.st.com/web/en/catalog/mmc/FM141/SC1169/SS1858
[13:03:08] <Jartza> ahh. point was lost.
[13:03:20] <specing> it has a built-in lcd controller iirc
[13:03:28] <Jartza> I specifically want VGA output from attiny85
[13:03:51] <Jartza> just because it's so limited chip
[13:03:52] <specing> 32x12 would work
[13:03:57] <specing> definetely
[13:04:34] <Jartza> this is more like pushing the limits. I could use ARM with external memory and make full VGA but it wouldn't be as fun
[13:04:42] <specing> you'd need about 1kHz switcing for it
[13:04:52] <specing> even less, around 640 Hz
[13:05:20] <Hexum064> for one frame/sec
[13:05:44] <specing> oh right ;p
[13:05:55] <Jartza> 32x12 characters does not equal pixels :)
[13:06:02] <specing> 16 kHz for 24 frames per second
[13:06:14] <specing> oh ... well good luck then
[13:06:17] <Jartza> plus 60Hz requires more
[13:06:23] <specing> (you are going to need it)
[13:06:24] <Hexum064> Jartza:For your chars are you planning a standard 5x8?
[13:06:36] <Jartza> nope, 4*6
[13:06:40] <specing> Jartza: you could make a VGA controller out of some 74HC
[13:09:08] <Hexum064> Jartza: Just for fun, did you see this? Makes my mouth water (and makes me feel like a noob) http://hackaday.com/2014/01/25/update-from-wayback-avga-reborn-as-retrowiz/?utm_source=feedburner&utm_medium=feed&utm_campaign=Feed%3A+hackaday%2FLgoM+%28Hack+a+Day%29
[13:09:11] <Jartza> specing: I could make VGA out from many things, but now I want attiby85 :)
[13:10:21] <Jartza> Hexum064: yea, I've seen video output from avr already :)
[13:10:52] <Hexum064> wish I had the knowledge for that.
[13:11:12] <Jartza> vga is actually not that complucated
[13:11:15] <Hexum064> soon...
[13:11:19] <Jartza> complicated, even
[13:11:27] <Hexum064> lol
[13:11:44] <Hexum064> I haven't had a project in mind for vga yet, but it looks sooo cool
[13:12:44] <Hexum064> I totally read that as complicated. I didn't even notice you had spelled it wrong.
[13:13:25] <zed___> Jartza: speaking of the attiny85 http://www.adafruit.com/product/1501
[13:14:46] <Jartza> zed___: yea, seen that but haven't used.
[13:15:33] <Jartza> Hexum064: heh, using the cellphone currently and ssh has some lag so I make typos with the touch-kb
[13:16:03] <Hexum064> aah
[13:16:48] <zed___> it looks insanely cool. I want to put it on my keychain, but I'm afraid of exposing it to static and any other elements
[13:16:55] <Jartza> was laying on hammock the whole day, just reading datashets in the sun
[13:17:02] <Jartza> yea. bit nerdy I know.
[13:17:07] <zed___> might 3d print a really tiny case for it and throw headers on it, then epoxy around the headers
[13:17:49] <Jartza> talking about attiny85, have you all read this? http://labs.rakettitiede.com/?p=87
[13:17:51] <Jartza> ;)
[13:18:11] <Jartza> (shameless advertising of my own article)
[13:18:24] <zed___> "reaching speeds of up to 12kbps"
[13:18:56] <zed___> you say that like it's fast, though if you're programming a attiny you've got ~8000kb so it wouldn't take *that* long
[13:18:58] <zed___> still really neat though
[13:19:31] <Jartza> it's quite fast for audio
[13:19:51] <Jartza> and you can update that from like cellphone
[13:20:10] <zed___> #hackingLikeIts2002
[13:20:28] <Jartza> using only one pin and internal oscillator, doesn't need to be calibrated
[13:20:42] <zed___> hmm
[13:20:49] <zed___> that would make the keychain attiny even more awesome
[13:20:57] <LeoNerd> Jartza: I presume you're writing a bootloader for this, yes? ;)
[13:21:07] <zed___> need to reprogram it? write code on your phone, program it over audio
[13:21:08] * LeoNerd ponders avrdude-alsa
[13:21:16] <Jartza> LeoNerd: already did. tagsu firmware can be updated with audio.
[13:21:20] <LeoNerd> Ah I see
[13:22:18] <Jartza> though tagsu bootloader also contains i2c-lcd-library as it updates the screen too, so it's quite a bloat still, 1968 bytes
[13:22:32] <Jartza> but some day I'll rip the extras out
[13:22:38] <LeoNerd> Mmm.. Too big for my 'tiny13 ;)
[13:22:46] <Jartza> for sure :)
[13:23:24] <Jartza> it has some useless features for tiny bootloader still
[13:23:33] <Jartza> like animated progress bar
[13:25:20] <Jartza> ...and the lcd-functions, of course
[13:25:58] <Jartza> and i2c
[13:27:06] <Jartza> on tagsu I wanted it to show status, though, so it bloated
[13:40:58] <Hexum064> that's pretty awesome btw
[13:43:26] <Jartza> it's nice :)
[13:43:37] <Jartza> to update firnwsre
[13:56:28] <Jartza> Hexum064: https://drive.google.com/open?id=0B2dTzW9TMeBxNV81WXJaVXVTU2M
[13:56:34] <Jartza> there's Tagsu updating it's firmware via audio
[13:57:54] <Hexum064> Dude. That's awesome
[13:58:14] <Jartza> although you don't see anything else changing than version number at boot :)
[13:59:06] <Hexum064> I don't have my demo vid on the net anywhere but facebook, and I can't access that here at work
[14:00:45] <Jartza> the cool thing, that audio update also works over FM radio
[14:01:34] <Jartza> might be cool addition, FM receiver and then at some events, broadcasted information on event radio
[14:01:37] <Jartza> or something
[14:02:01] <Jartza> hmm. audio to vga? :D
[14:02:09] <Jartza> ....just kidding
[14:02:20] <Hexum064> or like a "start" signal for something
[14:02:30] <Jartza> yea
[14:02:34] <Hexum064> lol, ya, audio to video...
[14:02:53] <Jartza> "watch your tagsu, when you get this message, run to stage 3"
[14:03:37] <Jartza> at least on few events in finland there has been event FM radio broadcast
[14:04:08] <Hexum064> that would be cool
[14:04:12] <Jartza> though people who try to _listen_ to that would be pissed off
[14:05:07] <Hexum064> you'd have to hide it in a non-standard frequency. Someone would hack it otherwise.
[14:05:14] <Jartza> oh, and the audio can be converted to mp3 (and currently actually is, because IE or ipad can't pkay wav)
[14:05:45] <Jartza> can't play, even
[14:06:07] <Hexum064> "pkay
[14:06:17] <Hexum064> that the Finnish spelling?
[14:06:21] <Jartza> :D
[14:06:36] <Jartza> it's my touchscreen-laggy-typoing
[14:07:49] <Hexum064> at 12kbps, you could do a monochrom 16x16x5pfs display
[14:08:06] <Jartza> heh. thought more of the update of text on screen
[14:08:27] <Hexum064> or that
[14:33:10] <Jartza> well, got some crap on screen. maybe it's a start still :)
[14:34:14] <Hexum064> it totally is
[14:35:36] <stevejobsinhell> moin.
[14:36:44] <stevejobsinhell> I flashed a blank avr, atmega328p, with the avr dragon. The flashing was successfull, but it's blink program isn't working on the breadboard. It works with a regular arduino (avr with its bootloader). http://codepad.org/sKYkXndu
[14:44:19] <Hexum064> well, at this point it could still be code, or it could be hardward
[14:57:50] <Jartza> stevejobsinhell: did you burn fuses?
[14:58:41] <Jartza> and are you running with external or internal oscillator?
[15:00:21] <Jartza> ...and how does your code and breadboard look like?
[15:03:04] <stevejobsinhell> Jartza I have an external crystal. I tried with both with it and with out it.
[15:03:14] <stevejobsinhell> How do I set the oscillator? How do I know what fuses to burn?
[15:03:24] <stevejobsinhell> I just used avrdude -p atmega328p -c dragon_isp -P usb -e -Uflash:w:foo.hex
[15:03:33] <Jartza> so no fuses
[15:03:40] <stevejobsinhell> No.
[15:03:58] <stevejobsinhell> What fuses should I burn for a blank avr chip?
[15:04:12] <Jartza> http://avrcalc.pl/
[15:04:19] <Jartza> there's a calculator
[15:04:45] <Jartza> the fuses define the oscillator used and many other things
[15:04:56] <Jartza> you burn them with avrdude too
[15:05:13] <Jartza> also code would be great, like pastie.org it or something
[15:05:29] <stevejobsinhell> Ok I ran the avr calc and got, http://avrcalc.pl/ATmega328P.html
[15:06:20] <stevejobsinhell> Do I use the 3 hex numbers at the bottom for avrdude ?
[15:07:19] <Jartza> leave SPIEN on if you want to program with avrdude
[15:07:36] <Jartza> yes, the three numbers tell the fuses
[15:07:46] <Jartza> low, high and extended
[15:08:34] <stevejobsinhell> I risk damaging the chip if I set a wrong fuse. right? Or can I just try again with avr dude
[15:09:02] <Jartza> as long as you keep the SPIEN you can burn them again
[15:10:38] <Jartza> avrdude <your chip & programmer flags> -U lfuse:w:0x??:m -U hfuse:w:0x??:m -U efuse:w:0x??:m
[15:10:52] <zed___> Jartza: regardless of what fuses are set, can't you always clear the entire chip and start over?
[15:10:52] <Jartza> of course, replace the ?? with the correct hex
[15:11:09] <Jartza> zed___: with mega, I think so
[15:11:18] <Jartza> with tiby, you need HVSP
[15:12:18] <zed___> which is easy when you've got a stk500 ;)
[15:13:02] <Jartza> if it's "real one" and not clone, yes
[15:13:29] <Jartza> some of the clones don't have the HVSP option
[15:13:34] <Jartza> nor HVPP
[15:14:02] <zed___> yeah, i've got a real one in front of me. trying to re a atmel16 qfp package on an unknown board, using the stk500 with a dip package atmega16 to learn to write code for it
[15:14:23] <zed___> so far i've got the leds on the stk500 to blink when i press switches
[15:15:04] <zed___> got atmel and atmega mixed up, but you get the idea
[15:15:58] <Jartza> I'm still learning too
[15:16:00] <Jartza> every day :)
[15:19:31] <Hexum064> Anyone here done some USB projects?
[15:20:16] <Hexum064> For those following along, I have an xmega128a4u attached via USB to my comp, but it's set up to look like a virtual COM port. That's going to be too slow for what I want.
[15:20:44] <zed___> why is it too slow? what are you doing that would need a faster speed?
[15:20:55] <Hexum064> display stuff.
[15:21:11] <Hexum064> I'll need throughput at around 5mbs
[15:22:22] <zed___> good luck, serial communication doesn't get that high
[15:22:57] <Hexum064> Right. USB does though
[15:23:23] <Hexum064> So I want to make the device appear as a different type of USB device instead of a virtual COM port.
[15:24:05] <zed___> making it "appear" as a different device doesn't change the fact that it speaks a serial connection which is limited by serial rates for data transfer
[15:24:49] <Hexum064> full speed USB is 12mbs
[15:24:58] <Hexum064> And the xmega can handle that
[15:25:02] <stevejobsinhell> what is the SPIEN ?
[15:25:11] <zed___> stevejobsinhell: SPI enable
[15:26:10] <zed___> Hexum064: read the data sheet, set cpu clock to 12mhz
[15:26:22] <zed___> Hexum064: page 41
[15:26:25] <zed___> http://www.atmel.com/images/Atmel-8387-8-and16-bit-AVR-Microcontroller-XMEGA-A4U_Datasheet.pdf
[15:27:47] <Hexum064> zed___:Yes.
[15:27:49] <zed___> Hexum064: or also check avrfreaks and search through there, i found this: http://www.avrfreaks.net/forum/full-speed-usb-xmega
[15:29:17] <Hexum064> cdc_stdio sets up the USB as a virtual COM port. That protocol is normally limited to about 500kbps
[15:29:42] <Hexum064> well, I should say, most examples using cdc_stdio
[15:30:36] <zed___> yeah, i noticed that
[15:30:57] <Hexum064> but that's a great page to read up on, so thanks for posting it!
[15:31:13] <zed___> can't provide much help other than googling stuffs and throwing links at you, you could try posting on the avrfreaks forum and more people would see it
[15:32:42] <Hexum064> It's all good. I'm trying to prioritize the things I need to learn as well.
[15:33:32] <Hexum064> I need to get better with interrupts, but those aren't that hard.
[15:33:49] <Hexum064> I need to learn how to implement DMA, which I've never tried before
[15:34:06] <Hexum064> And I need to learn more about creating USB devices and host side drivers
[15:34:10] <zed___> that's like 6 levels above my pay grade and 12 levels above my hobbyist grade
[15:34:17] <Hexum064> lol
[17:15:10] <zed___> anyone know a thing or two about asm for the avrs?
[17:15:51] <Hexum064> like what?
[17:16:28] <zed___> http://goo.gl/iOmce0
[17:16:48] <zed___> line 69 says it's an invalid number
[17:16:54] <zed___> well, i used to have that line as
[17:16:59] <zed___> sbi PORTB, pinval
[17:17:11] <zed___> the goal being to turn on LEDs when the switches are pressed
[17:17:27] <zed___> ignore the LEDon label
[17:17:37] <Hexum064> ok
[17:17:57] <zed___> i've tried lame stuff with values for pinval/r25
[17:18:05] <zed___> so i want to store whatever the current pin is in r25
[17:18:39] <zed___> when i hit ledoff, i want to set that led off
[17:18:55] <zed___> any ideas?
[17:19:33] <Hexum064> looking through the code now. I always have to switch my brain into asm mode
[17:20:41] <Tom_itx> why do you start with pinval using a binary value then switch to dec?
[17:21:00] <zed___> Tom_itx: was gonna change them all to a binary value before pasting that, but it was originall all dec
[17:21:21] <Tom_itx> quite a mix of hex bin and dec there
[17:21:31] <zed___> ;) i know
[17:22:41] <Tom_itx> the others have a PIND, after each pinval
[17:23:33] <zed___> so all of portD is connect to switches
[17:24:01] <zed___> sbic should test pind #0, and if not pressed, turn off the led, otherwise, turn on the led
[17:24:35] <Hexum064> I thought sbi took a constant val, not a val in a register
[17:24:53] <zed___> yeah, i think that's what the problem is
[17:25:08] <zed___> any way to make it take a val in the register?
[17:25:20] <Tom_itx> SBI PINB, PB2 ;toggle PB2
[17:25:23] <Tom_itx> is what i do
[17:25:49] <Hexum064> what is PB2 in this case?
[17:25:56] <Tom_itx> http://tom-itx.no-ip.biz:81/~webpage/avr/tiny10/t10blink.asm
[17:26:01] <Tom_itx> basic led blinky
[17:26:15] <zed___> got the leds to blink, i wanna make em blink when I press switches :D
[17:26:30] <zed___> PB2 is port b data register bit 2
[17:26:44] <Tom_itx> yeah that's defined in the header
[17:27:01] <Hexum064> aah
[17:27:10] <Tom_itx> err, .inc file
[17:27:14] <zed___> yeah
[17:27:29] <Hexum064> zed___: In your case, instead of doing a jmp, you could set or clear the port with a constant
[17:28:06] <zed___> hmm
[17:28:10] <Hexum064> i.e. ldi pinval, 0b00000001; sbic PIND, 0 ; sbi PORTB 0;
[17:28:21] <Hexum064> ok, well that would do the opposite
[17:28:40] <Hexum064> but instead of sbic
[17:29:54] <Hexum064> SBIS
[17:30:13] <Hexum064> that's what I thought the op code was but I couldn't be sure
[17:30:35] <Hexum064> ldi pinval, 0b00000001; sbis PIND, 0 ; sbi PORTB, 0;
[17:31:04] <Hexum064> You actually don't need ldi pinval, 1
[17:32:17] <Hexum064> in fact, you may be able to just do this:
[17:33:25] <Hexum064> ld r25, PORTD; out PORTB, r25
[17:33:34] <Hexum064> don't quote me on that
[17:35:17] <zed___> it's ldi, but i'll try that
[17:35:39] <zed___> nah that didn't work
[17:36:00] <Hexum064> I don't think it's ldi. You can only use that to store a constant in a register
[17:36:52] <Hexum064> sry. I knew I had that wrong. It's IN
[17:37:00] <Hexum064> so:
[17:37:21] <Hexum064> in r25, PORTD; out PORTB, r25;
[17:38:15] <zed___> nope, no leds lit
[17:38:30] <Hexum064> in this case, you are just pushing whatever is in port D (that's your input port right?) to your output port
[17:38:37] <zed___> yep
[17:39:22] <Hexum064> just to clarify, those two lines of code replace everything between your Start label and your final rjmp Start.
[17:39:34] <zed___> yeah, i know
[17:39:57] <Hexum064> And all your LED's should be on to start wtih
[17:41:07] <Hexum064> Do you have your switches set up where they will ground the pin they are attached to?
[17:42:10] <zed___> not sure. i'm using a stk500 dev board and i've just got a 2x5 cable running between portD and the switches
[17:42:14] <Hexum064> Also, I'm assuming your switches pull your input pins high?
[17:42:32] <zed___> i mean the gnd of portd is connected to the gnd of the switches
[17:43:16] <Hexum064> let me see if I can find the schematic real quick
[17:45:15] <Hexum064> OK, it looks like those switches are set up to pull a pin high while they are open (not pushed) and pull a pin to ground when closed.
[17:46:24] <Hexum064> What I am not sure about is if you are actually setting the pull-up resistors on by doing 'out PORTD, r16' at the end of your init file.
[17:46:28] <Hexum064> sry init code
[17:47:07] <Hexum064> if that is working correctly, all of your LEDs should be on and then a specific LED would turn off when you pushed a button.
[17:47:16] <zed___> so i got it to do that
[17:47:39] <zed___> sbic PIND, 0; cbi PORTB, 0
[17:47:42] <zed___> sbic PIND, 1
[17:47:49] <zed___> cbi PORTB, 1
[17:47:50] <zed___> etc
[17:47:53] <zed___> then at the bottom
[17:47:57] <zed___> sbi PORTB, 0
[17:48:00] <zed___> sbi PORTB, 1
[17:48:01] <zed___> ....
[17:48:05] <zed___> sbi PORTB, 7
[17:48:07] <zed___> rjmp Start
[17:48:57] <Hexum064> doing all those sbi PORTB, n instructions is kinda a waste. You should just be able to do out PORTB, 0xFF
[17:49:06] <zed___> true
[17:49:06] <Hexum064> but I digress
[17:51:34] <zed___> you'd have to do 'ldi r25, 0xFF' first then 'out PORTB, r25'
[17:51:45] <zed___> 'cause out goes i/o <- register
[17:51:51] <Jartza> "HiFi Gualidy VGA Gonnecdor"
[17:51:55] <Jartza> https://drive.google.com/file/d/0B2dTzW9TMeBxRzV3UTdaTmVFVGM/view?usp=sharing
[17:52:08] <Hexum064> zed__: yes, that's right
[17:52:26] <Hexum064> Jartza: LOL!
[17:52:27] <zed___> which yeah, that works
[17:52:41] <Hexum064> that's beautiful
[17:53:04] <Hexum064> now if it was only capton tape instead
[17:53:10] <Jartza> hehe
[17:53:18] <zed___> Jartza: ....what is on the other end? do i want to know?
[17:53:30] <Jartza> https://drive.google.com/file/d/0B2dTzW9TMeBxREVoRzR0WUt0Ukk/view?usp=sharing
[17:53:32] <Jartza> this
[17:53:35] <Hexum064> OK, gonna walk home and hop back on I think.
[17:53:41] <Hexum064> see ya later
[17:54:24] <Jartza> just used my "nucleobread"-card, which is originally meant to get those stm32 nucleo -cards "breadboarded"
[17:54:45] <zed___> lame, it's not even soldered
[17:54:51] <zed___> ;)
[17:55:14] <Jartza> it's a first proto
[17:55:35] <Jartza> maybe I'll buy vga connector and solder that thingie inside it when it's working :)
[17:55:41] <Jartza> or... IF it's working one day
[17:55:49] <zed___> *while it's working*
[17:55:56] <zed___> like while power is applied, solder it
[17:56:13] <Tom_itx> Jartza, what's that board for?
[17:56:32] <Jartza> Tom_itx: just playing with attiny85, trying to get output to vga monitor I found from storage
[17:57:00] <Jartza> sort of like "something to do on summer vacation"
[17:57:58] <Jartza> or do you mean that "nucleobread"? :)
[17:58:36] <Jartza> the long green one. it's adapter I made for stm32 nucleo boards to convert those "morpho" headers into breadboard-ones
[17:58:43] <Tom_itx> oh ok
[17:59:08] <Jartza> I had some extras, so I was lazy and used that for this too
[17:59:22] <zed___> ah i've got it now
[17:59:30] <zed___> in r25, PIND
[17:59:37] <zed___> out PORTB, r25
[17:59:39] <zed___> rjmp Start
[17:59:41] <zed___> BOOM. Works
[17:59:46] <Jartza> Tom_itx: https://slack-files.com/T02FEAMUS-F064QQ1FZ-7e76f22b42
[17:59:51] <Jartza> that's the "original" use
[18:00:15] <zed___> obnoxious that port is the output buffer and pin is the input buffer
[18:00:19] <Jartza> https://slack-files.com/T02FEAMUS-F064RQ2RX-1a694f62cb
[18:00:24] <zed___> why can't they all be ports or just pins
[18:01:27] <Jartza> because when you use pin as input, port is used to toggle pull-ups :)
[18:01:54] <zed___> lammmeeeeee
[18:01:56] <Jartza> some avrs have "PUE" though (pull-up enable)
[18:02:01] <zed___> about as lame as me for trying to learn asm for avrs
[18:03:41] <Tom_itx> you got to try
[18:03:53] <zed___> oh yeah i know
[18:04:09] <Lambda_Aurigae> http://www.avr-asm-tutorial.net/avr_en/
[18:04:18] <Lambda_Aurigae> old but still viable avr assembly tutorial site.
[18:04:30] <zed___> that site has terrible grammar
[18:04:44] <zed___> but yeah, i've been running through it
[18:05:39] <zed___> delays are probably the weirdest thing i've seen yet in avr asm
[18:05:50] <zed___> "want to delay something? figure out how to waste those clock cycles"
[18:06:12] <Jartza> if you want to delay something more than 15ms, you can always sleep :)
[18:06:28] <zed___> but how do i wake up again?
[18:06:37] <Jartza> wd interrupt
[18:06:46] <Lambda_Aurigae> wd being watchdog
[18:06:50] <Jartza> yea
[18:07:03] <Jartza> sorry, I don't know why I shortened it
[18:07:08] <Jartza> might be because I'm tired
[18:07:43] <zed___> cant find info to set a watchdog anywhere
[18:07:44] <zed___> http://www.atmel.com/webdoc/avrassembler/avrassembler.wb_WDR.html
[18:07:50] <zed___> just to reset it
[18:08:04] <Jartza> watchdog information is in the datasheet
[18:09:15] <zed___> omfg there's asm and c code examples of it in the datasheet
[18:09:20] <zed___> this is like christmas
[18:10:51] <Jartza> :)
[18:11:50] <zed___> that seems like such a literal delay method though. "don't need it right now? tell it to sleep and wake it up again later"
[18:12:07] <zed___> not even "wake it up" but "interrupt it's sleep"
[18:13:46] <zed___> it's about as literal as a forklift lifting a box of forks
[18:14:07] <Hexum064> wow. gone for 15 min and now we are talking about weird shit
[18:14:22] <zed___> ...wanna join?
[18:14:29] <Hexum064> hmmm
[18:15:17] <Jartza> weird shit?
[18:15:23] <Jartza> watchdog and interrupts aren't that weird :)
[18:15:33] <Hexum064> forklift lifting a box of forks
[18:16:01] <Hexum064> I got a new toy in the mail! Woot
[18:16:02] <zed___> it's just so damn literal
[18:16:10] <Jartza> what's literal?
[18:16:24] <zed___> a forklift lifting a box of forks
[18:16:38] <Jartza> you either delay the processor by just wasting cycles being busy doing "nothing" or sleeping :)
[18:17:02] <Lambda_Aurigae> atmel datasheets rock...lots of code examples for about everything in there.
[18:17:21] <zed___> except there's an example for turning on the watchdog, but that's it
[18:17:32] <zed___> nothing about how you can turn it off once you're sleeping
[18:19:49] <Lambda_Aurigae> you don't turn it off while sleeping
[18:20:08] <Lambda_Aurigae> when it wakes the chip up you can disable it(hence turning it off)
[18:20:50] <Lambda_Aurigae> sometimes you gotta extrapolate how to do things and not expect it all to be handed to you.
[18:21:04] <zed___> >.<
[18:30:37] <zed___> there are two types of people in the world, those who can extrapolate from inco
[18:31:56] <Lambda_Aurigae> nope...10 kinds of people...those who can count in binary and those who can't.
[18:33:00] <zed___> what a loser, using 1 based indexing
[18:33:38] <Lambda_Aurigae> we could always switch to base 13.
[18:34:39] <zed___> 0xNope
[18:35:05] <zed___> you might just be 0xDEAD if you use base13
[18:52:25] <Hexum064> Anyone have one of the usb JTAG ICE programmers?
[18:55:19] <Lambda_Aurigae> not I.
[19:34:32] <Dreamer3> Xark: you around?
[20:02:38] <stevejobsinhell> Jartza: I burned fuses via --> avrdude -p atmega328p -c dragon_isp -P usb -U lfuse:w:0x62:m -U hfuse:w:0xD9:m -U efuse:w:0x04:m
[20:02:42] <stevejobsinhell> and it's still not working.
[20:03:00] <stevejobsinhell> should I upload the sketch again after burning the fuses?
[20:04:55] <Tom_itx> read the fuses back to make sure they were set
[20:05:50] <Tom_itx> Hexum064 i've got a generic one
[20:05:52] <Tom_itx> older
[20:09:50] <stevejobsinhell> Tom_itx: you mean verify ?
[20:10:35] <Tom_itx> yes
[20:11:01] <Lambda_Aurigae> cycle power on the chip and read the fuses.
[20:11:07] <Lambda_Aurigae> confirm that what you wrote is what is on there.
[20:11:32] <Tom_itx> limited mobility atm. typing only what i need to
[20:11:50] <Lambda_Aurigae> watching porn and typing with one hand there Tom_itx ?
[20:12:05] <Tom_itx> pinched nerve in my neck
[20:12:12] <Lambda_Aurigae> likely story.
[20:12:12] <Tom_itx> causing the arm to malfunction
[20:12:18] <Lambda_Aurigae> time to make a tens unit.
[20:12:41] <stevejobsinhell> Tom_itx: I suppose it's the same command I posted but subsitute w with v in -U option. correct?
[20:12:45] <Tom_itx> you should see the xray
[20:13:18] <Tom_itx> http://tom-itx.no-ip.biz:81/~webpage/how_to/atmega168/using_avrdude_index.php
[20:13:22] <Tom_itx> will tell you
[20:13:42] <stevejobsinhell> avrdude: safemode: Fuses OK (E:04, H:D9, L:62)
[22:16:59] <Hexum064> Tom_itx: Sry. I stepped out. You have a generic JTAG ICE? Perfect.
[22:17:12] <Hexum064> Does it work with AS6? And what does it show up as in device manageR?
[22:17:43] <Hexum064> ug brb again
[22:41:51] <Tom_itx> i'm not sure, it's packed away in a box somewhere
[22:44:13] <Hexum064> :(