#avr | Logs for 2015-06-22

Back
[04:19:14] <umquant> Can anyone provide some insight on structuring an application that must issue serial commands and read responses.
[04:20:02] <umquant> The device is a WiFi card. I am having trouble coming up with a clean way to issue commands and then process / passing results
[04:20:44] <LeoNerd> I use my little cooperative scheduling OS for that
[04:21:18] <umquant> LeoNerd, The enviroment I am using does have an RTOS. I am just struggling with organizing the threads and such
[04:21:51] <LeoNerd> "threads"
[04:21:52] <LeoNerd> Eh
[04:22:15] <LeoNerd> Honestly on AVR-sized stuff, I find just having some functions that keep state in variables is good enough
[04:22:33] <LeoNerd> If you need to interrupt and come back later, have the task function be a big switch block that keeps a progress counter
[06:02:19] <LeoNerd> https://www.tindie.com/products/sinzu/the-ultimate-pcb-ruler/?utm_source=twitter&utm_medium=twitter&utm_campaign=product_back_in_stock_tweets <== Since when did *anyone* ever use QFN16 package sizes?
[06:02:43] <LeoNerd> Smallest I've ever seen anyone sell anything is QFN20. Even Atmel do SOIC14 chips in QFN20, and just leave 6 pins N/C
[06:30:05] <RattusRattus> hi guys. I2C slave on an avr. I am haveing problems with 400kHz clock but if I drop back to 100kHz clock on my master device everything comes up and works. AVR311: Using the TWI module as I
[06:30:09] <RattusRattus> 2
[06:30:32] <RattusRattus> ... Using TWI asn and I2C slave
[06:31:10] <LeoNerd> If it works at 100kHz but not 400 there might be electrical-level issues.
[06:31:27] <RattusRattus> suggests that the AVR needs a main clich greater than 6.4MHz to achive this but I have it set to 8MHz
[06:31:28] <LeoNerd> Check stray capacitance, pullup resistors, etc... Do you have a scope you can probe the slave pins on?
[06:31:55] <RattusRattus> LeoNerd: yep with a scope my clock and data symbols look pretty square
[06:31:58] <LeoNerd> E.g. one problem could be if your slave doesn't have low-enough resistance pullups on its end, the SCL pin might not raise quickly enough
[06:32:07] <LeoNerd> Hmm
[06:33:04] <RattusRattus> 100.6ns rise time, 64.0ns fall time
[06:33:21] <LeoNerd> Hrm
[06:33:22] <RattusRattus> no obvious ring
[06:33:52] <LeoNerd> 100ns rise time... over a total bit time of 400kHz==2.5µs
[06:34:26] <RattusRattus> sorry measuring at 100kHz
[06:34:29] <RattusRattus> goes back
[06:37:34] <LeoNerd> Ah; well I have no particular ideas.. I try to avoid I2C if I can, and so far never had to implement a slave on AVR
[06:38:06] <RattusRattus> make that 40nS rise and 6.7nS fall. over a 2.5uS clock
[06:38:55] <RattusRattus> what I see at 400kHz is after the first signal the AVR holds SCK low and doesn'tr release it
[06:38:57] <LeoNerd> Well that sounds like it should definitely suffice
[06:39:09] <LeoNerd> Oh the I2C slave needs to be told to release the clock
[06:39:21] <RattusRattus> but not at 100kHz?
[06:39:27] <LeoNerd> When in slave mode, the ATmega I2C unit does clockskew
[06:39:30] <LeoNerd> er.. stretch
[06:41:32] <LeoNerd> I'd imagine the behavour would be independent of clock speed, but I admit I haven't checked the datasheet.
[06:41:40] <LeoNerd> See above under "I generally avoid I2C" :)
[06:41:49] <LeoNerd> Anyway, gotta head out for lunch now. Goodluck..
[06:43:03] <RattusRattus> thx
[07:34:42] <LeoNerd> Hrm... Offhand anyone know what the difference is between ATmega8 and ATmega48/88/168/328?
[07:34:55] <LeoNerd> They appear to have identical pinouts on all packages, same set of peripherals,...
[07:42:07] <LeoNerd> Ohwait... mega8 has fewer PWM outputs
[07:42:12] <LeoNerd> timer0 in fact lacks any PWM output
[07:42:41] <LeoNerd> Wow the mega8 timer0 unit looks almost entirely useless
[07:58:02] <Palsson> I'm trying to use my JTAGICE mkii to program my Atmega186PA but i can't get avrdude to run properly with the debugger. I'm using OSX and Crosspack, anyone recognize this problem? http://pastebin.com/saKUyRx0
[07:59:09] <Tom_itx> use GDB?
[07:59:45] <Palsson> Tom_itx do you mean that i should start a GDB server?
[08:00:09] <Tom_itx> i've not used GDB but if you want to debug that would be the linux tool to use
[08:00:21] <dunz0r> Palsson: TRied with a different cable? You never know.
[08:00:37] <Tom_itx> afik avrdude doesn't do debugging
[08:00:44] <dunz0r> Or a different USB-port, in case its not provide enough power.
[08:00:48] <Palsson> Well right now i'm just trying to download an existing firmware.
[08:00:57] <dunz0r> *it isn't providing
[08:00:59] <LeoNerd> avrdude is just for memory write/read operations
[08:01:25] <Palsson> dunz0r as can be seen on pastebin, the device is found and the serial number is read which is the correct serial number btw
[08:02:11] <dunz0r> Sure, but just reading the serial might not need as much power as reading the memory. I don't think that's the reason though, but stranger things have happened
[08:02:20] <Palsson> Yeah, right now i'm just trying to flash my device so avrdude should do for that i think ?
[08:02:29] <Palsson> dunz0r true, i'm gonna try that :)
[08:17:12] <LeoNerd> So... my 'v1 HVSP controller based on a tiny841 seems to be working relatively well. I wonder if I should consider a 'v2 (since I need to redesign the board anyway), based on a 32U4 or somesuch
[08:17:46] <LeoNerd> Do away with the separate serial line + UART bridge, and the separate onboard 74xx595 to drive the LEDs. a 32U4 has enough IO pins ot do that natively in one chip, plus also I'd have the UART spare to talk debugWire
[08:17:47] <LeoNerd> *gasp*
[08:50:28] <LeoNerd> I'm considering linking up two ATmega chips over a serial link, by UARTs. Since the bus will be sufficiently idle most of the time, I'm thinking of using a two-wire approach, just ground and signal; diode the TX pins to turn them into opencollectors, give the bus a pullup line. Basically, similar to I2C only using an asynchronous clock instead of dedicated second clock line
[08:50:46] <LeoNerd> Is there a name for this idea? I want to read more about it, and get some ideas on how to implement collision detection
[08:51:37] <LeoNerd> Plus this is then easily expandable to > 2 nodes
[08:51:56] <specing> yes, it is called i2c
[08:52:18] <LeoNerd> No; I2C is synchronously clocked with a second bus line containing the clock signal
[08:52:33] <LeoNerd> I'm intending to use the UART and have a single line
[08:52:35] <specing> async i2c
[08:53:30] <specing> you want 1-wire?
[08:54:19] <specing> https://en.wikipedia.org/wiki/1-Wire
[08:54:21] <LeoNerd> I want *a* one-wire serial bus system, yes. But I don't think I want to implement the Dallas 1-Wire thing because that has lots of features I don't really need, or like the look of
[08:59:23] * LeoNerd finds AVR274: Single-wire Software UART
[09:01:10] <LeoNerd> Ah.. this is a software impl., so they can do collision detect for every bit
[09:13:11] <LeoNerd> Hrm.. doesn't seem to be a lot of writing on the internet about it
[09:13:41] <LeoNerd> I guess maybe I'll just try it. collision detect is /probably/ a simple matter of seeing if the byte my local RX received is the same value as the one I just TXed, then it likely means no collision
[09:13:57] <LeoNerd> If it differs, it meant a collision happened so I should start again
[09:27:23] <l_oliveira> hey
[09:27:38] <l_oliveira> is there any kind of bus pirate thing using AVR MCUs ?
[09:27:45] <LeoNerd> I'm slowly working on one
[09:27:52] <LeoNerd> (because IMHO the Bus Pirate is *terrible* in places)
[09:28:14] <LeoNerd> Mine will be binary-only, support some interrupt input lines, include voltage/current monitoring of the PSU lines...
[09:28:24] <LeoNerd> Probably an onboard status/information readout LCD
[09:28:46] <l_oliveira> I was thinking of spying a I2C bus
[09:28:56] <l_oliveira> I'm not a fan of PIC chips lol
[09:29:01] <LeoNerd> Eh, for bus snooping I just use my saleae (clone)
[09:29:25] <LeoNerd> So I'm not intending to reïmplement that particular feature
[09:29:45] <l_oliveira> I have no idea how go about doing that though
[09:29:50] <l_oliveira> I could do it myself
[09:29:58] <l_oliveira> but... why reinvent the wheel ?
[09:30:26] <LeoNerd> Just get a saleae.. or a clone. You can get pretty cheap clones these days. Mine was £20 which included probe cables and stuff
[09:30:53] <l_oliveira> I would like to assemble one instead
[09:32:39] <LeoNerd> Well an AVR-based I2C snooper shouldn't be too hard. Just put the I2C module into slave mode without SCL stretching, don't ever touch the SCL line, don't ever transmit, arrange not to ACK,...
[09:34:53] <l_oliveira> it would need to be software based to get that controllable, right ?
[09:35:08] <LeoNerd> I've no idea. Hardware alone might support it
[09:36:39] <LeoNerd> See above though - I really don't play with I2C unless I absolutely can't avoid it
[09:37:32] <LeoNerd> In fact I've never used AVR I2C hardware directly. The only time I've ever had to talk I2C as a master, was from an ATtiny chip, where I use the USI for it
[09:37:58] <l_oliveira> I see
[09:43:02] <jacekowski> you can do it
[09:43:05] <jacekowski> it's software controlled
[10:13:57] <l_oliveira> good to know
[10:14:06] <l_oliveira> thanks. I'll look that up later on
[15:35:39] <ColdKeyboard> By any chance did anyone find The Art of Electronics 3rd edition pdf for download? Just asking... for science ofc. :)
[15:36:40] <aandrew> save your bandwidth. go download anything by Robert Grossblatt and Forrest M Mims III
[15:39:15] <ColdKeyboard> I had 2nd edition, wanted to compare it with 3rd edition and just to have it in my digital collection
[15:54:04] <Lambda_Aurigae> Getting Started In Electronics...all the electronics book you ever need...other than his mini-notebooks and a few hundred datasheets.
[15:55:31] <aandrew> yep. love his work
[15:55:50] <aandrew> AoE would be useful if they doubled its weight, it'd be an effective doorstop then
[15:56:14] <Lambda_Aurigae> I have all of the original mini-notes and 2nd edition GSIE in dead-tree version.
[15:56:19] <aandrew> me too
[15:56:43] <Lambda_Aurigae> the fact that they are all handwritten just makes them even more awesome.
[15:56:46] <aandrew> my original copy (when I was a kid) is long dead... solder holes, pencil scratching, blood stains, covers missing...
[15:57:16] <aandrew> if I'm honest with myself there were probably booger marks between those pages too
[15:57:20] <Lambda_Aurigae> LeoNerd, you could just connect the two microcontrollers through a pair of 56K modems!
[15:58:34] <Lambda_Aurigae> LeoNerd, also, on your question earlier about the atmega8 vs 88 series...88 is a much improved 8...faster, more stuff stuffed in there, etc. They added pin change interrupts to the 88 along with major core updates.
[16:28:50] <twnqx> http://i.imgur.com/LEvb6bE.png friend's comment: "looks like an inka statue"
[16:33:55] <LeoNerd> Lambda_Aurigae: Yeah, so I see... the mega8 just seems like an old one. I only ask because it also came up as a quite cheap part on a list...
[18:11:05] <Lambda_Aurigae> LeoNerd, yea...cheap because not made anymore...they are clearing stock most likely.
[18:52:52] * JoeLlama sings
[18:59:31] * Lambda_Aurigae tosses live cats at JoeLlama