#avr | Logs for 2014-08-27

Back
[04:34:53] <mux_> abcminiuser: did everything work out yesterday?
[04:36:20] <Jartza> hmmh
[04:36:31] <Jartza> what would be a good bootloader for atmega328?
[04:36:57] <Jartza> I find gazillion websites telling how to put arduino bootloader on atmega, but if I don't want that :)
[04:38:23] <mux_> bootloader for which interface?
[05:31:36] <Jartza> mux_: well, I guess rs232 serial is still the easiest :)
[05:31:59] <mux_> there are a million serial bootloaders available
[05:32:33] <mux_> if you're unsure of what to use, the safest choice is usually just ASF
[05:33:20] <mux_> supports atmel's toolchain and avrdude, it's well-maintained and not made by some douchebag with his own ideas of how to do stuff to run off half a year later
[05:33:41] <mux_> thats a weird sentence, disregard strangeness
[05:38:48] <Jartza> :)
[05:39:54] <Jartza> I have ~10 of those cheap chinese usb-serial-converters, so serial is indeed the easiest way
[05:57:31] <Lambda-Aurigae> Xark, ali express has them in stock.
[05:57:37] <Lambda-Aurigae> problem is, the datasheet is in chinese.
[05:57:44] <Lambda-Aurigae> which is ok if you read chinese and all,,,
[09:05:42] <brabo> hi, i'm trying to get an atmega8 to send out text over rs485 over a max485 chip. i can manage to send spmething out, but it's unreadable characters. anyone here has any experience doing this?
[09:06:18] <woodyj21> baude rate mismatch?
[09:07:46] <brabo> it is possible.. i am trying to set the baudrate like: #define BAUD 9600UL
[09:08:15] <brabo> other end of the bus there's also a max485 that just outputs tu uart, where i look with minicom
[09:08:33] <brabo> there's bascom example code that works fine, so the hardware setup is ok
[09:08:51] <woodyj21> and you get good charaters w/ that?
[09:09:10] <brabo> with the basc om code ye, but now i'm trying to code it in c
[09:10:09] <brabo> i can make you a paste of my current code and the working bascom code if that helps to show what i'm trtying and how it can work?
[09:10:30] * brabo totally unexperienced doing this hehe
[09:10:37] <woodyj21> i can take a peak, no promises tho, my avr-fu isn't awesome yet
[09:11:02] <brabo> oh, having a look is as much as i can ask of you hehe ;)
[09:11:13] <brabo> sec, making paste
[09:11:17] <woodyj21> roger
[09:14:26] <brabo> woodyj21: working bascom code: https://paste.xinu.at/FVHE/ my c attempt: https://paste.xinu.at/jFLP/ and header https://paste.xinu.at/T5hc/
[09:15:49] <woodyj21> k, checking them out
[09:16:03] <brabo> if i uncomment the other chars in my c code, i do get as much more unreadable characters in minicom
[09:16:12] <brabo> so it's def trying to send something
[09:16:34] <brabo> just not entirely correct
[09:16:43] <brabo> well, that's what i think atm
[09:17:39] <skroon> i'm trying to program my device, but I think i've somehow screwed up the fuses earlier on and set the clock wrong... i'm trying to reprogram the fuses but it's failing, is the SCK period the configuration to set the speed for ISP programming?
[09:21:12] <woodyj21> brabo: so, when running the om code, you get "test" coming out readable?
[09:23:17] <brabo> the bascom code? yes i do
[09:24:09] <brabo> the hardware guy wrote that as test, i get the output perfectly fine in minicom with that running on the mcu
[09:25:37] <woodyj21> in the header file, there is a #warning "BAUD not defined. Assuming 38,400 Baud" does this interfere w/ the 9600 we have elsewhere?
[09:27:06] <woodyj21> or, i guess i mean, do we see that warning, or anything else that could help identify that the baude rate is our culprit
[09:27:44] <brabo> lemme eliminate that
[09:28:09] <brabo> ah
[09:28:35] <brabo> no.. i remember.. i scaled down the baudrate that was set in the example code i found to 9600
[09:28:54] <woodyj21> roger, that's good
[09:29:17] <brabo> uhu, i wanted same as bascom example code to get it working
[09:29:32] <brabo> since that's my reference :)
[09:30:15] <woodyj21> makes sense... i've looked it over for typos and whatnot... i can't find anything
[09:30:21] <woodyj21> but you've got the pastebin on here
[09:30:26] <woodyj21> so someone should be by to help
[09:31:34] <brabo> okay, thanks anyway!
[09:33:57] <woodyj21> brabo: np, good luck!
[09:34:44] <brabo> :)
[09:44:40] <brabo> it works
[09:44:42] <brabo> yay
[09:47:46] <woodyj21> boom!
[09:47:49] <woodyj21> what gives?
[09:50:25] <brabo> partly it is i cannot just RS485_UDR = (char)"A"; or RS485_UDR = "A"; however if i do RS485_UDR = 0x41; then it outputs an "A" over the rs485
[09:51:03] <woodyj21> ahh... so it's HEX?
[09:51:16] <brabo> not sure why this is.. i'm just starting out with mcu coding, and i'm not exactly a c wizard hehe
[09:51:25] <woodyj21> or ANCII
[09:51:53] <woodyj21> see if 0x61 sends lower case A
[09:52:35] <brabo> kk
[09:53:25] <brabo> ye it does.. sending 0..255 shows a nice ascii string
[09:53:36] <woodyj21> sounds like you got it!
[09:54:01] <brabo> uhu, it's be good to find out how i can use real chartacters instead of the hex
[09:54:08] <brabo> but it works
[09:54:20] <brabo> that's already very very good :)
[09:54:46] <woodyj21> maybe do a case statement to map the "real" chars to their ANSCI equivilent?
[09:55:57] <brabo> uhm like i have a char array, loop over it, case statement to convert it?
[09:59:11] <woodyj21> stackoverflow.com/questions/11590914/how-get-ascii-of-a-string
[09:59:29] <woodyj21> if you had the string, you could convert it to ascii, then pass that out
[09:59:46] <woodyj21> and this doens't involve case statement, way simpler, if it works
[10:01:44] <skroon> when you enable debugWire, does this also mean that any SPI communication stops working, or that has nothing todo with it ?
[10:04:58] <brabo> woodyj21: okay thanks!
[10:05:19] <brabo> i'll try to mess around a bit.. it'll work.. eventually ;)
[10:06:13] <brabo> and i can continue in mean time making the master and slave code
[10:06:16] <brabo> :D
[10:09:04] <woodyj21> love it when a plan comes together!
[10:12:59] <brabo> indeed :)
[11:20:41] <krizoek> hello everyone
[11:20:54] <krizoek> Error 1 Cannot find include file: avr\io.h
[11:21:04] <krizoek> i get this in avr studio 6.2
[11:21:23] <krizoek> i do have the include file in the directory of the project
[11:21:58] <krizoek> for some reason avr studio doesnt seem able to find the include file
[11:24:27] <krizoek> nevermind, it was set as a assembler project instead of c
[11:28:19] <brabo> krizoek: is it in same directory?
[11:28:19] <brabo> how are you defining the include? can you copy-paste that line?
[11:28:19] <brabo> but i guess your general environment needs to find the avr libraries
[11:34:34] <brabo> aah
[11:34:34] <brabo> glad you figured it out, i'm on linux without ide
[11:34:34] <brabo> so i wouldn't have been able to help you a lot hehe
[11:37:13] <krizoek> :)
[13:29:22] <apo__> \o
[13:30:56] <apo__> I'm playing around with the watchdog for the first time, and having some problems - it always resets, instead of just calling the interrupt, despite having WDTCSR|=(1<<WDIE)
[13:31:02] <apo__> Here's my program: http://p.0au.de/7b2698be/main.c
[13:31:28] <apo__> it should just toggle porta every 16ms, but instead it resets...
[13:42:58] <apo__> ... and if I put PORTA = (WDTCSR&(1<<WDIE))?0xFF:0x00; in my main loop, it stays high for a while, then goes low after about 37ms
[13:43:18] <apo__> and then resets after a total of 128ms (so when the WDT kicks in)
[13:45:47] <Jartza> apo__: what chip?
[13:46:35] <apo__> Jartza: attiny84
[13:47:49] <Jartza> well the first obvious problem, you haven't enabled interrupts
[13:48:20] <apo__> ...
[13:48:22] <apo__> d'oh
[13:48:30] <apo__> that would be it, I suppose :p
[13:48:39] <apo__> I blame arduino ;)
[13:48:48] <Jartza> add sei(); :)
[13:48:59] <apo__> Yeah
[13:49:01] <apo__> Thanks :D
[13:51:03] <Jartza> and also, you set the sleep modes, but never actually sleep
[13:51:35] <apo__> yeah, I know. I disabled that for debugging
[13:54:04] <Jartza> also I guess attiny84 has same kind of sequence as attiny85
[13:54:44] <Jartza> there you have to use the "timed sequence" to change watchdog
[13:55:26] <Jartza> (or at least that's how I got mine to work, and how I understood it)
[13:56:00] <Jartza> WDTCSR |= (1 << WDCE) | (1 << WDE); // start timed sequence
[13:56:00] <Jartza> WDTCSR = b; // set new watchdog timeout value
[13:56:01] <Jartza> WDTCSR |= (1 << WDIE);
[13:56:03] <Jartza> like that
[13:56:05] <Jartza> ah
[13:56:09] <Jartza> shoul've used pastebiin
[13:56:13] <Jartza> irc doesn't like tabs
[13:56:27] <apo__> Jartza: only for disabling
[13:56:34] <apo__> Jartza: But I only enable it, so that's okay
[13:56:44] <Jartza> hmmh, yeah, or changing the timeout
[13:56:45] <Jartza> true
[13:57:57] <Jartza> anyway, use sei();
[14:00:45] <Jartza> I have multiple attiny84s but haven't done anything except simple led blinker with it yet :)
[14:00:58] <Jartza> attiny85 has plenty of power left :)
[14:01:34] <apo__> aww, can't use my scope to measure current like this (1k resistor in series on the power pins), too much AC noise :p
[14:04:29] <Jartza> :P
[14:05:48] <Jartza> apo__: I blame arduino for many things :)
[14:06:01] <Jartza> although I just barely tried it, but didn't inhale!
[14:06:31] <apo__> :D
[14:08:20] <Jartza> maybe it was because I've done embedded C before trying any avr (which happened around 7 months ago), arduino just felt like too obscured
[14:08:33] <Jartza> with arduino it's quite hard to tell what actually happens sometimes
[14:09:25] <Jartza> and "being in control" is exactly what I like in embedded programming
[14:09:37] <apo__> I worked with AVRs before trying arduino, so I'm not as tainted as most people who use it :p
[14:09:40] <apo__> yup
[14:09:41] <Jartza> I guess I should've started doing electronics way way way ago
[14:10:03] <Jartza> never just "had time"
[14:10:14] <Jartza> except now :D
[14:17:53] <Jartza> I'm off to bed, early for once
[14:17:54] <Jartza> laters &
[14:23:23] <thomasqbrady> Anybody here have any experience with LED matrices?
[14:44:22] <apo__> Heh, the 128khz oscillator doesn't even go up to 128 khz
[14:44:42] <apo__> The highest frequency it gets is 109 khz
[14:44:50] <apo__> and that's with 1.8V and -40°C
[14:45:12] <woodyj21> apo__: put it in the blast freezer did ya?
[14:45:26] <apo__> woodyj21: no, this is from the friendly manual
[14:45:44] <apo__> Which also claims that at 5V and room temp it gets 105 khz, which is about right
[14:45:51] <woodyj21> i see... i was gonna say that's some serious testing dilligence
[14:48:14] <apo__> interesting that with higher voltages it decreases
[14:49:06] <apo__> I don't think I want to run a clock from this
[15:05:25] <Tom_itx> zlog
[21:27:33] <colton_> is it ok to ask arduino related question in here? :)
[21:29:50] <woodyj21> sup
[21:29:57] <woodyj21> colton_: what's up
[21:30:26] <colton_> question... I am running arduino IDE on mac osx, I am trying to burn a bootloader to a blank 328p. The IDE errors out because it cant find port 'usb'. Is there a way I can specify a /dev/tty to use instead of 'usb'
[21:31:09] <woodyj21> not sure on osx... i am fairly certain google would yeild results tho... search for:
[21:31:40] <woodyj21> mac osx arduino USB specify
[21:31:57] <woodyj21> someone else might have much better answer, just wait
[21:32:17] <woodyj21> maybe "specify port"
[21:32:47] <colton_> Problem is that the arduino IDE on osx is looking for serial port titled 'usb'... i know for a fact the serial port is titled '/dev/tty.usbmodem'... but because of the IDE GUIness i am unable to specify which port I want to use to burn th ebootloader
[21:32:51] <colton_> ok thanks
[21:33:09] <woodyj21> that's a typical type problem
[21:33:23] <woodyj21> so other's have encountered it, and will haev posted fixes :)
[21:34:40] <colton_> If I try to burn the bootloader through SPI... should I expect the external programmer to reset the avr, or do I have to manually do it?
[21:35:08] <colton_> orr I guess any program, doesnt necessarily have to be a bootloader
[22:31:11] <strukturalna> does anyone use mega's?
[22:31:59] <strukturalna> typo: xmega's I mean