#avr | Logs for 2014-04-28

Back
[03:59:51] <volbus> Hi! By
[03:59:53] <volbus> Traducir del: espaƱol
[03:59:54] <volbus> initialization
[04:00:02] <volbus> crap!
[04:01:28] <volbus> Well, by initializing the eeprom in avr-gcc, like label1: .byte 0x66, label2: .ascii "mytext"..., is there a way to get the addresses of the labels to use them in the code?
[04:01:53] <volbus> without counting the bytes
[04:30:10] <volbus> anyone still using the avr-as?
[04:34:23] <Xark> Sure, try something like: extern char label1[];
[04:34:48] <Xark> (You may need to preprend an underscore or something [whatever C does]).
[04:35:09] <volbus> yeah, but I'm doing it in asm, not C
[04:35:29] <Xark> Ok, so when you say code, you mean use the asm label in asm? :)
[04:35:33] <volbus> in C I could use the sizeof()
[04:35:41] <volbus> yes
[04:36:08] <Xark> Ahh, in asm you would define a label at the end and get the size via endtable-starttable (e.g.)
[04:36:52] <volbus> endtable-starttable? How does thet work?
[04:37:30] <Xark> Well, just subtraction. If you subtract the address of the end of your table from the address at the start you get the size (similar to sizeof).
[04:38:23] <Xark> Perhaps your question is more basic... how to use a label in AVR code?
[04:39:09] <volbus> no, I know how to use it, I don't know how to get the addresses of EEPROM labels without counting the bytes
[04:39:51] <Xark> volbus: I don't get why you can't treat them as normal labels...
[04:40:55] <Xark> volbus: However, I have never actually used EEPROM from AVR asm, so I may be missing some issue.
[04:41:26] <volbus> 'cause it doesn't work. Let's say somewhere in EEPROM I have: label: .ascii "mytext", ok, so now I want to load the eeprom address of label in register r16: "ldi r16, label" won't work
[04:43:39] <volbus> Xark: you know what I mean?
[04:48:38] <volbus> so I have to count (know) the eeprom address of label, and define it with .equ label_address, 0xYY; and then use "ldi r16, label_address"
[04:48:45] <Xark> volbus: Why won't it work? Why is an eprom label different from a normal one? Perhaps you ave to declare it external?
[04:48:59] <Xark> volbus: Are you using ".eseg" directive?
[04:49:38] <volbus> no, I use ".data" directive, .eseg is not recognized in avr-as
[04:50:25] <Xark> How does it know it is for EEPROM (vs SRAM or Flash)?
[04:51:40] <volbus> 'cause in asm, I have a code section ".text", and the eeprom section is a ".data" section and I assamble them separately
[04:52:33] <volbus> so, I tell the assembler to assemble the code section in a .hex file, and the data section in a .eep file
[04:54:37] <Xark> OK, I am pretty sure it is possible to also link with that file (in a discardable segment, similar to SRAM) and get at any symbols defined.
[04:55:58] <Xark> I say this being familiar with GNU tools (and knowing they don't care about AVR EPROM so probably work normally). However, too late for me to prove my theory. :)
[04:58:00] <volbus> well..., I'll just do the counting then... 'till I get smarter! :)
[07:18:01] <Tom_itx> anyone have any issues programming an XMEGA16E5 with my programmer?
[07:50:41] <Roklobsta> Tom_itx: clearly not
[07:54:23] <superware> I'm trying to capture PWM from atmega328 IPC1 (PB0) but getting stange values from _pulse_ticks http://pastebin.com/Y8WGzNXg any ideas?
[08:01:06] <superware> anyone?
[08:17:59] <angs> I have a very simple loop with _delay_ms() that is run on atmega168a, I expect the delay to be about 20 sec as it delays 200ms for 100 times, but when I measure it, it takes about 40 sec. can anyone tell me why it waits twice longer than I expect?
[08:19:02] <dxtr> slower clock frequeny?
[08:19:23] <angs> dxtr, I forgot mention it, I use #define F_CPU 1000000UL // 1 MHz
[08:20:27] <dxtr> Why not 20MHz?
[08:21:37] <dxtr> I'm a filthy noob so I may or may not be of any help :p
[08:21:45] <angs> the internal oscillator of that MCU has maximum 8 MHz freq, and I use CKDIV8 fuse that MCU's freq should be 1MHZ
[08:22:31] <angs> I thought the _delay_ms() handles the frequency by itself as its name says ms delay
[08:23:11] <dxtr> yeah, as long as F_CPU is correct according to my understanding
[08:23:46] <dxtr> What else are you doing in the loop?
[08:23:56] <angs> nothing, just that one
[08:23:57] <dxtr> does that take 200ms?
[08:24:03] <dxtr> right
[08:25:36] <dxtr> 1MHz isn't a lot so what I would do is to measure how long the loop itself is taking. Shouldn't be more than two or three instructions in total but you never know :p
[08:26:24] <dxtr> But, as I said.. I'm not expert
[08:26:30] <dxtr> no expert*
[08:27:31] <angs> I measure the total loop, it loops _delay_ms(200) 100 times, I read the http://www.nongnu.org/avr-libc/user-manual/group__util__delay.html#gad22e7a36b80e2f917324dc43a425e9d3 it says the clock should be constant and I defined it as that document suggests
[08:28:12] <dxtr> did you define it before the include?
[08:28:23] <angs> yes
[08:28:34] <angs> it is on the very top part of the code
[08:28:58] <dxtr> hmm
[08:29:16] <dxtr> well, measure the loop without _delay_ms
[08:29:55] <dxtr> (And make sure the compiler doesn't remove it during the optimizations)
[08:30:16] <angs> loop does not do anything, it just assign a value to OCR0A
[08:30:35] <dxtr> measure it..
[08:31:08] <angs> it should take 1 or 2 clock to assign a new value to OCR0A
[08:31:32] <dxtr> should
[08:32:09] <dxtr> plus th loop
[08:32:18] <dxtr> How many cycles is that?
[08:33:17] <superware> is this http://pastebin.com/KSkcexuc the right way to capture PWM on PB0/ICP1? I'm getting stange values from _pulse_ticks
[08:33:46] <rue_bed> superware, hmm, I have code that does that somewhere
[08:38:11] <superware> rue_bed: can you spot something wrong with mine?
[08:44:33] <superware> anyone?
[10:24:17] <MrVoltz> Hi, I have problem with avra. It shows me: Cannot find include file: m8def.inc
[10:25:25] <MrVoltz> But the file is in /usr/share/avra/
[12:50:08] <dxtr> Try adding -I/usr/share/avra to your command line
[17:27:05] <awozniak> I have dev studio and a JTAG ICE mkII. how do I read the registers in the chip? In the device programming window, I see tons of stuff about programming memory and reading fuse bits and production signatures, but there doesn't seem to be a way to read the program counter.
[17:28:39] <Tom_itx> should be on the right side panes
[17:28:56] <Tom_itx> i forget just which one you open
[17:30:30] <awozniak> Tom_itx: in the device programming window, or the main dev studio window?
[17:30:41] <Tom_itx> main
[17:34:41] <awozniak> Tom_itx: looks like I need source code. I'm working on a bootloader, and all my compiles are currently done via a makefile on a linux machine. Is there any way to do this without having to port my project into dev studio? I just want to read the registers...
[17:35:15] <Tom_itx> not that i know of since the code modifies the registers
[17:35:26] <Tom_itx> you would view them in debug mode single step most likely
[17:35:53] <Tom_itx> you can use the external makefile in studio
[17:46:38] <awozniak> Tom_itx: thx, easiest thing to do was open / file / open object file for debugging, then tell it to look at the external makefile.
[17:47:51] <Tom_itx> yep
[21:53:07] <krysmin> how to copy data from register to memory? assembly
[21:53:39] <krysmin> like "mov variable, r16"