#avr | Logs for 2016-08-02

Back
[01:23:11] <magni> i need to write to program space at runtime, anyone know of a good article or literature?
[01:26:07] <tkoskine> Datasheet, but if I remember correctly, you can write flash only from the boot loader code.
[01:27:07] <magni> cool
[01:40:34] <MarkX> hi, is it possible to auto flash using flip through atmel studio?
[01:41:29] <MarkX> i have an atmega32u4, i'm doing testing on it so i need to flash it a lot with newer code every time. i'm using atmel studio for the programming and flip for the flashing
[02:04:31] <gjm> maybe with external makefile?
[09:58:23] <_ami_> just wondering why the timer1 in normal on attiny85 does not work :/ http://pastebin.com/Rz9apCmx
[09:58:39] <_ami_> similar code for timer0 works fine.
[10:05:18] <LeoNerd> tiny85's timer1 is very strange
[10:05:27] <LeoNerd> More strange than most AVR timers. It's a unique snowflake
[10:05:51] * sebus looks @ tiny85 datasheet
[10:06:30] <cehteh> PLL :D
[10:08:25] <sebus> woah, 64/32MHz internal source? ;o
[10:08:35] <LeoNerd> That's the PLL
[10:08:47] <sebus> yep, i see it in pllcsr
[10:08:57] <LeoNerd> Weird that the timer is only 8bit, given it has that high-frequency source
[10:09:04] <LeoNerd> It would have been nice to get the 16bit precision of counting
[10:10:40] <sebus> anyway _ami_ check if tov1 flag is set... if (tifr & (1 << TOV1) {turn_on_LED_macro();}
[10:10:48] <sebus> still wierd...
[10:10:59] <_ami_> ok
[10:14:13] <_ami_> sebus: nope, it did not work.
[10:14:27] <_ami_> with TIFR & (1 << TOV1)
[10:16:07] <_ami_> LeoNerd: generally timer1 timer use to be a 16 bit timer but its a 8 bit timer in t85. weird :P
[10:16:11] <sebus> lemme see if my simulator has tiny85 support
[10:16:51] <_ami_> sebus: ok, thanks
[10:21:49] <sebus> _ami_ wait a bit...
[10:30:53] <sebus> nope, it does not run at all _ami_, i see tccr1 is loaded with value 0x0C amd tcnt1 is stopped -.- also pllcsr bit 1 is set (PLLE)
[10:34:22] <_ami_> sebus: oh.. boy!
[10:34:29] <_ami_> i figure it out..
[10:34:50] <_ami_> TCNT1 in normal mode starts from 0xFF to 0x00 :P
[10:34:54] <_ami_> WTF :P
[10:35:21] <sebus> yes
[10:35:27] <sebus> it counts down
[10:36:02] <_ami_> i was doing opposite.
[10:36:22] <_ami_> t85: " In the normal mode an overflow interrupt (TOV1) is generated when Timer/Counter1 counts from $FF to $00"
[10:37:07] <_ami_> sebus: Generally we do TCNTX = 0 in timerX_init()
[10:37:18] <_ami_> but it seems like i don't have init tcnt1 here
[10:40:16] <sebus> and now your led is blinkin every few microseconds :P
[10:40:50] <_ami_> sebus: http://pastebin.com/raw/DVp3WQkW
[10:41:12] <_ami_> this seems to work - means.. i can actually see the result :P
[10:41:39] <_ami_> earlier the led was blinking very fast which a human can not figure out :P
[10:42:24] <_ami_> sebus: btw, is it normal to TCNT1 to count down? i don't see this behavior in atmega16a
[10:42:41] <sebus> it's weird for me too
[11:07:24] <kre10s__> the counters can usually be configured to count up, or up they down. and I think some can even be configured to just count down.
[11:07:44] <kre10s__> also. get a scope. scopes are cool!
[11:10:22] <sebus> http://s7.fmdx.pl/main.txt Can someone tell me why this thing doesn't work? It should keep power state on till I push button or pull external input down for awhile, but from time to time it can reset itself to power-off state. AVR simulator says nothing... Wrong pullups? :/
[11:14:18] <sebus> I want to put this thing for arietta g25 / banana pi psu board.
[12:41:16] <_ami_> sebus: In general, we call sleep related functions together. i wonder if this is what you are not doing.
[12:41:37] <_ami_> ideally sleep routines should be called just before sleep_mode()
[12:42:09] <_ami_> set_sleep_mode(), sleep_enable().. power_all_disable(), sleep_mode(); <-- sleeps here
[12:42:24] <_ami_> sleep_disable(); <-- wake up from here.
[12:42:34] <_ami_> power_all_enable();
[12:43:51] <_ami_> sebus: In short, i meant - move sleep mode routines into loop;
[12:44:09] <_ami_> just before sleep_cpu()
[12:45:32] <_ami_> sebus: one example for your reference: https://raw.githubusercontent.com/amitesh-singh/amiduino/master/avr/atmega16a/parkingsensor-powersave/parkingsensor.c
[12:48:33] <sebus> sleep_cpu() is called @ the end of main loop. Main loop is done after ~12us if none of "if" statements are true
[12:48:38] <sebus> and again in loop
[12:50:06] <_ami_> umm.. it is okay for init. but not for second iteration in loop?
[12:50:37] <sebus> sleep_enable() will enable sleep in general
[12:51:29] <_ami_> sebus: does the sleep enable flag remain set when you wake up?
[12:51:35] <sebus> yes
[12:51:48] <_ami_> are you sure?
[12:53:31] <sebus> afair it is
[12:54:22] <_ami_> sebus: http://www.nongnu.org/avr-libc/user-manual/group__avr__sleep.html#ga475174a7aa4eda03dfa7a4483e400a9e
[12:54:43] <_ami_> i think you should clear the SE bit then after sleep_cpu()?
[12:55:02] <_ami_> sleep_disable() call after sleep_cpu()?
[12:55:18] <_ami_> but then u need to set sleep_enable() routines again
[12:55:35] <_ami_> sleep_cpu(): Put the device into sleep mode. The SE bit must be set beforehand, and it is recommended to clear it afterwards.
[12:55:49] <_ami_> *recommended*
[12:57:00] <_ami_> All the examples i have seen yet on power save, always do the sleep ON and OFF routines together.
[13:00:25] <_ami_> one of my parking sensor code which i wrote for my kid's car is based on it and it works fine till now :)
[13:00:28] <sebus> ok, lets modify code a bit. Anyway, when I call sleep_cpu with isr every 1000ms, led toggles every 1000ms +/- without toggling SE bit in mcucr
[13:01:51] <_ami_> sebus: i don't see sleep_disable() and i think it should be added just after sleep_cpu() at-least
[13:05:47] <sebus> ok, I've modified code. Let's see, if hardware *will* work like I wanted ot.
[13:05:53] <sebus> to*
[13:06:09] <_ami_> :)
[13:07:46] <sebus> At first, I was afraid of register variables if they're messing with compiler, but nope. Atmel toolchain does not even use R2..R8 registers with -02 -mrelax -DNDEBUG
[13:09:45] <_ami_> sebus: did it work?
[13:09:50] <_ami_> the new code.
[13:09:56] <sebus> testing
[13:10:46] <sebus> well I left my hw in power_on state for about 48hrs and power_off/reset occured so I am wondering why it happened
[17:33:28] <WormFood> Is it true, that the ATmega88A/PA/PB models have 1/2 the EEPROM, and double the RAM, of the non-A/PA/PB models?
[17:35:30] <Casper> I.... don't know and don'T think so... keep us updated!
[19:11:22] <dgriffi> anyone here recently have an AVR making sounds? I'm having problems finding an audio taper trimpot
[19:23:07] <Tom_shop> you mean like 'BOOM!' or 'fooooof!' followed by blue smoke?
[19:24:52] <kre10s_> in which case you don't even need a trimpot of any kind.
[19:27:35] <dgriffi> no.. I'm just making an audio gizmo for which I need to set the correct volume once and then screw the case together
[19:28:57] <Lambda_Aurigae> I've used digital pots for such things...then can adjust them,,,well,,digitally.
[19:29:19] <Lambda_Aurigae> I'm sure digikey and others have proper trimpots.
[19:29:36] <Tom_itx> just use a resistor for that then
[19:30:21] <Tom_itx> figure out what the pot divider resistance would be and use a resistor divider
[19:30:25] <cehteh> digital pots are somewhat expensive
[19:31:17] <dgriffi> cehteh: and complete overkill for this project
[19:31:40] <dgriffi> do log tapered trimmers even exist?
[19:33:00] <cehteh> i tihnk i search for that too once .. and didnt found any
[19:33:21] <cehteh> but do you have a free pwm output? you may use that to generate a bias
[19:33:33] <Tom_itx> i doubt it
[19:37:20] <Lambda_Aurigae> what value pot you looking for?
[19:39:06] <Lambda_Aurigae> nevermind..not finding pcb trim pots in log...
[19:53:22] <Casper> is it a set once and forget?
[19:55:44] <cehteh> http://www.falstad.com/circuit/circuitjs.html?cct=$+1+0.000005+10.20027730826997+50+5+50%0A174+240+160+240+256+0+10000+0.005+Resistance%0Ar+352+208+352+256+0+1000%0Aw+256+208+352+208+0%0Aw+240+256+352+256+0%0Aw+352+256+432+256+0%0Aw+352+208+432+208+0%0AR+240+160+192+160+0+0+40+5+0+0+0.5%0Ag+240+256+240+304+0%0Ap+432+208+432+256+0%0Ao+8+64+0+550+5+0.00009765625+0+-1%0A
[19:55:57] <cehteh> .. isnt exact log .. but how about that?
[19:56:28] <cehteh> (or is it log? i dont even know)
[20:12:48] <kre10s_> Why's it got to be log? just turn your screwdriver in a log fashion!
[20:16:10] <cehteh> haha
[20:16:40] <cehteh> even for a multi turn pot that would be rather hard
[20:22:58] <Casper> but seriously, why multi-turn?
[20:23:00] <Casper> err
[20:23:02] <Casper> log?
[20:41:25] <cehteh> yes you only need that for analog shit :D
[21:01:13] <Casper> usually trimpot log ain't needed for audio, specially multi-turn