#avr | Logs for 2015-10-02

Back
[00:04:01] <FrankD> hrmm
[00:04:49] <FrankD> I can't use the ATTiny USI to read in 32 bits of data after I send 8 bits, can I?
[00:12:15] <Casper> why can't you? read 4x8
[00:13:12] <FrankD> mmk
[00:13:19] <FrankD> havent done any SPI code before
[00:13:20] <FrankD> :D
[00:15:22] <FrankD> too bad attiny1634 isnt supported by arduino, although this is more entertaining
[00:19:43] <Casper> you don't want arduino junk library
[00:19:52] <Casper> really, move out of that junk
[00:21:49] <FrankD> yeah
[00:21:51] <FrankD> its just quick and easy
[00:21:53] <FrankD> :p
[00:23:50] <nollan> good morning
[00:29:23] <FrankD> mornin
[00:49:48] <FrankD> ugh
[00:49:55] <FrankD> couldnt they devote more transistors to SRAM?
[01:02:56] <Casper> that's the cost of the tiny series
[01:04:14] <FrankD> i still think the mega2560 should come with (64K - register file size) of SRAM
[01:05:11] <FrankD> i had SRAM banks on an Atmega8 back in the day, each process had its own 32kb bank for data, stack and general purpose stuff sat in the internal sram
[01:05:33] <FrankD> because.. RAMs.
[01:05:59] <FrankD> wish i still had all those DIP SRAM chips :P
[01:10:12] <FrankD> ok so if i just write an ISR for USI_OVERFLOW_vect I can just buffer the input until I've got my 32 bits right?
[01:16:33] <Mr_Sheesh> FrankD - watch for old VGA ISA cards? LOL
[01:16:47] <FrankD> :D i took them off 486 motherboards :)
[01:18:18] <FrankD> ugh
[01:18:25] <FrankD> who wants to write this for me :P
[02:02:15] <Mr_Sheesh> cache RAM yeah.
[02:10:59] <FrankD> yup
[02:45:15] <FrankD> ugh
[02:45:20] <FrankD> maybe i should just bitbang SPI
[02:45:26] <FrankD> it looks like it sends and receives data at the same time
[02:45:38] <FrankD> and theres not a separate send/receive register for the USI
[02:46:29] <FrankD> unless im just an idiot (very possible)
[02:46:42] <FrankD> http://cds.linear.com/docs/en/datasheet/241418fb.pdf <-- maybe im reading page 14 wrong?
[02:56:14] <tkoskine> in SPI data moves to both directions "all the time". You can send 0xFF for example, if it doesn't matter what data you send (that "don't care" part).
[02:57:26] <tkoskine> Also, if you don't care what bytes you receive, just read the data and throw it away.
[03:17:13] <FrankD> tkoskine, my worry was more that theres only one register for USI/SPI on ATTiny
[03:17:43] <FrankD> so that would mean that the ADC sending data while I'm sending data would give me a corrupt USIDR
[03:18:26] <FrankD> unless im misunderstanding the USI somehow, but I'd hope not or the code I just wrote is useless
[03:18:26] <FrankD> :P
[03:19:11] <tkoskine> FrankD: I don't remember attiny spi details, but usually that is the way how SPI register is shown to software. Reading and writing parts are handled separately and you can safely read and write single register.
[03:22:26] <FrankD> tkoskine, from AVR319 about the USI: "The USI Data Register (USIDR) is an 8-bit Shift Register that contains the incoming and outgoing data. The register has no buffering so the data must be read as quickly as possible to ensure that no data is lost. The USI Status Register (USISR) contains
[03:22:26] <FrankD> a 4-bit counter. Both the shift register and the counter are clocked simultaneously by
[03:22:26] <FrankD> the same clock source. This allows the counter to count the number of bits received
[03:22:26] <FrankD> or transmitted and sets a flag alternatively generates an interrupt when the transfer is complete. The clock can be selected to use three different sources: The USCK pin, Timer/Counter0 Compare Match or from software. "
[03:23:30] <tkoskine> attiny85 datasheet has code example how to write and read USIDR. I would assume if you follow it, you can do things safely.
[03:23:38] <FrankD> so it seems that you would have a collision in the USIDR and it'd be impossible to use the USI in SPI mode for simulatenous data transfer
[03:25:37] <FrankD> tkoskine, that doesnt seem to show bidrectional simulatenous data transfer unless im missing something?
[03:28:44] <tkoskine> I would assume that things just work if you follow the example and write USIDR first, then write USICR 16 or so times, and then read USIDR.
[03:34:05] <FrankD> hmm theres no way to grow the heap inside a function is there? like to make a variably sized variable?
[03:37:29] <FrankD> or a declaration like void dummyFunction(bufferSize) { unsigned char buffer[bufferSize]; } ?
[03:39:59] <tkoskine> recent enough gcc might be able to do that, but you could just allocate big enough static buffer and use just a part of it and hope that the total size is enough for all situations.
[10:30:02] <gorroth> hello, friends!
[11:43:05] <averowksy> Hi guys
[11:43:30] <averowksy> Im looking for code to read values from mpu6050
[11:43:38] <averowksy> is there anything free to use
[11:43:38] <averowksy> ?
[11:43:51] <LeoNerd> It's just I²C isn't it?
[11:44:41] <averowksy> LeoNerd: yep you are right
[11:45:13] <LeoNerd> So.... just talk I²C then
[11:45:40] <averowksy> Im reading about I2C right now :)
[11:48:20] <averowksy> LeoNerd: So Generaly speaking I should read about i2c protocol and I will be able to read values from my sensor ?
[11:48:32] <LeoNerd> Most likely
[11:52:11] <averowksy> LeoNerd: Do I have to implement myself or there is something ready ?
[11:52:27] <LeoNerd> ?
[11:52:49] <LeoNerd> The AVR chip itself knows how to talk I²C. Just use the I²C module
[11:52:54] <LeoNerd> Which chip are you using?
[11:54:01] <averowksy> I mean someone who has arduino there are libs for it
[11:54:09] <averowksy> atmega 328p
[11:54:35] <LeoNerd> Well, Arduino definitely has I²C wrapping libraries, yes
[11:56:44] <averowksy> So it is not so easy with atmega
[11:56:51] <averowksy> Im going to try something myself
[11:56:53] <averowksy> then
[11:57:39] <LeoNerd> ?
[11:58:56] <averowksy> LeoNerd: Im new to uC programming so maybe Im confusing something
[11:59:58] <averowksy> and I dont have anyone who could explain me some things :)
[12:00:38] <LeoNerd> Then ask questions here
[12:02:22] <averowksy> Maybe you could tell me what should I read to read something from mpu6050
[12:03:06] <LeoNerd> youmean like a book or something?
[12:03:08] <LeoNerd> I've no idea.
[12:03:26] <LeoNerd> MPU6050 is an I²C device. Talk to it over I²C. Ask it for stuff, read its reply
[12:03:54] <averowksy> you know any good site where i2c communication is explained
[12:04:05] <averowksy> how to ask and recieve
[12:04:10] <averowksy> data
[12:04:10] <LeoNerd> ... No
[12:04:17] <LeoNerd> It's specific per device, surely?
[12:04:39] <LeoNerd> How your AVR program drives the AVR I²C peripheral will be completely different to how a PIC program drives a PIC I²C periph, or whatever
[12:04:51] <LeoNerd> So you will have to read about how to drive the AVR I²C system
[12:06:59] <averowksy> Ok
[12:13:41] <theBear> don't write it like that ! you'll get us sued !
[12:14:03] <theBear> and for the love of god don't say smbus ! intel will ruin us all !
[12:14:12] <LeoNerd> I{U+00b2 SUPERSCRIPT TWO}C
[12:14:39] <LeoNerd> Or maybe I^{2}C if you're a LaTeX fan
[12:34:22] <gorroth> oh sweet, my atmega88 has multiproessor comms mode on the USART
[12:34:42] <gorroth> that can be used to connect several devices to the same USART pins, right?
[12:35:05] <LeoNerd> Yup
[12:35:11] <gorroth> awesoooooome
[12:35:22] <gorroth> right now i'm just sending raw data to my AVR, but i should totally set that up
[12:35:31] <LeoNerd> I usually do that by a single shared wire across all the RX pins, with a pullup resistor, and a pulldown diode from each TX pin
[12:35:45] <LeoNerd> For a truely multimaster shared bus
[12:35:53] <LeoNerd> Basically, a slower, async onewire version of I²C
[12:38:14] <gorroth> yeah, i don't know hwo to do that
[12:44:14] <gorroth> after i do this robotics project, i'll probably work on my UART code some more and setup a multiprocessor segment, along with a design that usese it
[12:44:30] <gorroth> this way that code can also be out on the internet, along with some code to configure addresses and stuff pretty easily
[14:12:46] <inkjetunito> is it just me or does 8-bit vertical resolution on a digital oscilloscope sound a bit... less?
[14:14:52] <inkjetunito> 0,3 mm
[14:19:07] <averowksy> LeoNerd: Where can I found address of my MPU6050
[14:19:08] <averowksy> ?
[14:19:44] <averowksy> find*
[14:25:09] <antto> i only have experience with one digital scope.. a rigol.. probably the chepeast one
[14:25:19] <antto> it's quite silly
[14:25:59] <antto> it's even more silly that the freq/pw reading it shows is calculated from the screen buffer
[14:26:59] <antto> so.. it has like 320 pixels width, that's 320 samples of signal on screen, and it uses that to calculate freq/pw, and i think the vmin/vmax/vpp too
[15:03:41] <Arch-TK> Why are all the makefiles that people write for AVR project so awful?
[15:04:23] <Arch-TK> for some insane reason providing their own %.o: %.c targets and similar weird stuff
[15:07:11] <Arch-TK> at least the ones you find in examples on websites
[15:07:25] <Arch-TK> I haven't really looked at all the makefiles in projects on GH
[15:08:13] <Arch-TK> It's like someone who had known about make for 5 minutes decided to write a makefile, post it on the internet, and everyone and their grandmother, who didn't know any better, spread it.
[15:08:18] <LeoNerd> antto: The 1052E?
[15:11:06] <Arch-TK> LeoNerd: Surely the DS1052E isn't THAT bad?
[15:11:34] <LeoNerd> I've no idea; hence my asking
[15:11:47] <LeoNerd> I have a 1054Z and I quite like it
[15:11:58] <Arch-TK> I need a scope.
[15:12:04] <LeoNerd> 480x800 screen
[15:15:31] <Tom_itx> Arch-TK you have a problem with this one? http://tom-itx.no-ip.biz:81/~webpage/avr/atmega328/PCINT0/makefile
[15:16:13] <Arch-TK> Tom_itx: not bad
[15:16:15] <Arch-TK> I like it
[15:16:38] <Tom_itx> http://tom-itx.no-ip.biz:81/~webpage/avr/adc_test/makefile
[15:16:43] <Tom_itx> similar
[15:16:56] <Tom_itx> they're sprinkled all over that dir
[15:18:29] <Arch-TK> You could possibly use LINK.o in $(PRG).elf
[15:22:27] <Arch-TK> LeoNerd: that's actually quite a nice scope
[15:22:55] <Arch-TK> LeoNerd: and there's one on ebay on auction ending in 2 days going for £150 right now
[15:23:25] <Tom_itx> my scope is a 7x4
[15:23:29] <Arch-TK> (It will probably go up from this about 2 hours prior to the end of the auction.)
[15:23:30] <Tom_itx> 7x45*
[15:24:03] <Tom_itx> http://tom-itx.no-ip.biz:81/~webpage/scope/scope2.jpg
[15:24:21] <Tom_itx> oh wait.. you mean the electronic type...
[15:24:31] <Arch-TK> :P
[15:24:33] <Tom_itx> mine's in the closet covered in dust
[15:24:42] <Tom_itx> phillips 2channel 100Mhz
[15:24:49] <Arch-TK> I'm guessing you have a logic analyser which gets a lot more usage.
[15:25:00] <Tom_itx> it's in the drawer collecing dust
[15:25:07] <Arch-TK> what DO you use?
[15:25:19] <Tom_itx> i haven't done much with avr for a spell
[15:25:25] <Arch-TK> I see.
[15:25:35] <Tom_itx> been rebuilding my cnc and a few other odds n ends
[15:26:30] <Tom_itx> http://tom-itx.no-ip.biz:81/~webpage/cnc/psu/psu_index.php
[15:26:35] <Tom_itx> part of the control
[15:27:36] <Tom_itx> oh i do have a Saleae in the drawer...
[15:27:39] <inkjetunito> Arch-TK: which rigol model do you have?
[15:27:49] <Arch-TK> inkjetunito: I don't :P
[15:28:07] <inkjetunito> Arch-TK: sorry :po
[15:28:10] <inkjetunito> -o
[15:28:36] <inkjetunito> antto: which rigol model do you have?
[15:29:25] <Arch-TK> but this DS1054Z on ebay really looks like something I might buy
[15:29:41] <Arch-TK> along with the EEVBlog review
[15:31:01] <inkjetunito> hmm. the price is quite ok
[15:32:07] <Arch-TK> ~£370 new and this auction is currently at £155 Used.
[15:32:17] <Arch-TK> that's more than Ok.
[15:32:25] <Arch-TK> If I can get it for under 200 I'm getting it :P
[15:32:37] <Arch-TK> heck, maybe even more.
[15:51:11] <inkjetunito> the eevblog guy :)
[17:34:01] <MarkX> hi
[17:35:40] <MarkX> i'm trying this in the latest atmel studio >> http://pastebin.com/SyDzD6HM << but i keep getting >> undefined reference to `usbInit()' AND undefined reference to `usbPoll()'
[17:37:27] <MarkX> i have usbdrv.h included. isn't that enough for the reference
[17:50:15] <MarkX> http://stackoverflow.com/questions/9024802/undefined-reference-to-usbinit-in-c-avr
[17:50:22] <MarkX> looks like this person had the same issue
[17:50:32] <MarkX> don't know what that first answer means though