#avr | Logs for 2013-07-14

Back
[05:01:48] <braincracker> http://circuitco.com/support/index.php?title=BeagleBoneBlack < 2) Made the LEDs dimmer for those that could not sleep due to the brightness of the LEDs. << humans!
[05:03:12] <braincracker> user error and they mod the board because of this lol.
[05:04:10] <twnqx> using bright status leds is a design error
[05:04:50] <antto> diffused LEDs are the shizzle
[06:05:19] <braincracker> put on duct-tape, sandpaper the led, or change the resistor you want.
[06:05:36] <braincracker> now i will complain i can't see the led in daylight.
[06:26:07] <braincracker> new quad core arm http://www.allwinnertech.com/en/product/A31.html
[06:40:34] <Roklobsta> screw avr, i want arm. bye bye, suckers.
[06:59:20] <braincracker> this can run quake3 for 100 euros.
[06:59:31] <braincracker> avr is $4
[07:21:34] <twnqx> so it can decode 4kx2k - but not display it
[07:21:36] <twnqx> good job.
[07:43:54] <braincracker> :)
[07:44:06] <braincracker> hey abcminiuser
[07:44:15] <abcminiuser> Heyo
[07:44:32] <braincracker> blogged some things here if you are interested
[07:44:41] <abcminiuser> Sure, lets see
[07:44:48] <braincracker> adc issues
[07:44:58] <braincracker> internal mux
[07:45:19] <braincracker> ti think youwere not here at the moment
[07:46:13] <braincracker> and timer2 ctc mode does not work as i expected
[07:46:30] <Roklobsta> have you looked at the chip errata?
[07:46:33] <braincracker> i could make it work though by resetting the timer2 count within the ocra interrupt...
[07:48:35] <braincracker> the adc internal mux is not brake before make? or there is some problem internally you forgot to mention
[07:48:48] <braincracker> slow switching?
[07:49:04] <abcminiuser> What's wrong with the CTC mode first
[07:49:19] <theBear> course it's break before make ! and the timing is clearly mentioned in the datashee
[07:49:20] <theBear> t
[07:49:37] <braincracker> it simply does not work
[07:50:00] <theBear> you're simply doing it wrong
[07:50:04] <braincracker> tried to set ctc more on timer2 to div by 128, and set ocra
[07:50:25] <abcminiuser> I've used it before, so I would hope it works
[07:50:28] <abcminiuser> Show us your code
[07:50:37] <braincracker> and expected timer counter be cleared after reaching the limit
[07:51:43] <braincracker> and timer2_OVF_VECT be called
[07:52:39] <braincracker> i have pasted here some code i used
[07:52:58] <braincracker> right now i'm doing 5 things at same time
[07:54:04] <theBear> that's probly why you getting two of them wrong
[07:54:10] * theBear smiles
[07:54:57] <braincracker> now only 4, the bike lamp started functioning
[07:56:09] <braincracker> i know i should create a test case you can compile make and test out instantly...
[07:56:30] <braincracker> this is what gcc devs say on problems too
[07:57:05] <braincracker> but i could say atmel did not provide enough information to make it work correctly
[07:57:12] <theBear> i dunno about the compile/make/test bit, but that's kinda basic debugging
[07:57:20] <theBear> make a test case, workout the differences
[07:58:00] <braincracker> also was wondering if internal mux will get damaged if switched into a reserved state
[07:58:17] <twnqx> (me checks his code
[07:58:24] <twnqx> yes, using timer 0, 1, 3 in ctc mode
[07:59:08] <braincracker> hm;/ does timerx overflow int get triggered reaching limit? and get reset to 0 ?
[07:59:26] <twnqx> why iverflow
[07:59:35] <twnqx> i use the COMP interrupts
[07:59:48] <braincracker> ocra int gets triggered, but i had to reset the timer counter value manually
[08:00:27] <twnqx> TIMER0_COMP_vect, TIMER1_COMPA_vect, TIMER3_COMPA_vect
[08:00:38] <braincracker> used timer2 btw
[08:00:43] <braincracker> and in async mode
[08:00:55] <twnqx> you said ctc
[08:01:00] <braincracker> yes
[08:01:03] <braincracker> async ctc mode
[08:01:54] <twnqx> TCCR0A = 1 << WGM01 | 0 << WGM00 | /* CTC Mode */
[08:01:54] <twnqx> 0 << CS02 | 1 << CS01 | 1 << CS00; /* Clock /64 from prescaler */
[08:01:54] <twnqx> OCR0A = 250; /* 16MHz/64 = 250000 */
[08:01:54] <twnqx> TIMSK0 = 1 << OCIE0A; /* Enable Output Compare Interrupt */
[08:02:18] <twnqx> gets me a strict 1khz interrupt
[08:02:39] <twnqx> so the timer must be reset
[08:03:09] <twnqx> of course not an overflow interrupt, since the timer never overflows, as it's reset before it does
[08:04:10] <twnqx> so you need to use TIMER0_COMP_vect
[08:05:50] <braincracker> http://pastebin.com/h03iqiMv
[08:06:13] <braincracker> here is my init_timer2 async ctc routine
[08:06:58] <braincracker> now disabled overflow interrupt since it wasn't triggered anyway...
[08:09:31] <twnqx> TCCR3A = 0 << WGM31 | 0 << WGM30;
[08:09:31] <twnqx> TCCR3B = 1 << WGM32 | 0 << WGM33 | /* CTC Mode */
[08:09:31] <twnqx> 1 << CS32 | 1 << CS30; /* Clock from /1024 prescaler */
[08:09:32] <twnqx> hm
[08:09:45] <twnqx> for me to get ctc mode i have to clear the wgm?1 bit
[08:10:11] <braincracker> ds is not too clear about those magic flags
[08:10:47] <braincracker> you have to guess the numbering in atmega168p ds
[08:11:15] <twnqx> i see
[08:11:29] <twnqx> so they might differ between chiops
[08:11:35] <twnqx> well, you can try mine :P
[08:11:40] <braincracker> i'd expect even between timers
[08:11:49] <twnqx> they differ between 8 and 16bit timers
[08:12:04] <braincracker> and timer2 has async mode too...
[08:12:11] <braincracker> it is different
[08:12:34] <twnqx> not sure what that means without downloading and reading the DS
[08:12:40] * twnqx rather goes and makes soem espresso
[08:12:41] <twnqx> bbl
[08:13:02] <braincracker> that means it ticks asynchronously related to cpu clock
[08:47:43] <braincracker> Dhrystone Benchmark, Version 2.1 - amd 64 3500+ http://pastebin.com/9jJsmp76
[08:48:53] <twnqx> cute
[08:48:55] <twnqx> i had that cpu
[08:48:59] <twnqx> 10 or so years ago
[08:49:01] <braincracker> :)
[08:49:29] <braincracker> how does this compare to a beaglebone black, or olimex a20 ?
[08:52:31] <braincracker> http://e2e.ti.com/support/dsp/omap_applications_processors/f/447/t/93345.aspx
[08:52:34] <twnqx> probably not at all.
[08:53:08] <braincracker> "1.9 DMIPS/MHz for all our Cortex-A8 based parts"
[08:59:46] <braincracker> oh yea i see http://zenit.senecac.on.ca/wiki/index.php/Dhrystone_howto
[09:06:13] <braincracker> nah done, hacked the source, 3173.445 DMIPS
[09:06:27] <braincracker> (relative to the 1 MIP VAX 11/780 that achieves 1757 Dhrystones per second)
[10:27:10] <braincracker> Dhrystone Benchmark, Version 2.1 - amd 64 3500+ correction http://pastebin.com/f6q5zihE hmm i noticed Hz setting was incorrect and this alters results, actually the cpu performs better
[10:27:41] <braincracker> 5289.074 DMIPS / 2199.716 MHz
[10:40:47] <jobgg> hey
[10:40:58] <jobgg> anybody programming avrs on ubuntu?
[10:41:18] <braincracker> no
[10:41:21] <braincracker> but on linux
[10:41:25] <theBear> just ask the real question, ubuntu is background information, pfft
[10:41:38] <theBear> and likely irrelevant
[10:45:54] <Tom_itx> jobgg yeah why not?
[10:46:43] <specing> ubuntu is the new linux
[10:47:07] <specing> speaking of which... their shell scripts are junk
[10:47:22] <jobgg> well, I'm looking for some kind of guide setting up a toolchain
[10:47:41] <specing> jobgg: you can
[10:47:46] <specing> 1) install a pre-built one
[10:47:52] <specing> 2) build your own
[10:48:00] <specing> a) manually
[10:48:15] <specing> b) using a script
[10:48:31] <Tom_itx> install it from the package manager silly boy
[10:48:34] <Tom_itx> it's there
[10:51:15] <Tom_itx> avrdude is separate iirc
[10:51:22] <Tom_itx> as is the debugger
[10:54:17] <Tom_itx> avrdude, binutils-avr, avr-libc, gdb-avr, simulavr, gcc-avr all part of it
[11:02:11] <RikusW> avarice is the debugger
[11:23:24] <jobgg> ok, i had everything in that list except for simulavr
[11:40:36] <mr_boo> do most avrs have a hardware counter incorporated that is at least 16 bit?
[11:43:07] <specing> yes
[11:43:17] <specing> s/counter/timer/
[11:43:31] <mr_boo> neat
[11:44:56] <mr_boo> how many clock cycle would you believe it would take to emulate a 16 bit word and perform division with another 16 bit word?
[11:45:37] <twnqx> rough guess: 6 per bit until underflow.
[11:45:57] <twnqx> how about you benchmark it :P
[11:46:46] <mr_boo> i'd like to make a polyphonic synthmodule with only one avr
[11:48:19] <mr_boo> i was thinking maybe one could generate square waves at division of the clock frequency
[11:48:22] <twnqx> try to avoid divisions :P
[11:48:50] <Xark> mr_boo: Hmm, I had good luck with the technique this project shows -> http://www.instructables.com/id/Turn-your-Arduino-into-a-4-voice-wavetable-synth-w/ (here are photos from my attempt -> http://imgur.com/a/qPis6#2 )
[11:48:59] <BJfreeman> have yet to figure out what the attraction is to us 8bit uC for 16 bit operations
[11:49:38] <twnqx> just glue a SID to the ARM :P
[11:49:41] <twnqx> err to the AVR
[11:49:48] <BJfreeman> LOL
[11:49:48] <mr_boo> Xark: how did you make it polyphonic?
[11:50:04] <Xark> mr_boo: It mixes together 4 waveforms.
[11:50:13] <twnqx> not good, BJfreeman?
[11:50:40] <BJfreeman> twnqx just noted the slip with ARM
[11:50:41] <Xark> mr_boo: I suspect you could add more (perhaps 8 with careful coding).
[11:51:03] <mr_boo> Xark: you're amazing
[11:52:16] <mr_boo> Xark: i believe you're mixing the waveforms analogly
[11:52:25] <Xark> mr_boo: Heh. I will mention that my waveforms are generated while I am also bit-banging composite video -> http://imgur.com/a/JO4Cq
[11:52:51] <Xark> (doing audio mixing in horizontal blank - similar to how Amiga did it).
[11:54:27] <Xark> mr_boo: No, every this is all digital (using one output pin). See this pic and you can see the "digital" PWM superimposed on the "smoothed" output waveform (using a small capacitor). -> http://imgur.com/a/qPis6#1
[11:54:34] <Xark> every thing*
[11:55:04] <mr_boo> Xark: what sampling frequency and bit-depth of the waveforms in your project?
[11:56:50] <Xark> mr_boo: This was using 8-bit wavetables (and 8-bit output). I did the mixing at 22Khz (mixing four samples per scan line as I output composite video).
[11:57:43] <mr_boo> hmm honestly i'm aiming at better audio quality
[11:58:19] <mr_boo> are there 32-bit ARM development kit available corresponding to the aurdino and avropendous?
[11:58:37] <Xark> mr_boo: Yeah, this sounded pretty OK, but not going to win awards for fidelity. I wanted it for "game" sound effects etc. (BTW, it was 15.625 kHz not 22Khz).
[11:59:05] <Xark> mr_boo: I suggest looking into Teensy 3.0.
[12:00:12] <mr_boo> looks intresting
[12:00:52] <Xark> mr_boo: http://www.pjrc.com/store/teensy3.html ~$20 for 32-bit ARM @ 48Mhz.
[12:01:08] <mr_boo> amazing
[12:01:22] <mr_boo> costs more than avrs of course
[12:02:01] <Xark> mr_boo: Less than many AVR boards, actually (e.g., less than Arduino Uno board IIRC).
[12:02:08] <Amadiro> There's also the launchpad stellaris, which used to be $5 for 80MHz 32-bit ARM with VFP, but I think they bumped the price to $12
[12:02:41] * Xark has one of those in his drawer (much prefer Teensy 3.0). :)
[12:02:58] <Amadiro> Haven't tried the teensy3.0 yet
[12:03:13] <mr_boo> think i want a teensy now
[12:03:56] <mr_boo> gotta find a c compiler environment similar to avr studio
[12:04:36] <Amadiro> Doesn't AVRStudio (Isn't it called "AtmelStudio" nowadays?) just use avr-gcc?
[12:04:47] <mr_boo> yup
[12:04:57] <Amadiro> then switching to arm-gcc shouldn't be too hard
[12:05:06] <mr_boo> what compiler is used for the ARM microcontrollers?
[12:05:14] <mr_boo> ah
[12:05:29] <Xark> mr_boo: Teensy 3.0 has a modified Arduino IDE (using gcc-arm).
[12:05:45] <mr_boo> i see
[12:06:30] <Amadiro> mr_boo, I've programmed AVR, PIC, MSP430 and ARM microcontrollers with gcc, I don't think there's really much of an alternative
[12:06:32] <mr_boo> amazing one can get the hands on a 32-bit architecture system for as little as $20
[12:06:41] <Amadiro> TI has their own shitty C compiler for MSP, but I wouldn't use it...
[12:06:57] <Xark> Amadiro: Is it still "crippled"?
[12:07:20] <Amadiro> Xark, don't remember, but it's just a shit C compiler all-around. It produces small output and everything, but it doesn't even implement C99.
[12:07:31] <Amadiro> I think it wasn't particularly crippled for the line of devices I was using
[12:07:40] <mr_boo> as far as i can see i'm going to be able to make me a hammond tone-wheel emulator for $20
[12:07:56] <Xark> Amadiro: Yeah. As I recall it had limits on optimization or code size (but I may be mixing it up with Microchip).
[12:08:00] <mr_boo> they're like $150 and up
[12:08:29] <Amadiro> It also isn't really able to produce even a fraction of the useful warnings gcc can spit out. I still kept it in the loop because it would occasionally give a warning gcc couldn't give (like "doing this or that will increase your power consumption") but I wouldn't use it other than that
[12:08:38] <BJfreeman> yeah and you don't know what your missing in audio till you do it with a DSP and DAC
[12:08:40] <Amadiro> Xark, microchip does that, yeah.
[12:09:06] <mr_boo> * correction hammond modules are $1500 and up
[12:10:00] <BJfreeman> The arduino IDE 1.5.x has the arm compiler in it also
[12:10:32] <BJfreeman> or you can go native ARM with the maple IDE
[12:11:39] <BJfreeman> I use Eclipse with the AVR and ARM toolchaings
[12:11:41] <Amadiro> Or just a text-editor and arm-gcc
[12:12:14] <BJfreeman> yup all sorts of flavors
[12:12:18] <Xark> You can go native with Arduino IDE even. Just declare your own "main" (not setup/loop) and don't call Arduino funcs also.
[12:12:41] <BJfreeman> Xark true
[12:13:00] <Amadiro> Xark, it's kinda hellish to debug once something goes wrong though
[12:13:06] <Xark> BJfreeman: However, I do suggest a better editor. :)
[12:13:07] <Amadiro> and severely limits you in the options you get to use
[12:13:16] <Xark> Amadiro: Serial prints FTW. :)
[12:13:28] <Amadiro> Xark, I mean in cases where your code doesn't work
[12:13:39] <Amadiro> because the IDE has been doing something obscure with it, or because the IDEs preprocessor fails on something
[12:13:49] <Amadiro> which it tends to do if you use, say, too long strings
[12:13:49] <Xark> Amadiro: I understand, however, no different from Arduino. :)
[12:14:03] <Amadiro> Xark, hm? I'm talking about the arduino ide, yeah
[12:14:21] <BJfreeman> arduino was focused on the begginer and advance should not be in the IDE
[12:16:13] <Xark> I also have one of these FreeSoC using PSoC5 (like an ARM mixed with a CPLD so you can define custom I/O logic). It has a Windows IDE with a very nice debugger (no additional hardware needed). -> http://freesoc.net/
[12:16:56] <Xark> There is also this "little brother" version ($25). http://www.cypress.com/?rID=77780
[12:18:38] <Xark> Also, another cheap board with debugging is http://logiblock.com/products/galago (I have one, but haven't really played with it).
[12:19:39] * Xark notes Galago is Cortex-M3 with FPU also.
[12:26:04] <BJfreeman> the m3 hide that DSp as Enhanced instructions with single cycle math
[12:39:08] <braincracker> oh yea i see the original 286 code contains many rounding errors in that DMIPS benchmark
[15:08:12] <Duality_> can i use a timer on any pin ?
[15:09:48] <Xark> Duality_: No. Generally only OSC pins (if I understand your Q).
[15:11:01] <Xark> Duality_: (Generally the ones Arduino marks with # on the PCB).
[15:11:07] <Duality_> if i look in the data sheet what kind of naming does it have ?
[15:11:19] <Duality_> Xark: not using an arduino :)
[15:11:55] <Duality_> don't see any # on my arduino boards :)
[15:12:22] <Xark> Duality_: OK, then look for AVR name that genreally has OSC in it.
[15:12:35] <Xark> Duality_: OK, how about ~ (as seen here -> http://arduino.cc/en/Main/ArduinoBoardUno)
[15:12:43] * Xark has a clone with #...
[15:14:46] <Duality_> Xark: you meen pwm pins ?
[15:15:06] <Xark> Duality_: Yes. The PWM is controlled by the timers.
[15:15:55] <Duality_> cool
[15:16:04] <Duality_> then i know which pins i have to connect
[15:18:12] <Duality_> i lovee logic analyzers :P they make life a lot easier
[15:19:39] <Xark> Duality_: Yes, nothing like "seeing" what the pins are doing. :)
[15:20:40] * Duality_ is trying to make a remote controle for his optio pentax A40
[15:20:48] <Duality_> with a attiny85 :)
[15:20:54] <Duality_> to keep it small enough
[15:21:20] <Xark> Neat. I quite like the ATtiny85 for small jobs.
[15:29:17] <tlvb> Damnit, now I want my logic analyzer...
[15:31:32] <tlvb> Any reason why intensive serial dumping onto an avr (where intensive is 9600bd) would cause resets? There are no long strings, and on the whole the program is a small state machine, so stack overflows and such /should/ be unlikely…
[15:33:26] <Tom_itx> i assume you have a pullup on reset
[15:33:35] <Tom_itx> what about the WDT
[15:36:34] <tlvb> I have never ever used a wdt, and it comes disabled by default, so it should not be active. I should check the pullup though, it may be the culprit.
[15:37:11] <Duality_> looks like attiny has i2c ? cool
[15:38:49] <BJfreeman> tlvb if your usng interupts check that you are not gettng interupts while processiong the last interupt
[15:41:39] <Duality_> the datasheet says counter 1 and counter 0 does that meen it has two timers ?
[15:46:11] <BJfreeman> yes one slow 8bit and one fast 8bit
[15:46:21] <tlvb> BJfreeman: I have only one thing running on interrupts (16 bit timer1) and it is set to fire no more often than 8k cycles
[15:46:22] <BJfreeman> 8-bit Timer/Counter with Pr
[15:46:23] <BJfreeman> escaler and Two PWM Channels
[15:46:23] <BJfreeman> – 8-bit High Speed Timer/Counte
[15:46:23] <BJfreeman> r with Separate Prescaler
[15:46:23] <BJfreeman> • 2 High Frequency PWM Outputs with Separate Output Compare Registers
[15:46:23] <BJfreeman> • Programmable Dead Time Generator
[15:47:43] <BJfreeman> tlvb OK
[15:47:44] <Xark> tlvb: Do you have any strings on the stack? Very easy to overflow RAM if so...
[15:48:09] <tlvb> Xark: no strings
[15:48:28] <Duality_> yes but maybe i don't understand TCCR1B, because with it, it won't compile, but with TCCR0B it will
[15:48:31] <tlvb> no recursive functions either
[15:51:16] <tlvb> It could be that the hodgepodge board is going wonky too
[15:51:54] <Xark> Duality_: Hmm, probably because looking at datasheet, ATTiny85 doesn't have a TCCR1B register (looks like just TCCR0A and TCCR0B).
[15:52:55] <Duality_> so there is A and B ?
[15:53:10] <Duality_> how did you see that in the datasheet ?
[15:53:19] <Duality_> (so i can find it in the future :)
[15:53:39] <Xark> Duality_: I suggest the "Register Summary" section. :)
[15:53:53] <Xark> (pg 200 assuming you have the same PDF)
[15:53:54] <BJfreeman> chapter 12 Timer/Counter Control Register A – TCCR0A
[15:54:34] <Xark> Duality_: The summary will have a link to more detailed info (like BJFreeman mentions).
[15:55:39] <BJfreeman> if you have a your using the web PDF reader click on the ICon at far left the one that show document outline
[15:56:44] <BJfreeman> then scroll down to 12.8 8-bit Timer/Counter Register Description
[15:57:33] <BJfreeman> click on it and it will link you to the page
[15:57:57] <Duality_> thanks much!
[15:57:59] <Duality_> :)
[15:58:23] <BJfreeman> my pleasure
[16:17:21] <Duality_> coool i can controle a timer ^^
[18:05:16] <MarkX> hi
[18:06:47] <MarkX> quick question, lets say i have an 8bit register X, and i want to set bit 3 to 0, how can i go about doing that?
[18:07:50] <Xark> And leave the other bits alone? Probably ANDI
[18:08:04] <MarkX> yea, leaving the other bits alone
[18:08:54] <MarkX> i'm looking at this "UEINTX = ~(1<<TXINI);" and wondering if that might be a viable way to do it
[18:09:13] <BJfreeman> look up bitwise operation
[18:09:24] <Xark> MarkX: Yeah, that will turn into an ANDI I believe (unless on a port, then perhaps CBI).
[18:09:57] <MarkX> BJfreeman: i have, its just this line which is confusing me, in my mind, im thinking that UEINTX is getting entirely replaced
[18:10:23] <Xark> MarkX: Hmm, you are right. I would expect &= (not just =).
[18:10:40] <MarkX> Xark: right but the code i'm reading has various instances of just =
[18:10:44] <Xark> As is, that is just a load (and will trash other bits).
[18:10:45] <MarkX> which is confusing the hell out of me
[18:11:11] <MarkX> "UEINTX = ~((1<<RXSTPI) | (1<<RXOUTI) | (1<<TXINI));"
[18:11:17] <MarkX> another example in said code
[18:11:44] <Xark> MarkX: Apparently preserving other bits isn't important...
[18:11:44] <MarkX> that turns RXSTPI, RXOUTI, TXINI to 0 and everything else to 1
[18:11:49] <MarkX> looks that way
[18:12:03] <MarkX> but is my logic right in the sense that those 3 bits will be zero and the rest will be 1?
[18:12:23] <Xark> Yes. The ~ is ones compliment (i.e., invert bits).
[18:12:33] <MarkX> right
[18:12:35] <MarkX> ok cool
[18:12:40] <MarkX> i guess the other bits dont matter then :P
[18:13:21] <MarkX> just struck me as odd
[18:15:58] <Tom_itx> MarkX, have a read: http://tom-itx.dyndns.org:81/~webpage/avr/c_bits/bits_index.php
[18:16:54] <MarkX> l, thanks
[18:16:57] <MarkX> k thanks*