#avr | Logs for 2015-07-28

Back
[00:19:10] <jadew> has anyone found cheap ribbon cables with 0.635mm pitch?
[02:53:22] <martinus> Tom_itx | they're for ppl too lazy or dumb to write their own stuff >> and those of us that haven't got over our fear of working close to the iron. ;)
[06:23:52] <Lambda_Aurigae> martinus, I don't understand that kind of fear...but, I guess that comes from tearing apart and usually being able to put back together anything I could get my hands on since I was single digit years old.
[07:57:48] <martinus> Lambda_Aurigae: Being facetious. Mostly I'm just overwhelmed by how complex the microcontrollers are. The more I learn the more I realise I'm only starting to understand their capabilities.
[10:14:40] <day> does anyone here have by any chance experience with the st7735 display driver?
[10:17:41] <day> im really tempted to buy a arduino to check how they do it...but i cant cross that line...
[10:27:46] <specing> why would you need to buy an arduino?
[10:27:59] <specing> just open their ide and flash with avrdude
[10:28:19] <LeoNerd> AVR != Arduino
[10:29:32] <day> i dont even know why the driver claims to have an spi interface... it uses the same pin to send/transmit...
[10:30:57] <LeoNerd> Eh.. a number of people claim "SPI compatible" when they aren't.
[10:31:08] <LeoNerd> E.g. a lot of chips never hiZ their output line YES 74xx165 I AM LOOKING AT YOU
[10:35:03] <day> they could at least implement an easy command that gives feedback on the display to see if everything is fundamentally working...
[10:37:59] <day> i love the comments in the init routine in the github library: "Magical unicorn dust, 16 args, no delay: ive no idea what this does"
[10:38:13] <day> Sparkles and rainbows, 16 args + delay:
[10:57:14] <Getty> Anyone up for a TWI master example? I tried several implementations i found but nothing seems to work, its hard for me to debug sadly (no UART) so i am bit guessing here ;)
[10:57:40] <LeoNerd> There's an AVR AN that has some examples
[10:57:56] <LeoNerd> Personally, I've onyl actually done I2C on ATtiny using the USI, not mega using the real I2C hardware
[10:58:08] <LeoNerd> (I presume you mean using real hardware module?)
[11:01:12] <Getty> thats a good question, and hi btw ;)
[11:01:43] <Getty> that is right now the point, the TWI_master.c example i have here somehow doesnt define the pins where the I2C has to be, so i am now questioning if i use the common one or not
[11:02:34] <LeoNerd> The code doesn't really define the pins. The code will just talk to the I2C hardware module; it'll depend on the chip where that module is
[11:02:42] <LeoNerd> E.g. on a mega328p it's on PC5/PC6
[11:05:54] <Getty> damn must wait till my dad is back to chec that up, but yeah thats primary good to know, i bet he does as i dont see any definition in his code either
[11:06:07] <Getty> (he uses BASCOM, so i have a working BASCOM code in front of me, and: fuck bascom, just for the protocol)
[11:06:44] * LeoNerd still waiting for the day that Atmel put a big crossbar matrix on all the digital IO pins so things like UART/SPI/I2C can be arbitrarily mapped
[11:07:15] <LeoNerd> I'd be happy not to be able to move analog pins, because that's hard. I'd even settle for not being able to move PWM pins because those tend to have "high current sink" drivers
[11:07:55] <LeoNerd> But really.. come on.. It's 2015 - why do I still have to suffer the conflict between INT0/1 and TX/RX, or INT2/3 and SCL/SDA on a 32U4??
[11:33:17] <Getty> LeoNerd: so he just approves he uses hte hardware module
[11:33:29] <Getty> but i will now make the PWM run first, so that i have at least morse code signals output ;)
[11:33:37] <LeoNerd> Hehe... debugging my morse
[11:33:51] <Getty> but i have no idea....
[11:34:03] <Getty> its like trying to read ancient stuff, after coming from ARM
[11:34:13] <bss36504> LeoNerd: Xmega?
[11:34:45] <LeoNerd> bss36504: ?
[11:35:44] <aandrew> lol I've done a lot of different kinds of LED debugging but I've never gone as far as to go Morse
[11:35:58] <Getty> well i have no alternative ;)
[11:36:15] <aandrew> Getty: oh I'm not judging, it's not a bad way to go. early linux 2.2 or 2.4 kernels had that option as well
[11:36:16] <LeoNerd> Sometimes I bitbang SPI (or even use the real SPI if it's free) into nothing in particular, and attach the Saleae logic probe
[11:36:19] <Getty> if i see it right, i dont have the debugging channel on the programmer i would need, but i might be wrong
[11:36:42] <Getty> i have the avrispmkii
[11:36:53] <aandrew> most I've done is PWM with different average voltages for different thigns, or different blink types which I guess is a weaksauce version of full-out morse
[11:37:40] <Strangework> aandrew, what do you mean by a weak version of morse?
[11:37:55] <Strangework> If anything, I'd imagine that bitbanging would be a better analog to morse
[11:38:42] <aandrew> Strangework: meaning my various blink codes are a primitive version of morse
[11:41:16] <Strangework> Ohhh I see
[12:38:32] <day> my god.
[12:38:35] <day> my display
[12:38:41] <day> it did something
[13:00:54] <Gaulois94> Hello
[13:03:29] <Gaulois94> I have a problem concerning the adress of .data section
[13:04:46] <Gaulois94> I'm trying to do the following thing : http://pastebin.com/8DEKr429
[13:05:10] <Gaulois94> I know that UARTTransmit works well (I have test it alone)
[13:05:45] <Gaulois94> I just want to send through UART protocol my string
[13:06:31] <Gaulois94> But what I receive isn't what I should get. For me the issue comes from "ld r16, X+" (the parameter for UARTTransmit is on r16)
[13:18:29] <Getty> WOW.... i ... i made the pwm lit.... it works... ok ;) so that part is not that hard
[13:18:43] <Getty> now i need to make the morse codes
[13:19:45] <Getty> god this arm programmer takes FOREVER.....
[13:24:42] <FL4SHK> I hear that some text editors make programming faster than others
[13:24:44] * FL4SHK runs
[13:26:45] <Gaulois94> And you heared right
[13:37:25] <Getty> FL4SHK: ha ... ha
[13:58:40] <Gaulois94> Anyone knows why my r16 register (on UARTTransmitString) isn't "C" then "o" then "u"... ?
[14:28:12] <day> how do R&D departments get displays and similar complex hardware running? do they simply call the manufacturer and demand code?
[14:28:29] <day> at least thats what our customers do...
[14:30:37] <JoeLlama> hi Chillum
[14:30:43] <Chillum> hello
[14:30:44] <JoeLlama> yes this is the avr channel and there is another
[14:42:59] <Jartza> why another
[18:05:45] <Gaulois94> Hello
[18:06:13] <Lambda_Aurigae> olleH
[18:07:30] <Gaulois94> I have some problem using pointer in asm on avr
[18:07:35] <Gaulois94> In this code : http://pastebin.com/8DEKr429 I want r16 on function "UARTTransmitString" get the value 'C' then 'o' the 'u'....
[18:08:40] <Gaulois94> But it get strange value.....
[18:09:54] <tpw_rules> the avr doesn't really have separate sections. usually on the .text ends up on the flash. move the string there
[18:09:57] <tpw_rules> Gaulois94: ^
[18:11:24] <Gaulois94> But I don't have "exit program" opcode
[18:11:43] <Gaulois94> I know that I use an endless loop (who doesn't on this light pastebin)
[18:11:53] <Gaulois94> but it's dirty to put the string there ?
[18:12:24] <tpw_rules> it won't work there, i don't think. the avr is too small to bother having .data and also .text, so only the stuff in .text is used
[18:12:46] <tpw_rules> how are you assembling it?
[18:13:20] <twnqx> it won't work, but for a very different reason...
[18:13:34] <twnqx> the key here is lpm
[18:13:50] <tpw_rules> oh duh. you are right
[18:14:08] <tpw_rules> wouldn't that generate an assembler error though? when would ld r16, X+ be useful
[18:14:21] <twnqx> whenever you want to read from ram :P
[18:14:25] <tpw_rules> oh duh
[18:14:26] <Gaulois94> I hav this warning : warning: internal error: out of range error
[18:14:26] <Gaulois94> I'm using avr-gcc for assembling the code
[18:14:46] <tpw_rules> yes. lpm r16, x+ reads from program ROM. 'ld' is for reading from ram
[18:15:00] <tpw_rules> (buut you must use the Z register)
[18:15:04] <Gaulois94> This string value is then on the ROM
[18:15:05] <twnqx> not that i ever used more than inline assembler inside C, so i won't be of much help
[18:15:14] <Gaulois94> (I didn't know if it was on the SRAM or on the ROM)
[18:15:18] <twnqx> rom
[18:15:24] <tpw_rules> you have no C runtime that copies it to ram
[18:15:33] <twnqx> if you have no code to copy it into ram like your c compiler inserts into bootstrap
[18:15:45] <Gaulois94> tpw_rules: After I will use the C main function
[18:15:53] <Gaulois94> (I'm just getting my hand on some assembler stuff)
[18:16:10] <Gaulois94> And why should I use Z register ?
[18:16:18] <twnqx> because the lpm instruction says so
[18:16:25] <tpw_rules> you can't use x or y with it, only z is compatible
[18:16:34] <twnqx> also keep in mind that lpm accesses words, not bytes
[18:16:35] <twnqx> :)
[18:17:08] <tpw_rules> so do you only get half the memory?
[18:17:22] <twnqx> nah, it reads 16bits
[18:17:28] <twnqx> as the program flash is 16 bits wide
[18:17:38] <tpw_rules> yeah but where does the top 8 bits go
[18:17:39] <twnqx> (that's why you have 8bit avrs with 128kB flash)
[18:18:24] <tpw_rules> r16 isn't 16 bits wide. does the top byte go to r17?
[18:19:03] <twnqx> somewhere :P no idea, i use C most of the time
[18:19:07] <Gaulois94> *Arf, I should use arm 32 bits"
[18:19:21] <twnqx> but you might want to read the pgmspace.h macros
[18:19:22] <tpw_rules> do they translate the datasheets
[18:19:26] <twnqx> should be inline asm
[18:20:11] <Gaulois94> And what about the warning ?
[18:20:43] <tpw_rules> does it say the line? it may be because the sram is only 2K big and register X ends up at 3Kor so
[18:21:01] <Gaulois94> no line
[18:21:14] <Gaulois94> The problem comes on the linking
[18:21:41] <Gaulois94> Something like this : (.text+0xc): warning: internal error: out of range error
[18:21:43] <Gaulois94> src/main.o: In function `main':
[18:23:54] <tpw_rules> twnqx: lpm reads bytes according to pgmspace.h
[18:23:59] <Gaulois94> And I change for Z register
[18:24:22] <twnqx> doesn't really make sense, but ok
[18:25:47] <tpw_rules> yeah, the bigger parts have a different instruction which takes a bank in some i/o register
[18:26:09] <twnqx> i see
[18:26:15] <twnqx> seems i remembered wrong
[18:26:37] <Gaulois94> This warning came from string:.ascii "Coucou\r\n\0" adding at the end of .text section
[18:28:35] <Gaulois94> Despite the fact that my program is very light (just 70 asm lines)
[18:28:44] <tpw_rules> can you paste the whole program?
[18:28:53] <tpw_rules> and the precise command you use to build it
[18:30:17] <Gaulois94> The main file : http://sprunge.us/cWOP
[18:30:32] <Gaulois94> The UART file : http://sprunge.us/BIRV
[18:30:45] <Gaulois94> The command for making a .o : /usr/share/arduino/hardware/tools/avr/bin/avr-gcc -Os -Wall -fno-exceptions -ffunction-sections -fdata-sections -funsigned-char -funsigned-bitfields -fpack-struct -fshort-enums -mmcu=atmega328p -DF_CPU=16000000 -DARDUINO=100 -DUSB_VID= -DUSB_PID= -I. -Iutil -Iutility -I /usr/share/arduino/hardware/arduino/avr/cores/arduino -I include -I
[18:30:47] <Gaulois94> /usr/share/arduino/hardware/arduino/avr/variants/standard/ -I /usr/share/arduino/hardware/tools/avr/avr/include/ -c -o src/main.o src/main.S
[18:31:00] <Gaulois94> and the command for linking : /usr/share/arduino/hardware/tools/avr/bin/avr-gcc -Os -Wl,--gc-sections -mmcu=atmega328p src/main.o src/UART.o -lm -o "Arduino".elf
[18:31:14] <tpw_rules> how do you get the elf onto the chip?
[18:31:22] <Gaulois94> via avr-dude
[18:31:48] <Gaulois94> (the warning comes from the second command)
[18:31:56] <tpw_rules> what command to you use with avrdude?
[18:32:21] <Gaulois94> I'm getting the .hex like this : /usr/share/arduino/hardware/tools/avr/bin/avr-objcopy -O ihex -R .eeprom "Arduino".elf "Arduino".hex
[18:32:42] <Gaulois94> And the avr-dude : /usr/bin/avrdude -DV -p atmega328p -P /dev/ttyUSB0 -c arduino -b 115200 -U flash:w:"Arduino".hex:i
[18:34:24] <Gaulois94> If I suppress a caracter on the string, the warning disapeared
[18:35:12] <Gaulois94> (or adding one : is like the string want to be 2k wide)
[18:35:16] <tpw_rules> does it work though?
[18:35:49] <tpw_rules> can you upload the elf somewhere?
[18:35:58] <Gaulois94> With that warning ? no, without it ? yes
[18:36:19] <Gaulois94> http://sprunge.us/WQSW
[18:36:50] <Gaulois94> Wrong one sorry : http://sprunge.us/ZEYf
[18:38:10] <tpw_rules> hmm. it says it is corrupted
[18:38:23] <Gaulois94> both ?
[18:38:54] <tpw_rules> yes. perhaps i'm doing something wrong
[18:39:42] <Gaulois94> I can't read them with a text editor
[18:39:48] <Gaulois94> For the problem, for me it appears that the string value want to be even
[18:39:48] <tpw_rules> that should be true
[18:39:57] <Gaulois94> string length*
[18:39:57] <tpw_rules> what happens if you run "avr-objdump -x Arduino .hex"
[18:40:02] <tpw_rules> sorry Arudino.elf
[18:42:01] <Gaulois94> 1http://sprunge.us/TcRV
[18:42:01] <Gaulois94> http://sprunge.us/TcRV
[18:42:06] <Gaulois94> Oups, you asked .elf : http://sprunge.us/YEQO
[18:42:43] <tpw_rules> okay. try using -d instead of -x and paste the result
[18:43:10] <Gaulois94> http://sprunge.us/YcKH
[18:45:41] <tpw_rules> try using string<<1 instead of string when you load Z
[18:46:59] <Gaulois94> Error: invalid operands (.text and *ABS* sections) for `<<'
[18:47:30] <Gaulois94> I had added it a \0 more
[18:47:41] <tpw_rules> hm
[18:48:34] <Gaulois94> (not for the dump you asked). With a \0 more, all works well
[18:49:30] <Gaulois94> Another question, in this dump : http://sprunge.us/KOVU
[18:49:46] <Gaulois94> Why so many commands at 0x00A8 ?
[18:50:13] <tpw_rules> because it does not know that that is a string
[18:50:20] <tpw_rules> those are the instructions that correspond to the letters in the string
[18:51:02] <tpw_rules> try deleting a letter from the string and then adding ".align 1" on the line after
[18:51:07] <Gaulois94> Should be the label string be remplaced by value, or that's only the disassembled 'value' of my string ?
[18:51:07] <Gaulois94> Ok :). Thank you so much :)
[18:51:08] <tpw_rules> if that does not work, add ".align 2"
[18:52:07] <Gaulois94> With .align 1 it works
[18:52:10] <tpw_rules> the problem is that the string needs an even number of letters because instructions can only start on an even address. .align handles that automatically
[18:55:47] <Gaulois94> I should allways finish a string value by .align 1 ?
[18:58:56] <tpw_rules> yes
[18:59:04] <Gaulois94> Thank you :)
[18:59:11] <tpw_rules> well not quite
[18:59:37] <tpw_rules> you can use it after groups of strings. but if it's already an even length, .align 1 will not add anything else
[19:01:57] <Gaulois94> That's not a problem
[19:02:10] <Gaulois94> (I don't want to count allways the length of my string x) )
[21:43:03] <ferdna> my eclipse ide is crashing when selecting "do not set fuse bytes".
[21:43:05] <ferdna> http://i.imgur.com/EqdcXYr.jpg
[22:01:35] <Tom_itx> i dislike eclipse
[22:01:50] <FL4SHK> I prefer Vim
[22:01:55] <Tom_itx> it locked up the first couple times i tried it so i dumped it
[22:02:28] <Tom_itx> so back to a txt editor
[22:03:06] <Tom_itx> for linux it's gedit, for windows it's PN
[22:25:34] <inflex> hi Tom_itx
[22:30:14] <q_bert> dunno if i'd bother comparing IDEs and text editors
[22:32:06] <q_bert> i finally figured out how to add my stk500 in studio6 so i can finally stop only using version 4
[22:42:17] <Casper> I wonder if there is some good IDE for linux...
[22:59:50] <Valen> gedit FTW
[22:59:51] <Valen> ;->