#avr | Logs for 2015-03-23

Back
[00:16:20] <Xark> Flipp_: Yes, __attribute__((__progmem__))
[00:17:18] <Xark> See avr/pgmspace.h
[00:17:39] <Xark> http://www.nongnu.org/avr-libc/user-manual/pgmspace.html
[00:18:07] <Xark> (Newer versions of avr-gcc require const also)
[00:18:09] <Flipp_> Xark: awesome, thanks. I knew there was probably some way to do it
[00:19:12] <Xark> Flipp_: Yeah. It is pretty critical or every "string literal" gets put in flash and copied to (precious) SRAM on program start. :)
[00:19:24] <Xark> (same for any array)
[00:20:07] <Flipp_> yup yup. My Main function pointer in my bootloader was being copied into sram, which was totally unnecessary
[00:20:22] <Flipp_> since it, y'know, never changes :)
[00:20:30] <Xark> Note that the compiler can't tell a SRAM pointer from flash pointer at run-time (so you have to be careful).
[00:21:39] <Flipp_> hm. alright. I know it uses lds for the original function pointer. I'll have to check the lss file for the new one...
[00:22:17] <Flipp_> hm. alright. I know it uses lds for the original function pointer. I'll have to check the lss file for the new one...
[00:22:28] <Flipp_> oops, sorry, too many windows open >.<
[00:22:39] <Flipp_> gotta look before alt-tabbing...
[04:20:03] <skroon> hi
[06:10:38] <Tekkkz> Hello!
[06:11:07] <Tekkkz> Look at my main.c:
[06:11:09] <Tekkkz> http://ix.io/h30
[06:12:20] <Tekkkz> At the INT1 interrupt im changing the X_EN flag if my spi_shift_data "register". It works, but if the external interrupt low (=no int anymore) this flag is set back as the origin (0, not 1 like in the ISR) why?
[06:13:02] <Xark> Hmmm...
[06:13:34] <Xark> Tekkkz: What chip is his code for?
[06:13:47] <Tekkkz> atmega32u4
[06:13:56] <Tekkkz> the code works
[06:14:04] <Tekkkz> but the flag i set in the isr
[06:14:14] <Tekkkz> this "set of the flag" is undoed after the isr
[06:14:42] <Xark> Hmm, so you are saying ISR sets it to 1, but (somehow) you see it reset to 0?
[06:15:22] <Tekkkz> yes, after the external interupt is "disabled" it is resetted
[06:15:24] <Xark> Since it is AVR register, presumably AVR is clearing it (based on SPI use etc.).
[06:15:48] * Xark is not familiar with X_EN offhand...
[06:16:24] <Xark> Hmm, X_EN not mentioned in 328P datasheet...
[06:16:26] <Tekkkz> X_EN is just #define X_EN 0
[06:16:32] <Tekkkz> its defined by me
[06:16:37] <Tekkkz> for bit 0
[06:16:45] <Tekkkz> of myy spi_shift_data "register"
[06:16:52] <Xark> Okay, that explains why I haven't heard of it. :)
[06:16:58] <Tekkkz> haha ok
[06:17:04] <Tekkkz> but why is it restted?
[06:18:23] <Xark> Not obbious. What makes you think it is getting altered?
[06:18:28] <Xark> obvious*
[06:19:11] <Tekkkz> what do you mean? my english is not really good so i dont know what you have asked
[06:19:20] <Xark> Since it is a static global, I wouldn't think any could would accidentally alter it (unless stack overflowing or similar).
[06:19:54] <Tekkkz> hm sorry? explain in easy words pls
[06:20:34] <Xark> Not clear how it would be clobbered. Is it possible that (e,g,) stack is overflowing or something that would trash it?
[06:21:42] <Tekkkz> hm i really dont know what you mean ..
[06:21:49] * Tekkkz need to improve his english
[06:22:35] <Xark> Why would global be over-written? Seems unclear.
[06:23:02] <Tekkkz> you mean why i wanna cahnge it?
[06:23:14] <Tekkkz> *change
[06:29:36] <Xark> I mean why would the memory be over-written. Seems unlikely AVR is doing it...
[06:29:37] <aczid> anyone here use the jtag ice mk2 under linux with Avarice?
[06:29:58] <Tekkkz> you mean why my "register" is getting overwritten?
[06:30:03] <aczid> seems like my device has a device ID that's not recognized by avarice
[06:30:06] * Xark only has AVRISPmk2 and Dragon (but has been eyeing AVRICE). :)
[06:30:49] <Xark> Tekkkz: Why is the memory address holding your global being overwritten. Seems like a code bug vs AVR oddness (at first glance).
[06:31:03] <aczid> well I guess I'll just fix it :)
[06:31:17] <Tekkkz> Hm so whats the problem? -> a bug?
[06:32:26] <aczid> my device id is not checked by avarice
[06:32:30] <aczid> it works in avrdude though
[06:33:07] <aczid> my device id is 03eb:2141 . that second part is not in the source, neither in decimal form
[06:33:10] <avrdude> wut?
[06:33:21] <aczid> not you :P
[06:33:24] <Tekkkz> hhahahaha
[06:33:26] <avrdude> oh
[06:35:36] <Tekkkz> Xark: so how can i fix it?
[06:36:21] <Xark> Tekkkz: Not clear. Look for how your code could write to that global, perhaps.
[06:36:30] <Tekkkz> hä?
[06:36:32] <aczid> ok so I guess it's not a real JTAGICE mkII. but a regular 'ICE debugger'
[06:39:40] <aczid> btw I was looking at the USBasp project yesterday
[06:39:45] <Tekkkz> btw
[06:39:52] <Tekkkz> im a coworker
[06:39:56] <aczid> anybody know why those programmers shouldn't support debugWire?
[06:39:57] <Tekkkz> of the usbtiny board
[06:40:04] <Tekkkz> its using the usbasp to selfprograamm it
[06:40:10] <Tekkkz> http://matrixstorm.com/avr/tinyusbboard/
[06:45:57] <Lambda_Aurigae> aczid, because they haven't been programmed to.
[06:46:24] * Xark notes probably not fully documented...
[06:46:40] <aczid> Lambda_Aurigae: exactly
[06:46:56] <aczid> the debugwire protocol seems to be documented enough to be able to use it from avarice
[06:47:04] <Lambda_Aurigae> aczid, debugwire isn't fully documented, as Xark mentioned. Also, usbasp is a quick hack programmer.
[06:47:21] <aczid> I know
[06:47:34] <aczid> would be cool if it worked. there's no technical reason it shouldn't, afaict
[06:47:47] <Lambda_Aurigae> so, make it work.
[06:47:51] <aczid> yes sir :)
[06:48:00] <aczid> also: has anybody played with reversing Dragon firmwares?
[06:48:15] <aczid> I was just asking if I'm right in my understanding
[06:48:23] <aczid> that there is no physical / fundamental limitation
[06:49:19] <jacekowski> someone did RE it though
[06:49:26] <jacekowski> debugwire i mean
[06:50:52] <aczid> yes
[06:51:01] <aczid> it's also the basis of avarice :)
[06:51:31] <aczid> I'm not sure if it's really fully reversed though. but seems to be understood well enough to try putting it in USBasp
[07:13:11] <Tekkkz> Lambda_Aurigae, aczid, jacekowski do you know why my register is resettet like described above?
[07:14:16] <Lambda_Aurigae> Tekkkz, programming in C? how did you select the register to use?
[07:14:49] <Tekkkz> C, yes, code:http://www.mikrocontroller.net/attachment/highlight/251534
[07:14:56] <Lambda_Aurigae> hmm.
[07:15:02] <Lambda_Aurigae> you don't have anything defined as register
[07:15:14] <Tekkkz> my static variable
[07:15:18] <Tekkkz> spi_shift_data
[07:15:22] <Tekkkz> i call it register
[07:15:28] <Tekkkz> cause im suign it like a register
[07:15:39] <Tekkkz> *using
[07:16:01] <Lambda_Aurigae> and,,,you want me to go through your code line by line and figure out how it works?
[07:16:23] <Tekkkz> wait
[07:16:25] <Tekkkz> sorry
[07:16:27] <Tekkkz> wait
[07:16:36] <Lambda_Aurigae> no time to wait...going to work now.
[07:17:51] <Tekkkz> okok
[07:17:53] <Tekkkz> so
[07:18:02] <Tekkkz> at the isr i want to set a flag to my "register"
[07:18:18] <Tekkkz> but after the isr it is resettet (set to 0) hwhy?
[07:21:44] <Tekkkz> ok whatever i need to go into the city bye
[10:30:04] <Tekkkz> hi
[10:30:15] <Tekkkz> i want to calculate something with the atmega32u4
[10:30:22] <Tekkkz> 16000000/(3200*128)-1
[10:30:38] <Tekkkz> instead of 3200 there should be a variable, but for now 3200 because:
[10:30:44] <Tekkkz> = 38.0625
[10:31:06] <Tekkkz> but i wont count with floats
[10:31:23] <Tekkkz> so does the chip round it to 38?
[10:33:00] <LeoNerd> Count?
[10:33:05] <Tekkkz> *calculate
[10:33:17] <aczid> don't use floats for loops :)
[10:33:25] <Tekkkz> ??
[10:33:29] <Tekkkz> i dont want to us a float
[10:33:35] <aczid> yeah ok
[10:33:38] <Tekkkz> so my questionis if the chip round it to 38
[10:33:50] <aczid> that depends on the types and the comparison you make
[10:34:05] <aczid> with ints it will probably round down to an int, so 38?
[10:34:21] <aczid> you can easily test this...
[10:34:33] <Tekkkz> #define step_val(f) F_CPU/(128*f)-1
[10:34:46] <Tekkkz> OCR0A = step_val(x)
[10:35:07] <Tekkkz> i will use it as define and write it into the OCR0A timer0 compare value a register
[10:35:12] <Tekkkz> will it round it down?
[10:35:25] <aczid> that register will not like you writing floating point values into it
[10:35:35] <aczid> so you should cast it to an int before, which will round it yes
[10:35:36] <LeoNerd> Are you using this for your own timing loop?
[10:35:42] <LeoNerd> If so, you might want to apply an IDDA to it
[10:35:43] <aczid> again you could have easily tested this on your own
[10:35:53] <LeoNerd> That way you can get subinteger resolution without actually using non-integer values
[10:37:41] <Tekkkz> hm i will have a look at it; aczid you are right, sorry
[10:39:31] <aczid> no worries man, next time just ask the compiler ;)
[10:45:21] <Tekkkz> nono, im worry cause im annoying and i dont want to be that
[10:52:15] <Tekkkz> zlog
[11:23:27] <Tekkkz> Whats a good function name for a function which handles the movement of 3 motors?
[11:23:35] <Tekkkz> motor_movement sounds stupid
[12:09:29] <howlymowly> hi everyone... short question: I tried to modify a register as output in a hardware-specific header file (like this DDRD |= 1 << PD7; // PDT=>Output): but i get an error "error: expected identifier or ‘(’ before ‘volatile’
[12:09:29] <howlymowly> DDRD |= 1 << PD7; // PDT=>Output" if do this.. any idea whats going on here?
[12:10:47] <howlymowly> is not possible to somehow put that "elegantly" outside of a function?
[12:11:26] <Tekkkz> which line is the error
[12:11:36] <Tekkkz> and paste the complete error please
[12:11:40] <Tekkkz> with given line
[12:13:04] <Tekkkz> Is it possible to make an External Interupt ISR just got called one time when the interrupt activated, so the interrupts isnt the whole time when the pin is low, only when the pin gets low?
[12:13:14] <Tekkkz> *become low
[12:13:28] <howlymowly> Tekkkz: its not really an "error" i just want to know if it is possible to change register variables like DDR outside of an actual function, as they are globally valid for my whole project
[12:13:39] <howlymowly> (I use avr-gcc)
[12:13:56] <Tekkkz> the error isnt at your code
[12:13:57] <LeoNerd> Tekkkz: Sure; use edge instead of level triggering
[12:14:06] <LeoNerd> I find that can lead to bugs though
[12:14:11] <Tekkkz> its somewhere else or are you using a vlatile?
[12:14:19] <Tekkkz> LeoNerd: will try this :D
[12:14:54] <Tekkkz> LeoNerd: you see, i studied the datasheet already but cause my bad english i didnt know what edge means :D
[12:16:41] <LeoNerd> Ah; then yes, what you just described is called "edge-triggering"
[12:18:12] <Tekkkz> ok
[12:36:47] <skroon> how can I use gdb to directly write to memory/io registers?
[20:55:15] <hypermagic> hello my friends