#avr | Logs for 2013-08-22

Back
[03:02:16] <plouf> hello
[03:02:31] <plouf> newbie question about studio4 + win avr
[03:02:37] <plouf> i have install both
[03:02:56] <plouf> d/l a project (siam32)
[03:03:34] <plouf> trying to compile but come with error
[03:03:37] <plouf> make: *** No rule to make target `..//E/Downloads/siam32/test_client_avr.c', needed by `test_client_avr.o'. Stop.
[03:19:34] <Tom_itx> add the file to your dependency list on the left
[03:23:31] <plouf> you mean right
[03:23:39] <plouf> i try something simpler
[03:23:46] <plouf> new project
[03:23:57] <plouf> void main (void)
[03:23:57] <plouf> {
[03:23:57] <plouf> }
[03:24:01] <plouf> code is the above
[03:24:13] <plouf> i press build
[03:24:25] <plouf> make: [test.o] Error 127 (ignored)
[03:24:38] <plouf> Build started 22.8.2013 at 11:09:16
[03:24:38] <plouf> mmcu=atmega32 -Wall -gdwarf-2 -std=gnu99 -DF_CPU=15000000UL -Os -funsigned-char -funsigned-bitfields -fpack-struct -fshort-enums -MD -MP -MT test.o -MF dep/test.o.d -c ../test.c
[03:24:38] <plouf> /usr/bin/sh: -Wall: command not found
[03:24:38] <plouf> make: [test.o] Error 127 (ignored)
[03:24:38] <plouf> mmcu=atmega32 -Wl,-Map=test.map test.o -o test.elf
[03:24:39] <plouf> /usr/bin/sh: -Wl,-Map=test.map: command not found
[03:24:41] <plouf> make: [test.elf] Error 127 (ignored)
[03:24:44] <plouf> avr-objcopy -O ihex -R .eeprom -R .fuse -R .lock -R .signature test.elf test.hex
[03:24:45] <plouf> avr-objcopy: 'test.elf': No such file
[03:24:47] <plouf> make: *** [test.hex] Error 1
[03:24:49] <plouf> Build failed with 1 errors and 0 warnings...
[03:46:44] <Tom_itx> #include <avr/io.h>
[03:47:08] <Tom_itx> add that above main
[03:47:44] <Tom_itx> although studio should know
[03:50:49] <plouf> same
[03:52:19] <asteve> I recommend http://www.pastie.org or http://www.github.com
[04:04:43] <plouf> hm reinstall avrstudio at least compiles the "viod one .. lets see
[06:11:38] <plouf> hm
[06:11:53] <plouf> seems that studio4.18 was the last supporting winavr
[06:12:00] <plouf> from 4.19 only avr toolchain
[06:14:08] <Roklobsta> is that a problem?
[06:18:34] <plouf> dunno hope not
[06:18:54] <plouf> i have installed 4.18 ang starting to get many error in compilation
[06:19:07] <plouf> seems to work , but hope tha it will compile :)
[07:26:18] <Tom_itx> the new ones have winavr built in
[07:27:20] <Tom_itx> and you can download just the winavr from atmel separate from studio 6.xx
[09:00:57] <Elco> winavr is incredibly outdated and the one that whips with arduino is even worse
[09:01:06] <Elco> the atmel toolchain is much, much better
[09:49:31] <cmanders_> Hey Dean, just sent your my current code, still having issues
[09:49:50] <abcminiuser> Yeah I know, unwinding a bit before I start reading it
[09:49:51] <abcminiuser> :P
[09:50:15] <cmanders_> no problem, really appreciate you taking a look
[09:50:21] <cmanders_> i think it is quite close
[09:50:44] <abcminiuser> Sa brura
[10:46:16] * RikusW might see RMS at a talk http://www.ncc.co.za/content/view/50/124/
[10:58:38] * abcminiuser reboots brain
[10:58:41] <abcminiuser> Okiedokie
[10:58:47] * abcminiuser cracks knucles
[12:06:45] <avrdood> what is the voltage supposed to be on the /SS line ?
[12:06:59] <avrdood> when it is high, just like every gpio port?
[12:08:31] <Casper> yup
[12:09:47] <avrdood> ohhh
[12:09:51] <avrdood> here is my init:
[12:09:53] <avrdood> DDRB= 0b10111111; // DDRB=0b10111111 PORTB=0b10110000;
[12:10:16] <avrdood> this sets /SS as an output and gives the HIGH value
[12:10:21] <avrdood> is this corect?
[12:10:30] <avrdood> if so , my chip is broken
[12:11:26] <soul-d> it sets most of port B as out put and if the port b parts is behind // not on a new line it does noting
[12:11:59] <soul-d> DDR data direction bits
[12:12:06] <soul-d> portb the actual out
[12:12:10] <soul-d> for those bits
[12:12:34] <avrdood> portb sets high for 1 and low for 0
[12:12:36] <Casper> soul-d: but... DDR is also double dada rate... and most importantly... it is also... Dance Dance Revolution! :D
[12:12:52] <avrdood> on output, and for the inputs it enable the pull up
[12:13:06] <soul-d> :)
[12:13:07] <Casper> yay the laptop turned off! time of death: 12:58
[12:13:24] <soul-d> lol
[12:13:25] <avrdood> and is it normal that the clock signal is so low voltage?
[12:13:49] <Casper> 1:30 on battery in the bios, not too bad
[12:14:21] <soul-d> oh temporarily wonderd who has so much fun over a dieing laptop :P
[12:14:41] * Casper goes make a sticker... CH22 B090 ← can someone figure out what this mean? :D
[18:22:19] <AndreeeCZ> Hi. Im using arduino with atmega 2560 and using this code to send to it via /dev/ttyACM0
[18:22:19] <AndreeeCZ> http://pastebin.com/4x9yXKF2
[18:22:39] <AndreeeCZ> could you pls take a look at it and see if there is something "in the face" wrong?
[18:23:10] <N1njaneer> Can you tell us what it's not doing correctly?
[18:23:23] <AndreeeCZ> dont mind the ugliness, the only thing i need is to send an int to it via virtual com port
[18:23:29] <AndreeeCZ> its not sending it
[18:23:32] <N1njaneer> And what your hardware looks like, firmware running, etc.
[18:23:52] <N1njaneer> Have you checked the serial port output with a scope / another terminal, etc?
[18:23:54] <AndreeeCZ> i tried asking on #arduino and #raspberry but to no avail
[18:24:08] <N1njaneer> Need to isolate it to ensure which end the problem is at :)
[18:24:20] <AndreeeCZ> ok
[18:24:27] <Tom_itx> #arduino didn't know about arduino???!
[18:24:36] <Tom_itx> wtf
[18:24:48] <Tom_itx> rasberry is arm
[18:24:51] <AndreeeCZ> they have been unable to help
[18:24:58] <Tom_itx> no surprise there
[18:25:04] <N1njaneer> Andre: Sanity-check the serial port to make sure it's working on the machine. I had someone with a problem that couldn't get the serial port to work and spent hours before realizing he was opening the wrong port # XD
[18:26:24] <AndreeeCZ> when running screen /dev/ttyACM0
[18:26:32] <AndreeeCZ> i can send chars to the arduino
[18:27:03] <AndreeeCZ> so /dev/ttyACM0 is working and correct
[18:27:18] <AndreeeCZ> that means permissions are also correct
[18:28:34] <avrdood> is there a tutorial on how to write menus for rs-232 terminal ?
[18:28:39] <avrdood> havent found yet
[18:29:02] <AndreeeCZ> that code is something i assembled from various tutorials.
[18:29:03] <Tom_itx> that's the arduino code?
[18:29:05] <avrdood> including real-time acquisition
[18:29:08] <Tom_itx> are you passing parameters to main?
[18:29:19] <avrdood> like you start a spi acquisition, stop it, show values etc
[18:29:21] <AndreeeCZ> the only thing i need really is to send an uint8_t
[18:29:22] <Tom_itx> why do you have parameters on main? not that it's the problem...
[18:29:24] <avrdood> or adc..
[18:29:25] <AndreeeCZ> Tom_itx, of course
[18:29:30] <AndreeeCZ> ./send 1
[18:30:14] <AndreeeCZ> Tom_itx, strange thing: if i run screen and then detach from it (keep it running in background)
[18:30:21] <AndreeeCZ> i can sudo ./send 1 and it works
[18:30:26] <AndreeeCZ> w8 let me check again
[18:31:05] <AndreeeCZ> ok now it doesnt
[18:31:11] <Tom_itx> i don't recall ever seeing parameters passed to main on a C
[18:31:32] <AndreeeCZ> Tom_itx, this is running on a raspberry
[18:31:34] <Tom_itx> i know on a pc they're default parameters
[18:31:45] <AndreeeCZ> which is connected to arduino via usb
[18:32:06] <Tom_itx> Im using arduino with atmega 2560 and using this code to send to it via /dev/ttyACM0
[18:32:13] <Tom_itx> is this avr code or arm?
[18:32:54] <AndreeeCZ> im not shure what you mean, but the program is running on raspberry, so arm
[18:33:06] <Tom_itx> this is avr
[18:33:11] <Tom_itx> can't help you there
[18:33:26] <Tom_itx> maybe someone here could
[18:33:40] <Tom_itx> i assumed it was the 2560 code
[18:34:02] <Tom_itx> which appeared a bit odd but then arduino code is a bit odd
[18:34:33] <AndreeeCZ> i went here because i dont know what else to do.
[18:35:55] <AndreeeCZ> i cant find a simple tutorial on how to send an integer from raspberry to arduino via a virtual com port
[18:36:17] <Tom_itx> you could also ask in #seattlerobotics
[18:36:22] <Tom_itx> or #robotics
[18:36:50] <N1njaneer> (hold one)
[18:37:44] <Tom_itx> you may have to wait a bit for a reply there
[18:38:04] <AndreeeCZ> ok thx
[18:41:26] <jadew> avrdood, like normal...
[18:41:43] <avrdood> jadew: ?
[18:42:05] <jadew> did you ever do a text based menu?
[18:42:20] <jadew> any platform
[18:42:23] <Tom_itx> i did one but wasn't so happy with it
[18:42:24] <avrdood> yes but without input from the microcontroller
[18:42:40] <jadew> well, it's just the same
[18:42:44] <Tom_itx> the one in marlin isn't too bad
[18:42:51] <jadew> what's merlin?
[18:42:58] <Tom_itx> the reprapper stuff
[18:43:04] <jadew> ah, I don't know it
[18:43:07] <avrdood> yes..
[18:43:08] <Tom_itx> uses an encoder for selecting
[18:43:22] <Tom_itx> and a button on the encoder to select the item
[18:43:31] <avrdood> just wanted to save some time
[18:43:41] <jadew> I'm more of a command line guy, especially when it comes to serial
[18:43:58] <Tom_itx> mine was a complete hack
[18:44:12] <avrdood> i put printf and scanf as part of a stream
[18:44:21] <avrdood> configured with the uart
[18:44:26] <Tom_itx> oh wait..
[18:44:29] <avrdood> only have to put some printf and scanf in there
[18:44:46] <avrdood> and polling mode for uart
[18:44:49] <avrdood> anyways
[18:45:16] <Tom_itx> http://tom-itx.dyndns.org:81/~webpage/avr/rs232_rx_test/
[18:45:21] <Tom_itx> that might give you an idea
[18:45:26] <Tom_itx> not a menu as such
[18:45:34] <Tom_itx> input from serial to select?
[18:46:01] <N1njaneer> Andre: If you aren't seeing any characters come out of your example, I'd check some return error codes on some of the additional commands you are using to configure the port and to send data. If it's not working write() or open_port() or tcsetattr() should be throwing an error, etc
[18:46:02] <avrdood> yes my code have that without the interrupt
[18:46:21] <avrdood> i was more looking for nice menu template for sensor acquisition
[18:46:35] <avrdood> tom_itx: but thanks :) , what does it do exactly?
[18:48:02] <Tom_itx> i forget now.. blinks a led one way or the other based on a keypress
[18:48:31] <avrdood> so there's communication only when a key is pressed
[18:48:46] <Tom_itx> it's waiting for the rx interrupt
[18:48:53] <avrdood> ok
[18:49:11] <avrdood> ive never used interrupts before
[18:51:54] <Tom_itx> well it's about damn time
[18:52:24] <avrdood> no need to
[19:09:11] <tzanger> Interrupts aren't tricky. There are only a couple things to keep in mind
[19:09:42] <tzanger> 1. They are interrupts. Don't do heavy work in them, and that goes double for using printf
[19:10:34] <tzanger> 1a. If you have to do something heavy, set a flag and have your main loop watch for the flag.
[19:11:34] <N1njaneer> B. You have to be aware that interrupts can preempt and jump-in to any task at any point between any instructions, so it's critical to consider how cross-over data elements may interact, and to use critical sections around any area that may be problematic, especially in test/set scenarios.
[19:11:36] <w|zzy> come on.. but I want to take a reading, do floating point math on it and print it to the serial line every 100ms!
[19:11:36] <tzanger> 2. Any variables you change in an interrupt that are read anywhere else MUST be declared "volatile" or you will tear your hair out trying to debug it
[19:11:55] <N1njaneer> tz: I was just going to mention learning to love "volatile" :D
[19:11:59] <Tom_itx> tzanger so true
[19:12:00] <w|zzy> you'll become volatile if your variables aren't
[19:12:25] <N1njaneer> I make all my variables volatile, even the const ones in PROGMEM, just to be sure. :)
[19:12:34] <tzanger> N1njaneer: Yep although if written correctly you won't need locking mechanisms except in the rarest of places
[19:13:21] <w|zzy> can't excessively using volatile cause slow downs?
[19:13:54] <jadew> it can
[19:13:56] <N1njaneer> w: Volatile removes certain compiler optimization assumptions, so yes, it certainly can if you're compiling with any optimization on
[19:14:12] <tzanger> e.g. if you want to read an i2c device in an interrupt handler, don't. Not only is i2c slow as hell, but you will need to use locking to ensure any other i2c accesses by your main code don't get interrupted mid-transfer
[19:15:01] <N1njaneer> Correct. But also test-set statements are prone to very subtle and difficult to debug preemption problems if you are not careful.
[19:15:03] <tzanger> It's highly unlikely to cause slowdowns if used correctly, mainly because the code won't work right without it and code that is fast but broken is useless. :-)
[19:15:35] <tzanger> N1njaneer: Sure, but that's all part of the locking primitives.
[19:16:17] <w|zzy> I don't use volatile too often.
[19:16:44] <tzanger> My usual application start point is a 1ms interrupt that counts to 1000 and "peels off" 1ms, 10ms, 100ms and 1000ms intervals
[19:16:49] <Valen> volatile all the things!
[19:17:01] <N1njaneer> i.e. "if(x < 5) x++;" -- if x tests true for being less than five, then an interrupt jump happens and modifies x to something that makes x >= 5, the return happens and x is still incremented. And it will happen once in a blue moon when the interrupt occurs EXACTLY between the compare and jump operations.
[19:17:17] <tzanger> The ISR does nothing but set Boolean flags for these events. The main loop tests for these and clears them.
[19:18:12] <N1njaneer> tz: Depending on how intensive the operation is, sei() and cei() are single clock-cycle ways to form critical sections without the immense overhead of a formal semaphore. Sometimes the application can afford that, but sometimes it can't.
[19:18:34] <tzanger> So if you want a routine to run every 100ms you do something like if (onehundred_ms) { onehundred_ms = false; keyboard_loop(); } for example
[19:19:16] <w|zzy> almost into rtos territory.
[19:19:20] <N1njaneer> One also has to be aware of what interrupts can preempt other interrupts, and when you may or may not want this to happen.
[19:19:29] <tzanger> N1njaneer: Yes, and on avrs you must use sei/cli to do any atomic operations such as an emulated cmpxchg
[19:19:58] <ferdna> there is a site with most common made schematics...
[19:20:03] <ferdna> anyone remembers the url?
[19:20:10] <ferdna> *knows
[19:20:32] <ferdna> i think they use eagle i am not sure
[19:21:32] <tzanger> Anyway that kind of main loop lets you quickly build up an application and get things going. If a routine that is supposed to be called every 100ms takes 200ms to run, you don't get a backlog and the erroneous operation gives it away. You can then either move the heavy code to a slower time loop or break it up so that the part that has to be called quickly can in fact be called quickly.
[19:21:50] <Valen> i believe you are meant to use atomic block flags or something rather than sei manually (at least in theory, i haven't seen it in the wild)
[19:22:36] <N1njaneer> tz: Yes, t'was my point. :)
[19:22:50] <tzanger> It's not perfect in the sense that it does not give you preemptive multitasking and a slow routine can cause a must-be-called-quickly routine to be called less often, but it easily covers 99% of micro applications.
[19:23:04] <Valen> you should take a look at the apollo landing module system, now that was neat
[19:23:15] <N1njaneer> Valen: On AVR there are no atomic test-and-set instructions in the op-code set, so you are kind of forced to use cei/sei pairs.
[19:23:18] <tzanger> The last 10% you will know how to write because you'll have become experienced enough to identify them. :-)
[19:23:41] <Valen> N1njaneer: its a macro i believe
[19:23:44] <tzanger> Valen: I have, and it is
[19:23:55] <avrdood> whats does volatile do?
[19:23:57] <N1njaneer> Valen: macro >> op-code
[19:24:21] <Valen> http://www.nongnu.org/avr-libc/user-manual/group__util__atomic.html
[19:24:22] <N1njaneer> Valen: If it's more than a single clock-cycle for a test-and-set instruction, the pair can and will get split at the worst time :)
[19:24:54] <tzanger> avrdood: Volatile tells the compiler it cannot make an assumption that a variable has not changed.
[19:24:57] <N1njaneer> Valen: That's exactly it - SEI sets the I bit, CEI clears the I bit :)
[19:25:05] <tzanger> avrdood: Examole
[19:25:54] <tzanger> Example: while (! flag) { i++; }
[19:26:43] <avrdood> ?
[19:26:50] <tzanger> If flag is not declared volatile, the compiler can assume that since flag does not get changed in the loop, the compiler can read the variable once before entering the while.
[19:26:54] <Valen> that's great N1njaneer, now if you use the atomic functions you get a more readable and clearer end result hence "(10:07:03) Valen: i believe you are meant to use atomic block"
[19:27:02] <avrdood> if you increment a variable...its content go up so what does the compiler have to say about that?!
[19:27:16] <tzanger> If it is declared volatile, the compiler must read flag every time through the loop.
[19:28:20] <N1njaneer> tz: My point was not the style, it was speaking of the techique and why you need to use atomic operations explicitly on an architecture that doesn't contain test-and-set op-codes :)
[19:29:33] <tzanger> avrdood: Worse, the compiler may decide to read flag every loop when compiled with -O0, but once you are getting constrained for space you may turn on -Os and now the program doesn't work any more... And you'll pull your hair out trying to figure out why turning on optimization breaks your code
[19:30:38] <tzanger> avrdood: This will lead to silly things like declaring the compiler buggy, the people in this chan idiots because the code is obviously correct, and will paint you a n00b. :-)
[19:32:19] <tzanger> avrdood: You've gone dark on me... Are you confused or just digesting?
[19:34:59] <tzanger> Actually everyone's gone quiet, is my client hosed?
[19:36:03] <Tom_itx> you're hosed
[19:36:08] <Valen> no we just all decided you smelt funny and left
[19:36:21] <tzanger> Lol
[19:41:31] <Valen> http://www.doneyles.com/LM/Tales.html btw, just don't read it if you are busy
[19:43:16] <avrdood> tzanger: confused actually
[19:43:44] <avrdood> tzanger : and not using interrupts atm
[19:44:06] <avrdood> too busy making a breadbord with max31855 that doesnt have contact issues
[19:44:16] <tzanger> Confused how
[19:44:24] <avrdood> all these flags
[19:44:40] <avrdood> and constrained for space that breaks code !?
[19:44:54] <jadew> avrdood: http://www.youtube.com/watch?v=J5Sb21qbpEQ
[19:44:55] <jadew> YouTube: EEVblog #180 - Soldering Tutorial Part 1 - Tools
[19:45:36] <tzanger> avrdood: All these flags?
[19:45:51] <tzanger> There was only one
[19:46:20] <avrdood> yes im about to solder the whole thing
[19:46:29] <soul-d> breadboarding without issues :> is like taking dump without wiping at some point stuff gets messy no matter how carefull
[19:46:30] <avrdood> i didnt wanted to solder on the headers of my stk500
[19:46:43] <tzanger> soul-d: Hahahahaha
[19:47:08] <avrdood> you just threw that at me D:
[19:47:31] * jadew wants a PCB factory
[19:47:41] <tzanger> jadew: Good lord why
[19:47:57] <jadew> so I don't have to make the PCBs myself
[19:48:07] <avrdood> heh?
[19:48:13] <avrdood> its way cheaper to do it yourself buddy\
[19:48:18] <soul-d> but i can't talk been messing with state machienes all day still doesn't make sense
[19:48:18] <tzanger> If I had to make my own I would use a cnc
[19:48:26] <jadew> avrdood, it's not that much cheapper
[19:48:41] <jadew> 5x5 cm double sided pcb goes for $1!
[19:48:46] <tzanger> Most of my boards are min. 4 layer now though
[19:48:47] <jadew> that's super cheap
[19:48:57] <avrdood> plus shipping
[19:49:03] <jadew> free shipping from china
[19:49:14] <jadew> but you have to buy 10 :P
[19:49:21] <avrdood> >.>
[19:49:25] <avrdood> and get them in 2 weeks...
[19:49:29] <jadew> 1 month
[19:49:31] <avrdood> build your own in a few hours!
[19:49:33] <avrdood> ouch
[19:49:52] <avrdood> of course above 2 layers its too hard
[19:50:01] <jadew> even 2 layers is hard enough
[19:50:03] <tzanger> I don't do cheap most times. Sunstone for multilayer, apcircuits for single/dual. They're cheap enough and I know them
[19:50:05] <avrdood> or just glue them together
[19:50:07] <avrdood> yes
[19:50:12] <jadew> tzanger, how much do you pay for the 4 layer boards?
[19:50:45] <N1njaneer> www.66each.com for US fab of 4-layer :)
[19:50:50] <tzanger> jadew: Get a quote from their site. They'll do direct eagle imports too
[19:50:52] <N1njaneer> They are $66 each :)
[19:50:59] <avrdood> d:
[19:51:00] <avrdood> D:
[19:51:05] <tzanger> I get them electrically tested too
[19:51:07] <jadew> haha, good site name
[19:51:46] <jadew> tzanger, the $1 5x5 pcb gets full e-test too
[19:52:03] <tzanger> I think my boards are usually around $150 with electrical test and shipping, and that'll be for a pair of 6x8ish panels, routed
[19:52:11] <N1njaneer> I have gotten small quantities of 20" x 20" 4-layer gold ENIG 0.030" boards done SAME DAY at Advanced Circuits. It's not cheap. :)
[19:52:30] <jadew> damn
[19:52:32] <tzanger> jadew: How thick copper, any lamination or registration issues? I've had some really bad experiences
[19:52:52] <N1njaneer> tz: If you've ever had those kind of problems, find a different board house :)
[19:53:02] <jadew> tzanger, don't know the thikness of the coper, I think you get to chose and no, I haven't had any issues with them
[19:53:09] <tzanger> N1njaneer: I did. Sunstone and apcircuits. :-)
[19:53:13] <jadew> brb, kid crying
[19:53:30] <N1njaneer> We go through thousands of PCBs here a month at times and have never had an issue :)
[19:53:47] <tzanger> If you plan it right you can get electrical test thrown in too
[19:54:03] <N1njaneer> E-test is free on all of our orders :)
[19:54:23] <tzanger> Oh 66pcb is just advanced. Yes they are a good board house
[19:54:34] <N1njaneer> 5th largest in the US :)
[19:54:54] <tzanger> I wonder why all board houses tend to be o.
[19:54:56] <N1njaneer> A bit expensive at times for normal production, but they will match anyone else's pricing for apples-to-apples domestic urns
[19:54:58] <tzanger> On the west coast
[19:55:03] <N1njaneer> +turns
[19:55:12] <N1njaneer> Ac is in CO
[19:55:19] <tzanger> I know. Most are
[19:55:21] <N1njaneer> If you are ever in Denver, go take a tour :)
[19:55:46] <tzanger> I had a 2y contract out there with Aircell
[23:55:10] <Valen> anybody have handy a setup for timer0 to give a ~100Hz interrupt rate??