#avr | Logs for 2014-08-20

Back
[05:55:00] <hmw> I created an I2C display "controller" (DC) (Main MCU sends ASCII and ANSI codes, which get displayed on an LCD). The MCU can read back a line of DC's Text-RAM, sometimes characters get lost. I disabled all other IRQs in the DC but no luck. Delay after sending chars helps a little, not with reading.
[05:56:04] <hmw> DC's input buffer is large enough. Can you hint me on how to generally debug such a problem? I am relatively new to the µC world (both MCUs are AtMega8 btw.), but have experience with programming.
[06:02:32] <Lambda_Aurigae> hmw, do you have an oscilloscope? preferably a DSO
[06:04:07] <hmw> Looking at the actual signals... Didn't think about it yet. I can get access to an Osc.
[06:04:50] <Lambda_Aurigae> that will tell you if the data is flowing or not.
[06:05:05] <Lambda_Aurigae> might take some time to go through it but that's a start.
[06:05:13] <Lambda_Aurigae> a protocol analyzer would be better.
[06:05:26] <Lambda_Aurigae> but often far more expensive.
[06:06:32] <Lambda_Aurigae> for my i2c lcd controller(using hd44780 16x2, 20x2, and 20x4 LCDs) I just used a pcf8574 i2c-gpio chip.
[06:07:05] <hmw> It will take me a few days until I can carry my weird mini-PC into that lab, so I will be trying to find out more by thinking and tweaking, I guess...
[06:07:13] <Lambda_Aurigae> then modified peter fleury's lcd library to send over i2c instead straight gpio pins.
[06:08:42] <hmw> Everyone appears to use this library *smirks*
[06:08:59] <Lambda_Aurigae> it is simple, has been around a LONG time, and it just works.
[06:09:01] <hmw> I'll dig into the i2c spec again.
[06:09:26] <Lambda_Aurigae> what LCD are you using?
[06:10:40] <hmw> LCD 128x64 - NHD12864WG (NT7108C)
[06:11:14] <Lambda_Aurigae> aahh.
[06:11:20] <Lambda_Aurigae> bit more complex display than mine.
[06:11:27] <Lambda_Aurigae> how many i/o pins do you need for it?
[06:12:19] <hmw> The display was easy enough. I connected all 20 pins to a small protoboard, 14 connected to the m8
[06:13:03] <Lambda_Aurigae> so a pair of pcf8574 chips would suffice.
[06:13:12] <Lambda_Aurigae> there are 16 bit i2c port expanders too.
[06:13:22] <Lambda_Aurigae> would simplify things in my opinion.
[06:14:03] <Lambda_Aurigae> http://www.microchip.com/wwwproducts/Devices.aspx?product=MCP23017
[06:14:06] <Lambda_Aurigae> like that.
[06:14:11] <hmw> They can't interpret ANSI codes, nor can they tell the CPU the contents of the video RAM as ASCII. I am working on a self-programming mobile AVR experimental thingy.
[06:14:33] <hmw> Going to work similar to the monitor of a commodore-128
[06:15:15] <Lambda_Aurigae> well, you would have to move your processing back to the other AVR but it could read and write the display with those...
[06:15:32] <Lambda_Aurigae> all depends on where you want your processing and how robust you want the i2c bus.
[06:19:11] <hmw> I want the chip being used for reprogramming to be as empty as possible, so the user doesn't see to much confusing code.
[06:19:52] <hmw> Perhaps I should make a special device made only for holding a minimum infrastructure (I2C and re-write flash routines).
[06:20:40] <Lambda_Aurigae> I need to dig out my stuff and do some more work on my VGA display controller.
[06:21:15] <Lambda_Aurigae> I'm using 1Mb serial srams clocked at 20MHz to generate 800x600 16 color VGA.
[06:21:27] <hmw> There is so much, I would like to do. And so little hmw in this world...
[06:21:46] <hmw> nice.
[06:22:34] <Lambda_Aurigae> by adding more memory chips and the control logic I can expand it beyond 4bit color to 8bit or even 16 or 32.
[06:22:47] <Lambda_Aurigae> so far I've been doing it all on solderless breadboard too.
[06:23:04] <hmw> oh my
[06:23:07] <Lambda_Aurigae> need to make a PCB for the next round becuase I get a lot of noise on the breadboard.
[06:23:40] <Lambda_Aurigae> first phase was just simple display where I updated the ram during the vertical blanking interval...kinda slow and ponderous.
[06:24:12] <Lambda_Aurigae> second phase which I'm on now is doing a double(triple) buffer system.
[06:24:25] <Lambda_Aurigae> with 3 sets of video memory...2 for display and 1 for upload.
[06:24:43] <hmw> "expensive" isn't it?
[06:25:14] <Lambda_Aurigae> the processor would send data to the upload buffer...then do a push which would upload the buffer to the non-displayed ram and do a switch between non-displayed and displayed.
[06:25:26] <Lambda_Aurigae> not really...the chips are only a couple dollars each.
[06:25:39] <Lambda_Aurigae> currently I'm using 6 of them...2 per buffer.
[06:25:53] <Lambda_Aurigae> and got them as free samples so no cost for development.
[06:26:04] <hmw> well... i put quotes there. I mean is it/was it usual to have tripple buffers in early VGA cards?
[06:26:23] <Lambda_Aurigae> could have been...no clue.
[06:26:39] <hmw> Interesing approach. Should be relatively easy, I guess?
[06:27:05] <Lambda_Aurigae> yeah..it's not too hard as the 800x600 svga pixel clock works well at 20MHz.
[06:27:06] <hmw> I mean easy on the brain, perhaps a lot of work still.
[06:27:38] <Lambda_Aurigae> and the serial srams I use are able to do serial dual or serial quad i/o.
[06:27:53] <Lambda_Aurigae> so 1bit, 2bits, or 4bits at a time read and write.
[06:28:09] <Lambda_Aurigae> and you can set them to read out memory one bit at a time on clock pulse.
[06:28:50] <hmw> I've got a bunch of 30-pin SIMMs collecting dust in my shelf...
[06:29:02] <Lambda_Aurigae> I use 30pin sipps...
[06:29:13] <Lambda_Aurigae> but those require a lot of overhead just doing refresh to keep the data live.
[06:29:41] <hmw> Nothing for me at the moment. I want only to play with DIP sized parts.
[06:29:48] <Lambda_Aurigae> simms work too but you have to solder pins to them.
[06:29:56] <Lambda_Aurigae> sipp is the same as a simm but it has pins soldered on.
[06:30:06] <Lambda_Aurigae> and they fit in a solderless breadboard...0.1 inch spacing
[06:30:41] <hmw> interesting
[06:32:11] <Lambda_Aurigae> http://dmitry.gr/index.php?r=05.Projects&proj=07.%20Linux%20on%208bit
[06:32:21] <Lambda_Aurigae> this guy did it with an avr and 30pin simm.
[06:32:56] <Lambda_Aurigae> and someone did it with an ardweeny.
[06:33:25] <hmw> I heard, it boots in under a day?
[06:33:36] <Lambda_Aurigae> yeah.
[06:33:45] <Lambda_Aurigae> I built it for the fun of it...got bored in a week.
[06:33:49] <Lambda_Aurigae> but it was a nifty project.
[06:34:44] <hmw> Oh noes. I just realized, that my current project is *again* making things blink. Is this a curse??
[06:35:07] <Lambda_Aurigae> http://www.piclist.com/techref/microchip/picsimm.htm this thing is what I started with to add a simm/sipp to my avr...it's pic based but not hard to understand and port.
[06:35:16] <hmw> Everyone around me is crazy for RGB leds and blinkenstuff
[06:35:32] <Lambda_Aurigae> hehe...that's the thing these days.
[06:35:40] <Lambda_Aurigae> I prefer making things move to making things blink.
[06:35:53] <hmw> Heheh. yeah.
[06:36:01] <Lambda_Aurigae> constantly bringing home bits and pieces from work to make moving things.
[06:36:23] <Lambda_Aurigae> I fix copiers for a living so get all kinds of motors and controller boards and power supplies and gears and stuff.
[06:36:55] <hmw> I dream of building a simple robot arm some day, but I am stuck with the building of the mechanics. No idea, how to approach something like this yet. But I know whom to ask, when I am ready :)
[06:37:24] <hmw> A "virtual hacker" that can be remotely controlled to solder stuff would be awesome.
[06:37:29] <Lambda_Aurigae> I couldn't guide you other than,,,,put shit together.
[06:37:39] <hmw> LOL
[06:37:39] <Lambda_Aurigae> precision robotic arms are hard.
[06:37:47] <hmw> I suppose so
[06:37:51] <Lambda_Aurigae> if you have money to spend, I suggest vex robotics hardware.
[06:38:04] <Lambda_Aurigae> it's awesome and easy to work with...but not very precise.
[06:38:13] <Lambda_Aurigae> that or lego mindstorms.
[06:38:29] <Lambda_Aurigae> I started with early lego mindstorms then went to vex then started combining the two for the fun of it.
[06:40:31] <hmw> I'd like to have a kit like this, with some gears added: http://www.s-line.de/homepages/horber-privat/bilder/innen1.jpg
[06:40:44] <hmw> Oh, it even has some.
[06:40:52] <dunz0r> hmw: For a start I suggest something like a bunch of cheap servos and icecream sticks or something
[06:41:16] <dunz0r> For Meccano, you might need some bigger servos though, it's heavy :)
[06:41:42] <hmw> My first project would be a simple USB controlled foam-bulled cannon with 2 DoF
[06:41:57] <hmw> *bullet
[06:55:40] <hmw> i connected my XScope to the I2C bus and realized, this is going to be difficult. There is a lot going on on the bus
[06:55:55] <jacekowski> get a logic analyser
[06:56:03] <jacekowski> or scope that can decode i2c
[06:59:05] <hmw> i got one of those. http://www.gabotronics.com/components/com_virtuemart/shop_image/product/xprotolab-logic.jpg
[06:59:27] <hmw> RTFM now about the I2C sniffing
[07:54:34] <mux_> the magic is real!
[07:56:13] <mux_> finally done porting dean's mass storage bootloader to xmega with all functionality
[08:05:06] <evil_dan2wik> mux_, what programmer do you use for the xmega?
[08:05:35] <mux_> avrisp mkII, basically the default programmer for everything AVR related
[08:05:46] <evil_dan2wik> ok.
[08:07:23] <mux_> any particular reason why you're interested?
[08:08:49] <evil_dan2wik> mux_, I got my xmega and then I realised I needed a PDI programmer for it.
[08:09:07] <evil_dan2wik> at the moment all I have is a USBASP
[08:09:22] <mux_> ah, well, I can highly recommend getting an avrisp mkII in general
[08:09:36] <evil_dan2wik> ok, thanks.
[08:09:46] <mux_> the only real reason against it is if you live in a country where it's either very expensive or hard to get (no distributors)
[08:10:08] <mux_> I've talked to people from china for whom it's the equivalent of 1/10th of their monthly salary, that's a bit ridiculous
[08:10:16] <mux_> around here it's about 30 euros
[10:57:02] <NicoHood> okay guys ive got a very weird behaviour: ive got a pin with pullup. if the pin is low led goes high, otherwise low. works fine. but if i try to connect and disconnect several times the pin goes into a weird stage where the pullup doesnt work anymore and i have to push the pin to high again to get the led off. the bug stays then, so the pin is "broken" until i replug it. whats going on there? is my pin broken?
[18:54:57] <N1njaneer> So quiet again.
[18:55:41] <Casper> then use a vuvuzella
[19:00:52] <N1njaneer> Mmmm vuvuzellas
[21:16:04] <jeremyabel> WormFood: I was referred to you from ##electronics. Do you have a moment?
[21:16:45] <N1njaneer> He may not be here at the moment, but feel free to ask away here in channel.
[21:17:23] <jeremyabel> so according to the UBRRn settings for oscillator frequencies, the slowest freq I can get away with for 115.2k baud is 1.8432MHz
[21:17:55] <jeremyabel> I'm wondering if I'd want to use a 14.7456 osc since divide-by-8 is automatically on for the clock speed already, yeah?
[21:18:04] <N1njaneer> Yes, but doesn't leave much overhead to do processing :)
[21:18:11] <jeremyabel> good point
[21:18:15] <jeremyabel> let's seeeee
[21:18:45] <N1njaneer> Unless there's a compelling reason to leave DIV8 on, turn it off and run the micro at full speed, then just change your UBRR divisor
[21:18:51] <jeremyabel> 3.6864 is next up
[21:19:00] <jeremyabel> well I'm aiming for low-power here
[21:19:24] <N1njaneer> You can also do 115.2K off an 8/16Mhz crystal with acceptable error %'s
[21:19:45] <jeremyabel> yeah, that's what arduino mega does
[21:19:50] <N1njaneer> We recently just did a bootloader that runs 115.2K on 16Mhz and loads firmware just fine :)
[21:20:18] <N1njaneer> If you don't HAVE to do 115.2K, just use something slower.
[21:20:25] <jeremyabel> nope, have to have it
[21:20:30] <N1njaneer> Kind of depends on your constraints.
[21:20:35] <jeremyabel> bluetooth module
[21:20:47] <N1njaneer> Gotcha
[21:20:49] <jeremyabel> I can switch the baud after I connect but I need to connect first :P
[21:21:06] <jeremyabel> also I had less-than-reliable results at lower bauds with it
[21:21:57] <N1njaneer> With the AVR, or the module?
[21:22:06] <jeremyabel> the module
[21:22:12] <N1njaneer> Have you checked your error term with the lower baud rates?
[21:22:18] <jeremyabel> no
[21:22:31] <N1njaneer> That may factor in.
[21:22:46] <jeremyabel> really I just whacked it in the arduino mega to make sure it wasn't a busted unit and to show my boss "look I told you bluetooth would work fine" :P
[21:23:02] <jeremyabel> but now I'm putting it into production into real-avr-land
[21:23:17] <jeremyabel> so I have to... remember how to turn on USART and stuff :P
[21:23:33] <jeremyabel> it's been years
[21:23:42] <N1njaneer> Datasheets gives you all the registers - it's only about 5 register sets to get it going. Very easy.
[21:23:53] <jeremyabel> yeah
[21:24:01] <jeremyabel> simple example code in the datasheet looks good to me
[21:25:04] <N1njaneer> You can get more sophisticated with interrupts and things as well, but yeah. And if you are processing a lot of regular data at high speed, interrupts can actually be detrimental.
[21:25:15] <jeremyabel> def not at high speed
[21:25:17] <jeremyabel> or even a lot
[21:25:42] <jeremyabel> data from an accelerometer, interrupt from one button, that's it so far
[21:25:58] <N1njaneer> Just have to make sure you are able to service the UART fast enough. 115.2K doesn't leave a lot of idle time between bytes if receiving
[21:26:14] <jeremyabel> no recieving, only transmitting
[21:26:21] <N1njaneer> Especially a low clock rates :)
[21:26:29] <N1njaneer> Then you should have less difficulties!
[21:26:48] <jeremyabel> well, recieving "OK" status I assume, after every request to send, not sure though
[21:27:19] <jeremyabel> take things one step at a time, I'll deal with that when I see it sending me stuff back :P
[21:29:57] <jeremyabel> N1njaneer: what would you do though, if you needed a low-power solution, what clockrate would you pick?
[21:31:18] <N1njaneer> Depends on the application, really. AVRs can run high clock rates and then still go in to extremely low-power sleep mode and pull only uA's worth of idle current. They are also designed to be able to run off a 32.768Khz oscillator for continuous low-power operation.
[21:31:58] <jeremyabel> let me consult the datasheet for the frequency vs current consumption graph
[21:33:19] <jeremyabel> seems like at 3.3v I can only go up to like 12.3-something anyway
[21:33:44] <N1njaneer> Yes, frequency is limited by a function of voltage
[21:34:22] <jeremyabel> 7.3728MHz sounds good
[21:34:48] <jeremyabel> 0 error ratio, a little under 5mA
[21:37:06] <N1njaneer> Sounds good!
[21:37:34] <jeremyabel> now to figure out how to get AtmelStudio's simulator to run at that
[21:37:46] <jeremyabel> until my boards arrive in a few days, allowing me to program the actual chip
[21:38:21] <N1njaneer> As most people on here will tell you, don't even try to bother with the simulator. They are inaccurate at best, and just plain useless at worst. Just write your code and stub it in as best you can then start testing on the hardware.
[21:38:27] <jeremyabel> :(
[21:38:38] <jeremyabel> well, good to know!
[21:38:51] <jeremyabel> glad I didn't go much beyond stubbing with comments :P
[21:39:06] <N1njaneer> The emulaors are just pretty worthless. Especially since you can in-system debug for nothing these days.
[21:39:16] <N1njaneer> +emulators
[21:39:49] <jeremyabel> maybe I'll bug a friend who might have a smd - dip adapater I could use in the meantime
[21:40:13] <jeremyabel> got like 5 days before board gets here, doubt I can spend more than a day on just stubbing code out blindly
[21:40:28] <N1njaneer> Did you have an Arduino there?
[21:40:42] <jeremyabel> yep, that's what I've been using so far
[21:40:49] <jeremyabel> was thinking about just using that
[21:41:07] <N1njaneer> You can always program that from Atmel Studio. Just use that, then adjust your clock crystal rate on your next board and just change the divisors.
[21:41:08] <jeremyabel> it'll still let me test almost everything
[21:41:12] <jeremyabel> word
[21:41:26] <jeremyabel> anything special I have to do or can I plug USB straight in?
[21:41:36] <jeremyabel> I have an AVRICE mkII thing too
[21:42:03] <N1njaneer> If you don't mind blowing away the bootloader, just use the MKII on the ISP port and just wipe the chip and work with it directly.
[21:42:22] <jeremyabel> def don't mind blowing it away
[21:42:23] <N1njaneer> Else you can target the Arduino as if it's an STK500 via the virtual COM port it appears on
[21:42:27] <jeremyabel> ah cool
[21:42:42] <jeremyabel> I'll probably end up forgetting to bring the MKII tomorrow from home, knowing me
[21:43:08] <N1njaneer> I prefer the ISP programmer in all cases since you have complete flexibility. You'll just want to clear the BOOTRST fuse if you intend to start loading code on to it from Atmel Studio, since it won't have a bootloader after erasing it.
[21:43:20] <jeremyabel> right right
[21:44:11] <N1njaneer> Should let you do what you need to, though :)
[21:44:19] <jeremyabel> yeah def, sounds like a plan
[21:44:55] <N1njaneer> Good luck. Don't hesitate to ask in here if you have any more #avr questions. Folks are usually awake most times :)
[21:45:06] <jeremyabel> sweet, thanks!
[21:45:24] <jeremyabel> this is all part of my first commercial hardware gig, so kinda nervious :P
[21:45:25] <N1njaneer> For now, I head home :)
[21:45:34] <jeremyabel> night, and thanks for the tips + advice
[21:46:03] <N1njaneer> Good luck. Nothing like your first commercial hardware gig, and don't be nervous - just work through it. Confidence breeds confidence. Get this one under your belt, then the next one will be even easier.
[21:46:18] <jeremyabel> absolutely
[21:46:58] <N1njaneer> My piece of advice - go on the 80/20 rule -- 80% of any new project should be stuff you know cold and can do in your sleep, 20% of it should be stuff you've not touched before. Forces you to learn new stuff without getting too outside the realm of realism for completion :)
[21:47:31] <jeremyabel> heh, my usual style is to reverse those two!
[21:47:31] <Valen> ahh, so thats what I have been doing wrong
[21:47:38] <Valen> jeremyabel: +1
[21:47:49] <jeremyabel> I've been doing well so far!
[21:48:40] <N1njaneer> From a hobbiest area you can do those numbers anywhere you want, but for commercial stuff you generally should play it more conservatively if you want to be in business and keeping your customers happy and delivering on time. :)
[21:48:46] <jeremyabel> oh sure
[21:48:52] <jeremyabel> for commercial stuff yeah, 80/20 all the way
[21:48:58] <jeremyabel> hobbiest I'm more like 20/80!
[21:49:13] <N1njaneer> Sometimes 70/30, but that's up to you and how fast you can tackle new stuffs :)
[21:49:18] <jeremyabel> word
[21:49:46] <N1njaneer> The 80/20 also lessens frustrations, too. Easy to get overwhelmed in new territory.
[21:50:12] <N1njaneer> Good luck!!
[21:50:15] <jeremyabel> thanks!
[21:53:21] * twnqx like 10/90 projects
[21:54:06] <jeremyabel> I just undertook one last night. Played clarinet when I was 6 for a year, 26 now, just bought a saxophone... they both have reeds, yeah? :P