#avr | Logs for 2013-09-01

Back
[00:27:36] <MarkX_> Xark: looks like visual assist comes with the color correction! going to try it out sometime this week :D
[00:28:10] <Xark> MarkX_: Oh yeah, that is right. Much "smarter" color than default VS. :)
[00:28:41] <Xark> MarkX_: Visual Assist is awesome. Only downside is it is a bit pricey (I got work to buy it for me).
[00:28:49] <MarkX_> i will too
[00:28:54] <MarkX_> company credit card :D
[00:29:00] <Xark> Sweet. :D
[00:29:38] <Xark> It is "per user" so you can install it on all the machines you use legally.
[00:34:54] <MarkX_> beauty
[02:27:18] <braincracker> http://www.youtube.com/watch?v=yLKR6RrhGJs
[02:27:33] <braincracker> what can you do with a Hexapod ?
[02:34:22] <braincracker> Mantis - Hexapod Walking Machine Tests 2012 http://www.youtube.com/watch?v=1sRlFQLwg3w hahaha i want one, would be great going shopping with this ^^
[06:05:30] <Zad0k> hello
[06:06:14] <Zad0k> Where can I have information about serial communication with an Attiny85 WITHOUT using an arduino or arduino libraries ? thanks
[06:11:07] <Xark> Zad0k: Perhaps http://www.atmel.com/Images/doc4300.pdf
[06:12:03] <Zad0k> Thanks wark, I'll use that
[06:12:37] <Zad0k> I was wondering, what is the arduino code exactly? A mix between c and c++ ?
[06:13:03] <Xark> Zad0k: There is also http://eluaexamples.googlecode.com/svn-history/r127/trunk/eluarotary/avr-controller/softuart.c which may be interesting.
[06:13:42] <Zad0k> Hoho, this is far more intetesting since I have some code to use, thanks a lot
[06:13:43] <Xark> Zad0k: It is just C++. The IDE does a minor amount of preprocessing to add #include and prototypes for your sketch.
[06:14:17] <Zad0k> Ok, but there is a difference between programming an avr uC with atmel studio and the arduino IDE, sin't it?
[06:14:36] <Xark> Zad0k: Not really other than the libraries.
[06:14:47] <Xark> Zad0k: They both use avr-gcc.
[06:15:18] <Xark> Zad0k: I believe if you override "main" in Arduino, you can do pretty much the same things as AVR Studio.
[06:15:45] <Zad0k> So an arduino code is usable in atmel studio to program an uC ?
[06:15:53] <Zad0k> With a little modifications of course
[06:17:33] <Xark> Zad0k: Yes. Typically the biggest problem with be calling Arduino library functions (but the source for all these is under the IDE directory, worst case).
[06:17:45] <Xark> will be*
[06:19:09] <Zad0k> But is C code made in atmel studio usable in the arduino IDE then ? (I ask a lot of questions...)
[06:22:32] <Zad0k> In fact I want to use this serial output on my router with an attiny85 to blink a led over the internet http://zad0k.rtfm.re/dl/images/mr3020.jpg
[06:23:07] <Zad0k> I know how to do it with an arduino, but not with an attiny
[06:31:51] <Xark> Zad0k: Yes, it is the same compiler.
[06:33:26] <Xark> Zad0k: You can use ATTiny in Ardiunino IDE, but typically you need an ISP programmer. See http://hlt.media.mit.edu/?p=1695
[07:07:09] <Zad0k> I have goy one Wark
[07:07:30] <Zad0k> But I don't want to use arduino, I don't really like it. I have got an usbasp programmer
[07:12:56] <Xark> No worries. :)
[08:19:06] <abcminiuser> Damn releases always take forever
[08:19:10] * abcminiuser *sigh*
[08:21:02] <specing> RELEASE THE KRAKEN!
[08:21:12] <abcminiuser> Someone else can do it next time
[08:21:49] <abcminiuser> Fix documentation version, run the release buld test script, build bootloaders, package core, package documentation, build studio extension, test all three
[08:21:59] <abcminiuser> Upload on my site, on google code, update project page
[08:22:08] <abcminiuser> Write release blog post, update project on AVRFreaks
[08:22:16] <abcminiuser> :P
[08:31:40] <age> Hi. I've experienced a non-functioning 'if' statement earlier today with this code: http://codepad.org/laT0JdZy (tiny13a). An obvious guess would be that it's an optimization issue, but the problematic flag is declared 'volatile' and I've tried -Os, -O2, -O3. Any other ideas as to what's broken here?
[08:34:26] <age> (the compiler is avr-gcc 4.8.0)
[08:42:14] <CMLinux> hey Dean
[08:44:21] <abcminiuser> Yahoyhoy
[08:44:46] <CMLinux> did you happen to see my messages a few days ago?
[08:46:05] <CMLinux> things are basically working
[08:46:16] <abcminiuser> Err, possibly...
[08:46:26] <abcminiuser> Refresh?
[08:46:44] <CMLinux> no problem, the data is getting through, the pointer doesn't latch the finger position
[08:47:09] <CMLinux> but that is probably because physical maximum is not set correctly in the hid descriptor
[08:47:14] <CMLinux> or something like that
[08:47:53] <CMLinux> also, there is a daily substantial lag, one is likely a delay i have in a main loop
[08:48:42] <CMLinux> but, before, if i turn up the baud rate from the atmega16u2 to the micro controller running the main, the data gets messed up
[08:49:09] <CMLinux> but i only tried moving from 9600 baud to 115200, which may have been a bit extreme
[08:50:22] <CMLinux> anyhow, so there are those two issues, which feel soluble and comparative minor to getting the whole thing going, which took a lot of trial and erro
[08:52:23] <CMLinux> any advice on either situation?
[08:54:03] <CMLinux> do you happen to know what happens if you set the physical maximum for the x and y values in the hid descriptor to 0? i can't seem to find much information in the usb specification
[08:59:04] <CMLinux> Dean?
[09:00:17] <abcminiuser> Whoops :P
[09:00:33] <abcminiuser> The phys min/max adjusts the resolution
[09:00:45] <abcminiuser> Logical mix/max sets the actual valid value range
[09:00:58] <abcminiuser> Have you set the IN values to relative or absolute?
[09:01:14] <CMLinux> but if the resolution of the display changes, shouldn't the physical min/max also change
[09:01:33] <CMLinux> seems like it should happen automagically somehow
[09:01:47] <CMLinux> the IN values are absolute
[09:01:57] <CMLinux> but, i should double check
[09:07:11] <CMLinux> actually, if i set the phys max correctly, it could help with end goal of the whole project
[09:08:03] <CMLinux> any idea idea about the baud rate and the lag? i saw someone else asked you a similar question before, but i didn't see a solution
[09:08:19] <abcminiuser> The resolution is calced from the physical and logical max/min
[09:08:46] <CMLinux> ok, cool
[09:08:51] <abcminiuser> The ratio dictates how much the pointer moves on the display (there's a formula in the spec)
[09:09:21] <CMLinux> ok, i can get that happening
[09:09:33] <abcminiuser> For baud rate, make sure the USART error rate is acceptable
[09:09:47] <abcminiuser> You don't want more than +/- 2% error
[09:09:48] <CMLinux> is there an easy way to do that?
[09:09:50] <abcminiuser> preferably less
[09:10:01] <abcminiuser> Yes, the datasheet has a table of values and errors
[09:10:15] <abcminiuser> Also, easier: http://www.wormfood.net/avrbaudcalc.php
[09:10:24] <WormFood> :D
[09:10:28] <CMLinux> ok, i'll check it out
[09:10:59] <CMLinux> thanks though… it's really stating to work, probably just need to get through these issues
[09:11:16] <CMLinux> LUFA is really amazing
[09:11:50] <abcminiuser> New release today :)
[09:12:15] <CMLinux> moved out of beta?
[09:13:01] <CMLinux> the atmega16u2 is running at 16MHz, at 115200 the error is 3.7
[09:13:33] <CMLinux> i guess i should set it to 76800, where the error is only 0.2
[09:19:20] <abcminiuser> Yeah, out of beta this afternoon
[09:19:31] <abcminiuser> Jupp, 3.7% is too high
[09:21:20] <CMLinux> likely can't change the clock speed right? but it probably doesn't matter
[09:21:30] <CMLinux> 76800 is probably high enough
[09:22:48] <CMLinux> if i could run the 16u2 at 18.432MHz, the error rate is 0 for all baud rates
[09:22:51] <abcminiuser> Yeah 8MHz or 16Mhz only
[09:23:00] <abcminiuser> God knows why the hell they designed it that way
[09:23:46] <WormFood> my avr bit rate calc, will allow you to input your target bit rate, and it will give you every crystal that will produce that bit rate...if that helps.
[09:23:48] <CMLinux> it's on an arduino, i don't know if the pulse is from an external crystal, or onboard the 16u2
[09:24:08] <CMLinux> ya, i'm looking at your page right now
[10:40:35] <megal0maniac_afk> abcminiuser: :D
[10:42:00] <megal0maniac> And i sent that before I even realised that I made it into the changelog :P
[11:00:01] <abcminiuser> The wha?
[11:00:04] <abcminiuser> Or right
[11:00:06] <abcminiuser> Ja :)
[11:00:16] <megal0maniac> And for interest sake, since CMLinux is gone, the 16u2 on the arduino uses a standard full-size 16mhz crystal. There's a tiny surface mount one for the 328p. Apparently USB clock is more mission-critical than operation of the Arduino itself
[11:01:14] <abcminiuser> Actually that kinda makes sense
[11:01:26] <abcminiuser> You use a 32KHz crystal for asyn timer RTC operations
[11:01:40] <abcminiuser> That said, just use full size for both :P
[11:01:55] <megal0maniac> No, but both of them are 16mhz
[11:02:30] <abcminiuser> Might as well share them
[11:02:36] <abcminiuser> Feed it into the USB AVR, enable CLKOUT
[11:02:44] <abcminiuser> Then feed that into the secondary controller
[11:02:46] <megal0maniac> Exactly. Cheaper too
[11:03:03] <megal0maniac> Then they're sync'd
[11:03:17] <megal0maniac> Not that it matters much, but yeah.
[11:03:30] <megal0maniac> Or maybe it does. I don't know :/
[11:05:43] <megal0maniac> In any case, it's Arduino. No sense in thinking too hard about it ;)
[11:16:53] <megal0maniac> To run two devices directly off one crystal, you need some kind of buffer, right?
[11:17:34] <abcminiuser> You can run one in crystal mode and the other in external clock
[11:17:42] <abcminiuser> But it's not recommended by any stretch
[11:18:34] <megal0maniac> Because a crystal can
[11:18:44] <megal0maniac> 't "drive" an input as far as I understand it
[11:20:10] <abcminiuser> I think the additive capacitive load can affect it
[11:42:10] <age> Sorry for repeating myself, but I really need some ideas on why the 'if' statement here would not work: http://codepad.org/OtyTFpLZ
[11:43:05] <abcminiuser> Looks OK, but why would you change DDRB?
[11:43:22] <abcminiuser> Which toolchain?
[11:44:46] <abcminiuser> -nostartfiles removes the init code IIRC, which means your RAM might not be zero-inited
[11:45:37] <age> abcminiuser, avr-gcc; it's an IR transmitter, I'm just enabling the output port
[11:46:10] <age> I had to do that because it would work for tiny13, but not 13a, it's a known bug iirc
[11:46:31] <timemage> age, right, but you may have to manually = 0 in main() rather than trying to init the global.
[11:47:45] <age> timemage, I don't see how that would make a difference; I'm assigning 1 to it in the ISR anyway, and if it was 1 at the beginning, I'd see some output on the scope
[11:48:46] <timemage> age, no way to know what you were expecting to see and what you were seeing based on "not work".
[11:50:28] <age> timemage, see commented out code; if I enable PB0 as output right in the ISR, I can see a 36 kHz signal on the scope; if I set the flag, and the if condition is still not met, I'm not seeing a signal
[11:53:22] <age> hmm; still, it must be a compilation issue, since I have an exact same tiny13a on a different board, setting volatile flags from ISRs works, and the only difference is that avr-gcc is passed -mmcu=attiny13, without the -nostartfiles
[12:06:10] <timemage> age, it may not make any difference, but i would try it anyway. it won't take much effort to try and gcc can do the weirdest things with uninitialized variables when any level of optimization is enabled. speaking of which, see what happens when you -O0?
[12:15:35] <age> timemage, I will, I just don't have the device here :<
[12:16:05] <age> and actually yes, I tried -O2/-O3/-Os, but forgot -O0
[12:18:35] <timemage> age, ok. for what it's worth, i complied the code here and compared some assembly listings. at least for that target and my version of gcc it seems to make no difference in main.s when complied for tiny13 without command-line modifications for start code and tiny13a with modifications. so it probably won't matter. in other targets i've seen gcc plant the clearing code directly into the object file containing main(). i assumed it was doing this for
[12:18:36] <timemage> the 13(a). it isn't.
[12:22:13] <age> so maybe there's a reason it's not supported "out of the box"
[12:22:37] <timemage> age, everything else is equal? the target board, fuse bits, power supply, scope etc?
[12:22:40] <Zad0k> I've been searching for hours, so I'm asking here now: how can I read serial data with an attiny 85?
[12:23:43] <timemage> Zad0k, i think avr has an appnote for that.
[12:23:50] <timemage> Zad0k, atmel rather.
[12:24:13] <specing> Zad0k: the datasheet has a code sample?
[12:24:52] <timemage> Zad0k, try AVR304 (doc0941.pdf)
[12:25:24] <specing> Zad0k: oh wait, the 85 doesen't have a hardware serial port
[12:25:37] <specing> Zad0k: you'll have to bitbang it
[12:25:44] <Zad0k> bitbang?
[12:25:49] <specing> emulate
[12:26:00] <specing> by toggling the relevant pins from software
[12:26:30] <specing> Zad0k: see below on https://en.wikipedia.org/wiki/Rs232 for signal waveform
[12:26:36] <BJfreeman> you can fallow the arduino softserail
[12:26:54] <timemage> Zad0k, that appnote gives an outline for doing it. i'm sure there are implementations of it availabre on the web. if nothing else look at the... thing BJfreeman just mentioned.
[12:27:09] <age> timemage, no, just *similar* code on same model MCU, compiled differently
[12:27:11] <BJfreeman> do a search on attiny85 serial
[12:27:27] <Zad0k> BJfreeman, i've been doing that for a long time
[12:27:35] <specing> Zad0k: you need to be aware that that scope trace was done on true RS232, which is a +- 13V electrical system
[12:27:41] <Zad0k> only arduino things, nothing I can use
[12:27:52] <specing> Zad0k: all line drivers I've used so far invert it
[12:28:16] <Zad0k> The serial datas aren't coming from a computer
[12:28:25] <BJfreeman> zadok you can dig down into softseral and use the AVR part
[12:29:30] <specing> Zad0k: http://sprunge.us/EiEf
[12:29:35] * specing wrote ^
[12:30:30] <specing> I don't know if that works, it has been a long time since I've done t45 work
[12:32:56] <BJfreeman> http://www.atmel.com/Images/doc8488.pdf Precision Software Serial Transmitter for ATtiny
[12:40:15] <Zad0k> I can't understand everything
[12:40:27] <specing> you must
[12:40:57] <timemage> Zad0k, what is your project?
[12:42:53] <Zad0k> I have a tp-link mr3020 router with a serial com port. I can easily send ascii characters through this port from the internet. I want to read this charac with an attiny so i can control things with my router
[12:43:05] <Zad0k> I already did it with an arduino with this code http://pastebin.com/nNjvfwvr
[12:43:26] <Zad0k> but now I want to use an attiny, because I want to shrinkyfu it
[12:43:40] <Zad0k> shrinkify
[12:45:33] <Zad0k> This is my router right now https://pbs.twimg.com/media/BTGBg3wIYAA7zOs.jpg:large
[12:45:55] <Zad0k> It will have a 9v battery powering the router+ the attiny
[12:45:58] <timemage> Zad0k, i have actually seen arduino target the tiny45. it's not in the main files. it's not impossible to get it to work that way. what you might try to do instead is take your arduino code and run it through something like inotool and softwareserial. then start paring away at the software serial code to wrap your brain around what it's doing.
[12:46:54] <timemage> Zad0k, in other words, start with arduino and refactor down to something that will fit on an a tiny avr. you should able to start with something that functions and work stepwise to your goal with some sort of positive reinforcement.
[12:47:20] <Zad0k> I see.
[12:47:32] <timemage> Zad0k, dunno, i could just be crazy.
[12:49:09] <Zad0k> I've found this earlier, it's french, but I couldn't find how to download the library he used http://p.loussouarn.free.fr/arduino/exemple/PortSerieSurATtiny.html
[12:49:26] <timemage> Zad0k, another way you could cheat would be to just look at the serial signal and don't actually interpret it. just us it as a source of pulses. i've done that for quick control with an ir remote. i basically wanted to turn something on and off and decided that i really didn't need to decode the remote protocol anyway. i just needed to see if there was sufficient ir nose there to be someone holding a remote button down. the upshot was the project w
[12:49:26] <timemage> orks with any remote.
[12:51:11] <Zad0k> I see what you mean, but I need to do multiple actions, like turning multiple things on and off
[12:52:45] <timemage> Zad0k, well, i sort of simplified the explanation. i am doing more than merely on-and-off. but yeah, it would be nicer to do it properly if you have the time and effort to learn everything you need.
[12:53:31] <Zad0k> I think I'll cheat by doing this http://www.instructables.com/id/The-9-Quasi-duino-Almost-duino/step6/Celebrate/
[12:53:51] <Zad0k> Use arduino anyway, since it works, but with this project
[12:54:10] <Zad0k> it would fit on the tiny breadboard on my router (cf https://pbs.twimg.com/media/BTGBg3wIYAA7zOs.jpg:large)
[13:35:58] <megal0maniac_afk> Zad0k: What about http://hlt.media.mit.edu/?p=1695
[13:36:10] <megal0maniac_afk> Arduino with the attiny, using software serial
[13:36:41] <Zad0k> ?
[13:36:56] <megal0maniac_afk> Yes, Arduino works on the attiny
[13:37:02] <Zad0k> I have no interest in programming an attiny with arduino
[13:37:06] <Zad0k> I know that
[13:37:15] <Zad0k> not the libraries I want unfortunately
[14:07:49] <antto> two atmegas, with a test "bootloader" having just DDRA = 0x80; while (1) { delay_ms(5); PORTA ^= 0x80; } ... same fuses/locks, same everything, the bootloader is flashed on them, then flash dump from both of them matches 100% and one of them just doesn't function after that
[14:08:47] <antto> in other words, that one appears dead, except that it works perfectly fine when hooked to the programmer
[14:30:03] <timemage> antto, placed in the same circuit?
[14:33:40] <antto> they are surface mount onto the same little board
[14:33:49] <antto> 100 of them
[14:34:46] <antto> so far about 20 of them were flashed with the bootloader and tested (with the same exact procedure) but about 3 or 4 of them failed working afterwards
[14:35:31] <antto> putting them back into the programmer - they work, flash dump == identical as the hex, fuses and lock bits identical
[14:35:50] <antto> then out of the programmer and into the actual device - they appear dead
[14:41:33] <antto> that's why we even tried temporarily with the bootloader just setting up one pin and outputing a square wave in an infinite loop, to see if the thing works at all or not
[14:42:17] <antto> but those few cpus just appear dead no matter what, except that when you put them in the programmer - they work as if nothing happened
[14:42:28] <antto> aliens or what?!
[14:45:01] <timemage> antto, why not? =)
[14:46:27] <timemage> antto, i take it when you say "put them in the programmer" you mean attach the programmer to the board the mcu is solder to.
[14:46:43] <timemage> antto, nevermind, i see above.
[14:49:15] <timemage> antto, i suppose you might scrutinize whatever is hooked to the reset line. and just see what your voltage looks like on a scope.
[14:50:55] <antto> all of them are on small boards with a crystal and some few things
[14:51:59] <antto> we use USBASP (updated to newest firmware) and avrdude to flash them
[14:52:56] <timemage> antto, have you tried enabling the clockout line and seeing if it's outputting?
[14:53:06] <antto> nope
[14:53:24] <antto> do you mean the spi clock thing?
[14:53:24] <timemage> antto, might be something to do try.
[14:53:44] <timemage> antto, nope. on phone now.
[14:55:45] <timemage> antto, there's a fuse for a clock-out function that has a dedicated pin. that sends a squared crystal signal out.
[14:55:59] <antto> ah
[14:56:09] <antto> gonna see
[15:20:55] <timemage> antto, which chip?
[15:52:02] <antto> timemage atmega2561
[15:52:26] <timemage> antto, you found CKOUT fuse, yeah?
[15:53:07] <avrdood> someone coded with the UC3C ?
[19:30:54] <MarkX_> quick question
[19:31:15] <MarkX_> is it possible to get into program mode with the (i think) DFU bootloader, through firmware? rather than pressing physical buttons?
[19:31:39] <Tom_itx> not that i'm aware of
[19:31:56] <Tom_itx> take HWB low and push reset
[19:31:57] <MarkX_> that would require a custom bootloader then? or is it not possible at all?
[19:32:11] <Tom_itx> i tie HWB low with a resistor but you can't hardly do that with reset
[19:32:26] <Tom_itx> it's possible
[19:32:36] <Tom_itx> jumper a pin high or low and look for it on boot
[19:32:49] <Tom_itx> you need some way to signal it though
[19:33:43] <MarkX_> well what if you send a USB reset
[19:33:54] <Tom_itx> idk
[19:33:56] <MarkX_> while holding the jumpered pin high or low
[19:34:18] <Tom_itx> you
[19:34:21] <MarkX_> the pin's state wouldn't change because only the usb portion is being reset....
[19:34:29] <Tom_itx> you'd have to catch it while it's starting up
[19:34:40] <MarkX_> yea
[19:34:45] <MarkX_> might have to talk to dean about this
[19:35:20] <Tom_itx> there are other ways to enter boot but i'm not sure about external
[19:36:07] <Tom_itx> delay x time and wait for a signal, if you don't get it boot normally
[19:36:13] <Tom_itx> something you'd have to write into it
[19:36:44] <MarkX_> hmm but again, it would need external
[19:37:29] <MarkX_> hmmm a big enough cap might work :P
[19:37:53] <Tom_itx> teensy tried caps early on and doesn't use them now
[19:38:12] <Tom_itx> i never tried them
[19:38:26] <MarkX_> ah well, that portion of the project can wait
[19:39:12] <MarkX_> that can be added later without mass amounts of rewrites to the firmware