#avr | Logs for 2013-07-12

Back
[03:56:05] <sussman> We conjure the spirits of the computer with our spells.
[04:46:17] <braincracker> h
[05:39:26] <Elco> hi mdma!
[09:27:35] <antto> O_o
[09:27:47] <antto> what a silence today
[09:31:16] <Kev-> magnificent, isn't it?
[09:37:38] <antto> it's so loud ;]
[10:33:26] <cart_man> Why wont my dam code work? http://pastebin.com/WY65mtrM
[10:35:25] <cart_man> ?
[10:36:04] <cart_man> Anybody getting this... Nver know if I am disconnected :(
[10:36:18] <cart_man> RikusW: http://pastebin.com/WY65mtrM ? you see anything strange?
[10:39:04] <cart_man> The first IF statement always works and then just never go to Menu2()
[10:39:05] <cart_man> ?
[11:04:46] <RikusW> cart_man: *TimerX++;
[11:05:11] <RikusW> you need to put a * before to access the value
[11:05:24] <RikusW> LCDdisplay(&variable)
[11:05:52] <RikusW> erm (*TimerX)++;
[11:06:12] <cart_man> Ohh ok
[11:06:16] <RikusW> *TimerX++; will still increment the pointer itself..
[11:06:21] <RikusW> you need the ()
[11:06:57] <RikusW> when using >= () isn't required
[11:07:11] <RikusW> *TimerX=0;
[11:07:16] <RikusW> will work fine
[11:07:34] <RikusW> TimerX=0; assigns 0 to the pointer
[11:08:59] <RikusW> cart_man: so you want it to count really fast between 20000 and 21000 ?
[11:09:52] <RikusW> static int TimerX; might work too, if you don't need it outside of this function
[15:52:43] <braincracker> weird things happen when you don't use atomic_block when needed
[15:52:46] <braincracker> ;>
[15:54:14] <Roklobsta> so true. i just use: char sreg = SREG; cli(); foobar(); SREG= sreg;
[15:54:25] <Roklobsta> same thing
[15:55:08] <Roklobsta> don't forget, any variables shared between ISR and nonISR should be global and set as volatile.
[15:55:25] <braincracker> why volatile ?
[15:55:32] <braincracker> gcc is dumb?
[15:55:35] <Roklobsta> no
[15:56:11] <Roklobsta> it means it will always be atomically read and written instead of being inferred or optimised inappropriately
[15:56:17] <braincracker> yea gcc migh prefer optimizations that assume a variavle never change ...
[15:56:45] <Roklobsta> don't use volatile and do -O1/2/3 and watch your code fial.
[15:56:47] <Roklobsta> fail
[15:56:57] <braincracker> :)
[15:57:04] <braincracker> fail at random - best
[15:58:15] <braincracker> working after reset, works for a while, fails, power cycle doesn't help
[16:01:16] <braincracker> do you use volatile for tables ?
[16:01:17] <Roklobsta> oh yeah, and any non isr code that competes with resources (like shared volatile globals) must be wrapped in the atomic block.
[16:01:26] <braincracker> and tables in PGM?
[16:01:44] <Roklobsta> no, pgm are constant, can't be changed.
[16:01:54] <Roklobsta> i mean globals in ram
[16:02:14] <Roklobsta> like flags or data buffers
[16:02:23] <braincracker> volatile affects all code touching your variable
[16:02:29] <Roklobsta> yes
[16:02:47] <braincracker> but yea, it is constant
[16:03:17] <Roklobsta> OK, anything that is constant doesn't have to be valatile.
[16:03:39] <Roklobsta> like data in pgm
[16:03:39] <braincracker> unless you want magic functions :)
[16:03:52] <Roklobsta> or stuff declared as constant
[16:03:56] <Roklobsta> const
[16:06:57] <braincracker> and no suck thing like oops forgot to static volatile display buffer
[16:07:21] <Roklobsta> yes
[16:07:52] <Roklobsta> memory mapped I/O on the ram bus should be volatile too.
[16:08:03] <braincracker> it may also work for some time until the stars get out of ideal position :)
[16:08:21] <Roklobsta> so is it working now you use atomicblock and volatile?
[16:08:38] <braincracker> i was using it, but not everywhere
[16:08:50] <braincracker> now cleaning up things and correcting them
[16:09:09] <braincracker> by default i don't make everything static volatile
[16:09:23] <braincracker> and don't atomic_block everything
[16:09:51] <braincracker> also i added a display in interrupt later
[16:10:24] <braincracker> a non-interrupt code becomes interrupt-code
[16:10:57] <Roklobsta> only volatile variables shared by isr and non-isr. only atomicallyblock nonisr code that is competing with isr. Isr, but it's nature will block nonisr code.
[16:11:12] <Roklobsta> but = by
[16:12:10] <braincracker> raden <= learning hard how to code ?
[16:32:16] <braincracker> nah, code is rolling again
[17:16:59] <braincracker> mm button dual press function with backtracing
[17:17:20] <braincracker> non-blocking mode
[19:20:37] <lavataucher> hello, is this the right place for avr gcc questions or is there a more specific room?
[19:22:47] <theBear> this is probably it, try
[19:22:56] <lavataucher> alright
[19:24:10] <lavataucher> i'm reading data out of a uint8_t buffer, in particular i'm trying to fill a uint32_t with 4 bytes out of that buffer
[19:24:35] <lavataucher> let me pastebin that, hold on
[19:25:04] <lain> anyone have experience with AVR ONE's Streaming AUX Trace feature in AVR32 Studio or IAR Workbench? my project is from Atmel Studio 6.1, but that doesn't appear to support streaming trace, so I'm trying to debug it elsewhere...
[19:25:30] <lain> AVR32 Studio just crashes consistently on a java null pointer exception, and I can't seem to find anything but NanoTrace in IAR...
[19:26:21] <lavataucher> http://pastebin.com/MGzCTEGF
[19:27:01] <lavataucher> if i do it like a) it sometimes works, sometimes i get ff ff in the upper 2 bytes
[19:27:22] <lavataucher> if i do it like b) the endianess is wrong, but there are no random wrong bytes
[19:27:48] <lavataucher> the data in the buffer is always correct as verified by a dump
[19:42:30] <Roklobsta> avrgcc is LSB oriented
[19:43:26] <vectory> uhu?
[19:46:49] <lavataucher> actually, if i filter every part with a bitmask, it works: http://pastebin.com/TPh3hX9j
[19:47:15] <lavataucher> seems a bit clunky though
[19:54:52] <Roklobsta> try casting the destination as a union of uint32 and char[4] array. i have done that in the past to do what you are doing.
[19:59:59] <Roklobsta> typo.
[20:00:25] <Roklobsta> uint32_t seq = ((uint32_t)receive_buffer[4] << 24) | ((uint32_t)receive_buffer[5] << 16) | (uint32_t)receive_buffer[6] << 8 | (uint32_t)receive_buffer[7];
[20:00:42] <Roklobsta> try it with uint32_t on the last two bytes
[20:02:59] <lavataucher> ok, gonna try
[20:05:27] <lavataucher> yep, that works
[20:05:28] <lavataucher> thanks