#avr | Logs for 2013-12-31

Back
[04:09:09] <DarkSector> Hey guys, I connected a button to 10k resistor to 5V and the other end to GND. So it's HIGH when NC. On pressing the button it goes LOW. I connected it to my INT0 and this is my code http://pastie.org/private/zrdnsx1wffht3vt9dmggw
[04:09:23] <DarkSector> Unfortunately the else loop works only
[04:09:30] <DarkSector> Can anyone tell me what's wrong here?
[04:09:36] <DarkSector> *else condition
[04:10:10] <DarkSector> BTW the if condition is == 1 and not 0xFF
[04:11:08] <DarkSector> Oh shit, sorry, the Interrupt isn't working. Yeah, that's the problem. Any insight as to why it isn't?
[04:22:03] <DarkSector> Never mind found the errro
[04:22:06] <DarkSector> INT0_vector
[04:50:17] <rue_bed> I dont really see why it had to change
[06:47:59] <Epsilon-Auriga> http://tech.slashdot.org/story/13/12/31/0328221/if-unix-were-a-religion?utm_source=rss1.0mainlinkanon&utm_medium=feed
[07:11:58] <hackvana> carabia: Hi :-)
[07:12:11] <hackvana> 5 mins to go and it's 2014 here
[07:13:17] <Tom_itx> lemme know if it's worth getting all excited about
[07:14:50] <Epsilon-Auriga> think I'll stick with last year...I'm going back to 2012.
[07:15:21] <Epsilon-Auriga> hackvana: where you is?
[07:15:51] <Tom_itx> Au i believe
[07:15:57] <Epsilon-Auriga> oooh...yeah..looks so.
[07:15:58] <Tom_itx> or Ch sometimes
[07:16:02] <Epsilon-Auriga> I miss aussieland.
[07:16:23] <Epsilon-Auriga> spent a little over a year there back in the late 80s.
[07:16:47] <Epsilon-Auriga> daym...they are abandoning north dakota! there was a train wreck and it's on fire..
[07:17:05] <Epsilon-Auriga> well, at least, one entire town, which is like, half the population of the state most likely.
[07:17:22] <Epsilon-Auriga> well pooh.
[07:17:25] <Epsilon-Auriga> gotta go to work.
[07:24:14] <DarkSector> Does debounce affect INT0 connected to a button as well?
[07:24:22] <DarkSector> If so, how do I tackle that?
[07:26:37] <hackvana> Epsilon-Auriga: Melbourne Australia
[08:22:33] <vectory> DarkSector: int0 only triggers after x repeated reads, so, should be fine? try it?
[08:23:05] <vectory> although, a cap on the button doesnt hurt does it?
[08:23:13] <vectory> i mean, try and report, im curious :)
[08:23:41] <DarkSector> vectory https://github.com/DarkSector/AVR/blob/master/c/interrupts/interrupttest.c This takes multiple presses to toggle the glag
[08:23:42] <DarkSector> *flat
[08:23:44] <DarkSector> Fuck
[08:23:46] <DarkSector> *flag
[08:24:51] <vectory> maybe because
[08:24:59] <vectory> // Set INT0 as high
[08:25:03] <vectory> GIMSK = (1 << INT1);
[08:25:07] <vectory> is a bit mixed up
[08:25:37] <DarkSector> The pin's connected to INT0
[08:25:40] <vectory> wait, it does trigger sometimes, so the but is on int1
[08:25:49] <vectory> huh?
[08:25:49] <DarkSector> That was a mistake I already fixed, didn't fix the comment
[08:25:53] <DarkSector> Errr
[08:25:54] <DarkSector> INT1
[08:26:04] <DarkSector> Jeez, typo after typo
[08:26:14] <DarkSector> The pin's connected to INT1
[08:28:42] * twnqx` just connects everything to everything
[08:30:05] <DarkSector> So I am thinking there has to be an issue with debounce
[08:31:04] <vectory> oh, its edge triggered
[08:31:16] <vectory> yeah, most likely
[08:32:53] <vectory> scratch that
[08:33:30] <vectory> you have MCUCR[ISC10:ISC11] = 0, so thats level triggered
[08:34:17] <vectory> it will continuisly interrupt, as long as it reads a low signal
[08:37:39] <vectory> at least if you write for m8, which you dont cause m8 doesnt have GIMSK
[08:40:41] <overrider> I have a problem downloading code into an m128; i have a simple while(1) with a for loop that toggles some LEDs. It uploads fine via avrdude. Then i add one or two extra things to the while loop, such as an extra _delay_ms(100) or so, and then upon burning avrdude complains about a content mismatch. Adding since outside the while loop that never get executed works fine.
[08:40:58] <overrider> Any ideas, i would be grateful.
[08:41:47] <DarkSector> vectory I'll try that
[08:42:09] <DarkSector> overrider code?
[08:42:48] <vectory> DarkSector: try to turn of the interrupt in the int1isr and see if it reliably switches once
[08:42:58] <DarkSector> okay
[08:43:00] <vectory> or dont
[08:43:14] <vectory> nvm me, i dont know why i wrote that
[08:48:57] <overrider> Here are two examples that upload fine, and two that don't http://www.pastebin.ca/2520698
[09:12:46] <vectory> overrider: do the working ones still work? i find it hard to believe that verfificarion error had to with the code
[09:22:12] <DarkSector> overrider create your own delay function and try that
[09:22:22] <DarkSector> I have had a lot of problems with _delay_ms()
[09:34:41] <overrider> What i posted as working really works fine, and the other ones don't. Ill try to play more. For now, i seem to have bricked the whole board(one of those development boards with lots of leds and buttons etc), by setting the wrong fuses somehow maybe. Figuring out how to reset it now.
[09:43:25] <phinxy> Could a bad solder on my small(minimal) caps to the clock crystal make it oscillate 10x times more slow?
[09:43:54] <phinxy> delay_ms(250) is like 1000 ms
[09:45:04] <phinxy> when i bought the caps for the crystal i got the 2-3mm wide ones. wasnt easy getting legs soldered on it :\
[09:46:06] <twnqx`> lol
[09:46:07] <twnqx`> no
[09:46:18] <twnqx`> i would not expect that
[09:48:04] <phinxy> fuses on external crystal. i swear to god it was ticking at right speed before..
[09:48:14] <phinxy> no wonder SPI didnt work
[09:53:14] <DarkSector> Ah electronics. 25 percent actual information and control, 75 percent magic.
[09:53:17] <DarkSector> later
[10:07:09] <overrider> this is the kind of crystal i got, http://orzparts.com/images/7-3728MHZ.jpg , a 7.3728Mhz one. What is the right fuse for that? I am using http://www.engbedded.com/fusecalc/ and not sure what to pick. Is it an Ext. RC Osc. 3.0 MHz - 8.0 MHz?
[10:07:51] <overrider> Or is it a Ext. Crystal/Resonator Medium Freq.
[10:08:00] <phinxy> all the way down in the drop down is what i use
[10:08:19] <phinxy> oh right. it could be medium one
[10:09:17] <phinxy> overrider, i would just try it out.
[10:09:48] <phinxy> make sure you have two caps for the crystal too. so it can oscillate
[10:10:54] <overrider> It does have
[10:11:12] <phinxy> overrider, any reason you go with the crystal? what mcirocontroller do you have?
[10:12:02] <overrider> Its a avr development board which has this crystal onboard already, and its a m128a
[10:12:34] <overrider> Also, i just tried and it froze the system. Now i need to hookup an arduino again to x1 to be able to reset the fuses
[10:13:00] <overrider> Grr this fuse business. I suspect because i have the wrong settings in there, is what is causing my bizzare upload problems.
[10:16:06] <phinxy> overrider, you should be fine with default engbedded settings and just changing the dropdown to Ext. anyhow just so you know you can run 8mhx with the internal oscillator
[10:17:57] <overrider> ok. Happy New Year. It just turned where i am.
[10:18:07] <overrider> I hear the fireworks outside lol.
[10:18:30] <overrider> Now back to these fuses :-)
[10:20:44] <phinxy> ++++++++,-
[10:21:38] <phinxy> ++++-++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
[10:21:44] <phinxy> Sorry
[10:22:01] <phinxy> happy new year
[10:28:00] <twnqx`> +8 hm... china?
[10:28:29] <phinxy> Is it possible for a crystal to wear out and tick slower if given too much voltage?
[10:29:16] <overrider> Yes China.
[10:31:12] <overrider> And i still can't upload. Gosh darnit. Maybe this board is messed up a bit or something.
[10:31:40] <phinxy> using avrdude?
[10:35:56] <phinxy> overrider, i now remember; you cant use the Ext.Clock since that is something completley different in engbeddeds calc
[10:36:10] <overrider> yes using avrdude
[10:36:10] <phinxy> you want the ones which is ext.crystal/oscillator
[10:36:26] <overrider> Ok interesting, thanks
[10:43:53] <overrider> ok awesome. Used the last entry in the list and it worked...
[10:45:18] <phinxy> glad to hear that i changed from external to internal and its now not responding at all! wow
[10:45:27] <overrider> But still get verification error; content mismatch when burning something slightly more complex than blink. Maybe this board is bad, ill give it a rest for today. Thanks for helping...
[10:45:34] <overrider> He
[10:45:42] <phinxy> overrider, if youre using usbasp thats normal
[10:46:07] <overrider> really? But the code actually uploads incorrectly to the device
[10:46:32] <phinxy> oh no thats not normal. i was refering to: avrdude: warning: cannot set sck period. please check for usbasp firmware update
[10:46:47] <phinxy> i gotta use -F to get a sucessful flash
[10:47:48] <overrider> Yeah for me that wont do unfortunately.
[10:48:08] <overrider> Ill have another go tomorrow.
[10:54:59] <ambro718> is there anything faster than strtod for converting text to float?
[11:05:41] <vectory> you might get away a bit faster if you are willing to loose precision and write your own routine
[11:06:12] <vectory> no wait, thats for the reverse case
[11:08:38] <phinxy> How come PIC has a very cheap beginner debugger and atmels costs so much?
[11:12:50] <vectory> atmel has a dragon for 50
[11:12:50] <vectory> *the avr dragon
[11:15:47] <phinxy> vecotory, is there any reason to get something better than the dragon? For amateur use
[11:26:19] <vectory> i dont know but i guess it depends on the features you need
[11:27:30] <vectory> like what debuging protocol it supports
[11:27:41] <vectory> i used the jtag on xmega
[11:28:29] <vectory> seems the knowledgable regulars are out partying
[11:30:20] <twnqx`> jtag mk1/2 clones are cheap too
[11:44:26] <phinxy> ive decided to go with dragon. is it a good idea to order from atmel.com so i dont get a clone?
[11:44:40] <phinxy> or should i just ebay it
[14:30:01] <Tom_itx> phinxy do you need jtag?
[14:43:43] <phinxy> Tom_itx, I just ordered the dragon :) yeah id like that. its so universal
[14:43:54] <phinxy> even my satellite box got it
[14:45:34] <Tom_itx> got what?
[14:45:48] <phinxy> Tom_itx, AVR dragon
[14:46:18] <Tom_itx> you will need to make connectors for it
[14:46:23] <Tom_itx> it comes with none
[15:17:07] <OndraSter_> your satellit box got AVR Dragon?
[15:17:08] <OndraSter_> or what?
[15:17:19] <OndraSter_> JTAG on AVR won't work with JTAG on some ARM
[15:17:33] <OndraSter_> (ok, JTAGICE3 is an exception)
[15:17:53] <rue_house> jtag isn't standard then? or just the drivers
[15:19:07] <Tom_itx> OndraSter_ is jtagice3 universal jtag?
[15:19:33] <OndraSter_> JTAG is standard
[15:19:38] <OndraSter_> but only basic commands are universal
[15:19:47] <OndraSter_> Tom_itx, jtagice3 works with AVRs and the lowend atmel's ARMs
[15:19:51] <OndraSter_> (atsam20)
[15:19:54] <OndraSter_> samd20
[15:19:57] <OndraSter_> or w/e is the name
[15:19:59] <Tom_itx> oh
[15:20:26] <OndraSter_> basicly JTAG defines communication level, not data itself
[15:21:40] <OndraSter_> so don't expect AVR Dragon to work with your satbox @phinxy
[15:22:22] <OndraSter_> I have Riff Box for ARMs, but it has libs only for ARMs that are in phones etc, only single (AT91SAM9X... I think) non-phone ARM is supported
[15:22:41] <OndraSter_> and it contains a (huge) FPGA that is controlled from the PC anyway
[15:22:53] <OndraSter_> like I said, JTAG only defines the way the data are transmitted
[15:47:24] <learath> speaking of JTAG :) are there any good jtag utilities for linux?
[16:52:06] <rue_house> do you have a keyboard and gcc installed?
[17:02:16] <kdehl> Well, happy new years, people! I'm off watching fireworks.
[17:13:44] <Epsilon-Auriga> http://img.gawkerassets.com/img/17n1rfl1x98oljpg/ku-xlarge.jpg
[19:34:41] <ambro718> omg stupid gcc... ((uint32_t)bytes[0] << 0) | ((uint32_t)bytes[1] << 8) | ((uint32_t)bytes[2] << 16) <-- it actually produces "or" instructions
[19:35:52] <ambro718> luckily I was able to trick it into producing efficient code using a union
[19:37:50] <phinxy> ambro718 ive seen similar code which i compiled without problems
[19:37:56] <phinxy> maybe youre missing | =
[19:38:33] <phinxy> (im noob)
[19:38:44] <ambro718> it "compiles without problems" all right....
[19:47:04] <antto> ambro718 perhaps it sees uint32's
[19:47:39] <antto> try (uint32_t)(bytes[0] << 0)
[19:47:59] <ambro718> maybe later, it's working now with union
[19:48:05] <ambro718> but you need the others I think
[19:48:07] <antto> but yeah, union ftw
[19:48:12] <ambro718> or integer overflow
[19:48:38] <antto> if you bitshift uint8_t - you lose teh bits
[19:49:15] <ambro718> I think the uint8_t is auto promoted to int (int16_t) so you can actually shift 7 bits safely (but not 8 bits)
[19:49:52] <ambro718> I consider this a defect of C
[19:50:24] <ambro718> semantics of operations on fixed size types depend on what "int" is, lol
[20:58:47] <specing> -mint8