#avr | Logs for 2015-09-14

Back
[00:13:12] <gorroth> omg
[00:13:20] <gorroth> i can't help but love these damn little chips
[00:13:36] <gorroth> i've owned a few of them for years but never was able to use them, because i didn't have the time or energy
[00:14:07] <gorroth> but avr-libc is just making it so easy to get at the PWMs and EEPROM
[00:16:42] <Casper> yes, once you stop being scared of C :D
[00:16:58] <gorroth> oh, i've done advanced videogame programming in C and C++
[00:17:02] <gorroth> never been scared :)
[00:17:10] <gorroth> i've mmap'd like a boss and then some :-P
[00:17:29] <gorroth> done some crazy low level networking performance enhancements for the physics-based game simulation, etc
[00:17:32] <gorroth> ROBLOX :-P
[00:18:05] <gorroth> but for the AVR chips, i just didn't have the time or energy to mess around, hehe. work and emotional stuff was keeping me busy
[00:18:24] <Casper> hehe
[00:19:59] <Casper> maybe you will have an idea: unidirectional serial communication over 1 wire, where speed will be different on each device...
[00:20:04] <Casper> one master, several slave
[00:25:03] <gorroth> right now, i have the idea of using SPI with one master and one slave at least, hehe
[00:25:31] <gorroth> pretty much unidirectional, but i haven't worked out whether or not i'll have the AVR respond with acks
[00:25:37] <gorroth> i haven't gotten into that protocol yet
[00:25:58] <gorroth> but i'm already wired up with SPI to do ISP; so, it's natural i'll just continue using that interface for now
[00:26:21] <Casper> spi need a clock line iirc, which I do not have
[00:26:26] <gorroth> yes
[00:26:55] <gorroth> if you're going to do 1-line serial coms... hmm, i'd have to think about that
[00:27:49] <gorroth> i suppose if you ensure your slave is faster than data being sent to it, and you make sure your master is sending data at a speed slow enough, then you could just use an ISR on the AVR to pick up the data being pushed over to it
[00:29:10] <gorroth> i hate to do this, but i have to prepare for bed
[00:29:17] <gorroth> if you msg me in here, i'll pick it up tomororw though
[00:29:20] <gorroth> goodnight :)
[00:31:02] <Casper> gorroth: the tiny88 do not have any usable rx, beside, the speed is mismatched (internal RC)
[00:34:00] <Casper> I guess manchester is the only way....
[06:28:13] <Lambda_Aurigae> Casper, see Jartza about his audio comms....
[06:28:26] <Lambda_Aurigae> you can't do exactly 1 wire as you need data and GND..
[06:28:36] <Lambda_Aurigae> but with 2 you can send data over.
[06:28:44] <Lambda_Aurigae> or you could use the dallas 1-wire tech.
[08:15:19] <Eszett> hi
[08:15:45] <Eszett> hello guys can you help me with some problem
[08:16:24] <Eszett> with debugging, how can I check whether a certain pin of my AVR µC is floating or not?
[08:16:48] <LeoNerd> That's not *really* a question that makes sense to ask
[08:19:23] <Eszett> well i suspect a pin is floating, how can i find out?
[08:20:09] <LeoNerd> Who is "I" in this context?
[08:20:27] <LeoNerd> The chip itself could enquire, though various methods of that which would require additional hardware to make safe
[08:20:42] <LeoNerd> An engineer armed with a suitably designed piece of test kit could enquire
[08:20:52] <Eszett> yes but im not enginner, just a user
[08:21:20] <day> does anyone know of a good outdoor low power display that accepts spi/i2c or similar?
[08:21:55] <day> displays that rely on background light are probably not a good idea
[08:21:56] <LeoNerd> You are a user applying technical knowledge to build a device
[08:22:00] <LeoNerd> That makes you an engineer
[08:22:32] <Tom_itx> engineer in training
[08:22:54] <Tom_itx> you gotta be old gray and crabby to be an full fledged engineer
[08:29:54] <RikusW> and the guy who repairs stuff is the technician ?
[08:30:41] <LeoNerd> I think I just have a rather broad definition of an engineer
[08:30:54] <LeoNerd> "An engineer is what happens when you combine a scientist with an artist/designer"
[08:31:20] <LeoNerd> Someone who knows how things technically work, but also who appreciates how people will interact and use them for some specific task
[08:33:26] <RikusW> s/engineer/technician goes for MCSE though, I did it for NT4
[08:35:02] <Tom_itx> i always thought the engineer was the guy driving the train
[08:36:42] <day> LeoNerd: no if you do that you get the nuclear bomb :>
[08:36:59] <LeoNerd> day: mm?
[08:37:09] <day> scientist + artist
[08:37:27] <LeoNerd> You do?
[08:37:34] <day> ;_;
[08:37:43] <LeoNerd> I think you also get a lot of other things, though
[08:41:35] <Eszett> LeoNerd: you are right, basically im too stupid to solve the prob, but thats the reason im asking here for help
[08:41:51] <LeoNerd> Well, maybe you could start by answering my question
[08:51:04] <Eszett> [14:56] <LeoNerd> Who is "I" in this context?
[08:51:19] <LeoNerd> Yes, that one
[08:52:23] <Eszett> well, good question. Im new to MCUs, just read abit about the basics, and try to run my custom build keyboard with a teensy2.0
[08:52:37] <LeoNerd> Nono.. you miss the question
[08:53:14] <LeoNerd> Are you asking: a) How can I write an AVR program such that the AVR chip itself can determine if a pin is floating? or b) How can I as an engineer working on this circuit right now determine if this pin is currently floating?
[08:53:29] <LeoNerd> It's not really clear yet what your question is about, so it's hard to answer it
[08:53:51] <Eszett> ahh, i mean b) i would like to peek inside the MCU to get an idea where the fault may be
[08:54:00] <Eszett> because there is a fault going on..
[08:54:24] <LeoNerd> Umm
[08:54:29] <LeoNerd> .. OK now the question is more vague again
[08:54:37] <LeoNerd> Take a step back and explain the context of the problem
[08:54:47] <Eszett> alright i will explain everything in detail
[08:56:30] <Casper> Lambda_Aurigae: ueah data+gnd, but need speed too
[08:57:16] <Eszett> I have a keyboard matrix connected to the Teensy2.0. I have 17 I/O pins for scanning the cols, and 5 for strobing the rows. When a switch is pressed a connection is made between a certain row pin and a col pin, drawing the col pin to GND. If there is no switch pressed the col pin is pulled up high, by internal pull up resistors.
[09:00:34] <Eszett> now the col pin PB2 is acting _as if_ drawn to GND, but it is not connected to GND. my conclusion is, that its floating and reacting to noise
[09:01:27] <LeoNerd> I'm not quite sure I get what you mean... "acting as if drawn to GND but it is not connected to GND" ?
[09:01:44] <day> Eszett: that would mean your pullup is not ok. Did you try using an external pullup?
[09:02:23] <Eszett> day: yes... i thought about using an external pullup. but can i check without external pullup if the internal pullup is notok?
[09:03:04] <Eszett> like with a multimeter perhaps?
[09:03:44] <day> hm i guess if you connect it to gnd with a high resistance it should stay at 3.3V or 5V if it doesnt your internal resistor clearly isnt pulling it up
[09:04:07] <day> with high i mean multiples of your internal pullup
[09:05:48] <Eszett> day: right, and now comes the odd thing about it, and why im having a head ache: the keyboard works normaly. not reacting to noise, perfect. so the internal pull up (must?) be ok. only when i reboot my pc with the keyboard plugged in while booting up, the pin PB2 seems to float (?)
[09:06:32] <Eszett> in other words: the whole problem occurs only in the certain circumstance, that the keyboard is plugged in while booting the pc up.
[09:07:45] <Eszett> when i plug the keyboard off, and plug in again, the problem is gone.
[09:08:28] <Eszett> so it seems as if the internal pull up doesnt work, until i plug the keyboard out and in again. and this is not logical to me.
[09:08:55] <day> Eszett: maybe the teensy does undefined things during its bootup phase?
[09:10:58] <Eszett> mhhhh, probably
[09:11:16] <Eszett> and at this point it is getting odd.
[09:12:11] <Eszett> at this point i habe no logical reasoning anymore.
[10:02:05] <RikusW> Eszett: internal pullup can easily be checked with a multimeter
[10:02:52] <RikusW> measure the volts, when the pin is output and high it will be about vcc, when only the pullup is on (DDR=0 PORT=1) it will read a lower voltage
[10:03:15] <RikusW> how low depends on the internal resistance of the meter
[10:03:36] <RikusW> say VCC = 5V then it might be 4V or so
[10:03:53] <LeoNerd> And the other load on the circuit
[10:04:18] <LeoNerd> Basically I'd say: if you're concerned that the chip itself is broken, take it out of circuit and power it up alone, with a small test program you can drive to control such things
[10:04:18] <RikusW> maybe the PC does a usb reset on the chip that is not handled ?
[10:44:03] <Eszett> Rikus: thanks
[10:44:49] <Eszett> Rikus: so i configure my firmway to make this pin a output pin and high, man that is good idea!
[10:45:09] <Eszett> firmware
[10:45:23] <Eszett> you made my day
[11:02:22] <gorroth> Casper: i forgot all about manchester code. it's been about 11 years since i looked at PHY networking
[11:02:29] <gorroth> Casper: but that sounds like a cool idea to do
[11:02:49] <gorroth> and my networking stuff for PHY was only academic
[11:05:53] <Casper> I'ld like to find a way to do data over power, but since I use PWM, that will be hard
[11:06:50] <gorroth> what do you mean by doing data over power? you're making me think about the ethernet devices i have in my home that transmit data over the power lines
[11:07:07] <gorroth> (btw, the data over power thing i have seems to suck in terms of speed)
[11:08:06] <Getty> yesterday i did an eeprom:r for making an eeprom:w later, but it seemed he set all the 0xFF (not set) bytes to 0x00, did i made something wrong?
[11:10:49] <RikusW> Eszett: input pin and high out port output
[11:10:56] <RikusW> that enables the pullup
[11:10:57] <Casper> back story: individually adressable garden light
[11:11:08] <Casper> I want to minimise the wire count
[11:11:14] <RikusW> or output and high to drive the matrix
[11:11:57] <RikusW> Casper: modulate on top of the pwm
[11:12:09] <RikusW> say move the pulses slightly
[11:12:57] <RikusW> use center of pulse and move slightly forward of backward for 1 or 0
[11:13:41] <Casper> I need like 20kBps
[11:15:09] <Casper> might just use 3 wires... or change chip and use 4
[11:19:44] <Getty> Casper: you do face 2 problems which are not solved in one solution at once
[11:20:10] <Getty> Casper: but with the 4 wires you can do what you like, wiht just combining whatever 2 solutions for the power and the data
[11:20:29] <Getty> RS485 might be the direction for the data (thats what we actually wanna do, combined with power as protocol)
[11:23:49] <gorroth> Casper: i'm still an electro-nub; so, i still didn't get what you meant by "data over power" when you told me about your backstory :)
[11:29:03] <Getty> gorroth: he wants a bus, so that he can address them individual but has one line (at least thats what i think he wants)
[11:33:01] <Casper> gorroth: data over power: using the same wire for data and power
[11:33:21] <LeoNerd> IMHO that's usually far more trouble than it's worth
[11:33:47] <LeoNerd> It justabout works OK for Dallas-style 1wire sensors and so on that are very low power, but I wouldn't use it for much else besides
[11:34:28] <Getty> LeoNerd: we are actually exactly planning that for LED powering even, so high power :) with RS485 chips it is doable
[11:34:33] <Casper> and even with 1wire... it have serious limitation
[11:34:51] <LeoNerd> Ugh.. I really wouldn't power PWM-using LEDs over a 1wire bus
[11:35:02] <LeoNerd> Those LED drivers will inject loads of noise into the power feed, making data recovery very hard
[11:35:05] <Casper> but I'll try something one day... when I get time...
[11:35:18] <Casper> LeoNerd: yeah... even with a low pass filter..
[11:35:50] <LeoNerd> The 1wire sensors (e.g. those temperature probes) get away with it because they enforce a period of data-quiet time after a request for a conversion
[11:35:58] <LeoNerd> So the sensor knows it gets clean power for long enough to do it
[11:36:29] <Casper> and for some operation it require power
[11:36:35] <Casper> like eeprom write
[11:49:11] <gorroth> Casper: oh... you mean you want to provide Vcc over some line to your lights, but you also want to use that same pin/line for sending your pulses i take it
[11:49:26] <gorroth> i kinda get it
[11:49:50] <gorroth> i didn't think about doing that
[11:53:37] <twnqx> sounds like just what the atmel eeproms are doing
[11:53:58] <twnqx> the new*
[11:55:28] <Casper> but then, it mean I need to figure out how to make a strong enought signal... and lowpass filter.... and high pass filter.... so... might be just easier and cheaper to use other wires :D
[11:56:09] <LeoNerd> power, data, gnd.
[11:56:16] <LeoNerd> that's three wires. one of which can be the shield
[11:56:28] <LeoNerd> You can buy stereo audio wire pretty cheap these days
[12:01:47] <Casper> each light will draw 2A
[12:01:59] <LeoNerd> ... yeah; you really want to selfpower those
[16:20:26] <genexerc> RikusW: Hi!
[16:20:36] <RikusW> hi genexerc
[16:22:24] <genexerc> RikusW: I found your article about debugwire protocol and trying to use it with arduino uno
[16:22:43] <RikusW> ah
[16:22:48] <LeoNerd> Ah, more dW types :)
[16:22:58] <LeoNerd> Let us know how you get on - I'm keen to play with that too
[16:23:10] <RikusW> arduino got a cap on the reset line that needs to be removed...
[16:23:19] <genexerc> already done that
[16:23:37] <genexerc> trying to test it bare-bones
[16:23:52] <RikusW> dW is very lowlevel, you'll need to learn some avr asm to use it properly
[16:24:33] <genexerc> sounds good to me)
[16:24:47] <RikusW> Executing instructions via dW on the avr is required for some functionality
[16:25:15] <RikusW> dW cannot execute 2 word instructions, only 1 word
[16:25:46] <genexerc> I'm at the interface stage now
[16:25:54] <RikusW> Do you have a debugger capable of doing dW ?
[16:25:59] <genexerc> no
[16:26:21] <RikusW> once you get the serial link going you can turn it off by sending 0x06
[16:26:27] <genexerc> I have usb-usart made from another uno
[16:26:29] <RikusW> (until power cycle)
[16:27:08] <genexerc> It not responding on BREAK
[16:27:28] <RikusW> is your baud set right ?
[16:27:54] <genexerc> Tryed allaround
[16:28:07] <RikusW> did you enable the DWEN fuse ?
[16:28:27] <RikusW> (this will disable ISP)
[16:28:46] <genexerc> looks like, because uno not responding to SPI programming anymore
[16:28:51] <RikusW> dW baud is avr clock/128 iirc
[16:29:05] <RikusW> do you have a scope ?
[16:29:06] <genexerc> yeap. tryed 125000 and 62500
[16:29:18] <genexerc> old one. very old
[16:29:58] <genexerc> how scope can help?
[16:30:01] <RikusW> you could manually pull down reset and check on the scope for the 0x55 reply, do add a 10k pullup
[16:30:14] <RikusW> is the ckdiv8 fuse set ?
[16:30:28] <RikusW> then you need clk/128/8
[16:30:44] <genexerc> can't check anymore but I tried that rates too
[16:31:05] <RikusW> https://sites.google.com/site/megau2s/
[16:31:09] <genexerc> will dW respond 0x55 continuosly?
[16:31:22] <RikusW> only once after reset is released
[16:31:33] <RikusW> it is used to detect the baud
[16:32:54] <RikusW> My U2S programmer can disable dW to allow normal programming, I've eventually decided to opensource it
[16:33:02] <RikusW> -ve
[16:35:06] <genexerc> ok. thanks. will try
[16:35:17] <RikusW> genexerc: you need to convert the tx pin to open collector as well
[16:35:59] <RikusW> I've added a description on how to do it using 2 10k resistors and a npn transistor
[16:36:18] <LeoNerd> RikusW: I was looking at the ATtiny 1632 for my dW adapter, by the way. It's a 20pin 'tiny with two UARTs
[16:36:20] <genexerc> you write that i need pullup on base and collector, tx connected to emitter, how it connects to dW?
[16:36:28] <LeoNerd> So I can have one at target/128, and one at fixed speed for host control
[16:36:32] <RikusW> basically tx->E vcc->10k->B vcc->10k->C->rx-> dW
[16:37:40] <genexerc> why is it necessary?
[16:37:55] <LeoNerd> I don't usually bother with a Tr, I just diode it
[16:38:14] <RikusW> because dW use 1 wire for rx and tx
[16:38:25] <LeoNerd> 10k pullup, diode to pull bus wire down from Tx pin, connect straight to Rx
[16:38:30] <RikusW> diode could work
[16:38:44] <RikusW> schottky ?
[16:38:52] <LeoNerd> 4001 ;)
[16:39:00] <RikusW> or normal Vf 0.7V ?
[16:39:20] <LeoNerd> Yah - 0.7V is low enough to still count as "low"
[16:39:37] <LeoNerd> At least at these much-below-1MHz bitrates
[16:39:38] <genexerc> what will happen if you connect them directly?
[16:39:39] <RikusW> I've go for 0.2V schottky
[16:39:45] <RikusW> *I'd
[16:39:50] <LeoNerd> genexerc: driver conflict makes a large current flow and you pop something
[16:40:22] <RikusW> genexerc: tx is always high when not transmitting....
[16:40:35] <LeoNerd> An "open collector" bus has no active drivers to pull high, only pull low. So you use just a resistor pullup
[16:40:40] <genexerc> i have tx low
[16:40:52] <LeoNerd> The bus floats high via that if no driver pulls it low, or any driver can pull it low. It's exactly like the SDA line of an I2C bus
[16:41:05] <LeoNerd> Just using self-clocked async serial instead of having a separate SCL line
[16:41:07] <RikusW> tx must be high when not transmitting
[16:41:52] <genexerc> i have externall pull-up
[16:42:02] <LeoNerd> Hrm.. Why aren't there any 8pin ATtiny chips with a UART? I could just do with an I2C-attached serial port right about now
[16:42:32] <LeoNerd> Ohwait I'd need xtal too
[16:43:04] <LeoNerd> Basically: I want one UART on a 16MHz divison for dW target, and one on a 14.7456MHz one for host comms
[16:43:15] <LeoNerd> Hrm... or I use a 32U4 and do it over USB-CDC
[16:43:42] <genexerc> I have target RESET/dW pulled up on target board and usb-usart with tx/rx open-drain connected togather and tied to target
[16:45:27] <Getty> oh btw, dont know if that already hit the channel, but one of my friends released this some days ago: https://github.com/mhx/artx
[16:45:47] <Getty> and i can only tell that he knows what he does ;) didnt had yet the time to test it
[16:46:43] <RikusW> LeoNerd: USB CDC is easier
[16:50:21] <LeoNerd> Certainly
[18:19:34] <genexerc> got 0x55 after reset! it was direct TX what messed up
[18:20:40] <genexerc> *that
[23:40:47] <rue_mohr> maybe its time for a new library
[23:41:08] <rue_mohr> one that has almost all the things the old libraries did
[23:41:15] <rue_mohr> one that does atleast half a good a job
[23:41:25] <rue_mohr> one with atleast a quarter of the documentation!
[23:41:35] <rue_mohr> one with only twice the bugs!
[23:41:48] <rue_mohr> one that works on almost all the new parts!