#avr | Logs for 2015-01-14

Back
[02:19:22] <davor> hello
[02:20:38] <davor> I need some help, this code works fine without lines 101, 98 and 95. then the avr toggles an LED state every 8 seconds (watchdog timeout). however, if I put the lines in, the thing goes haywire, starts blinking the LED randomly and I have to jump through hoops to get code to upload again
[02:20:44] <davor> http://pastebin.com/G9CmZEGg
[02:21:14] <davor> why would reading a register three times make the thing go insane?
[02:26:33] <apo> you set registers to x,y,z vithout initializing them...
[02:27:54] <davor> variables are initialized as int in line 13, and I thought x = WDTCSR; is supposed to dump the register into x, and not set WDTCSR to x
[02:28:09] <davor> apo ^
[02:28:19] <apo> you do wdtcsr = x
[02:28:25] <davor> AH
[02:28:28] <davor> DAMN IT
[02:28:29] <davor> thanks man
[02:28:49] <davor> wait a minute
[02:28:54] <apo> off to shower.
[02:28:58] <davor> wouldn't that write x to WDTCSR
[02:30:29] <apo> Yes, that's how assignment is generally understood to work :p
[02:30:48] <apo> also, you only need WDCE to enable WDE
[02:33:10] <davor> but I want to write whatever is in WDTCSR to x so I can dump it through serial
[02:33:34] <davor> that is, I want to read WDTCSR and put that into x
[02:34:00] <davor> which is what I thought I was doing with x = WDTCSR; but apparently not as it breaks the entire thing
[02:57:40] <apo> ... You're doing WDTCSR = x
[02:57:46] <apo> that's different from x = WDTCSR
[02:59:21] <jacekowski> and there is few more
[02:59:30] <jacekowski> = y and = z
[03:04:54] <apo> davor: ^
[05:09:46] <Lambda-Aurigae> davor, look real close at your code. You are assigning x, y, and z to the WDTCSR...not reading WDTCSR and assigning it to x, y, and z...
[05:11:01] <Lambda-Aurigae> and you have no main()...which is doable but usually odd in my opinion.
[07:22:22] <apo> Lambda-Aurigae: The missing main is because of arduino crud, they have one that does setup(); while(1) loop();
[07:35:57] <Fleck> ;p
[07:50:43] <davor> Thanks guys. What's the proper way of reading a register value and storing it into a var?
[07:51:38] <davor> WDTCSR = x;?
[08:25:01] <Fleck> davor: no... x = WDTCSR; :D
[08:25:43] <davor> Yeah but I had that in the code I pasted and it didn't work
[08:28:07] <Fleck> davor: how do you tell? :D
[08:29:48] <davor> Ok.. I just realized i typed differently. My bad
[08:29:57] <davor> Thanks man
[08:30:05] <Fleck> cheers
[11:24:37] <LeoNerd> I'm suffering an annoyingly embarrasing problem. ATtiny84 + nRF24L01, using SPI + interrupt line on INT0.
[11:26:04] <LeoNerd> The first time the interrupt fires, the ISR runs, and queries the radio.. last thing it ever does is raises the SS line, to de-assert slave select and put the SPI link back to idle
[11:26:22] <LeoNerd> I think this is inducing a tiny little bit of noise along the SS line, which runs parallel to the INT line, because the ISR immediately fires again
[11:26:47] <LeoNerd> When it fires this time, it queries the chip, finds nothing to do, so goes back to sleep again... raising SS, triggering the whole cycle again, locking up the circuit completely
[11:27:19] <LeoNerd> What can I do about this? I'm thinking either some sort of hardware noise filtering (cap on the INT line?), or software configuration... I can't configure a delay on the INT line can I?
[11:27:37] <LeoNerd> If not, maybe I could just have the ISR wait a small delay, then read the PIN value of INT just to see if it's still there
[12:48:17] <davor> Fleck, hm, I just got home and figured out that I did indeed put in x=WDTCSR; with the intent to read WDTCSR to x, and it's still going haywire.
[12:53:16] <davor> ah. it says WDTCSR = x; in the paste, dunno why
[12:53:23] <davor> let's check again
[12:56:50] <davor> hm. why does this work properly without line 97, but makes the thing go haywire otherwise? http://pastebin.com/gq9gy6FX
[13:29:47] <LeoNerd> Mmmm, a cheeky thought occurs to me. If I use LEDs as the diodes in my pulldown OR gate to mux IRQs into the INT pin, I get visual feedback of per-device interrupt activity :)
[13:30:26] <Thrashbarg> hehe
[13:31:06] <Thrashbarg> assuming the interrupt stays on long enough, or is frequent enough to see :P
[13:31:13] <RikusW> beware of the 2V drop on the leds, it might cause problems ?..
[13:31:18] <Thrashbarg> that too
[13:31:39] <LeoNerd> True... should be enough to have seen my board lockup issue, anyway
[13:31:48] <LeoNerd> Ahhh, that's true
[13:31:51] <LeoNerd> Hmmm
[13:32:07] <Thrashbarg> how is the gate organised? DTL?
[13:32:15] <LeoNerd> I can try it out
[13:33:24] <Thrashbarg> or is it diodes through to a pullup resistor using negative-logic
[13:34:27] <LeoNerd> diodes and tiny's internal pullup
[13:34:32] <Thrashbarg> yea
[13:34:45] <LeoNerd> device IRQ --D-- INT attiny84
[13:35:03] <Thrashbarg> diode pointing away or to the ATtiny?
[13:35:53] <Thrashbarg> you'll have problems anyway because of the drop on the LED... the voltage will be too high to register a logic 0
[13:36:10] <LeoNerd> pointing such that pulldown of active-low on IRQ triggersmfalling INT
[13:36:23] <Thrashbarg> yeah
[14:07:22] <davor> with a 328p, why do I have to do WDTCSR |= (1<<WDCE) | (1<<WDE); even if I don't want WDE to be set later on?
[14:08:04] <davor> if I just do WDTCSR |= (1<<WDCE); then wdt starts acting erratically
[14:53:04] <pepijndevos> whelp! hehe, I made my own PCB with an atmega328p, but avrdude is giviing me troubles.
[14:53:33] <pepijndevos> I tried flashing a bootloader and... now nothing works.
[14:53:59] <pepijndevos> https://www.refheap.com/74880960c959b426f8b2ba4c6
[14:55:24] <pepijndevos> And before that it only worked with -B 250
[15:09:39] <pepijndevos> So after writing the firmware it read the fuse bits as all 00
[15:13:47] <pepijndevos> if this is true, it's running off the 32khz krystal using a 8 divider and reset disabled. That seems like a nasty situation....
[15:22:36] <RikusW> or something else is interfering with proper reading
[15:23:03] <RikusW> if reset is disable you won't even be able to read the fuses
[16:51:18] <garulf> hi guys, some of you known how to use raspberryPi as an avr-programmer (I need it for an atmega 328P)?
[16:53:33] <Tom_itx> someone here is using one but i forget who
[17:14:09] <specing> lelberryPI
[17:24:20] <Lambda-Aurigae> I use an rPI for programming AVR.
[17:24:38] <Lambda-Aurigae> but, I use the programmer I got from Tom_itx to interface between the rPI and the AVR.
[17:24:53] <Lambda-Aurigae> I don't use the rPI GPIO.
[17:27:15] <bitd> http://www.sportdevices.com/ignition/ignition_TCI_PIC12F675.gif - Anyone have any idea what the function of the 560 ohm resistor would be? Near the IGBT?
[17:28:01] <Lambda-Aurigae> bitd, pulldown resistor?
[17:28:14] <bitd> Ah, ofcourse lol.
[17:28:15] <Lambda-Aurigae> hold it down toward GND...the pic then pulling it high when in use.
[17:28:22] <Lambda-Aurigae> keep it from fluxuating.
[17:28:31] <bitd> Yeah its obvious when you see it >.>
[17:28:35] <Lambda-Aurigae> and the cap is for debounce/smoothing most likely.
[17:28:44] <bitd> Thanks Lambda-Aurigae
[17:28:57] <Lambda-Aurigae> welcome.
[17:29:07] <Lambda-Aurigae> looks like the same for that 670R near the pickup.
[17:29:32] <bitd> Yeah I think so.
[17:39:57] <garulf> Lambda-Aurigae, ah ok. No I want to use the GPIO, I found that an SPI interface can be enabled using some GPIOs. I'll give a try tomorrow
[17:40:31] <garulf> thank you btw
[17:44:29] <Lambda-Aurigae> remember that while the AVR ISP uses the SPI pins, it is not exactly an SPI interface.
[17:50:13] <malinus> Lambda-Aurigae: what makes it not a spi interface? It has been a while since I've looked at the specs
[17:50:24] <Casper> anyone have a suggestion to things to add to my digikey order?
[17:50:34] <Casper> it annoy me that the order is tiny :(
[17:50:50] <Lambda-Aurigae> malinus, well, you will have to have access to the reset.
[17:51:04] <Lambda-Aurigae> can't just use spi which is what it seemed garulf was thinking.
[17:51:19] <Lambda-Aurigae> Casper, a laser.
[17:51:22] <Lambda-Aurigae> big honking laser!
[17:52:00] <malinus> Lambda-Aurigae: good point. But the data transmission is plain spi, no?
[17:52:17] <Lambda-Aurigae> I think so.
[17:53:06] <Lambda-Aurigae> for some reason it seems there's something else odd...something about timing or setup or some such...
[17:53:14] <Lambda-Aurigae> would have to look at the datasheet on that again...been a while.
[17:53:22] <malinus> yeah don't bother
[17:53:30] <Lambda-Aurigae> got me thinking now..hehe
[17:59:14] <Lambda-Aurigae> looks to be SPI but you have to do some playing with both RESET and SCK to get it into programming mode.
[21:58:07] <Guest64034> Love embedded systems. Do jobs exist in good numbers for this type of career?
[21:59:30] <Casper> sure
[22:00:59] <Guest64034> Any area in particular? Country? I'm in a small town and looking to move on. Just need a place to start looking.
[22:01:13] <Casper> no idea
[22:01:33] <Casper> but look at how everything now have electronics in it, none use analog stuff anymore, they all use digital
[22:01:53] <Casper> even simple toys now use a microcontroller...
[22:02:22] <Guest64034> I'm learning avr assembly right now and wondering if assembly is really used? Love working is C but assembly seems a little slow going.
[22:02:44] <Guest64034> Flashlights even use them.
[22:02:59] <Casper> it depend on the field, but asm take too long to make
[22:03:26] <Casper> so lots of C, except when they need to squizz tons of code in a tight space, or precise timing is needed
[22:03:46] <Guest64034> Makes sense.
[22:05:08] <Guest64034> I am, however a little frustrated that everything from Atmel is windows based. I'm working in Linux and getting by with AVR-GCC.
[22:05:56] <Casper> shouln't be too hard to move to avr-gcc
[23:56:25] <rue_shop3> is this channel in order?
[23:56:48] <rue_shop3> yep, must be ok
[23:57:14] <Casper> rue_shop3: who knows
[23:57:25] <Thrashbarg> this channel out of order is always
[23:57:46] <rue_shop3> ok, just tell me who is making it out of order and I'll ban them
[23:57:52] <rue_shop3> is it you?
[23:58:05] <rue_shop3> no?, hmm
[23:58:44] <Casper> rue_shop3: so last weekend, I wanted to play some music on my home theater... but there was no bass comming out of the sub.... after some fidling... I ended up cranking the sub volume to max... the bass sounded weird... too late to put it louder to hear better.... finally, it's all distorted. Guess what was the issue
[23:59:36] <rue_shop3> cossed lines?