#avr Logs

Jun 10 2017

#avr Calendar

12:05 AM day is now known as daey
01:37 AM rue_bed: maybe you have the clocksource set wrong
02:54 AM mark4: could anyone tell me what the NVM_FUSES_JTAGUSERID BIT definitions are in my devices header file are? there is not documentation on them at all
02:54 AM mark4: theats just one of the definitions from the header file
02:55 AM mark4: NVM_FUSES_JTAG-----
02:56 AM mark4: nothing in the documentation, nothing in the header file to indicate what IO byte they are associated with
02:56 AM mark4: i mean it does say they are associated with NVM_FUSES.FUSEBYTE0 but there is nothing in there saying what address that is at
02:58 AM mark4: erm actually there is but its excluded in asm
06:04 AM mark4: every time i try do some example code i cannot get it to commpile. freeking build is saying <avr/io.h> no such file or directory
06:05 AM polprog: https://maritime.org/doc/neets/
06:05 AM polprog: mark4: check your inlcude path
06:07 AM mark4: polprog, doesnt the freeking tool set that up ?
06:07 AM polprog: that depends
06:07 AM polprog: in my cas i just installed avr libc from the repo
06:08 AM polprog: but im on linux
06:09 AM mark4: err i would hope atmel studio didnt reqiuire i set paths to libraries when there seems to be 45627456 different inc directories insode its tree. ive no idea which one is the reight one
06:11 AM mark4: half the time i get include files not found or some BLAH_DEFINE not defined
06:13 AM mark4: how can it not know where avr/io.h is
06:13 AM mark4: srsly do not freeking understand
06:17 AM mark4: actually in this same project i have an asm.S file. it includes avr/asm.h just fine
06:17 AM mark4: the C file cant include it
06:17 AM Lambda_Aurigae: rue_house, I combined them with the i2c lib and pcf8574 chips to make an i2c interfaced LCD module.
06:22 AM mark4: can anyone please tell me why i cant compile this code? WHY are the include paths not right?
06:23 AM Lambda_Aurigae: I would have to look at your computer.
06:24 AM Lambda_Aurigae: not knowing jack about your project, how it is setup, what you did to create it, and the like, there's no way for me to answer that question.
06:25 AM Lambda_Aurigae: specially as it is a windows thing using microsoft visual studio modded for atmel projects.
06:25 AM mark4: well how do you debug avr code from linux?
06:26 AM mark4: with gdb?
06:26 AM mark4: I would rather poke my eyes out with a blunt red hot poker
06:26 AM Tom_L: led
06:26 AM Tom_L: or serial
06:26 AM Tom_L: or LA if necessary
06:27 AM mark4: basically your doing printf debugging where the printf is the LED
06:27 AM Tom_L: no
06:28 AM Tom_L: printf is too costly
06:28 AM Lambda_Aurigae: LEDs, serial interface with debugging prints, I read my code and understand it.
06:29 AM Lambda_Aurigae: I bother to learn the chip I'm using. I read the datasheet and understand how it works. I understand the code I write.
06:29 AM mark4: and ive written a Android NDK Forth compiler in 100% thumb2 assembler and debugged that with printfs. i would still rather have a real debugger with the ability to step through code
06:29 AM Lambda_Aurigae: Pretty much the same way I've been doing programming since the 80s.
06:29 AM mark4: understanding the chip is not my problem
06:30 AM mark4: ldi r16, (USART_PMODE_DISABLED_gc | USART_SBMODE_bm | USART_CHSIZE_8BIT_gc) <-- this gives me an error telling me that | is not defined
06:30 AM mark4: srsl. wtf over
06:30 AM mark4: or maybe thats not what its saying
06:30 AM mark4: i dont understand the error message
06:30 AM Lambda_Aurigae: nor have you posted said error message that I've seen.
06:31 AM mark4: invalid operands(*UND* and *ABS* sections) for '|'
06:31 AM mark4: i was copying it as you said that
06:35 AM Lambda_Aurigae: http://www.avrfreaks.net/forum/how-get-word-address-label-gcc-avr-gas
06:35 AM Lambda_Aurigae: read through that.
06:35 AM Lambda_Aurigae: similar issue and the guy works through it..and explains whats going on.
06:36 AM Lambda_Aurigae: '|' is in the same boat as his '<<' in the same kind of statement.
06:37 AM Lambda_Aurigae: well, kindasorts.
06:37 AM Lambda_Aurigae: something's not kosher in how it uses those operands.
06:38 AM mark4: heh
06:38 AM mark4: the entire freeking development environment is obfuscated to the point of being unusable
06:39 AM Lambda_Aurigae: doing assembly with gas is,,,at best,,a pain in the ass.
06:39 AM Lambda_Aurigae: that's why I use gavrasm for assembly.
06:42 AM mark4: avrasm2 is " <-- that close to being a pile of complete and utter garbage. it IS garbage for this project because its macro facility IS utter garbage
06:42 AM mark4: show me a macro that allows you to assemble a linked list and ill eat those words
06:44 AM Lambda_Aurigae: no clue on that...I don't do macros in assembly.
06:46 AM Lambda_Aurigae: https://stackoverflow.com/questions/43119961/explain-this-avr-macro-for-linked-list-of-strings
06:47 AM Lambda_Aurigae: first thing I found on the subject though.
06:47 AM Lambda_Aurigae: no clue which assembler they are using...it's too early for me to actually read through it.
06:48 AM mark4: thats avrasm2
06:48 AM mark4: so i MIGHT have to eat my words here
06:49 AM mark4: except the documetnation lead me to believe the most it was capable of was creating a macro call STORE for the sts opcode
06:49 AM mark4: and yes lol ive actually seen someone do that
06:49 AM Lambda_Aurigae: that was literally the first link on a google search,, avr assembly linked list
06:50 AM mark4: i didnt search for it, i basically have two non related but linked projects here, one is my own for fun the other is for money and i need to get them both working in parallel
06:50 AM mark4: because my fun project can help with the payed one
06:52 AM mark4: yup i think avrasm2 isnt garbage maybe. its documentation is lol
06:53 AM mark4: if that strlen() is a built in macro inside the assembler THAT simplifies my code too@
06:54 AM mark4: can the avr load a word constant from an odd address or does that do screwy things like on ARM
06:56 AM Lambda_Aurigae: I think you need to go evens but not certain on that one.
06:56 AM Lambda_Aurigae: one way to find out...write a simple test.
06:58 AM mark4: yea its 6:30 am and i didnt sleep yet
06:58 AM mark4: probably wont sleep now till tonight
06:58 AM Lambda_Aurigae: I got up about 5:45am.
06:58 AM Lambda_Aurigae: used to do the all nighters when I was young and stupid.
06:58 AM mark4: if you knew the answer that would be cool, if not i can do the experiment some other time :)
06:59 AM Lambda_Aurigae: now I need my 8 hours of sleep or I get cranky.
06:59 AM mark4: it wasnt "im too lazy or stupid to write that code" :)
06:59 AM mark4: same same. except i go zombie not cranky
06:59 AM Lambda_Aurigae: I'm too lazy to write it...hehe
06:59 AM mark4: your allowed to be. it wasnt for a question YOU asked :P
07:00 AM Lambda_Aurigae: must....find....food..
07:01 AM mark4: must.. pour.. coffee....
07:01 AM mark4: heh reminds me of the dilbert coffee joke :P
07:01 AM mark4: ill just change out the offices coffee with my decaf....
07:01 AM mark4: then everyne is stumbling around "must... find... antidote..."
07:06 AM Lambda_Aurigae: coffee is only drinkable if it is percolated over an open fire for at least 20 minutes.
07:06 AM mark4: so avrasm has low(x) and high(x) does it have a macro for the 3rd byte of a 24 bit address?
07:06 AM Lambda_Aurigae: no clue.
07:07 AM Lambda_Aurigae: I use gavrasm and never bothered with that level of stuff...I learned assembly with the vicmon assembler/disassembler on the commodore vic-20..
07:07 AM Lambda_Aurigae: never got into all the macros for stuff.
07:07 AM Lambda_Aurigae: having a program that would actually take assembly code and turn it into machine code was a wonderful thing when I finally discovered it.
07:07 AM Lambda_Aurigae: mmmm....chilli cheese dog casserole for breakfast.
07:09 AM mark4: awesome! i learened asm for the first 6502 too
07:09 AM mark4: bought a computer mag with a asm program in basic statements
07:10 AM mark4: .data a9 01 85 02 ....
07:10 AM mark4: for the C64
07:10 AM Lambda_Aurigae: peek and poke
07:10 AM mark4: read the article and it was by some 11 yr old kid. i got PISSED OFF !!!!
07:10 AM mark4: some 11 year old knew what that goop was and it was unreadable to me
07:10 AM Lambda_Aurigae: I was probably one of those kids who wrote those.
07:10 AM mark4: bought the mag. read it cover to cover. learned that was machine code, and i needed to get "rodnay zakks programming the 6502"
07:10 AM Lambda_Aurigae: although, I didn't start programming till I was 12.
07:11 AM mark4: went to library and got that book and did a 100% hand reverse engineer of that entire program
07:11 AM mark4: a9 01 lda #$01
07:11 AM mark4: 85 02 sta $02
07:11 AM mark4: by the time i was done i knew every single 6502 opcode and its associated mnemonic BY HEART
07:12 AM mark4: i could pretty much code in machine code lol not just assembler
07:12 AM mark4: THEN i bought my first computer. a c64
07:12 AM mark4: learned 6502 assembly language in 2 weeks without a computer
07:13 AM mark4: i code 6502, x86, arm, thumb, thumb2, avr, nec 75x, 68000 and a whole bunch more i cant think of right now
07:13 AM mark4: i have written 8051 and avr assemblers
07:13 AM mark4: yes i have my own avr assembler
07:13 AM Lambda_Aurigae: I wrote a disassembler...did most of my assembly by hand...until I got the vicmon cartridge.
07:14 AM Lambda_Aurigae: then I wrote a basic compiler...in basic...
07:14 AM Lambda_Aurigae: then used it to compile itself.
07:15 AM Lambda_Aurigae: got my vic-20 in 1983 I think.
07:16 AM mark4: i got my c64 in 1987
07:16 AM Lambda_Aurigae: had been working with apple-2 for some years before that.
07:16 AM mark4: another 6502 machine :)
07:16 AM Lambda_Aurigae: yup
07:16 AM mark4: the IIe was anyway
07:16 AM Lambda_Aurigae: all the apple 2 except for the 2gs were 6502
07:17 AM Lambda_Aurigae: 2gs used the 65c816 which was a 6502 on steroids...pseudo 16bit processor.
07:18 AM mark4: why is avrasm2 telling me that my db x is missaligned?
07:18 AM mark4: .cset .db misalignment - padding zero byte
07:18 AM Lambda_Aurigae: no clue.
07:18 AM mark4: not an error
07:21 AM mark4: ana! i think i know why lol
07:21 AM mark4: i was doin
07:21 AM mark4: .db length
07:21 AM mark4: .db string
07:21 AM mark4: i need to do .db length, string
07:23 AM mark4: yup: fixt
07:31 AM mark4: ok i might still be buggered for using avrasm2
07:32 AM mark4: does it not allow me to create my own sections?
07:32 AM mark4: not just cset dseg eseg etc
07:32 AM mark4: what if i want a fooseg ?
07:32 AM * Lambda_Aurigae shrugs
07:32 AM polprog: read the manual
07:32 AM polprog: but then you also need to put that section in the hexfile
07:32 AM Lambda_Aurigae: google is your friend?
07:34 AM mark4: i am reading it
07:34 AM mark4: what do you mean, put it in the hex file
07:34 AM mark4: i have not found anything in here relating to custom sections
07:34 AM mark4: yet
07:35 AM polprog: by putting it into the hex file, i mean altering the settings of the objcopy program
07:36 AM polprog: but i forgot youre on atmel studio
07:36 AM polprog: normally in my toolchain, i just use avr-gcc on my asm file, it invokes gas, and produces an object file
07:37 AM mark4: im having extreme issues with avr-gcc. mostly because of the fact that you HAVE to use the C preprocessor
07:37 AM polprog: i then use avr-objcopy to copy the text and data sections (iirc) into the hex file, then i flash the mcu with the hex
07:37 AM mark4: FUCK 294762803 c header files
07:37 AM mark4: thats why im switching to avrasm2 if i can. this has ASSEMBLER include files
07:38 AM mark4: avr-gcc does not
07:38 AM julius: hi
07:38 AM polprog: honestly it doeant allow me to use registers below 15? im tryin to invoke the assembler directly, but i can get it to work
07:38 AM julius: in old cdrom drives, to get the tray out, are those stepping motors attached there?
07:38 AM mark4: and i cant see anything in the documentation for avrasm2 that related to sections at all
07:38 AM polprog: i dont use any c headers, i just .equ portd whatever
07:38 AM mark4: what device
07:38 AM mark4: some devices only have registers 8 and up
07:39 AM polprog: currently t4313
07:39 AM mark4: you include <avr/io.h> ?
07:39 AM polprog: not at all
07:39 AM polprog: i told you, i use in and out
07:40 AM mark4: then you define all the register io addresses and bits by hand?
07:40 AM polprog: all the io regs i need, yes.
07:40 AM polprog: if i was on my pc id show you
07:42 AM polprog: its totally transparent then, the output assembly hardly differs from what i wrote in the .s file
07:42 AM polprog: except for stuff like ldi r18, 0x00 becomes clr r18
07:43 AM polprog: and the likr
07:43 AM polprog: like*
07:43 AM polprog: i check the output with a disassembler, it also draws graphs, i check the flow too
07:44 AM mark4: thats because clr is a psudo opcode. there is no actual opcode of that name. the assembler and disassembler allow it and assemble the ldi rn, 0 opcode
07:44 AM mark4: its an alias
07:47 AM polprog: til
07:48 AM polprog: thanks
07:48 AM mark4: nothing on custom sections
07:48 AM mark4: bugger
07:48 AM polprog: i guess it doesnt support it then... id search google, and then give up and use a *real* assembler
07:48 AM polprog: :P
07:48 AM polprog: have fun, gtg
07:48 AM mark4: wait
07:49 AM mark4: is dseg PURELY ram?
07:49 AM mark4: or can dseg be in flash?
07:52 AM mark4: does it have local labels?
07:59 AM mark4: wait! you cant pass a STRING to a macro in avrasm2?
07:59 AM mark4: :/
08:00 AM mark4: like i said days ago. complete and utter fucking garbage
08:04 AM Lambda_Aurigae: if you are going to use macros, why not just use C and be done with it?
08:11 AM DKordic: mark4: I see avrasm is consipiring against You.
08:11 AM Lambda_Aurigae: naaa..I just keep updating the manual in the background so he is never sure what it says.
08:11 AM mark4: im familiar with the gnu assembler, i can use that. what im not familiar with is the obfuscaed and undocumented c include files
08:29 AM kre10s: I have a 24 bit number twos complement. easiest way to extend that number to 32 bits preserving the sign?
08:31 AM kre10s: nvm
08:32 AM polprog: but you dont have to include anything with gnu assembler!
08:33 AM polprog: you can have a separate assembly file with subroutines defined as .global and then call them from c, and vide versa
08:33 AM polprog: you just need to read how c passes arguments to registers
08:33 AM polprog: and youre done
09:08 AM rue_house: or find the good examples and just copy them
09:45 AM day__ is now known as daey
10:26 AM Emil: locuester: the way you talk, I doubt you have 16 years of experience
10:26 AM Emil: ah my bad
10:26 AM Emil: well I doubt you are an experienced programmer anyhoo
10:27 AM Emil: mark4: also lololo
10:27 AM Emil: oh he left
10:28 AM Emil: 2017-06-10 15:14:31 +0300 < mark4> thats because clr is a psudo opcode. there is no actual opcode of that name. the assembler and disassembler allow it and assemble the ldi rn, 0 opcode
10:28 AM polprog: this seems off
10:28 AM polprog: the summary show the clr opcode
10:28 AM Emil: yeah
10:28 AM polprog: shows*
10:28 AM Emil: And it is there
10:29 AM Emil: mark4 is just blaming the system when he can't get it to work ;)
10:29 AM polprog: i think i see how shitty is the atmel studio
10:29 AM Emil: It is the same as EOR Rd, Rd, though
10:29 AM polprog: oh, yeah, eor rd rd was also there once
10:30 AM polprog: oh, he parted too
10:30 AM polprog: also lol at locuester
10:30 AM Emil: Yeah :D
10:30 AM Emil: I bet he went by this philosophy
10:30 AM Emil: :
10:30 AM polprog: the navy has published it's set of electronic engineering textbooks for self-education
10:31 AM polprog: they are nice and clear
10:31 AM Emil: https://emil.fi/jako/kuvat/2017-06-10_18-00-44_TKyKig9h.png
10:31 AM Emil: polprog: US Navy?
10:31 AM polprog: xd
10:31 AM polprog: yes, us navy
10:31 AM polprog: https://maritime.org/doc/neets/
10:31 AM Emil: I'm also triggered by that picture calling it "mechatronic engineering" instead of EE
10:32 AM Emil: The fuck is my bash quote waiting for moderation
10:32 AM Emil: http://bash.org/?962978
10:32 AM polprog: mechatronics is like electronics with robotics i think
10:32 AM polprog: also, you have a bash account?
10:32 AM Emil: no
10:32 AM Emil: You?
10:33 AM Emil: Also nice link
10:33 AM polprog: i met a mechatronics engineer once, he had a lot of knowledge on mechanics but had a bit less on EE
10:33 AM Emil: They always do
10:33 AM polprog: i dont have a bash account too,
10:33 AM Emil: Mechatronics engineers are rarely well versed in EE
10:33 AM Emil: but it's a specialty
10:33 AM Emil: It's fine
10:34 AM Emil: polprog: s/ too/, either/
10:34 AM polprog: nevermind, it's just bash.org.pl which had closed registration
10:34 AM polprog: Emil: yeah, youre right with that either
10:34 AM polprog: :)
10:34 AM polprog: why cant i see pending quotes
10:35 AM Emil: Dunno
10:35 AM Emil: I bet bash is a bit död
10:35 AM polprog: and crap on "latest" has a negative amount of points
10:35 AM polprog: dod = stupid?
10:35 AM polprog: or dead
10:36 AM Emil: DEAD
10:36 AM Emil: sorry
10:36 AM Emil: dead
10:36 AM polprog: this one i can relate to: http://bash.org/?962920
10:36 AM polprog: :P
10:37 AM Emil: Top kek
10:37 AM Emil: but isn't that then COBOL ;)
10:38 AM polprog: ok, so cobol was the language that was essentially spoken assembly
10:39 AM Emil: https://emil.fi/jako/kuvat/2017-06-10_18-08-49_WcQUMPdV.png
10:39 AM Emil: The fuck is that supposed to mean :D
10:39 AM Emil: https://emil.fi/jako/kuvat/2017-06-10_18-09-05_RbpDxJta.png
10:39 AM polprog: i believe it's an infinite loop
10:40 AM Emil: so I thought, too
10:40 AM Emil: but if you look at it
10:40 AM Emil: it at least implies termination
10:40 AM polprog: it's definitely a loop
10:40 AM polprog: yeah, end perform
10:40 AM polprog: gtg
10:40 AM Emil: cya
12:47 PM JanC_ is now known as JanC
02:04 PM locuester3: I'm using a miniusb programmer to program my atmega328p-pu via the arduino compiler using "upload using programmer". Works fine, but the timing is horribly off. delay(1000) causes a ~16 second delay.
02:05 PM locuester3: thoughts?
02:05 PM LOMAS: can we activate both the CTC and Overflow interrupt in the same module ?
02:05 PM locuester3: I have not put on a external clock, so its using the internal 8mhz? I assume?
02:14 PM Emil: "arduino compiler"
02:15 PM locuester3: sorry, "compiler".
02:15 PM locuester3: is my approach flawed?
02:15 PM Emil: LOMAS: sure
02:15 PM Emil: but I mean :D
02:16 PM Emil: It can be useful
02:16 PM LOMAS: Emil, I mean at the same time. I don't think so
02:16 PM Emil: Tere i no special ctc interrupt
02:16 PM LOMAS: yes there is
02:17 PM Emil: rtfm
02:17 PM locuester3: I have amtel studio, but honestly cant even figure out how to do a "delay". I'm sure I can google if the better approach is to abandon the arduino platform. but I have a great led program runs great on an arduino. just trying to put it on an atmega for soldering onto a board.
02:18 PM locuester3: whats the best approach. right now it just looks like clock speed is wonky.
02:19 PM Emil: https://emil.fi/avr
02:31 PM locuester3: Emil: great intro page. compiling and sending that to my board does nothing though no led flash
02:31 PM locuester3: :/
02:31 PM locuester3: uploads without error
02:31 PM Emil: welll
02:31 PM Emil: is your led at the right place
02:32 PM locuester3: https://pastebin.com/RaY3v7s7
02:32 PM locuester3: yes.
02:32 PM locuester3: let me send a pic of breadboard.
02:34 PM locuester3: http://imgur.com/gallery/q9uL2
02:35 PM locuester3: why is one end of the led connected to a data pin instead of ground?
02:36 PM LOMAS: Emil, and how to disable a timer interrupt on the fly ?
02:36 PM LOMAS: let us suppose that I need to disable timer CTC interrupt while reading UART data
02:36 PM LOMAS: is it good way to set TIMSK = 0 to disable CTC interrupt
03:06 PM Emil: there is no ctc intereupt
03:06 PM Emil: get this through your skull :D
03:07 PM Emil: There is compare match a and b and overflow
03:07 PM Emil: nothing else
03:08 PM Emil: if you want to disable overflow interrupt just write 0 to the interrupt enable bit
03:10 PM Emil: TCCRnC iirc
03:13 PM Emil: locuester: everythibg is explained in the document
03:13 PM Emil: you can modify the circuit howwver you wany
03:35 PM locuester: Emil, I know. I'm just confused why its not running correctly. Thank you for your help.
03:44 PM Emil: locuester: check your crystal
03:44 PM Emil: check your crystal capaxitors
03:51 PM mark4: ok so im trying to build the appnote code for the xmega usart. it tells me it cant find <stdint.h>
03:51 PM mark4: :(
03:51 PM mark4: every fscking example i try to build tells me some include not find, some #define not defined....
04:04 PM mark4: can someone tell me why im getting stdint.h: no such file or directory
04:13 PM mark4: actually this c file cant even include avr/io.h
04:13 PM mark4: wtf over :(
04:54 PM Emil: fix your env
04:57 PM Jartza: or missing -mmcu=
09:26 PM locuester: I'm using a miniusb programmer to program my atmega328p-pu via the arduino compiler using "upload using programmer". Works fine, but the timing is horribly off. delay(1000) causes a ~16 second delay.
09:40 PM Casper: that's normal
09:40 PM Casper: and a user fault
09:40 PM Casper: first, do you indeed have a 16MHz crystal on your board with the matching capacitor?
09:52 PM Casper: locuester: ^^^^
10:27 PM Tom_L: also ckdiv8
11:55 PM Casper: I was going there after...