#avr | Logs for 2013-12-10

Back
[00:01:53] <Essobi> N2TOH: Chip to chip? Hmmm.
[00:05:58] <N2TOH> manufacturing 101, double up on a part, and cut the purchase cost...
[00:06:41] <N2TOH> sure use one AVR for USB to what ever, and the other for your task... seems legit
[00:36:36] <megal0maniac_afk> I've been asked to build something and the only way I know how to program it is with Arduino D:
[00:37:07] <megal0maniac_afk> Too much stuff I haven't learnt in C yet. HD44780, dallas 1wire, I2C
[00:49:35] <N2TOH> read and comprehend the data sheet for an RCA 6146B thermionic valve and we will talk...
[00:55:49] <megal0maniac_afk> Anyone know of a good way to have some kind of menu system for an LCD?
[01:00:22] <N2TOH> ???
[01:00:31] <N2TOH> IDFK, ask google
[01:00:55] <N2TOH> what are you gonna use for a UI?
[01:01:15] <N2TOH> mechanical buttons, or what?
[03:31:17] <MannImMond> ~/names
[03:50:45] <Tom_itx> megal0maniac_afk, look how they did the menus in marlin (reprap) with a rotary switch selector
[03:52:09] <Tom_itx> or a walmart automotive filter selector
[03:54:22] <Tom_itx> http://reprap.org/wiki/Marlin
[04:06:12] <jerkey> i'm so mad at marlin, it has an unforgivable bug that is pissing me off
[05:53:05] <megal0maniac_afk> Tom_itx: Thanks, I'll look into that
[05:53:44] <megal0maniac_afk> Just bought a pickit3. What a horrible set-up
[06:15:24] <mike_papa> Hello. First: I'm noob making my first steps with avr, so keep it in mind ;) I seem to have a problem with ADC sleep mode. Whenever I run my project with that enabled, everything seems to freak out after a while. Atmega doesn't hungs, but for example UART transmissions are mess. I suspect some kind of interrupt collisions. Any tips on preventing that? I don't use any atomic blocks. Should I?
[06:17:21] <mike_papa> Or any tips on how to track problem down? When I stop it in debugging mode, I just get somewhere in ASM code labeled as no source file. I tried to track it by running step by step, but... it doesn't happend at any particular point. Just after a random while.
[06:35:10] <mike_papa> Seems I've fixed it. Just adding empty loop: while ((UCSR0A & (1 << TXC0)) && (UCSR0A & (1 << RXC0))) {} before sleep_cpu(); to wait for UART to complete. I think sometimes it was going to sleep in the middle of transfer, messing whole thing. That would explain random occurance as well. Thanks (even if noone answered, but sometimes possibility to ask is enough to find solution) ;)
[06:36:32] <Tom_itx> don't sleep and drive
[06:37:35] <mike_papa> Tim_itx: Hehe... more like "don't sleep and talk" in this case.
[07:48:26] <errordeveloper> is the a libc macro that I could use to check whether my function is called from an interrupt context?
[07:48:53] <errordeveloper> or if there is no macro, how do i check it?
[07:52:02] <blathijs> errordeveloper: You could check if interrupts are disabled, though that's not necesarrily from interrupt context
[07:52:35] <errordeveloper> also.. actually, on an arm i can define a hardfault handler and print SP and PC, what can you do on avr for debugging a crash?
[07:52:36] <blathijs> errordeveloper: I'm not aware of any foolproof way to check this, AFAIK the CPU itself doesn't actually keep this info
[07:53:06] <blathijs> dunno :-)
[07:53:30] <errordeveloper> ah... really, i thought there must be some flag which says that it's in some sort of interrupt context...
[07:56:10] <blathijs> errordeveloper: I'm not 100% sure there isn't, but I haven't come across a mention of something like it so far
[07:56:48] <blathijs> I'm pretty sure the prelude code gcc generates for ISRs doesn't include anything like that
[08:01:04] <errordeveloper> grr
[08:01:34] <errordeveloper> ok, so may be i need to figure how can i debug a crash with jtag mkii attached
[08:02:12] <errordeveloper> in atmel studio... is there some way of finding out when the mcu resets using the jtag?
[08:06:32] * blathijs defers to others, I haven't done more complicated debugging than adding serial prints and blinking leds so far :-)
[08:09:58] <malinus> blathijs, of the look of it, it's mostly beginners that feel like they need a real debugger.
[08:11:13] <blathijs> malinus: Yeah, advanced users just write working code right away ;-p
[08:11:52] <errordeveloper> lol
[08:13:23] <mike_papa> blathijs: I've heard that those super advanced don't need programmer either. They can programm chip right away by simply touching pins with wire connected to some power source.
[08:14:01] <blathijs> mike_papa: Or using butterflies (http://xkcd.com/378/)
[08:15:04] <malinus> blathijs, no, but like you said, leds/serial port
[08:15:06] <mike_papa> lol
[08:17:27] <mike_papa> sure you can debug with leds. It's just easier/faster/more comfortable to connect debugger. More advanced you are - better code you write right away. That's obvious. But I'd be far away from stating that only lammers use debuggers. ;)
[08:22:22] <errordeveloper> heh
[08:23:01] <errordeveloper> so i figured that there is no of checking whether i am in an inturrupt contex
[08:23:31] <errordeveloper> but i'm still hoping i can find a alternative to hardfault handler...
[08:23:35] <blathijs> errordeveloper: Why do you (think you) need to know if you're in interrupt context anyway?
[08:24:46] <errordeveloper> well, i'm not too sure whether my function is called from the isr or it's actually not
[08:25:05] <errordeveloper> i suppose i can figure it out from assembly output...
[08:26:45] <errordeveloper> ok, this might help
[08:26:45] <errordeveloper> http://stackoverflow.com/questions/19693758/avr-mcu-crashes-no-logical-error-in-code-what-should-i-check
[08:28:29] <malinus> mike_papa, it's just that most beginner think that a debugger is a must-have, for their blinking led project. Of course its convenient, and you can in theory debug more efficient with one.
[08:29:13] <malinus> I guess I worded it wrongly
[08:32:01] <mike_papa> malinus: This may happen. In my case it's different I think. My first project (I'm learning both AVR and C on that) involves ADC in sleep mode, UART communication between 2 AVRs, couple of encoders on PCINT, couple of simple digital inputs and LCD display. Debugger helps. ;)
[08:34:16] <malinus> It does, if you are willing to pay the price. But still, a project like that can easily be done by modulating the development, instead of trying to get it all to work at once.
[08:36:02] <malinus> mike_papa, beginner tend to do the later ;). but good luck with a big project like that. I would suggest learning C first, then starting with something simple, while reading the datasheet. Then trying implementing each of the multiple things you want to work together.
[08:39:23] <mike_papa> malinus: Thanks. It took a while, but I'm getting on with that. I just solved problem with conflicting ADC sleep mode with UART. But no debugger will help with that. It's just expirience, and lot of analyzing what I need. Much more then advanced person, but I guess it's always like that at the beginning. I have time for my project. It's gonna control vacuum pump in old-timer car, so I don't need
[08:39:23] <mike_papa> it until late spring. :)
[08:40:23] <braincracker> hi
[08:40:32] <malinus> but I guess the best advice, is like I already said - make one little part work at a time.
[08:40:35] <braincracker> any cool new alien technology projects?
[08:43:28] <devilsadvocate> i didn't use a debugger for the first 5 years of uC work, and ever since then I've never used a debugger for AVR
[08:45:02] <devilsadvocate> debuggers are only really useful if they come with exceptionally good tools. otherwise, for something as small as AVR code, the debugger really only gets in the way. and it makes you lazy
[08:47:48] <mike_papa> devilsadvocate: Congratulations on that. I bet you will be able to help me with next problems that will arise for me with my project.
[10:41:28] <Mehrzad> Is there any standard function for converting float to string?
[10:41:50] <ambro718> snprintf
[10:42:17] <Mehrzad> ambro718: thanks
[10:50:29] <Mehrzad> Neither snprintf nor sprintf is recognized by the compiler (#include <stdarg.h>)
[10:51:16] <Mehrzad> Oh, that's stdio.
[11:18:30] <ambro718> don't forget -Wl,-u,vfprintf -lprintf_flt
[12:20:22] <kdehl> Um... on a power supply connector, how do I know whether I have a tip positive or tip negative?
[12:20:32] <kdehl> My power supply board doesn't specify that...
[12:20:40] <kdehl> http://www.ebay.com/itm/190893403831?ssPageName=STRK:MEWNX:IT&_trksid=p3984.m1439.l2649
[12:20:46] <kdehl> That's the one I bought.
[12:22:19] <devilsadvocate> kdehl: its usually, but not always, positive
[12:22:35] <kdehl> devilsadvocate: Okay, I'll try.
[12:26:46] <kdehl> devilsadvocate: Worked! Thanks.
[13:43:42] <syfhvbgos7> WARNING WARNING WARNING, WARNING
[13:43:42] <syfhvbgos7> WARNING WARNING WARNING, WARNING WARNING
[13:43:42] <syfhvbgos7> YOU MAY BE WATCHED
[13:43:42] <syfhvbgos7> YOU MAY BE WATCHED
[13:43:42] <syfhvbgos7> YOU MAY BE WATCHED
[13:43:59] <syfhvbgos7> WARNING WARNING WARNING, WARNING
[13:43:59] <syfhvbgos7> WARNING WARNING WARNING, WARNING WARNING
[13:43:59] <syfhvbgos7> YOU MAY BE WATCHED
[13:43:59] <syfhvbgos7> YOU MAY BE WATCHED
[13:43:59] <syfhvbgos7> YOU MAY BE WATCHED
[14:40:08] <jerkey> kdehl that was technically russian roulette. power connectors can be either way, you can find out using a multimeter. it wil read negative numberss if the polarity does not match the meters input.
[14:53:23] <hetii> Hi :0
[14:53:40] <hetii> ;)
[15:14:34] <kdehl> jerkey: No, my power supply was marked but the circuit board was not, so a multimeter wouldn't have helped me.
[15:22:38] <megal0maniac_afk> Who knew that pic could be so painful. I <3 AVR
[15:23:07] <jadew> megal0maniac_afk: yeah, I was left with the same impression
[15:23:38] <jerkey> kdehl in that case, you can identify ground of your circuit and measure with a multimeter for continuity from the connector. that will find you negative, since negative is almost always tied to ground.
[15:24:51] <jerkey> kdehl also you can tell some things by comparing a diode-check (using a multimeter) one polarity vs. the other. You will see the readings slowly creep up as the capacitor is charged, and then if it's backwards it might stop at a diode junction voltage.. but that's more in the department of clues
[15:25:56] <megal0maniac_afk> The new IDE is awful and the old one is outdated and not too great either. Anything decent you need to pay for, and I'm struggling to find any kind of continuity between compilers
[15:26:17] <megal0maniac_afk> consistency rather
[15:28:54] <jerkey> avrdude and avrgcc for the win
[15:28:59] <jerkey> vim for the ide
[15:29:08] <jerkey> you'll never go back
[15:29:34] <jadew> yeah, if you're coding on a remote server
[15:29:41] <jadew> via ssh
[15:30:11] <jadew> even then you could mount the filesystem via ssftp and still use a decent editor from this millennium
[15:30:26] <jadew> *sftp
[15:30:33] <DanFrederiksen> is the atmega comparator rail to rail?
[15:30:40] <DanFrederiksen> can it compare 50mV?
[15:30:48] <DanFrederiksen> reliably
[15:31:10] <jadew> the datasheet doesn't mention that?
[15:31:39] <kdehl> jerkey: True that.
[15:32:27] <kdehl> jerkey: I was actually a litte nervous, since it contained a few capacitors, and I understand that you don't want to connect those with the wrong polarity.
[15:32:51] <kdehl> megal0maniac_afk: 8015 ftw! It has a great OSS IDE.
[16:10:31] <jerkey> kdehl the capacitors are much easier to replace than all the integrated circuits and transistors, which will likely be destroyed if you hook it up backwards.
[16:37:49] <kdehl> jerkey: True that.
[17:23:58] <kdehl> I have a flash ROM that says it wants 12.0 +- 0.60 V for high-voltage programming. I have a 12.96 V power source, you think it could do any damage?
[17:26:14] <LoRez> stick a diode in there
[17:31:18] <kdehl> Don't have any, unfortunately.
[17:31:23] <kdehl> Wish I had a regulator.
[17:32:08] <kdehl> I have a 12 V adapter, and use a 5 V regulator for the circuit, and I figured I could take the 12 V source I need for the high-voltage programming directly from the adapter.
[17:32:43] <LoRez> do you have any transistors? hell, make a simple resister divider circuit to knock it down a bit.
[17:33:47] <kdehl> Don't have that either.
[17:34:18] <kdehl> I used to run my circuit directly from the adapter on 4.5 volts, and it was actually fine.
[17:34:57] <kdehl> I could just use a resistor, I suppose, but I have no idea about the internal resistance of the chip.
[17:39:47] <kdehl> I could test with a high-value resistor and test with different lower values while keeping track of the voltage of the pin?
[18:28:15] <LoRez> kdehl: I wasn't suggesting using the internal resistance as the second resistor of the divider.
[18:30:51] <kdehl> LoRez: I put a 16k resistor before the input, and it's almost exactly 1 V over it, you think it'll work?
[18:32:19] <kdehl> Wtf, now it's 11 volt on the Vpp.
[18:32:56] <kdehl> It's 12.38 without any resistor!
[18:33:19] <kdehl> Oh well.
[18:33:23] <kdehl> I guess it's all the load.
[18:42:55] <LoRez> so your adapter is unregulated?
[18:43:36] <kdehl> I thought it was.
[18:43:59] <kdehl> Or maybe I'm just using too much current for it to handle.
[18:44:05] <kdehl> Nah.
[18:56:41] <jerkey> kdehl surely 13v is fine. but check the datasheet.
[19:27:48] <kdehl> Gah.
[19:28:23] <kdehl> jerkey: Yeah, I think it's 12 V now after all.
[19:28:35] <kdehl> Finally, I got those shift registers to work.
[19:29:13] <kdehl> I use three cascaded (is that how you say it?) '595 to address the EEPROM. Is that a sane way to do it?
[21:42:43] <kdehl> Can I connect a crystal oscillator directly to a 8088/8086 or do I need to have some kind of "clock circuit" (whatever that means) before?
[21:44:16] <Casper> by crystal oscillator do you mean the 2 pins device or the 4 pins one?
[21:44:53] <kdehl> Well, would either one work?
[21:45:01] <kdehl> Actually, I'd prefer the 4-pin one.
[21:45:10] <kdehl> Because they're cheap on ebay. Heh.
[21:45:13] <Casper> the 4 pins one contain a full clock circuit
[21:45:21] <Casper> you send power, it output a clock
[21:45:25] <kdehl> At least the 5MHz one.
[21:45:38] <kdehl> Okay, so no need for 8284 clock generator circuit?
[21:45:58] <Casper> I don't know the 8088/8086 so can't say for sure
[21:45:58] <Casper> but
[21:46:15] <Casper> if it have a xtal1 and xtal2 pin, it may take directly a crystal
[21:46:38] <kdehl> It doesn't. It has a CLK input.
[21:46:38] <Casper> if only a single clock pin then it need an external clock circuitry (or a module like the 4 pins)
[21:46:46] <kdehl> Okay.
[21:47:43] <kdehl> Well, that sounds great.
[21:47:46] <N2TOH> 2 pin of passive crystals typically require bypass caps to the ground plane, while "canned" oscillators tent to start more reliably
[21:47:57] <N2TOH> tend*
[21:48:04] <kdehl> Yeah.
[21:48:14] <kdehl> So what's the point of the 8284 then?
[21:49:09] <N2TOH> of special note, http://www.linear.com/product/LTC6904
[21:50:42] <kdehl> "The generator may have additional sections to modify the basic signal. The 8088 for example, used a 2/3 duty cycle clock, which required the clock generator to incorporate logic to convert the 50/50 duty cycle which is typical of raw oscillators."
[21:51:11] <Epsilon-Auriga> also, the crystal with 2 caps is just a reference for an oscillator, not the oscillator itself...the 4 pin can is a full oscillator device.
[21:51:14] <Casper> 2/3 duty?!? wth!
[21:51:40] <kdehl> What does that even mean?
[21:51:45] <Epsilon-Auriga> gotta love that 8088, eh? wait states within clock pulses wasn't it?
[21:51:51] <kdehl> A 1 is longer than a 0?
[21:52:05] <Epsilon-Auriga> pretty much, more or less, yeah.
[21:52:06] <N2TOH> 66 and 2/3% on with 33 1/3% off?
[21:52:50] <Epsilon-Auriga> the z80 was easier to work with than the 8088 for the hobby world.
[21:53:20] <N2TOH> was that just an old school hack to stabilize the system bus?
[21:53:27] <Epsilon-Auriga> I think so.
[21:53:31] <kdehl> Or the 6502. Heh.
[21:53:43] <kdehl> Oh well, I guess I'll have to make that clock circuit then...
[21:53:49] <Epsilon-Auriga> 6502 required 2 clocks synchronized but out of phase or some such.
[21:54:27] <N2TOH> 180 degrees out of phase?
[21:55:21] <Epsilon-Auriga> yeah...but it takes one clock in and produces 2 clocks inverted.
[21:55:27] <Epsilon-Auriga> for timing of external devices.
[21:55:45] <Epsilon-Auriga> it's been a long time since I worked with the 6502 and then did very little with hardware,,mostly programming.
[21:57:02] <Epsilon-Auriga> http://lateblt.livejournal.com/88105.html# good description of 6502 clocking stuff.
[21:57:08] <kdehl> http://helmpcb.com/electronics <=- DIY 8088 Computer
[21:57:22] * kdehl checks
[21:57:39] <kdehl> Oh, 6502. Heh. Some other time.
[21:59:30] <Epsilon-Auriga> hmm...hows about an 8088 emulator running on an avr?
[21:59:39] <Epsilon-Auriga> if they can emulate an ARM on an AVR, why not an 8088?
[21:59:43] <kdehl> Too slow.
[22:00:03] <kdehl> Ah yes. As long as the speed is of no concern.
[22:00:13] <N2TOH> I asked the same question about emulating a PDP-11 on the AVR
[22:01:12] <N2TOH> then maybe later porting UNIX directly to the AVR, yes I know the PDP-11 is a native 16 bit machine, and the AVR is 8 bit
[22:01:59] <Epsilon-Auriga> N2TOH: shouldn't be any reason why it can't be done...
[22:02:05] <kdehl> And the Linux ARM is 32.
[22:02:07] <Epsilon-Auriga> they emulated a 32bit ARM on avr already.
[22:02:23] <Epsilon-Auriga> takes several hours to boot to a command prompt.
[22:02:27] <Epsilon-Auriga> but, hey, it boots!
[22:02:46] <N2TOH> right so an ancient 32 bit OS originally ran on a 16 bit system is doable
[22:04:46] <kdehl> I want you to run Windows 3.0 on it when you're done.
[22:05:24] <N2TOH> sure after I port DOS to it first!
[22:05:55] <N2TOH> that would be an epic hack!
[22:06:30] <N2TOH> some AVR chip with VGA output and mouse/KB inputs
[22:07:18] <N2TOH> depending on pricing it might be cheaper to use more AVR chips with 16KB+ of SRAM
[22:08:05] <Epsilon-Auriga> atmega1284p with an external 1MB SIPP or SIMM
[22:08:16] <Epsilon-Auriga> like they did for the arm emulator.
[22:08:31] <Epsilon-Auriga> should be easier to do 8088 than arm...fewer commands.
[22:08:35] <N2TOH> there is already a guy who built a 16 AtMega328 multi processor system
[22:11:00] * N2TOH needs to dig into the J11 further
[23:00:41] <Casper> hey xSmurf
[23:00:44] <Casper> how's foulab?
[23:52:31] <jerkey> china has made a superior clone to the atmega88A http://www.lgtic.com/wp-content/uploads/2013/07/LGT8F88A_vs_ATMega88A.pdf
[23:55:40] <jerkey> http://i.imgur.com/qYsmzbQ.jpg