#avr | Logs for 2013-06-30

Back
[02:19:28] <braincracker> :) new hobby Hydroplaning a Quad http://www.youtube.com/watch?v=SWWt9IC7mGs
[04:23:40] <zarya> can some one here tel me how i can use only the rx pin of a atmega328 and use the tx for in/output
[04:25:33] <zarya> and good morging everyone
[04:47:35] <OndraSter__> enable only receivemode
[04:47:43] <OndraSter__> do not enable TXEN bit
[04:48:11] <bitd> What'd I miss <.<
[04:48:20] <OndraSter__> your gf
[04:48:27] <bitd> Awww :(
[04:48:33] <bitd> I don't have one >.>
[04:48:44] <OndraSter__> yes
[04:48:50] <bitd> Hahaha.
[04:48:51] <OndraSter__> you missed your future gf and wife
[04:48:54] <OndraSter__> the best woman ever :P
[04:49:15] <bitd> You mean the kind that doesnt talk back?
[04:49:45] <bitd> Cause that feature seems to be disabled in most of em.
[04:49:57] <OndraSter__> wait what?
[04:50:45] <twnqx> lol
[04:51:30] <bitd> Bah, been waiting a week for my pcb to be in the mail.
[04:51:43] <bitd> Need to start etching those myself :-(
[04:52:29] <OndraSter__> zarya, you still alive?
[04:53:04] <zarya> yeh
[04:53:19] <zarya> but i cant realy find how to only enable rx mode
[04:54:00] <OndraSter__> <OndraSter__> enable only receivemode
[04:54:00] <OndraSter__> <OndraSter__> do not enable TXEN bit
[04:54:06] <zarya> ah oke
[04:54:07] <OndraSter__> there should be RXEN and TXEN bits
[04:54:14] <zarya> so just dont do tx settings
[04:54:16] <OndraSter__> in the UCSR0A or B register
[04:54:23] <OndraSter__> yes
[04:54:27] <zarya> sweet
[04:57:53] <zarya> i am trying to get rid of this slow arduino crap
[04:58:23] <bitd> Oh yes, that would be a great first step.
[04:58:51] <bitd> Have to learn how to write all of it yourself anyway at some point :)
[04:59:53] <zarya> bitd: yeh but i am trying to build a led board interface
[05:00:04] <zarya> and then writing bit directly to the port is so mutch faster
[05:00:48] <bitd> And so much prettier :D
[05:02:14] <bitd> Only thing I got confused at was the timers.
[05:02:15] <zarya> in then end ;)
[05:02:29] <zarya> well PORT i get now
[05:02:33] <bitd> Arduino libs make that pretty easy.
[05:04:39] <zarya> yeh
[05:04:42] <zarya> but slow as well
[05:04:59] <zarya> i got it working but the board was flikring
[05:05:06] <zarya> thats not suppose to happen
[05:10:55] <zarya> bitd: still working on shaking of all the arduino stuff but this is a far is i have come https://gist.github.com/zarya/24b3b56be5c432334539
[05:51:43] <Badaboom> Morning
[05:55:52] <HylianSavior> I accidentally connected the SS* pin of a device to the SS* pin of the SPI module on my XMEGA
[05:56:16] <HylianSavior> you think i can just set the pin to an output and use it as chip select anyways
[06:02:35] <OndraSter__> yes
[06:02:35] <OndraSter__> the issue is only when it is set up as input
[06:02:48] <HylianSavior> ok
[06:02:50] <HylianSavior> thanks!
[06:50:41] <mashku> Hi
[06:51:09] <mashku> how can I define my own functions in C code for avr ?
[06:51:34] <Roklobsta|2> huh?
[06:51:36] <mashku> when I define my own function above main, I get error from linker tiny.c:(.text+0x0): multiple definition of `lazy'
[06:51:49] <mashku> lazy is a function I am trying to define
[06:52:05] <Roklobsta|2> try another name like sleepy
[06:52:15] <Roklobsta|2> see what happens
[06:56:42] <mashku> I tried
[06:57:35] <mashku> tiny.c:(.text+0x0): multiple definition of `sleep_hahaha'
[06:57:47] <mashku> I will paste the code
[06:57:51] <Horologium> lets see the code.
[06:58:33] <mashku> http://pastebin.com/qGyCH0wq
[06:59:19] <Horologium> if you put the function above where it is used you don't need the prototype.
[06:59:19] <mashku> I am just learning, so this a code for self-learning, I am trying to check status of the PB2 on PORTB and also blink a led every 1s
[06:59:22] <Horologium> remove the prototype line.
[06:59:35] <mashku> Yes prototype line was added after that error
[06:59:44] <mashku> cause I thought maybe that will help but it didnt
[06:59:54] <Horologium> move the function to the bottom after the main()
[07:00:16] <mashku> without prototype it wont work below main() afaik?
[07:00:28] <mashku> same error
[07:00:40] <mashku> I compile it like this
[07:00:42] <mashku> avr-gcc -std=c99 -DF_CPU=1000000 tiny.c -o tiny -mmcu=attiny85 -O1 -DF_CPU=1000000 tiny.c -o tiny
[07:01:04] <mashku> well one -DF_CPU too much, but that does not mattr
[07:01:21] <Horologium> I get a different error.
[07:01:29] <mashku> oh.. I messed up my command..
[07:02:11] <mashku> sorry it works now
[07:02:24] <mashku> I just didnt realized I pasted by mistake twice command for compiling
[07:02:50] <mashku> I am getting blind... and this copy/past feature in Xwindows, just sometimes is annoying
[07:03:03] <mashku> sorry for confusion, proble solved
[07:03:18] <Horologium> also, I get an error when it compiles saying you can't do a define of variable in a for command.
[07:03:31] <mashku> yes -std=c99 is needed
[07:03:40] <Horologium> tiny.c:19:9: error: ‘for’ loop initial declarations are only allowed in C99 mode
[07:03:40] <mashku> avr-gcc -std=c99 -O1 -DF_CPU=1000000 tiny.c -o tiny -mmcu=attiny85
[07:03:41] <mashku> this works
[07:03:58] <Horologium> bah...breaking C....hehe
[07:04:13] <Horologium> makes things harder to read I think....
[07:04:38] <Horologium> but, I'm old fashioned.
[07:04:47] <mashku> for loop ?
[07:05:03] <Horologium> for (int i=0,,,,,,
[07:05:20] <mashku> ah.. true thats from c++
[07:05:27] <Horologium> the "int i;" should, in my opinion, not be in the for loop..it should be a line by itself.
[07:05:34] <mashku> yes.. true
[07:05:38] <Horologium> makes things easier to read.
[07:05:57] <Horologium> put all your variable definitions together at the beginning of the function....
[07:06:21] <Horologium> just one of my little quirks.
[07:07:15] <mashku> done http://pastebin.com/zmCxeqKK
[07:07:20] <mashku> thanks for help
[07:08:10] <Horologium> welcome.
[07:09:33] <mashku> now I need to read about 74HC595 shift register
[07:09:41] <Horologium> easy to use.
[07:09:47] <Horologium> data and clock line.
[07:09:56] <Horologium> set data, toggle clock, set data, toggle clock.
[07:09:59] <mashku> I want to control 7 segment display with attiny85, I did it on arduino, but I want to port it to pure C code
[07:10:15] <Horologium> once all the data is out, toggle latch.
[07:10:24] <mashku> Oh...
[07:10:36] <Horologium> assuming there is a latch..
[07:10:40] <Horologium> looking up datasheet now.
[07:10:46] <mashku> there is
[07:11:20] <Horologium> stcp is the latch pin..t least on the nxp version of the chip.
[07:11:31] <mashku> I have nxp version
[07:11:33] <Horologium> rising edge of stpc latches data to output pins.
[07:11:54] <Horologium> shcp is clock.
[07:12:12] <Horologium> ds is serial data in.
[07:12:42] <Horologium> so,
[07:13:07] <Horologium> set data on DS, toggle SHCP, set data, toggle, set data, toggle....till you have 8 bits of data in.
[07:13:24] <Horologium> then toggle STPC
[07:13:37] <Horologium> and your 8 bits will show up on the output pins.
[07:13:57] <Horologium> http://www.nxp.com/documents/data_sheet/74HC_HCT595.pdf page 5 shows the logic table.
[07:14:14] <mashku> thanks
[07:15:11] <mashku> I am very new to all this, so it might be better if I read on shift registers and then try to understand basics..
[07:15:22] <Horologium> and /OE is output enable..should be pulled low to enable outputs.
[07:15:31] <Horologium> I just gave you the basics.
[07:15:47] <mashku> Thanks:)
[07:15:59] <Horologium> you send data one bit at a time and toggle the clock to shift the data in.
[07:16:31] <mashku> I quess that using shift register divides clock by 8 in the end ?
[07:16:48] <mashku> or even more.. right?
[07:17:12] <Horologium> well, it can be used as a divide by 8, yes.
[07:17:28] <mashku> because one needs to do all this shifting and then latch to push the data
[07:18:01] <Horologium> yes.
[07:18:20] <Horologium> some shift registers don't have the output latch...the data is just there and you can see it shift across the output pins.
[07:19:14] <mashku> well I just want to display 0-9 minutes on my device when I turn the knob.. but on know I will think later, now display
[07:19:40] <mashku> its just for fun
[07:46:13] <mashku> Horologium, I want to write a function that shifts in 1 or 0 given the integer value, so basically I thought that I can divide integer by 2, and check if the remaining part is 0 or 1, and then do shift accordingly
[07:47:37] <mashku> so val % 2 gives me the reminder, but after division I need to put the party that was divided..
[07:47:41] <mashku> how to obtian it?/
[07:47:53] <mashku> just (val-1)/2 ?
[07:53:20] <Horologium> a = val && 1;
[07:53:29] <Horologium> val = val / 2;
[07:53:37] <Horologium> output a somehow
[07:53:38] <Horologium> repeat.
[07:53:44] <Horologium> err..
[07:53:47] <Horologium> only one &
[08:04:46] <mashku> Horologium, its not SPI bus right?
[08:05:10] <mashku> because I found such a easy implementation http://jumptuck.com/2011/11/03/how-to-drive-595-shift-registers-with-avr-hardware-spi/
[08:05:13] <Horologium> not,,,quite.
[08:05:17] <mashku> but I dont think it would work with my shift register
[08:05:26] <Horologium> although spi hardware can be used to clock data out to a shift register.
[08:05:36] <Horologium> why wouldn't it?
[08:06:17] <mashku> meh attiny85 does not have SPI
[08:06:19] <mashku> nvm
[08:06:26] <Horologium> didn't you say you have a 74595?
[08:06:40] <mashku> 74HC595N
[08:06:41] <Horologium> does it have a USI?
[08:06:46] <mashku> it has
[08:10:25] <Horologium> then it has SPI
[08:10:39] <Horologium> universal serial interface.
[08:10:47] <Horologium> does usart, spi, and twi(i2c)
[08:16:01] <mashku> Horologium, this should work ? http://pastebin.com/GNu2r97i
[08:16:20] <mashku> I wrote it myself going to test it
[08:17:22] <Horologium> no clue.
[08:18:07] <Horologium> glub...all the if/else stuff for no reason.
[08:18:14] <Horologium> a = val & 1;
[08:18:18] <Horologium> output a
[08:18:50] <Horologium> val = val / 2;
[08:19:16] <Horologium> you do an AND of the value and 1...that gives you a 1 or 0 depending on the lowest bit of VAL
[08:19:23] <Horologium> then you output
[08:19:40] <Horologium> then divide val by 2 and you are doing basically a bit shift, dropping the lowest bit.
[08:19:59] <Horologium> not sure what that -1 is for in line 21
[08:56:02] <mashku> Horologium, ah true
[08:56:48] <Horologium> you can cut your routine down by a considerable bit by doing it as math rather than if/else
[08:57:13] <mashku> what does val & 1 does?
[08:58:06] <mashku> which you suggested that would be val & 10000000 ?
[08:58:18] <mashku> 0b10000000
[08:58:20] <Horologium> no...
[08:58:24] <Horologium> 0b00000001
[08:58:31] <Horologium> & is and
[08:58:36] <Horologium> do logical and of val and 1.
[08:59:15] <mashku> the shift is to the right hand side?
[08:59:36] <Horologium> it is however you do it but I was assuming shifting out LSB first.
[09:00:14] <antto> isn't & bitwise and?
[09:00:22] <Horologium> bingo!
[09:00:40] <Horologium> trying to separate out the LSB then shift it out.
[09:00:53] <mashku> I dont know what lsb is
[09:01:09] <mashku> and I dont understand what you wrote..
[09:01:32] <mashku> I do understand how ^ ~ & and | works
[09:01:53] <mashku> val is a number from 0 to 9
[09:01:58] <Horologium> least signifigant bit.
[09:02:02] <antto> lowest_bit = val & 0x01; val = (val >> 1);
[09:02:03] <Horologium> even if I can't spell it.
[09:02:37] <Horologium> mashku, umm....I think you totally do not understand how that shift register is going to work.
[09:03:02] <antto> what is he trying to do exactly?
[09:03:03] <Horologium> you can't just send the number 4 out to the shift register and expect it to display a 4 on a 7-segment display.
[09:03:22] <Horologium> you have to shift out the bits that correspond with the segments of the pattern you want to display.
[09:03:52] <antto> oh i think i get it ;]
[09:03:53] <mashku> Horologium, well best is the if I hardcore all the bits for certain leds
[09:03:58] <mashku> then
[09:04:05] <antto> you can use a LUT
[09:04:07] <mashku> with switch case
[09:04:52] <Horologium> ok,,,I'm out of this...not up to teaching someone basic logic today..
[09:04:58] <Horologium> laters..time to go do something in the real world.
[09:05:35] <mashku> Horologium, I told you I need to read myself, and you said you just explained to me, I don't think I am going to make any sense of what you wrote without reading myself first
[09:06:03] <mashku> Horologium, yes, have a nice day, and thanks for effort or trying:) but I really need to read first myself
[09:06:28] <antto> you need to read yourself? O_o
[09:09:06] <mashku> antto, whats wrong with that?
[09:09:27] <antto> i'm not sure what you mean with that
[10:40:32] <zarya> some one knows how to toggle 1 pin in a register without touching the other pins/bins
[10:40:37] <zarya> s/bins/bits/
[10:41:01] <twnqx> reg ^= (1 << pin);
[10:47:18] <Tom_itx> http://tom-itx.dyndns.org:81/~webpage/avr/c_bits/bits_index.php
[10:47:32] <Tom_itx> that will enlighten you
[10:50:56] <Badaboom> Ooompa Loompa
[10:59:20] <nickjohnson_> I'm trying to use external interrupts on my ATTiny4313. When I set GIMSK |= _BV(INT0), the interrupt is enabled, but unsetting it again does not seem to disable it
[10:59:45] <nickjohnson_> (When I push the attached button, bringing the line low, the AVR seems to go into an infinite loop, presumably executiing the - nonexistent - ISR for INT0)
[11:00:07] <nickjohnson_> Changing MCUCR to affect when the interrupt is triggered doesn't seem to prevent the loop, either
[11:03:41] <nickjohnson_> Ah, the latter part of the issue is because the default ISR is the reset vector, of course
[11:03:58] <nickjohnson_> Which doesn't explain why I can't seem to disable INT0 once it's been enabled.
[11:05:10] <nickjohnson_> Also, any suggestions on reducing power usage further in power down mode?
[11:29:16] <Badaboom> I think thats compatible with the 2313 correct?
[11:30:49] <nickjohnson_> Badaboom: What is?
[11:31:24] <nickjohnson_> Oh, the 4313? Yes, it's the same, just with more ram and flash
[11:37:26] <Badaboom> hmm, i think i have the code for using an external int
[11:38:35] <nickjohnson_> What I want to do is use it to wake up the AVR, but not as an interrupt that triggers code
[11:38:47] <nickjohnson_> Simply defining an empty ISR may be the simplest approach to that, though
[11:39:32] <nickjohnson_> I'm curious if it's practical to further reduce power consumption, though. In power down mode it still draws 375 microamps
[11:39:33] <Badaboom> ahh ok,, in that case this is just a simple int
[11:40:17] <MarkX> hi
[11:41:40] <MarkX> in this code >> http://pastebin.com/FeM5zAy0 << can someone please explain line #9 to me?
[11:43:42] <nickjohnson_> MarkX: The third argument of the struct that's an initializer for is an array
[11:43:46] <nickjohnson_> That's an array literal.
[11:44:21] <MarkX> i'm sorry nickjohnson_ i still do not understand, can you dumb it down for me a little bit please?
[11:45:01] <nickjohnson_> MarkX: Lines 6-10 are a static initializer for an instance of the type declared on lines 1-4
[11:45:13] <nickjohnson_> The order of the arguments matches the order of the fields in the type
[11:45:27] <nickjohnson_> The third field of the type is an array - so the third field of the initializer has to be too
[11:45:27] <MarkX> right
[11:45:32] <MarkX> right
[11:45:37] <nickjohnson_> {...} is the C syntax for an array literal
[11:45:50] <nickjohnson_> {0x0409} is an array with one element in it
[11:45:59] <MarkX> aahhh
[11:46:03] <MarkX> ok
[11:46:27] <MarkX> so it could have also been something like {A, B, C, D}?
[11:47:52] <nickjohnson_> yup
[11:48:15] <MarkX> awesome! thanks a lot!
[11:48:31] <nickjohnson_> no worries
[12:30:04] <MarkX> me again :D
[12:37:53] <MarkX> in this code >> http://pastebin.com/vmauS2NS << I do not understand line 14. In the struct above (8 - 12) bLength = bLength (1 byte) + bDescriptorType (1 byte) + wString (2 bytes) = 4.
[12:39:07] <MarkX> but in the lower struct (13 - 17) bLength = sizeof(str...) (1 byte) + bDescriptorType (1 byte) + wString (5 bytes) = 7
[12:40:05] <MarkX> but bLength = sizeof(STR_MANUFACTURER) ... which equals 5
[12:40:11] <MarkX> im so confused :(
[12:40:59] <MarkX> any help would be greatly appreciated
[12:41:58] <ColdKeyboard> Can someone help me please. I want to set a fuse to ATmega8 to use external Crystal (16MHz)... I f**ed up once already with fuses so I would really appreciate any help on this :)
[12:42:54] <ColdKeyboard> Should my High fuse be 0xDE ?
[12:45:07] <ColdKeyboard> Anyone?
[12:47:33] <MarkX> just hang around ColdKeyboard , someone will be sure to answer :)
[12:50:36] <KidBeta> ColdKeyboard: you know that you can reset fuses right :) it just takes a HVP
[12:51:28] <ColdKeyboard> I programmed it with 0xFF low and 0xD9 High (High freq crystal with slow rising power and longer delay and no internal capacitors on XTAL pins)... It seems to work :)
[12:51:35] <ColdKeyboard> KidBeta: I know but I don't have one :\
[12:51:52] <KidBeta> are you using ArduinoISP ?
[12:55:13] <ColdKeyboard> KidBeta: USBasp
[12:55:45] <ColdKeyboard> It works for now... :) I'm trying to learn how to use vusb with ATmega8
[12:56:49] <Tom_itx> ColdKeyboard, http://www.engbedded.com/fusecalc/
[12:56:52] <Tom_itx> is your friend
[12:57:23] <MarkX> why not go with atmega8u2
[12:58:02] <Tom_itx> HF:0xD9 would be correct
[12:59:01] <ColdKeyboard> Tom_itx: That's where I calculated the fuses but wasn't sure if they were ok...
[12:59:18] <ColdKeyboard> MarkX: I have ATmega8 at my desk at the moment :)
[12:59:24] <MarkX> ah hehe
[13:00:33] <MarkX> Tom_itx: any idea about the code i pasted above?
[13:00:40] <Tom_itx> no
[13:00:44] <MarkX> dang
[13:00:46] <Tom_itx> cause i didn't click
[13:00:50] <MarkX> oh
[13:00:50] <MarkX> XD
[13:02:34] <Tom_itx> it will give you the length of STR_MANUFACTURER
[13:02:52] <Tom_itx> 10
[13:03:13] <Tom_itx> or 11 if it's padded with a null
[13:04:00] <MarkX> right but in the struct before that bLength = bLength (1 byte) + bDescriptorType (1 byte) + wString (2 bytes) = 4
[13:04:57] <MarkX> in this case, shouldnt bLength = 1 byte (sizeof(STR..)) + 1 byte (bDescrip...) + 10 bytes (wString) = 12?
[13:05:27] <MarkX> so basically bLength = sizeof(STR_MANUFACTURER) + 2?
[13:08:26] <Tom_itx> bLength = 4
[13:08:30] <Tom_itx> in string0
[13:08:51] <Tom_itx> and sizeof(STR_MANUFACTURER) in string1
[13:09:26] <Tom_itx> which would be 10 or 11 depending if it counts the null at the end or not
[13:09:31] <Tom_itx> that i'm not sure of
[13:10:00] <Tom_itx> and
[13:10:11] <Tom_itx> #define STR_MANUFACTURER "TTTTT TTTT"
[13:10:20] <Tom_itx> shouldn't have quotes i think
[13:10:25] <Tom_itx> unless it's a literal string
[13:10:34] <Tom_itx> i've not seen quotes used on defines
[13:11:19] <Tom_itx> but i'm far from a c expert
[13:11:23] <ColdKeyboard> #error "USB_CFG_CLOCK_KHZ is not one of the supported non-crc-rates!"
[13:11:33] <ColdKeyboard> Anyone got this error? F_CPU is 16000000
[13:11:44] <ColdKeyboard> So it should be ok but whatever I do I get this error :\
[13:11:57] <ColdKeyboard> Is it because of the assembler file or am I including something the wrong way?
[13:12:29] <ColdKeyboard> Because that file is .S file :\
[13:12:44] <ColdKeyboard> usbdrvasm.S
[13:14:41] <MarkX> Tom_itx: that's what is confusing me. in string0, bLength = 4 which is the sum of the sizes of bLength, bDescriptor and wString
[13:14:52] <MarkX> but in string1, bLength is just the size of wString
[13:17:01] <Tom_itx> so they are different numbers?
[13:18:04] <MarkX> well its the calculation of the number that confuses me
[13:19:38] <MarkX> why isnt bLength in string1 the sum of bLength, bDescriptor and wString
[13:19:56] <MarkX> sum of the sizes of bLength, bDescriptor and wString ****
[13:21:46] <Tom_itx> because it's not
[13:21:58] <Tom_itx> i didn't write it, i don't know how it's used
[13:22:27] <MarkX> hehe good point
[13:29:29] <ColdKeyboard> How can I add -DF_CPU=$(F_CPU) option to AtmelStudio build?
[13:30:39] <OndraSter__> in project options
[13:32:06] <ColdKeyboard> Can you be more specific?
[13:32:21] <ColdKeyboard> Toolchain then -> ?
[13:33:56] <OndraSter__> I don't remember it from top off my head
[13:58:29] <Tom_itx> OndraSter__, does xmega support quadrature encoders natively?
[14:01:37] <ColdKeyboard> What drivers should I assign to ATmega8 that is using vusb?
[14:01:58] <ColdKeyboard> Device manager says it is "Uknown device"
[14:08:03] <OndraSter__> Tom_itx, yes
[14:09:32] <specing> ColdKeyboard: whatever thing it is emulating, I guess
[14:09:56] <ColdKeyboard> specing: The example says that it is emulating Logitech mouse...
[14:10:09] <specing> then mouse drivers?
[14:10:10] <ColdKeyboard> but when I plug the device in, it says it's unknown device :\
[14:10:19] <specing> then you did something wrong
[14:10:23] <specing> try on Linux
[14:10:45] <ColdKeyboard> Why on linux?
[14:11:43] <specing> Because windows SUUUUUUUUCCCCCCCCCCCCCCKKKKKKKKKKKKKSSSSSSSSSSSSSSSS
[14:12:16] <ColdKeyboard> I know that :)
[14:13:38] <OndraSter__> ColdKeyboard, does it show the VID & PID?
[14:15:14] <ColdKeyboard> Which drop-down should I check on Driver details for that? :S
[14:16:20] <mashku> Hi
[14:16:57] <Tom_itx> OndraSter__, what about bldc?
[14:28:03] <mashku> I understand why my code does not work
[14:29:04] <mashku> When I upload it to attiny85 PB1 seems to be always high http://pastebin.com/R14rAQRQ
[14:29:12] <mashku> why?
[14:30:55] <mashku> how to debug it?
[14:31:29] <mashku> shoulnt the PB1 flip its state ? but I see that its always ON...
[14:35:29] <OndraSter__> Tom_itx, well you need H bridge drivers for that
[14:35:29] <OndraSter__> :P
[14:35:29] <OndraSter__> but with AWeX you should be able to do it even in hardware
[14:35:29] <OndraSter__> with just FETs
[14:37:08] <mashku> any help?
[14:37:17] <Horologium> just a min mashku
[14:37:20] <Horologium> let me look at the code.
[14:37:28] <mashku> thanks a lot
[14:37:46] <mashku> Horologium, I connected old scope to PB1 and it seems to be High full time
[14:38:52] <Horologium> you sure it's always high and not just on so much because it's running fast?
[14:40:57] <mashku> now I am checking PB3 which seems to be always low
[14:41:16] <mashku> I am not sure I check at 2V and 100us
[14:41:31] <Horologium> blah.
[14:41:47] <Horologium> sorry, but my logic is not working today.
[14:42:55] <mashku> maybe I need a cap between ground and clock?
[14:43:59] <Horologium> I don't think so.
[14:44:28] <Horologium> I'm just not in logic mode.
[14:46:16] <mashku> well at whole range of scope it stays 3.84V which is what my battery provides
[14:46:30] <Horologium> then something likely screwy with logic.
[14:46:38] <Horologium> that I'm not seeing because I'm brain damaged today.
[14:47:02] <mashku> 1<<PIN just does the same thing as _BV(PIN) right ?
[14:47:48] <mashku> though this lines PORTB |= (((data&(0x01<<i))>>i) << SPIN ); are tricky to me, I copied the whole code from some tutorial
[14:50:16] <mashku> and shift register is connected correctly because I was able to light up segments with arduino
[14:50:26] <mashku> its just something wrong with the code
[14:56:20] <nickjohnson_> A cap between ground and clock would be a bad idea :)
[14:57:42] <Tom_itx> not if it's a crystal
[14:58:16] <Horologium> it's a clock line for a shift register.
[14:58:19] <Horologium> so, bad idea.
[14:59:33] <nickjohnson_> That shift register code is weird
[15:01:22] <nickjohnson_> Still, it should be toggling spin as appropriate
[15:01:34] <mashku> nickjohnson_, I copied it from some tutorial
[15:01:42] <mashku> but scope hell shows constant voltage
[15:01:48] <mashku> and I know scope is working
[15:02:48] <ColdKeyboard> I'm trying to test vusb hid-mouse example. I'm using ATmega8 and I compiled the code without any errors but when I burn the firmware down to mcu and connect the USB I get uknown device error :\
[15:03:14] <ColdKeyboard> Can anyone help me?
[15:03:50] <nickjohnson_> mashku: The code's wrong, though - it doesn't set the pin high then low, it sets it to a value, then !value
[15:04:43] <mashku> nickjohnson_, can yo fix the code? I am checking if the cables arent lose
[15:05:06] <nickjohnson_> mashku: The line after "set the datapin low again" should be "PORTB &= ~_BV(SPIN)"
[15:07:24] <nickjohnson_> The line after "go through each bit of data and output it" can be more simply expressed as "PORTB |= ((data >> i) & 0x1) << SPIN"
[15:07:50] <mashku> well shift register clk shows square wave
[15:07:59] <mashku> so something is ticking
[15:11:26] <mashku> nickjohnson_, but RPIN isnot toggling
[15:11:38] <mashku> SPIN shows on scope square wave, but RPIN is flat
[15:11:41] <nickjohnson_> oh
[15:12:41] <nickjohnson_> pastebin isn't loading for me now
[15:12:49] <nickjohnson_> But I thought PB1 was SPIN according to the defs up the top
[15:13:04] <nickjohnson_> Okay, now it's loading. It is
[15:13:53] <mashku> PB1 is SPIN
[15:14:03] <nickjohnson_> Is your code exactly as depicted there? If you're missing the delay after calling shift, rpin will always be low
[15:14:19] <mashku> yes same code
[15:15:26] <mashku> on shift register pin 11, which is CPIN in my code, I see square wave
[15:15:36] <nickjohnson_> So it's RPIN that you're having trouble with?
[15:15:59] <mashku> pin 12 on shift register, which is RPIN in my code is constant
[15:16:17] <mashku> always zero
[15:16:49] <mashku> SPIN which is 14 pin on shift register is always ON
[15:16:51] <mashku> high
[15:16:58] <mashku> so both RPIN and SPIN have trouble
[15:17:48] <mashku> CPIN is switching
[15:19:49] <ColdKeyboard> How am I suposed to include this usbdrv folder in AtmelStudio ?
[15:21:02] <nickjohnson_> Sorry, I have no idea
[15:21:47] <nickjohnson_> Try removing the second assignment to spin entirely
[15:21:50] <nickjohnson_> It's not necessary
[15:21:56] <nickjohnson_> Actually, that's not true
[15:22:04] <nickjohnson_> Between the two of them they kind of set the value correctly
[15:22:12] <nickjohnson_> It's terrible code :P
[15:23:16] <mashku> I dont know why only CPIN works...
[15:23:55] <nickjohnson_> That pastebin is character-for-character what you're using?
[15:25:46] <mashku> nickjohnson_, http://pastebin.com/rA3m53sx
[15:27:22] <nickjohnson_> Sorry, I really don't know - the code looks fine
[15:27:25] <mashku> and I have probe on SPIN and its continuously HIGH
[15:27:30] <nickjohnson_> Maybe start with a simpler sketch that toggles those pins and see if it works
[15:27:40] <nickjohnson_> Or just rearrange the definitions so your CPIN is now PB1 or B3
[15:27:42] <nickjohnson_> er, PB3
[15:27:52] <nickjohnson_> That will at least help narrow things down
[15:28:18] <mashku> Simpler sketch might do as well
[15:32:39] <mashku> hm funny
[15:32:53] <mashku> looks like only PB2 is able to be modified
[15:33:02] <mashku> maybe attiny is damaged... I will take new mcu
[15:33:05] <nickjohnson_> Hardware issue, maybe?
[15:33:13] <nickjohnson_> That or a bad connection
[15:33:25] <mashku> nah I am checking on pins directly
[15:36:05] <nickjohnson_> ah
[15:36:34] <Badaboom> bah this ISP is giving me hell today
[15:36:55] <Badaboom> reboot after reboot:(
[15:37:59] <mashku> nickjohnson_, hmm... same with completly new mcu...
[15:38:03] <mashku> ^^
[15:38:10] <nickjohnson_> Really no idea, then
[15:38:16] <nickjohnson_> But at least you've narrowed it down a bit
[15:51:01] <mashku> well PB1 or PB2 is the digital pin, not physical pin number ?
[15:51:52] <Badaboom> digital
[15:52:06] <Badaboom> Port B 1 and 2
[15:52:18] <Badaboom> Thats not the physical
[15:52:25] <mashku> ok then that should be fine;/
[15:52:28] <Badaboom> whats the chip?
[15:52:31] <mashku> attiny85
[15:52:43] <Badaboom> have you looked at the datasheet>?
[15:53:05] <mashku> oh...
[15:53:48] <mashku> yes
[15:53:53] <Badaboom> It will show the ports and the physical pin #'s ie the functions of the pin
[15:54:23] <Tom_itx> Badaboom figure it out?
[15:54:34] <Badaboom> Tom, yes thank youz
[15:54:37] <Badaboom> you
[15:54:53] <Badaboom> Im working extra this week so maybe fri
[15:55:01] <Badaboom> hopefully earlier
[15:55:16] <Badaboom> oh it will work with 6.1 yes?
[15:55:26] <Tom_itx> yup
[15:55:30] <Badaboom> rgr
[15:57:59] <Badaboom> mashku: do you have the data sheet downloaded?
[15:58:47] <mashku> yes I have it in PDF viewer open in my iceweasel browser
[15:59:06] <Badaboom> ok, there is only one port on that chip which is B
[15:59:20] <Badaboom> but i might add its not a complete port
[15:59:29] <Badaboom> ie: not all 8
[16:02:20] <mashku> yes
[16:02:24] <mashku> PB1..PB4
[16:02:39] <mashku> PB5 is reset and I dont want to disable reset
[16:02:50] <Badaboom> yes try not to use that
[16:04:16] <Badaboom> one sec im trying to pull it up
[16:05:02] <Badaboom> ok so what's the problem now
[16:06:05] <mashku> Badaboom, http://pastebin.com/rA3m53sx this code is not toggling PB1 and PB3, only PB2 I see square wave
[16:06:25] <Badaboom> ok ill look
[16:06:34] <mashku> Badaboom, but I am making simple test case toggling all bits to check if that is working
[16:06:51] <ColdKeyboard> how the hell should I compile makefile on windows? I donwloaded WinAvr and run Makefile but Codegeneration and avr dude are disabled (light-blue)
[16:07:52] <Badaboom> mashku: use a resistor and led
[16:08:10] <mashku> Badaboom, I use a scope
[16:10:58] <Badaboom> ok.. that works too
[16:11:59] <mashku> meh
[16:12:15] <ColdKeyboard> Did anyone around here used vusb for adding usb to non-usb avr?
[16:12:42] <mashku> Badaboom, what do you think this should do ? http://pastebin.com/8QS0zJAZ
[16:12:53] <mashku> Badaboom, toggle all pins HIGH and LOW right?
[16:14:26] <Badaboom> high for 5v.. brb
[16:14:41] <mashku> nickjohnson_, found a problem
[16:14:41] <Badaboom> well yes on and off
[16:14:42] <mashku> lolz
[16:15:14] <mashku> nickjohnson_, converting wrong file to ihex
[16:15:29] <mashku> nickjohnson_, it was the same old code being uploaded over and over
[16:15:29] <mashku> ;/
[16:15:34] <nickjohnson_> mashku: You're doing the build process manually?
[16:15:46] <mashku> yes
[16:15:53] <mashku> from command line
[16:15:54] <nickjohnson_> Why?
[16:16:04] <mashku> hm.. I will make Makefile now ;/
[16:16:08] <nickjohnson_> There's standardised makefiles out there. They'll save you a lot of time and hassle.
[16:16:57] <mashku> now I have makefile
[16:17:03] <nickjohnson_> For instance: https://github.com/arachnidlabs/minimatrix/blob/master/firmware/Makefile
[16:18:03] <mashku> its very complicated
[16:18:11] <mashku> I like my simple makefile with 3 lines
[16:18:24] <mashku> at least I wont make such a mistake now
[16:18:30] <nickjohnson_> That's because it's generic. And it takes care of a bunch of stuff, like fuses.
[16:18:33] <nickjohnson_> true
[16:18:35] <nickjohnson_> Whatever works for you
[16:20:26] <mashku> yeah now I can see spikes on ports.. and 7 segment lighting up
[16:29:01] <Badaboom> ok im back
[16:29:12] <Badaboom> getting ready to poor here
[16:34:52] <Badaboom> mashku: are you loading a made hex or compiling ?
[16:43:16] <mashku> Badaboom, problem solved
[16:43:46] <mashku> I am compiling and loading hex, but that does not matter now, I know what was wrong:)
[16:46:33] <Badaboom> ok
[21:02:07] <eadthem> anyone have a recommendation on getting started with usb for AVR?
[21:02:56] <Horologium> yes
[21:03:27] <eadthem> no interested in arduino much preffer C/C++ on native hardware
[21:03:32] <Horologium> http://tom-itx.dyndns.org:81/~webpage/boards/USB_Breakout/USB_Breakout_index.php
[21:04:11] <Horologium> nice little board....has a lufa based bootloader onboard.
[21:04:22] <Horologium> Tom_itx here in this channel sells them.
[21:04:29] <eadthem> something without bootloader and without the AVR
[21:04:42] <Horologium> ummm.
[21:04:42] <eadthem> ie that i could just pop sidelong to a mega164 or similar
[21:04:52] <Horologium> oh, you want a usb to serial adapter?
[21:05:01] <eadthem> not realy
[21:05:08] <Horologium> then no clue what you want.
[21:05:22] <Horologium> do you want an external usb chip or an avr with usb built in?
[21:05:28] <eadthem> usb to serial appears as a RS232 port and can only do 8 bit words or messages
[21:05:49] <eadthem> ya thats what i was wondering whats best for that
[21:05:51] <Horologium> most of your usb chips out there are going to be 8bit.
[21:05:56] <eadthem> right
[21:05:57] <Horologium> what's the best for what?
[21:06:01] <Horologium> what do you want to do exactly?
[21:07:00] <Horologium> if you want to play HID, like mouse or keyboard or joystick, then you will need a microcontroller with built in usb, like that which I posted.
[21:07:36] <Horologium> if you just want to communicate with the chip then you can just do a usb to serial adapter and connect to the usart on the avr.
[21:11:32] <Tom_itx> eadthem, dean's lufa lib is probably the best way to go
[21:11:44] <eadthem> well first of all hid or other native usb methods will operate with messages greater than 8 bits right
[21:11:54] <eadthem> ?
[21:11:55] <Tom_itx> he's got alot of examples
[21:12:21] <Horologium> all depends on what you are looking to do eadthem
[21:12:55] <Horologium> no reason you can't send a packet with multiple bytes either via hid or cdc(usb serial)
[21:13:09] <Horologium> it's all 8 bit bytes at the core anyhow.
[21:14:15] <eadthem> yes well 8 bit core dose not dictate message size
[21:14:36] <Horologium> message being packet being you can send however many bytes you want/need.
[21:16:29] <Horologium> but, not knowing the project we have no way of knowing what would work best.
[21:17:58] <eadthem> atm planning
[21:18:20] <Horologium> atm being? asynchronous transfer mode or automatic teller machine or??
[21:20:50] <eadthem> 2 axis chip programmer http://final.servegame.com/public/robot/chips/AirTool.png
[21:20:56] <eadthem> had to prep the images :p
[21:22:01] <Horologium> that looks like an automated glue injector I saw at a customer's site a month or so ago.
[21:22:17] <eadthem> its just a 2 axis pick and place machine
[21:22:23] <eadthem> x and z
[21:23:39] <eadthem> atm im trying to plan out control
[21:24:04] <Horologium> so long as limit feedback is handled locally then you could easily do usb to serial.
[21:24:10] <eadthem> i could do all the work on the uc and just use minimal communcation to tell the computer to start programming and the computer to say when it is done programming
[21:24:16] <Horologium> still don't get the atm reference.
[21:24:22] <eadthem> this involves a keypad display and ... in hardware
[21:24:27] <eadthem> at the moment
[21:24:31] <Horologium> oh.
[21:24:58] <eadthem> or i could just make the UC a slave of the computer little more than a IO expander
[21:25:22] <Horologium> you don't want to do that over usb...
[21:25:38] <Horologium> not without local limit control on the microcontroller.
[21:26:14] <eadthem> and the computer program runs the vibratory feeder and loader, x z pulsing, monitoring the cal rod, touch and pressure switches...
[21:26:33] <eadthem> yes
[21:27:32] <eadthem> i could also make it a slave and the computer tells the UC the x and z to go to and that it dose involuntarly
[21:27:54] <eadthem> strongly leaning toward that
[21:28:07] <Horologium> that's how I started my 3 axis milling machine.
[21:28:13] <Horologium> then I switched to a full g-code interpreter.
[21:28:15] <Horologium> on the avr
[21:28:48] <Horologium> put the g-code file on an SD..stick it in..press start...let it fly.
[21:29:40] <Valen> EMC2 4ever
[21:48:59] <eadthem> mmm google docs wont incrementaly fill
[21:52:26] <HylianSavior> http://asf.atmel.com/docs/3.8.1/xmegaa/html/group__xmega__spi__master__group.html is there a way to simulataneously read and write over SPI using this library?
[21:52:29] <HylianSavior> doesn't seem like it...
[22:00:53] <eadthem> well you cant read and write to the same spi port at once
[22:01:26] <eadthem> it is bydirectonal but simplex not duplex
[22:03:16] <HylianSavior> I'm trying to use a CC1101 and apparently it sends an status byte over SO when the header byte is sent by the master
[22:04:02] <LoRez> eadthem: SPI is full duplex
[22:04:40] <eadthem> mmm yes it is
[22:04:47] <eadthem> 2 many busses in my head
[22:07:12] <HylianSavior> seems kinda silly that it doesn't just have a transmit function
[22:07:30] <HylianSavior> i suppose the easiest way is just to get it separately by sending a dummy header
[23:13:36] <MarkX> quick easy question
[23:14:23] <MarkX> lets say i have a couple of .h files. x.h, y.h and z.c. If i #include x.h into y.h. then #include y.h into z.c, can i access the macros in x.h still?