#avr | Logs for 2015-02-23

Back
[02:44:58] <jaggz> What's the difference between ATTINY85-20SURDKR-ND and ATTINY85-20SURCT-ND?
[02:47:24] <jaggz> going to get some attiny85's and confused by the options http://www.digikey.com/product-search/en/integrated-circuits-ics/embedded-microcontrollers/2556109?k=attiny85
[05:05:56] <vsync> jaggz: the packaging
[05:06:09] <vsync> one is cut tape and the other one seems to be a reel of sorts
[05:06:23] <vsync> i don't think you'll be needing a reel. Do you?
[05:21:44] <iJaggz> is this i2c accelerometer compatible with this avr i2c library? http://cache.freescale.com/files/sensors/doc/data_sheet/MMA8451Q.pdf http://homepage.hispeed.ch/peterfleury/doxygen/avr-gcc-libraries/group__pfleury__ic2master.html
[05:22:15] <iJaggz> never done i2c nor accelerometers before
[05:24:28] <jaggz> vsync, nah... just wanted a few of those chips. since i pretty much always need the capacitors and such, and the small size is useful, is there much reason to go with a plain chip instead of a breakout board?
[05:26:03] <jaggz> like, the atmega 32u4 chip can be so small that soldering its pins .. yuck..
[05:28:14] <twnqx> only the QFN, imho
[05:28:52] <jaggz> http://www.ebay.com/itm/Arduino-Pro-Micro-Atmega-32U4-MU-5V-16MHz-USA-Combined-Shipping-/321663308761?pt=LH_DefaultDomain_0&hash=item4ae4a093d9 i got a couple of these.. for a custom mouse type thing im working on for someone
[05:30:25] <twnqx> yeah, that's one of the no-fun chip formats :P
[05:30:57] <jaggz> :)
[05:33:37] <jaggz> twnqx: there are more than a handful of components this saves me from dealing with... http://dlnmh9ip6v2uc.cloudfront.net/datasheets/Dev/Arduino/Boards/Pro_Micro_v13.pdf
[05:33:55] <jaggz> although im using avr-gcc, not arduino
[05:35:46] <twnqx> my arduino wouldn't work with arduino :P
[05:35:49] <twnqx> it's missing the boot loader
[05:36:23] <jaggz> i found out arduino's com port libraries include support for a software reset for programming (switching to 1200 baud causes the "cdc" libs to use the watchdog to reset.. i lose that with my own code (avr-gcc, that is), and have to resort to using a physical reset switch added to it
[05:36:43] <jaggz> missing the bootloader? that sucks
[05:37:40] <jaggz> sparkfun provides the .hex and source to their bootloader there.. although i think the ones i got look like official ardiono's or something
[05:39:00] <jaggz> but they seem to use sparkfuns bootloader, which includes a .750s bootloader timeout.. but a double reset press causes it to go into an 8s bootloader run
[05:39:59] <jaggz> still need to know about this i2c stuff
[05:41:44] <vsync> what do you need to know
[05:43:28] <vsync> i really wanted to use an arm for this project, but this level of abstraction is over my head
[05:43:29] <twnqx> yeah, i could just flash the bootloader myself
[05:43:56] <vsync> or, just wanted to use ASF to get spi i2c and external interrupts rolling
[05:43:59] <vsync> no-fucking-way
[05:44:35] <vsync> the defines are so fucking convoluted, and the examples are pretty much useless
[05:45:57] <vsync> need to dig in deeper or then to switch to something else
[05:49:01] <twnqx> you know... it's like 100 lines of C to get the hardware working, if not less
[05:49:18] <vsync> on arm?
[05:49:20] <vsync> nah
[05:49:57] <vsync> to set them without asf is, a shit ton of liens
[05:53:51] <twnqx> ah, arm...
[05:54:04] <twnqx> yeah, chipinit on those thingies is pain
[13:51:30] <awozniak> having a rough time wrapping my head around TWI. The various example code I've found either try to do too much (master AND slave (why?)) or are too simple and do busy waits on interrupt flags or only do reads or only do writes. The data sheet is good, but I'm having trouble figuring out how to transition from writing to reading. Most of the I2C chips I deal with require START,SLA+W,write some bytes, read some bytes, STOP. It's
[13:51:30] <awozniak> not clear to me how to transition from writing to reading in the same transaction.
[13:51:46] <LeoNerd> You can't
[13:51:59] <LeoNerd> Well, not without a repeated start
[13:52:40] <LeoNerd> E.g. for a "registered read" which is a likely operation, you'd START, send the slave address in write mode, then write some bytes that some how set up the read address; you'd then send a repeat START condition, and this time send the slave address again in read mode.
[13:52:51] <LeoNerd> You can now clock in bytes from that selected slave
[13:54:16] <awozniak> Am I just misremembering this somehow? Is it always true you can't mix read and write?
[13:54:32] <LeoNerd> The way you do that is the repeated START
[13:54:40] <awozniak> ok, thanks
[13:54:49] <LeoNerd> After a (repeated) START, the first byte is always sent from the master, and contains the slave address and read/write mode
[13:55:00] <LeoNerd> After that, every other byte is always in the direction that the addressing byte indicated
[13:55:21] <awozniak> ok, I'm misremembering it. I wonder if I'm confusing it with something I remember from SPI.
[13:55:31] <LeoNerd> SPI is always full-duplex in principle
[13:56:04] <LeoNerd> E.g. a registered read in SPI probably looks like "assert SS, clock out an address byte and ignore incoming byte, then clock out some bit-stuffing (zeroes?) and read the incoming byte"
[13:56:31] <LeoNerd> Though being SPI probably the first byte out is some sort of command, or other indiciation to the slave that you want to read from it, because it doesn't have the I2C-level indiccation of read/writeness
[16:37:45] <smurfa> god damn it.... Want to spend 800 Euros on a electronics lab (PSU, Oscilloscope, soldering station, multimeter, programmer and a few other things). If I do that I'll have 40 Euro (after rent) for food each month for 7 months. My dreams are crushed
[16:38:24] <aandrew> smurfa: 40 euro of ramen noodles goes a long way... :-)
[16:38:28] <Tom_itx> welcome to reality
[16:38:51] <smurfa> Tom_itx: yes.. I hate reality :(
[16:38:59] <Tom_itx> get a logic analizer instead of a scope
[16:39:26] <aandrew> smurfa: honestly though I've been doing this for almost 20 years. my power supplies are all surplus, my soldering station is used, my multimeter is ebay'd and the programmers are cheap
[16:39:52] <aandrew> it's very much often not worth buying new unless you have a specific need for it
[16:40:56] <aandrew> if you have surplus electronics stores / university sales / etc. it's almost always worth going there first. real test equipment is terribly expensive to buy new but it's hard to break and an old pro-grade PSU or scope or soldering station will perform better and probably outlast a new cheap one
[16:41:24] <aandrew> I mean hell I'm looking at 5GHz quad-channel oscilloscopes and tehre's no way in hell I'm buying that shit new.
[16:41:48] <LeoNerd> I've still yet to find a need for a scope
[16:42:02] <LeoNerd> I use my 8ch logic probe aaaalll the time though, but no need for analog
[16:42:04] <aandrew> I can get a VERY nice LeCroy or agilent (dont' like tek's high-end stuff) for about $5-7k but I'm still hunting before I pull the trigger on such a buy
[16:42:22] <aandrew> and yes, a saleae logic analyzer is *great*.
[16:43:00] <LeoNerd> I have a.. *ahem* clone
[16:43:24] <LeoNerd> 8ch, claims it'll do 12Ms/sec, actually only copes with about 4. but only cost me £14 new, so ... I'm happy :)
[16:43:43] <LeoNerd> On a USB isolator it doesn't even cope with 1Ms/sec
[16:43:59] <aandrew> LeoNerd: me too. $70 for a 16-chan from aliexpress, but TBH I *did* buy the old saleae logic 8 and it lasted me a long, long time. I don't like their new ones at all
[16:44:13] <LeoNerd> The mixed A/D ones?
[16:44:50] <Tom_itx> LeoNerd's a cheapass
[16:44:55] <Tom_itx> :)
[16:45:11] <Tom_itx> have they cloned the analog ones yet?
[16:45:19] <Tom_itx> those look quite nice
[16:45:26] <LeoNerd> They do look nice. I might buy one sometime
[16:45:41] <LeoNerd> It's all just a personal hobby of mine though currently, so I can't really justify spending a *lot* on it
[16:45:48] <Tom_itx> same here
[16:46:10] <Tom_itx> if i need a tool though i get it and make it pay for itself
[16:46:33] <Tom_itx> or i generally don't get it
[16:49:52] <Tom_itx> guess he was dissapointed
[16:51:11] <Tom_itx> anybody here good with windows?
[16:52:14] <Tom_itx> i'm getting NTLDR missing error messages but it's not missing
[16:52:37] <Tom_itx> i've recopied it and ntdetect and looked at the boot.ini and all look ok
[16:52:55] <Tom_itx> some damn bug probably
[16:53:07] <aandrew> LeoNerd: if you look for a fx2lp breakout board on ebay/aliexpress those are exactly the same hardware as the old logic 8/16
[16:53:38] <aandrew> well no the logic8, the logic16 has an FPGA in it but the clones are also available for logic16 for abotu $70
[16:53:43] <LeoNerd> Eh.. I'm happy with my current one. If I ever need more than 4Ms/sec then.. uhh... it'll be for something that someone can pay me for :P
[16:54:01] <LeoNerd> The fastest I usually drive a 'tiny is 16MHz, and the fastest that will talk SPI is fCPU/4
[16:54:16] <aandrew> yeah I've never had need for the analog ones but there are really small self-contained low-frequency scopes for cheap and if you want a USB based scope they're cheaper than that too
[16:54:27] <Tom_itx> i've found mine plenty fast enough for what i do
[16:54:43] <zerowidth> aandrew: you don't like the new ones?
[16:55:05] <zerowidth> aandrew: because the analog isn't as good as a dedicated scope, or ...?
[16:55:47] <Tom_itx> they can serve different purposed
[16:55:50] <Tom_itx> s*
[16:56:08] <Tom_itx> i have a scope and the saleae analyzer and seldom use the scope
[16:56:15] <zerowidth> the new logic8 (not even the pro) can do 100MS/s on a couple pins, at least...
[16:56:27] <zerowidth> mainly i'm hoping there's not a good reason to *not* want one, because i just ordered one last week
[16:56:36] <Tom_itx> haha
[16:56:48] <Tom_itx> which one did you get?
[16:56:52] <zerowidth> the logic8
[16:57:08] <zerowidth> they're out of stock though, so i won't get it for a month or two
[16:58:12] <LeoNerd> From what I gather, the Logics are very nice. I just find them a little more expensive than I can quite justify on what is, for me, mostly a toy hobby
[16:58:16] <zerowidth> really looking forward to debugging ws2812 and SPI stuff
[16:58:26] <zerowidth> LeoNerd: haha, that's what i said ... and then i changed my mind ;)
[16:59:27] <Tom_itx> aww
[16:59:36] <Tom_itx> i got mine before they had all those fancy ones
[16:59:43] <Tom_itx> but i'm plenty happy with it
[17:00:30] <Tom_itx> i got extra wires with mine too
[17:01:37] <Tom_itx> just the plain ended wires that way if i need to attach something with solder i won't have to mess up the others
[17:01:56] <Tom_itx> work good with screw terminals too
[17:02:03] <LeoNerd> zerowidth: I find my ~4Ms/sec clone quite sufficient for SPI and WS2812. Actually I was just saying earlier on Twitter; the only time I've ever felt I needed assembly code even on a 'tiny, was the 2812 driver
[17:02:12] <LeoNerd> Everything else I find quite fine in plain C
[17:02:21] <aandrew> zerowidth: they're pricey and for me 4ch is not enough
[17:02:31] <zerowidth> cool, yeah. i *just* got ws2812b working last night with some asm
[17:02:34] <zerowidth> on a tiny
[17:04:31] <LeoNerd> I spent ages debugging mine, and all I could ever get out of it was a dim red flicker for a moment while it was changing
[17:04:56] <LeoNerd> Took me aaaages to realise that I'd not got Vcc wired up, because the pin was a row off in my breadboard
[17:05:13] <LeoNerd> So the thing was effectively only powering up from the clamp diodes around the Din line, for that brief moment of serial data
[17:05:14] <LeoNerd> Oops :)
[17:05:41] <LeoNerd> My code *had* been correct for ages, it was just the circuit was wrong
[17:06:04] <zerowidth> haha, ouch! i just had messed up the timing so i could get one LED to light, but any of the ones past it wouldn't. turns out being methodical about writing asm is a lot more effective than throwing stuff at the wall until you think it should work
[17:06:10] <aandrew> LeoNerd: those are the kinds of revelations that have me going for a quiet walk around the block before I destroy something
[17:06:17] <LeoNerd> Hehe
[17:06:23] <LeoNerd> Ohyes, sometimes you totally need a moment away
[17:06:57] <aandrew> also when that happens you usually see me write I AM SOFA KING WE TODD IT on channels like these
[17:07:28] <LeoNerd> I'll probably have another poke at my OLED screen tonight, actually
[17:07:53] <LeoNerd> It's I2C-based. I can manage to write to the control registers... I can turn it on, and get the random data that's in video RAM, but I don't seem able to write actual pixels. :(
[17:08:16] <aandrew> I just got a SSD1322 oled display working
[17:08:17] <zerowidth> LeoNerd: ah yes, tonight's goal is talking SPI to an RTC chip
[17:08:34] <aandrew> well rather the code was always working, I had just fried the module I was testing with MONTHS ago by powering it with 5V
[17:08:47] <LeoNerd> SSD1322.. hmm... that's similar to mine
[17:08:49] <zerowidth> aandrew: ouch
[17:08:58] <LeoNerd> I have an SSD1306 here. I wonder if it's similar enough...?
[17:09:12] <LeoNerd> Oooh. :/ Yes.
[17:09:30] <LeoNerd> I currently have a big red sticker on one of my breadboards, saying ** 3.3V ONLY. NO 5V **
[17:09:39] <aandrew> I have an SSD1322 oled controller and ST7565 LCD controller code now. they're pretty similar
[17:09:44] <aandrew> LeoNerd: :-)
[17:10:07] <aandrew> I design in protective circuitry for anything with a barrel jack or any chance of the wrong vin being applied
[17:10:36] <LeoNerd> Ah, well the trouble with mine is that I have on the board, a circuit based on one of my ATtiny+nRF radios
[17:10:55] <LeoNerd> The nRF24 -really- doesn't want 5V, but I also have the AVR ISP6 header on there
[17:10:59] <aandrew> usually something like http://mixdown.ca/dump/fetprot.png
[17:11:05] <LeoNerd> I have to remember to leave the AVR programmer on 3.3V and not 5V
[17:11:10] <aandrew> reverse voltage protection as well as overvoltage protection
[17:11:30] <LeoNerd> Ah.. well, my board will be tiny low-power battery powered for a long time, so I didn't want to put any sort of reg. / etc.. on it
[17:11:44] <zerowidth> aandrew: thanks, filed for reference
[17:11:47] <LeoNerd> That'll only eat battery. I'm using one of the new LiFePO4 cells.. they're lovely :)
[17:12:12] <aandrew> that's not a regulator. Q3 is reverse-voltage protection (FET is off if polarity is reversed). Q1/Q2 are overvoltage protection
[17:12:24] * LeoNerd actually looks at the link ;)
[17:12:26] <aandrew> D1/R10 set the trip level
[17:12:45] <LeoNerd> Ooooh
[17:12:51] <aandrew> it's imprecise but it's cheap
[17:12:53] <LeoNerd> Oh that's.... that's rather cute
[17:13:36] <LeoNerd> That's like one of those nice little logic puzzles you look at, and the moment you realise how it works you go "ooh.. wow, oh I see..." and then stare at it for five minutes in marvel
[17:13:55] <aandrew> heh yes. It's not my design. I stole it from someone smarter (of course)
[17:14:09] <LeoNerd> Mm.. shoulders, giants,...
[17:14:36] <aandrew> yep
[17:15:00] <aandrew> but yes you throw these kinds of circuits into your schematic and some guy 15 years later is like "OOOH THIS GUY WAS A GOD" and you can look good :-)
[17:15:21] <LeoNerd> Hehe
[17:15:29] <LeoNerd> Oh I've already got one of my own design like that
[17:15:37] <LeoNerd> My cunning double-use of the USI for both SPI and I2C
[17:15:41] <LeoNerd> in the same board :)
[17:15:44] <aandrew> but yeah... cheap and works well and can save you from releasing magic smoke
[17:17:32] <LeoNerd> It's the sort of setup I might consider making in some kind of breadboard'able layout
[17:17:41] <LeoNerd> Maybe make a 2x3-passthrough board
[17:19:33] <zerowidth> LeoNerd: double-use of the USI? is that not something you can do normally?
[17:20:02] <aandrew> LeoNerd: nice. I have to come up with a TINY I2C bootloader for an attiny25
[17:20:03] <zerowidth> LeoNerd: oh, on the subject of clever circuits, i came across this the other day (sounds like youv'e got attiny+nrf stuff): http://nerdralph.blogspot.com/2014/01/nrf24l01-control-with-3-attiny85-pins.html
[17:20:05] <LeoNerd> zerowidth: The USI can talk either SPI or I2C, yes. The trouble is using them both in one circuit
[17:20:13] <aandrew> figure I can fit it in under 256 bytes I'll be happy
[17:20:31] <LeoNerd> zerowidth: The problem is that SPI uses the same IO pins as I2C, so you have to be careful not to get "crosstalk"
[17:20:44] <zerowidth> LeoNerd: do you use another pin to switch the circuits somehow?
[17:20:59] <LeoNerd> I was going to use a spare pin as a gate for the I2C clock
[17:21:14] <LeoNerd> But in the end, I did USI in software-clocking mode for I2C, and just used a different GPIO pin
[17:33:52] <hypermagic> hello my friends