#avr | Logs for 2011-12-10

Back
[02:03:16] <earthshine> morning
[02:41:15] <mapee> morning
[02:42:04] <OndraSter> moarnin
[06:04:30] <norbi> hi!
[06:04:56] <Steffann> Lo
[06:12:49] <norbi> im trying to find the uart.c description of winavr
[06:12:53] <norbi> but i cant find it
[06:18:52] <karlp> the what?
[06:19:02] <karlp> uart.c from where?
[06:19:11] <karlp> winavr doesn't provide uart driver code...
[06:19:27] <grummund> procyon?
[06:19:45] <karlp> http://homepage.hispeed.ch/peterfleury/group__pfleury__uart.html ?
[06:19:49] <grummund> http://www.procyonengineering.com/embedded/avr/avrlib/docs/html/uart_8c.html
[06:21:40] <karlp> what's the license on that?
[06:21:54] <norbi> hmm
[06:22:23] <norbi> i have not remembered well, back in time was winavr in my mind
[06:22:31] <norbi> but definetly im wrong
[06:22:33] <norbi> thanks
[06:23:25] <norbi> i had back in time my own uart code saved somewhere, but i have to start from scratch
[06:27:14] <Steffanx> karlp it's gpl.. which sucks :P
[06:27:15] <norbi> im getting an error in avr studio and dunno why:avr-objcopy: 'UART.elf': No such file
[06:27:37] <norbi> when im building it
[06:30:28] <grummund> do menu Build --> Clean. and then try again
[06:32:22] <norbi> same : avr-objcopy: 'UART.elf': No such file make: *** [UART.hex] Error 1 Build failed with 1 errors and 0 warnings...
[06:33:09] <norbi> here is the pastebin: http://pastebin.com/CMtnkjMX
[06:33:19] <norbi> it doesnt see the winavr
[06:33:20] <grummund> which version avrstudio? did you override the makefile or let avrstudio manage it as default?
[06:33:24] <norbi> 4
[06:33:30] <norbi> avrstudio 4
[06:33:35] <norbi> didnt override nothing
[06:33:47] <norbi> but firstly installed studio and just after winavr
[06:35:28] <grummund> menu Project --> Configuration Options --> Custom Options... what does it say for External Tools?
[06:36:54] <norbi> nothing
[06:37:06] <norbi> avr-gcc blank
[06:37:09] <norbi> make blank
[06:37:25] <grummund> therin is the problem
[06:37:26] <norbi> at custom compilation options [All files]
[06:37:38] <norbi> -Wall
[06:37:50] <norbi> -gdwarf-2
[06:37:52] <norbi> etc
[06:38:21] <norbi> its checked Use AVR Toolchain
[06:39:09] <norbi> include directories and libraries is blank too
[06:39:15] <norbi> how can i fix that?
[06:39:39] <grummund> avr-gcc and make should be set
[06:39:54] <grummund> under External Tools
[06:40:25] <grummund> this happens automatically if winavr / avrstudio are installed in the correct order
[06:40:34] <norbi> avr-gcc.exe?
[06:40:52] <grummund> C:\WinAVR-20100110\bin\avr-gcc.exe
[06:40:53] <norbi> and make?
[06:40:53] <grummund> C:\WinAVR-20100110\utils\bin\make.exe
[06:40:56] <grummund> probably
[06:41:00] <norbi> thanks!
[06:43:42] <norbi> ../Cerebot2.c:10: error: 'F_CPU' undeclared (first use in this function) but it should be automatically
[06:44:33] <grummund> go back into Project Options and set the clock Frequency
[06:45:03] <norbi> ok, thanks
[06:51:22] <norbi> UCSRC |= (1 << URSEL) | (1 << UCSZ0) | (1 << UCSZ1); UCSZ1 is missing from atmega64 ...
[06:51:30] <norbi> and ursel is umsel0
[06:51:31] <norbi> ?
[09:13:17] <norbi> guys, what is the difference between 3 and 4 pin spi?
[09:20:40] <karlp> norbi: possibly no chip select pin?
[09:20:54] <karlp> people use all sorts of terms for various forms of spi.
[09:27:27] <norbi> dunno yet how to set up an accelerometer in spi mode
[09:27:28] <Steffanx> There is only one 'form' of spi ..
[09:27:33] <norbi> spi is not hard to init
[09:27:52] <karlp> Steffanx: hahahah
[09:27:54] <norbi> but to use it in complement of 2 im not really understanding
[09:28:04] <norbi> i know what is complement of 2
[09:28:48] <karlp> most people agree on at least 4 forms, and that's without getting into silly naming like, "two wire, rx only" sort of crap.
[09:30:05] <norbi> :))
[09:30:07] <norbi> yea
[09:30:21] <norbi> ive heard about that
[09:30:31] <norbi> but not really much tangence with spi
[10:30:41] <norbi> i have this adxl345 accmeter, but it is on 13bit, and the atmega64 is on 8bit, how should i use it?
[10:30:51] <norbi> im using it via spi
[10:31:34] <Tom_itx> read 2 bits and discard the extra
[10:31:44] <Tom_itx> or bit bang it
[10:46:25] <jakllsch> Tom_itx: you mean 16 bits? :-)
[10:48:50] <Steffanx> 2 bytes :)
[10:51:39] <jakllsch> ah.
[11:02:02] <Tom_itx> yes
[11:02:33] <Tom_itx> some µC's will actually allow you to clock in an odd number of bits
[11:02:44] <Tom_itx> the 68332 was one
[11:03:24] <Tom_itx> but since avr's are 8 bit that's a different story
[11:35:59] <Fleck> http://www.everbuying.com/product106689.html << anyone knows how this works? Why is it limited in watts... (20k for one unit)
[11:49:48] <mrfrenzy> it's a bullshit device
[11:49:56] <mrfrenzy> a chunk of aluminum and a simple LED
[11:50:14] <mrfrenzy> perhaps the proper term is "snakeoil"
[11:51:19] <JanneP> would be interesting to see what's actually inside =)
[11:51:42] <Fleck> ok any one else with out stupid comments like mrfrenzy
[11:51:51] <Fleck> JanneP same hee ;P
[11:52:03] <JanneP> eh of course that device is bullshit
[11:52:17] <mrfrenzy> Fleck: if you know anything about electricity you understand that it simply cannot work
[11:52:59] <JanneP> if it has some capacitors inside it may actually improve power factor a bit but otherwise utter bullshit
[11:53:22] <JanneP> and households don't need to pay for apparent power so even that point is moot
[11:53:26] <mrfrenzy> power factor has no impact on energy bill in a household
[11:53:27] <mrfrenzy> indeed
[12:01:06] <Fleck> sorry guys, calling something bullshit w/o knowing actually whats inside - is bullshit and dumb
[12:01:36] <JanneP> :D knowing a bit of physics and you can tell without seeing the insides
[12:03:19] <JanneP> problem is, as long as people are being ignorant and plain stupid, scammers like that will prevail
[12:04:02] <Fleck> i didnt say its not bullshit, i just dont call it yet!
[12:17:46] <norbi> guys any idea how to interface the spi of this adxl345 accmeter with atmega64? http://www.sparkfun.com/datasheets/Sensors/Accelerometer/ADXL345-BreakoutBoard-v10.pdf
[12:18:01] <norbi> int1 and int2 will be not used
[12:18:49] <norbi> sclk - sck
[12:19:38] <norbi> sdio-mosi
[12:19:44] <norbi> cs-ss ?
[12:19:52] <norbi> this is the 3 pin mode?
[12:21:46] <Fleck> mrfrenzy, JanneP: http://www.deltechbd.com/pdf/epsfaq.pdf
[13:07:23] <norbi> guys, i have a linking problem, how can i solve this? C:\WinAVR-20100110\avr\lib\libc.a(vfprintf_std.o): In function `vfprintf': (.text.avr-libc+0xd4): undefined reference to `__mulhi3' its with stdio
[13:18:29] <norbi> please help me, i dont know how to fully integrate winavr into avrstudio4
[13:23:46] <qiau> hm.. anyone used a RFBee? Trying to figure out how to connect a buspirate to it to program it
[13:23:55] <qiau> i.e. update the firmware
[13:24:33] <qiau> I guess the six pin holes is some kind of standard ISP thingie but I'd like to read about it before trying to connect anything
[13:44:33] <JanneP> Fleck: that faq is lying. bad power factor is not lost power
[13:45:10] <JanneP> and only big industries are charged more money if the power factor is bad
[13:46:32] <JanneP> power factor less than 1 means an inductive load, where current is at different phase in relation to voltage
[13:47:16] <JanneP> so even though you might have a big current, the actual power could be very small. and bill is sent based on actual power
[13:48:55] <norbi> im using this code with adxl345
[13:48:58] <norbi> http://pastebin.com/3K0Pd0Nw
[13:49:14] <norbi> but on usart i get just Power is: 0
[13:49:20] <norbi> why?
[13:57:54] <norbi> guy help me out here please!
[13:58:14] <norbi> what happened to this channel, no more activity like back in time
[14:02:19] <JanneP> spi problem mayby? seems like it's receiving 0 constantly and hence stuck in your loop
[14:02:42] <norbi> yes, but, i need to set probably the ss to 1?
[14:02:46] <norbi> that may be the problem?
[14:03:01] <norbi> dunno where ive read that should be 0
[14:03:02] <norbi> but..
[14:03:08] <norbi> maybe thats the solution?
[14:03:26] <karlp> on avr, spi master, make damn sure SS is set high, or physically plled high
[14:03:28] <JanneP> check the datasheet. usually chip select is active low, so put line low to acticate it
[14:03:34] <karlp> if it ever goes low, the avr will auto switch into slave mode
[14:03:41] <karlp> which is.... unhelpful.
[14:03:52] <karlp> seems to be to help multi master situations, stm32 does the same thing.
[14:07:32] <norbi> ok so sbi(PORTB,2) should do that
[14:18:24] <norbi> to clear bit 0 of a register, i need to write cbi(PORTB,0) right?
[14:36:53] <norbi> i cant find registry 0xAD in the datasheet of the adxl345
[14:37:12] <norbi> so then why is sending spi to 0xAD an 0x00 ?
[14:52:29] <karlp> man, at least you're on avr. avr spi master example is in the datasheet, in C, and is 17 lines, including comments and whitespace.
[14:52:37] <karlp> and it _works_
[15:01:38] <norbi> i had connected miso too now
[15:03:22] <norbi> mosi to sdo
[15:03:27] <norbi> and sda to miso
[15:06:38] <norbi> ok it works now
[15:06:47] <karlp> mosi to sdo?
[15:06:48] <norbi> ive inverted the mosi and miso pins
[15:06:53] <norbi> yea yea
[15:06:59] <norbi> ive just figured out
[15:07:17] <karlp> sorry I didn't see it earlier...
[15:07:33] <norbi> thanks for help! karlp :)
[15:07:52] <norbi> good to have pros near
[15:08:00] <karlp> hah, I didn't do anything
[15:08:08] <karlp> and I'm currently struggling to get SPI to work too :)
[15:09:20] <norbi> hmm
[15:09:33] <norbi> now after restarted the mcu now power is 0 again...
[15:11:35] <karlp> huh, I wonder if this is the problem. RCC_APB2PeriphClockCmd(RCC_APB1Periph_SPI2
[15:11:43] <karlp> APB2 != APB1
[15:32:22] <norbi> i dont even understand that code
[15:37:41] <karlp> well, it wsn't the whole ine for starters :)
[15:39:48] <norbi> karlp: i want to set PORTE pin 4,5,6,7 for output, that gives me 0xF0 in hex for DDRE
[15:39:53] <norbi> but that its not correct
[15:39:58] <norbi> and i dunno where im wrong
[15:40:49] <norbi> 0,1,2,3,4,5,6,7 is 11110000 for 4-7 to be output, right?
[15:42:43] <bram_> norbi, that seems correct to me
[15:43:25] <bram_> norbi, have you checked the "special functions" for porte?
[15:43:26] <karlp> looks ok to me.
[15:43:33] <karlp> is porte jtag?
[15:43:45] <karlp> what device is this?
[15:43:51] <norbi> atmega64
[15:46:59] <norbi> dunno, now im trying this way: DDRE=0xF0; PORTE, 0xF0; and the problem was that somehow i misstyped the PORTE=0xF0; and didnt catched my eyes...
[15:47:14] <norbi> maybe its late thats why im making stupid things here
[15:47:49] <bram_> hippy
[15:48:06] <bram_> hippie
[15:49:52] <norbi> =))
[16:16:04] <norbi> i have 2 bytes, that makes me a 16bit value, i want to convert that in decimal, how can be done that?
[16:16:08] <norbi> in fast mode
[16:16:24] <norbi> i thought to convert the msb first
[16:16:28] <norbi> then the lsb
[16:16:33] <norbi> and add them
[16:18:26] <karlp> int16_t = byte1 << 8 | byte2 ? is that what sort of thing you're looking for?
[16:20:11] <norbi> yea:d
[16:20:14] <norbi> thanks!
[16:22:54] <norbi> byte2 is the least significant?
[16:27:04] <mrfrenzy> http://www.ipv6buddy.com/
[16:27:11] <mrfrenzy> perfect when coding hex adresses ;)
[16:28:16] <norbi> i dont think it is usefull
[16:28:21] <norbi> who would use that?
[16:29:45] <mrfrenzy> it's mostly for fun ofcourse, hence the smiley
[16:29:49] <norbi> yea
[16:29:56] <norbi> i thought so
[16:29:57] <norbi> :)
[16:30:27] <norbi> int16_t = byte1 << 8 | byte2 in this statement what is the least segnificant byte?
[16:30:27] <karlp> bleh, stupid avr wasn't fast enoguh to catch the spi
[16:30:30] <karlp> works now.
[16:30:32] <norbi> byte2?
[16:30:41] <karlp> least significant is in the eye of the beholder
[16:30:55] <karlp> (byte2)
[16:33:24] <norbi> whats wrong with this? http://pastebin.com/q3Gjgqvw
[16:33:39] <norbi> the data from the accmeter is very weard
[16:33:58] <norbi> karlp: any idea?
[16:34:19] <karlp> what's axis?
[16:34:29] <karlp> signed/unsigned?
[16:34:31] <norbi> x,y,z is the order
[16:34:36] <norbi> signed
[16:34:43] <karlp> is the adx1 the chip select?
[16:34:48] <norbi> signed means complement of 2 right?
[16:35:00] <norbi> adxl345
[16:35:43] <norbi> even if it stays, it changes the data
[16:35:52] <karlp> print out something between each number :) it will make it much easier on yourself to see what's what.
[16:35:57] <karlp> anyway, I'm out of here.
[16:40:06] <norbi> ah, yea, ive fixed it, didnt observed that i missed a new line or something between
[16:52:08] <norbi> is there a way to output via uart without scrolling?
[16:52:30] <norbi> i mean just to modify the coords of output, some variables, not to output new lines
[16:54:52] <bram_> norbi: check how to use printf
[16:56:02] <norbi> bram_:?
[16:56:26] <bram_> printf gives you formatted output
[16:56:42] <norbi> now my output scrools this way: http://pastebin.com/HHuGiWEQ
[16:56:48] <norbi> but it keeps scrolling
[16:57:30] <norbi> i want it something like this way: x: [this value to change] ,y: [this value to change], z: [this value to change]; on the screen
[16:57:36] <bram_> you use a lot of output with new lines?
[16:57:38] <norbi> no new lines not anything
[16:58:19] <norbi> i do, but im wondering if there is any character to jump back to the begining of the line
[16:58:30] <norbi> im using putty for serial connection
[16:58:33] <bram_> then you have to print all the output again and again
[16:58:38] <bram_> with a clear screen cd
[16:58:40] <bram_> cmd
[16:58:58] <norbi> hmm, im wondering what is that clear screen cmd
[16:59:09] <bram_> you can check asciitable.com for backspace chars
[16:59:11] <Steffanx> Google knows
[17:03:20] <bram_> its %c,13 or something
[17:04:34] <norbi> %c,13?
[17:04:42] <norbi> i cant find this anywhere
[17:04:51] <bram_> printf("bla %c",var);
[17:05:08] <bram_> var is the decimal ascii value for a specific char
[17:05:23] <norbi> yea i know
[17:05:24] <norbi> but
[17:05:38] <norbi> i cant find the clear screen command int dec 13
[17:05:48] <bram_> if var=13, then you will have a backspace
[17:06:00] <norbi> that is carriage return in asci table
[17:06:12] <bram_> i am sorry
[17:06:14] <bram_> it is 8
[17:07:21] <bram_> those commands are designed for use on a printer
[17:13:13] <bram_> maybe end of medium will work
[17:13:25] <bram_> with start of text
[17:18:33] <bram_> or you can use a lot of new lines, to simulatie a clear screen command
[17:30:18] <ys0> hola
[17:31:09] <norbi> ctlr+l is the command and %c,12 is the ascii code for it
[17:31:17] <norbi> i mean 12 is the dec
[17:58:41] <mapee> good night guys
[18:06:20] <norbi> good night
[18:41:53] <norbi> anybody? my putty screen is flickering, the output data
[18:42:03] <norbi> why? i need a buffer or sumething to avoid that?
[18:42:26] <Casper> ?
[18:42:54] <norbi> im clearing the screen after each output, and doing a printf
[18:43:24] <norbi> here is the code casper: http://pastebin.com/anMGXMnf
[18:43:52] <norbi> and im loocking at the terminal window and i cant see the output smoothly
[18:44:08] <norbi> x,y,z tags to remain the same and just the numbers to change
[19:08:34] <norbi> guys, could you please help me a bit in accelerometer concept?
[19:43:09] <Casper> norbi: I know the very basic, not enought to help probably
[19:49:21] <norbi> Casper: i dont even the basic
[19:49:37] <norbi> ive interfaced this acc to the atmega64
[19:49:40] <norbi> it works
[19:49:42] <norbi> on spi
[19:49:52] <norbi> it is adxl345
[19:49:57] <norbi> but it fluctuates
[19:50:02] <norbi> like there is a big noise
[19:50:20] <norbi> big means, i cant get it stand near to 0
[19:50:30] <norbi> in static position
[19:50:43] <norbi> nothing moves but it does change large values
[19:51:56] <Casper> normal
[19:52:03] <Casper> accelerometer work with gravity
[19:52:10] <Casper> so one axis should read 1G
[19:52:28] <Casper> should be your Z axis
[19:58:18] <norbi> Casper: yea, but it doest reads just 1G
[19:58:31] <norbi> it reads on all of the axis
[20:00:12] <Casper> yeah the number won't be 1G, you have to see the datasheet to see how it can be converted to G
[20:00:27] <Casper> and noise is normal, just depend how much you get
[20:00:52] <inflex> Why is it in life, there are just some people you cannot stand?
[20:01:20] <Casper> inflex: so you can stand everyone else
[20:01:38] <inflex> Casper: that's about the sum of it, yes ;) :p
[20:09:22] <norbi> im measuirng with oscope the sclk but its constant voltage
[20:12:05] <norbi> it is 404mv at 1.73khz
[20:32:29] <tomatto_> hello
[20:33:44] <tomatto_> please, can i use 16bit timer as two 8bit? or how can i do 50KHz PWM with 8or16 MHz crystal and 16bit register with atmega8?
[20:38:28] <Tom_itx> read the upper byte
[20:38:38] <Tom_itx> but not as 2 timers
[20:39:14] <Tom_itx> err lower?
[20:40:49] <inflex> certainly it can be used as two... sort of... but yes, the lower will be 256x faster than the upper and have no overflow interrupt (but you could monitor it for 0x0100 changes). Maybe easier to use a single 8-bit timer and increment another global variable in the overflow interrupt?
[20:41:08] <inflex> eg, ISR(TIM0_OVF_vect) { global_tick++; }
[20:41:43] <inflex> oh, he's gone *sigh*
[20:43:39] <Tom_itx> who's gone?
[20:44:11] <inflex> sorr, I was wrong
[20:45:08] <tomatto_> i need two 8bit OCRs for generate 50kHz
[20:54:14] <Casper> tomatto_: you can use a 16 bits as a 8 bits one
[20:54:19] <Casper> set top to 255
[20:54:40] <Casper> and never care about the higher 8 bits
[20:54:55] <tomatto_> Casper: on every interrupt?
[20:57:54] <Casper> ?
[20:58:23] <doublebeta> Soo... has anyone played with AVR32 here?
[20:58:27] <tomatto_> or you mean in OCR register?
[20:59:28] <tomatto_> and let timer count 65535? or how do you exactly mean?
[21:01:12] <Tom_itx> doublebeta, they do that in ##avr32
[21:01:33] <Tom_itx> err #avr32
[21:01:45] <doublebeta> K, I'll join that too. Sorry.
[21:02:02] <Tom_itx> not alot of activity there
[21:02:49] <doublebeta> Oh hey, turns out there IS an #arm
[21:02:54] <doublebeta> But it's pmuch empty
[21:12:43] <tomatto_> Casper: please give me more info
[21:13:16] <Casper> tomatto_: you can not use the 16 bits as 2 8 bits, however you can use it as a 8 bits
[21:13:28] <Casper> but why ain't you using the 8 bits one?
[21:13:35] <Casper> each timer should work for 2 channel
[21:14:51] <tomatto_> Casper: with 16bit timer i can't get 50KHz pwm output. only this one 16bit register has 2 channels, hasn't it?
[21:15:41] <Casper> tomatto_: check the datasheet, 8 bits should have 2 pwm out. beside you do not have to use the full 16 bits resolution
[21:15:59] <Casper> for example set the top to be 255 and make it go from bottom to top
[21:16:11] <Casper> that would be the equivalent of a 8 bits
[21:16:52] <tomatto_> for me is enought 8bit resolution
[21:17:59] <tomatto_> Casper: timer0 hasn't pwm output and timer2 has only OCR2 according to datasheet
[21:19:51] <Casper> weird part, but still, playing with the top value will adjust the frequency anyway
[21:21:28] <tomatto_> do you mean OCR1xH register?
[21:23:44] <Casper> I forgot the register name
[21:24:49] <tomatto_> but still TCNT1 will count from 0 to 65535, so how can i get 50KHz with it?
[21:25:52] <Casper> set the mode so it stop at TOP and not at MAX
[21:26:09] <Casper> and it won't go to MAX but to TOP then back to 0
[21:26:35] <Casper> as said in the datasheet that you seems to not read enought, else you would have seen that, specially since I told you :D
[21:37:00] <tomatto_> Casper: i don't see where, or how set what you said
[21:41:40] <tomatto_> maybe Fast PWM, 8-bit
[21:41:47] <tomatto_> is what i want