#avr | Logs for 2012-07-04

Back
[04:06:27] <Administrator_> woah
[04:06:51] <OndraSterver> since I went to sleep nobody said anything
[04:09:29] <carp3> Hi, is it ok to apply 24V to avr pins when they are in high impedance mod? (both PORT and DDR are 0x00 )
[04:11:07] <karlp> what does the sheet in question say about absolute max ratings?
[04:11:39] <OndraSterver> :P
[04:11:57] <carp3> 6v
[04:14:37] <OndraSterver> Vcc + 0.6V approx
[04:15:18] <OndraSterver> you can use resistor + clamping diode..
[04:15:33] <dservo> o> Hello I am having a strange problem with an if statement inside of a ISR function on an Arduino
[04:15:56] <dservo> II'm having an if that will only compare once and use that result for all other checks for that if statement
[04:16:37] <dservo> well the board may be an arduino but the code is mostly AVR Register
[04:16:37] <Kevin`> carp3: no, it is not ok. any voltage above or below the supply voltage + the protection diode breakdown will be shorted to the rail. raising the rails to high will damage the chip, and breaking the protection diode and still applying a voltage can cause the transistors to lockup
[04:21:30] <dservo> so even though I am running an Arduino board could some one at least take a look at the code http://pastebin.com/v4rcJvye the problem is in the "ISR(SPI_STC_vect){"
[04:24:20] <OndraSterver> some comments would be nice
[04:24:45] <OndraSterver> what is the issue?
[04:28:08] <dservo> When the code first enters the ISR after the first byte is received in the array it is compared to a val if a match it should set the MISO pin to output if not it leaves it alone. this works fine, however, each time it encounters the if statement it does the same action regardless of the data received
[04:28:17] <jaeckel> dservo: you missed the initialisation of the rxBufferSlave?
[04:30:27] <jaeckel> and try to explain what you want to do, how you expect to do it and what you observe instead
[04:31:31] <dservo> I tried putting the initialization in the ISR as "volatile char rxBufferSlave[64];" It was at the begining of the code origionally and not in the ISR. I moved it to the ISR so that it should be created on enter and destroyed on exit. But placement does not seem to be the issue
[04:32:48] <jaeckel> try to explain what you want to do, how you expect to do it and what you observe instead
[04:35:22] <dservo> I am essentially setting multiple chips as slave mode and elevating one to master at a time. When the SS is grounded all devices still set as slave will listen for data to be sent. I am using the first byte transmitted to identify the slave that is addressed so that its MISO line can be set to output and full duplex communication can commence with the master
[04:36:17] <dservo> All other slaves will have their MISO lines left as input so that they will not communicate over the top of the addressed slave.
[04:41:06] <dservo> It looks at rxBufferSlave[1] and compares to the address. The first string of bytes transmitted to the slave are handled properly, however it seems to not allow a change on future attempts to enter the slave.
[04:43:45] <dservo> I added the pin flip code to PB7 so that I could see when it enters the if statement. And after a first match will enter it on each pass (seemingly) regardless of the condition being met. If the condition is false on the first pass then it never goes to true and so the pin remains unchanged.
[04:45:18] <iR0b0t1> You are using a state machine? Yes?
[04:45:32] <iR0b0t1> My only suggestion is to think harder.
[04:45:42] <iR0b0t1> I don't think we have enough info
[04:47:11] <jaeckel> iR0b0t1: +1
[04:48:26] <Tom_itx> you can only have one slave at a time with SPI
[04:49:10] <Tom_itx> SPI is bidirectional
[04:51:24] <Tom_itx> as you clock data to the slave, the slave will also send data back to the miso buffer. if you have multiple slaves sending back data, the data will be invalid at best
[04:51:25] <dservo> That is why the default setting for the MISO line on slave is held as input until an address is matched. This prevents multiple slaves talking on the line at once. I have had this setup working and used it to push data to multiple slaves at once.
[04:51:42] <Tom_itx> it can't be
[04:51:45] <Tom_itx> read the data sheet
[04:52:50] <Tom_itx> you are pushing the limits of SPI if you got it to work and it wasn't intended to be used that way
[04:53:20] <dservo> The MISO line is the only line on a slave that can have a non-standard direction.
[04:58:08] <dservo> The best I can describe it as is SPI with the SS line as bidirectional held high with pull up resistor untill a device elevates to master and drops the SS line low. I planned on using software side protocol to interpret and compare an address byte and establish full duplex communications. Unconventional, yes. Impossible, I sincerely hope not.
[05:00:33] <dservo> Really all I need to understand right now is why the if statement line 85 is broken. Sorry for being so wordy
[05:03:12] <Tom_itx> Unknown Paste ID!
[05:05:55] <dservo> http://pastebin.com/PiZrMhJ0 new paste
[05:11:04] <Tom_itx> arrays start with 0
[05:11:19] <Tom_itx> if you are reading the first byte
[05:14:04] <dsolover> do we need to make same changes with fusebits orpins of target chip while burning the 'usbasp' firmware to it.
[05:15:24] <dsolover> i have to make an usbasp programmer , i flashed thr atmega 8 with firmware available online , but its not working
[05:16:01] <Tom_itx> you may need to
[05:16:11] <Tom_itx> depends what the code is and does
[05:16:44] <Tom_itx> oh i don't know where the usbasp firmware loads
[05:17:03] <Tom_itx> if it acts like a bootloader you may need to alter the fuses
[05:17:44] <dsolover> where can i get more help on this
[05:17:55] <Tom_itx> why not get a programmer that works?
[05:18:13] <OndraSter> :P
[05:18:34] <OndraSter> Tom_itx is trying to sell more of his programmer :P
[05:18:44] <dservo> This is true. I first set the count at 0, load data into SPDR ( this first byte is unimportant as MISO should still be input) then increment the count which is now 1. The code then waits for data to finish receiving then reads the SPDR to rxBufferSlave[count] which is one. This is the first byte from the master and the count is 1 when it is received. I could increment after receiving then look at [0]
[05:19:41] <Tom_itx> OndraSter mine do work
[05:20:06] <OndraSter> yeah
[05:20:13] <OndraSter> that's why I said it :)
[05:20:35] <OndraSter> btw, didn't chinese copy your programmer already as well? :D
[05:21:05] <Tom_itx> ages ago
[05:21:40] <Tom_itx> and it was indonesia not china iirc
[05:21:46] <OndraSter> wow
[05:22:22] <Tom_itx> they even stole the wording from my webpage
[05:22:27] <Tom_itx> but denied it
[05:22:37] <OndraSter> lol
[05:22:44] <OndraSter> do you have link on their webpage?
[05:22:45] <dsolover> huys i need some serious help here
[05:22:55] <Tom_itx> OndraSter, not anymore
[05:23:16] <Tom_itx> dsolover is in panic mode
[05:23:19] <OndraSter> too bad, I wanted to get a laugh :(
[05:23:25] <OndraSter> dsolover, 42
[05:23:47] <dsolover> Tom_itx: tell me about ur programmer, i will make it
[05:23:51] <Tom_itx> OndraSter, dean may still know where it was
[05:24:37] <Tom_itx> dsolover, http://tom-itx.dyndns.org:81/~webpage/boards/USBTiny_Mkii/USBTiny_Mkii_index.php
[05:32:44] <CapnKernel> dsolover: Tom's programmers really rock.
[05:33:06] <CapnKernel> I took my programmer to China with me, I didn't take my wife. What does that tell you?
[05:33:20] <Tom_itx> she misses you?
[05:33:40] <CapnKernel> Tom_itx: hi
[05:33:48] <dsolover> CapnKernel: u dint had money to pay for her fare
[05:33:59] <dsolover> lol
[05:34:13] <CapnKernel> You're supposed to infer that I love Tom's programmer more than I love my wife.
[05:34:39] <dsolover> ok,ok
[05:34:42] <Tom_itx> it's cheaper?
[05:34:58] <dsolover> usbasp is also good
[05:35:09] <CapnKernel> Undoubtedly.
[05:35:10] <dsolover> but can u solve my problem
[05:35:12] <Tom_itx> yeah but i'm not familiar with it
[05:35:27] <Tom_itx> some clones require a 12mhz crystal
[05:35:29] <Tom_itx> i do know htat
[05:35:31] <Tom_itx> that
[05:37:05] <dsolover> do we need to provide an external clock to the target uc, which is going to be flashed with usb asp firmware ,
[05:37:23] <Tom_itx> not by default
[05:37:32] <Tom_itx> they have internal osc by default
[05:37:53] <Tom_itx> however the programming clock is handled by the programmer and the protocol
[05:39:34] <Tom_itx> there are a couple chips that don't use the spi lines for programming rather PDO PDI. the 128 is one such chip
[06:05:40] <OndraSter> CapnKernel, so do you have already the PCB calculator or do you still do it "manually"? :)
[06:06:06] <CapnKernel> <looks sheepish>
[06:06:21] <OndraSter> which option is that? :D
[06:06:31] <CapnKernel> Still doing it manually, because these folks called "customers" keep asking me to manually do them quotes and process PCB orders!
[06:06:42] <OndraSter> oh
[06:06:50] <OndraSter> how hard can it be to write some calculator? :)
[06:06:55] <CapnKernel> It's really a case of "which comes last, the chicken or the egg"
[06:07:14] <CapnKernel> So if I give you a spec, you'll have it done by the weekend?
[06:07:27] <OndraSter> :)
[06:07:32] <OndraSter> how big are the specs? :D
[06:07:46] <CapnKernel> A dozen pages or so.
[06:07:49] <OndraSter> huh
[06:08:27] <CapnKernel> I've been keeping written notes on what I do to fulfill an order.
[06:08:42] <CapnKernel> That's 8 pages of single-spaced A4 right there.
[06:09:06] <CapnKernel> Before I started automating it, I had 12 states the order could be in.
[06:09:29] <CapnKernel> Now that I'm working through it, there will be about 30 states an order can be in.
[06:09:34] <OndraSter> huh
[06:10:12] <CapnKernel> There's more to it than it may at first seem.
[06:10:31] <CapnKernel> My PCB orders are growing every week.
[06:10:36] <OndraSter> yay
[06:10:42] <CapnKernel> But the problem is it's leaving me little time to further the automation.
[06:10:42] <OndraSter> now imagine if it was automated! :)
[06:10:47] <OndraSter> ah
[06:10:47] <CapnKernel> So I'm *stuck*
[06:11:58] <CapnKernel> Spent the last three days going through shipping records, getting them all organised for my friend's accountant.
[06:12:38] <CapnKernel> Now that I know what I'm doing, the most recent orders are ok, but the ones in the beginning were a real mess.
[06:12:55] <CapnKernel> "Which order did this DHL waybill match with?"
[06:13:26] <CapnKernel> "I only know the nett weight of this particular shipment, what's a reasonable guess for the gross weight?"
[06:14:05] <CapnKernel> Anyway, I've finally got the shipping in the bag, about to head off to my friend's office to give him the numbers.
[06:14:13] <CapnKernel> Owe him nearly $1000 in DHL shipping.
[06:14:16] <OndraSter> :o
[06:15:11] <CapnKernel> More customers have been asking me about SMD stencils, so I got that arranged yesterday.
[06:15:23] <OndraSter> ooo
[06:15:25] <OndraSter> SMD stencils!
[06:15:35] <OndraSter> what material? kapton?
[06:17:05] <CapnKernel> Stainless steel.
[06:17:33] <OndraSter> not bad
[06:19:09] <CapnKernel> Standard size is 30x40cm, with an aluminium frame: http://i.imgur.com/0Aknu.jpg
[06:19:26] <CapnKernel> I also offer frameless
[06:20:22] <CapnKernel> The stencils are chemical etched imported-into-china stainless steel, but I can also do laser-cut
[06:38:01] <CapnKernel> Well that killed the conversation. Anyway, I'm off!
[14:06:35] <Waldi_> hey friends, does somebody know if you can burn an arduino bootloader on the atmega32a?
[14:07:19] <Tom_itx> i doubt it
[14:07:32] <Tom_itx> the peripherals are different as is the memory map
[14:07:37] <Tom_itx> you could rewrite it
[14:08:09] <Tom_itx> the 32 is quite a bit older chip
[14:08:19] <Tom_itx> mega328's are fairly cheap
[14:08:27] <Tom_itx> you could pick one of those up and do it
[14:09:03] <Waldi_> i picked it because it has more pins :D i already have an arduino uno with 328
[14:09:12] <Corwin> mega32 can be used
[14:09:39] <Corwin> sources of stk500v2 bootloader in arduino shows mega32 as supported
[14:09:40] <Tom_itx> you need to reconfigure the bootloader don't you?
[14:09:46] <Tom_itx> ok
[14:09:58] <Corwin> #if defined(__AVR_ATmega8__) || defined(__AVR_ATmega16__) || defined(__AVR_ATmega32__) \ || defined(__AVR_ATmega8515__) || defined(__AVR_ATmega8535__)
[14:10:07] <Tom_itx> just make sure it gets compiled for the right chip
[14:10:23] <Corwin> Waldi_, you will just have to recompile the bootloader
[14:13:47] <Waldi_> where do i find the stk500v2?
[14:14:29] <Waldi_> sry i'm a real noob xD
[14:15:25] <Corwin> you mean sources for that bootloader?
[14:15:31] <Tom_itx> do you have avrgcc installed?
[14:15:41] <Tom_itx> you will need it to compile the bootloader
[14:15:59] <Tom_itx> unless you can find a precompiled version which is slim
[14:16:32] <Tom_itx> you will also need to program the bootloader fuses
[14:19:26] <Corwin> Waldi_, try here http://arduino.cc/forum/index.php/topic,52223.msg372392.html#msg372392
[14:20:23] <Waldi_> thanks i'll try it
[14:20:36] <Tom_itx> be careful with the fuses
[14:22:13] <Tom_itx> i wonder why they use the lock bits
[14:22:20] <Tom_itx> that's a bit odd
[14:23:34] <Waldi_> uhm.. what are fuses? *blush* :D
[14:24:21] <Tom_itx> things that configure your chip like clock source, bootloader section etc
[14:24:41] <Tom_itx> and if they are not correct you can lock yourself out of it
[14:25:05] <Tom_itx> http://www.engbedded.com/fusecalc/
[14:25:23] <Tom_itx> find your chip and compare what those fuse settings do acording to your chip's data sheet
[14:25:30] <Tom_itx> it's worth double checking
[14:25:47] <Tom_itx> unless you wanna trust a total stranger :)
[14:44:04] <Waldi_> another thing, my arduino uno board isn't working well.. how it is possible that when i put a led in pin 13 and gnd, the L-LED is tuning off, also i cannot program the mega328 anymore, the rx is just blinking three times, but, i can programm an arduino pro mini with the uno-board..
[14:45:10] <Waldi_> (l-led burning all the time, even if i pull the mega328 out)
[14:45:51] <Corwin> do you have anything connected to ISP connector on that board?
[14:46:22] <Waldi_> nope
[14:46:23] <Waldi_> nothing
[14:48:46] <Corwin> and pin13 is empty too ?
[14:48:51] <Waldi_> yes
[14:49:22] <Waldi_> if you mean at programming the mega328
[14:50:19] <Waldi_> and:
[14:50:20] <Waldi_> avrdude: stk500_getsync(): not in sync: resp=0x00
[15:11:30] <drgreenthumb> Tom_itx, is the HWB resistor / one button reset trick documented somewhere? how does it work? tie a high ohm resistor to gnd?
[15:11:54] <drgreenthumb> my latest tight breadboard btw :) http://i.imgur.com/YZ2pC.jpg
[15:12:03] <drgreenthumb> specing I made it like that just for you :P
[15:25:21] <specing> drgreenthumb: ?
[15:26:24] <drgreenthumb> heh just kidding. you said one of my earlier ones looked like spaghetti :)
[15:26:44] <OndraSter> woah so few wires!
[15:29:27] <drgreenthumb> heh well. SPI and i2c are both connected on the top half. so it is pretty well networked :P
[15:29:44] <drgreenthumb> bottom half i could plug some other junk in to play with
[16:15:24] <drgreenthumb> hmm I think I get it. reset and HWB wired to same side of button, but reset through resistor to cause a delay. /me tries that.
[16:59:13] <Tom_itx> woops he left
[16:59:18] <Tom_itx> was gonna tell him
[17:06:38] <Tom_itx> umm a resistor won't cause a delay
[17:06:42] <Tom_itx> a cap will
[17:10:03] <OndraSter> actually, even bigger pullup resistor will :D
[17:10:11] <OndraSter> but the capacitance of the reset pins is too small...
[17:10:56] <Tom_itx> well the 'trick' he was referring to used a cap. i didn't use a cap on mine however
[17:14:45] <Tom_itx> http://www.pjrc.com/teensy/schematic.html
[17:14:49] <Tom_itx> aka teensy 1 there
[17:14:58] <Tom_itx> the others don't have it
[17:15:40] <OndraSter> ah
[17:16:07] <Tom_itx> it creates enough of a delay when you push reset to make it work
[17:17:07] <Tom_itx> it must not have worked that well because later versions don't use it
[18:52:48] <OndraSter> just out of curiosity - how many of you has some university degree and yes, which one (bachelor/engineer/..?)
[18:52:56] <OndraSter> asking just because I wonder whether uni has something to do with real life anyway
[18:53:04] <OndraSter> so far nothing I've learnt at school was near the reality :)
[18:53:14] <OndraSter> and EVEN when we were doing in laboratories tests!
[18:53:38] <Tom_itx> it's a wonderful part of reality when you go to pay the loans back
[18:53:59] <OndraSter> you have to pay for uni in the US?
[18:54:10] <Tom_itx> it's big business here
[18:54:32] <OndraSter> well there are some private unis here
[18:54:38] <OndraSter> but many of them are public
[18:54:38] <Tom_itx> books are outrageously expensive too
[18:54:44] <OndraSter> and honestly I don'T believe in private schools
[18:54:52] <Tom_itx> why not?
[18:55:15] <OndraSter> I don't believe in private schools here*
[18:55:35] <OndraSter> mostly middle (high) private schools, not sure how about unis
[18:55:40] <OndraSter> I know the results of those.
[18:55:55] <OndraSter> I can't imagine how can many people pass - they wouldn't pass on any other school.
[18:56:00] <OndraSter> "As long as he pays, he can stay!"
[18:56:04] <OndraSter> pretty much
[18:56:12] <Tom_itx> it is quite the opposite here
[18:56:15] <Tom_itx> so it seems
[18:57:15] <OndraSter> most likely it is
[18:57:29] <OndraSter> after all, you have books "Pinterst for dummies" and "Facebook for dummies"
[18:57:37] <OndraSter> :P
[18:57:37] <OndraSter> http://i.imgur.com/Wx91Z.jpg