#avr | Logs for 2016-01-12

Back
[02:31:51] <Haohmaru> PUBLIC_FUNCTION(blah) in a .s file gives error
[02:32:21] <Haohmaru> "Error: unknown opcode `public_fun'"
[02:32:42] <Haohmaru> public fun is not allowed?
[02:34:45] <Haohmaru> that is code given for avrgcc and xmega, on the other hand i see example .s files for usage with "avr" which look different, it looks like functions there are defined with .global blah
[02:34:58] <Haohmaru> halp
[02:36:09] <Haohmaru> are asm files (for usage with C) written differently on atmega and xmega?
[03:17:17] <Jartza> no
[03:17:21] <Jartza> but there are different assemblers
[03:17:51] <Jartza> avra compiles the same code as avr-asm2 in atmel studio
[03:18:03] <Jartza> whereas avr-as has different syntax
[03:18:43] <Jartza> so "this and this gives error" doesn't really tell much without seeing the code and seeing how you try to compile it :)
[03:20:42] <Haohmaru> seems it works when i renamed it to capital .S
[03:20:57] <Haohmaru> i mean, it compiled
[03:21:34] <Haohmaru> so i have to have this .S file around.. blah
[03:22:49] <Haohmaru> i'm trying to put it into an inline asm statement, but i'm failing
[04:13:45] <Haohmaru> http://pastie.org/private/ntwtfaryojf6ctkojozq
[04:14:30] <Haohmaru> now i'm "only" getting errors on the %3 operand (NVM_CMD)
[06:11:23] <Haohmaru> got it to compile http://pastie.org/private/i54b1js1ps7vmjgq4u4nvq
[08:53:53] <nuxil> morning all
[08:53:58] <nuxil> does anyone know of a good free circuit designer?
[08:54:50] <LeoNerd> I use KiCad
[08:55:46] <nuxil> nice
[08:55:51] <nuxil> will check it out
[08:55:53] <Casper> kicad, eagle free edition
[08:56:03] <nuxil> thanks
[08:57:09] * nuxil sips some tea while its downloading
[10:42:05] <LeoNerd> Anyone done much with RTC clock modules, or 32kHz watch crystals? It seems I need to calculate the load capacitor for this crystal, to put it on the board. Or maybe use a trimmer. Of some range...
[10:42:11] <LeoNerd> somehow... I'm a little vague on the subject
[11:31:27] <Jartza> what RTC module?
[11:31:38] <Jartza> I've been lately using DS3231 as it doesn't need external osc.
[11:43:54] <LeoNerd> PCF8563
[13:39:23] <ub|k> Xark: so, in the end i've managed to make the ssd1305 work with the atmega32... using software SPI
[13:39:39] <ub|k> i'm now trying to reproduce it using hardware
[13:39:57] <ub|k> exact same pins, just replace the function that sends the data, no luck so far
[13:49:16] <ub|k> oh, i made it. problem was the clock divider
[13:55:40] <ub|k> ok... not that stable :/
[13:55:42] <ub|k> http://i.imgur.com/PRM80Dg.png
[13:56:08] <ub|k> anyone who has worked with oled spi modules has a clue what might cause this?
[14:36:54] <ub|k> hm, i guess my buffer was getting corrupted. adding it to progmem helped.
[14:43:07] <ub|k> do people make datasheets impossible to understand on purpose?
[14:44:08] <LeoNerd> Maybe sometimes some people do
[14:54:45] <Jartza> ub|k: what datasheet is that?
[14:58:44] <ub|k> Jartza: SSD1305
[14:59:41] <ub|k> well, it's not that awful
[14:59:55] <ub|k> it's just that it's hard to find some stuff
[15:04:29] <Jartza> most chinese oled/lcd display datasheets are very badly written
[15:04:42] <Jartza> I hope not on purpose. it's just... chinglish :)
[15:08:19] <ub|k> anyway, if there are any SSD1305 users around, i have a couple of questions
[15:13:05] <ub|k> namely why is that that when i write the second time to the GDRAM the last few lines of the display become garbled
[15:59:27] <phinxy> i stumbled upon an "atomic read" example in a datasheet. is it good practice to temporarly disable interrupts when writing/reading >1byte variables?
[16:03:21] <phinxy> oh my, there is a status register. can this be used to do some clever assembly code with carry flags? i dont know how to do them but ive read you can save clock cycles
[16:03:32] <phinxy> does the compiler use some of these tricks in C
[16:43:13] <ub|k> added some debugging code that dumps the buffer I load the display with through serial
[16:43:18] <ub|k> data is ok :/
[16:43:27] <ub|k> it's the communication with the display that is not ok
[16:47:10] <Casper> phinxy: atomic block are near mandatory if you modify a >8 bits variable in an interrupt
[16:47:24] <phinxy> Good to know! makes sense
[16:47:48] <Casper> because you could be reading the first 8 bits, the interrupt fire up, change the 16 bits, then the main code read the second, new, 8 bits
[16:48:18] <Casper> if you do not modify any variable, or you don't care about glitch, then no, no need to disable the interrupts
[16:49:10] <Casper> this is also why it is a good idea sometime to use a temporrary variable, so you can reactivate the interrupt as soon as possible, provided that you have enought ram and that you don't write back the result and all...
[16:52:36] <phinxy> in a interrupt service routine for pin interrupt you dont get individual pin numbers do you? it just lets you know that someone of the masked pins fired?
[16:53:09] <phinxy> youd have to look up PINA in the routing for example
[16:53:28] <phinxy> in the routing.. in the routine**
[17:13:25] <Casper> yes
[17:13:49] <Casper> and you may be unable to determine which pin actually fired if the signal is too short or has bounced
[17:26:43] <LeoNerd> Anyone happen to know (or know where I'd find) the stray capacitance of an ATmega328P on the main xtal osc. pins? I don't seem to see it in the data sheet.
[17:47:22] * LeoNerd randomyl reading a PIC datasheet for fun and comparison
[17:48:05] <LeoNerd> Amusingly, these PICs seem to have a more flexible reference generator for the analog components, than an AVR. They're more tuneable, so you can use an internal resistor divider chain to get some multiple of 1/16th of supply or reference voltage
[17:49:22] <LeoNerd> Mm.. also the PWM generation for output pins is considered a separate module, than the actual timer that drives
[17:49:23] <LeoNerd> it
[17:49:40] <Jartza> PICs aren't technically bad
[17:49:58] <Jartza> I'm just not going to pay for decent toolchain :)
[17:50:12] <Jartza> at least for hobby-use
[17:50:33] <LeoNerd> Yah...
[17:50:46] <LeoNerd> That's why I've never really looked at them. I do like avr-gcc + libc + avrdude
[17:51:55] <Jartza> yep
[17:54:42] <Jartza> I think there are free toolchains, but they lack optimizations or something like that
[18:09:09] <LeoNerd> Ahhhah! I think I have come to a sudden realisation
[18:09:37] <LeoNerd> The reason my timer was behaving so badly on my HVSP controller board a few months ago is I misunderstood crystal load capacitance
[18:09:48] <LeoNerd> the xtal said "18pF", so I put 18pF caps on it.
[18:10:07] <Jartza> ohh. I did that too
[18:10:17] <LeoNerd> Where, what I should have done was put 2*(18 - 5-or-so) == 26pF
[18:10:18] <Jartza> and nothing worked :)
[18:10:47] <LeoNerd> Hard to guess the stray capacitance in advance of making the board. this could get tricky
[18:11:08] <Jartza> also I tried crystal on breadboard. tried all kind of caps and the chip didn't even start
[18:11:48] <LeoNerd> Ahh... see, I have a special breadboard xtal
[18:11:50] <LeoNerd> it has the caps onboard
[18:11:57] <Jartza> ripped caps off and started looking for an oscillatoe
[18:11:59] <LeoNerd> So that came already pre-designed and most notably - working :)
[18:12:13] <Jartza> suddenly, the leds started blinking
[18:12:30] <Jartza> seems my breadboard has enough capacitance as-is :)
[18:12:37] <LeoNerd> Hah!
[18:12:38] <LeoNerd> Ohyes
[18:12:38] <Jartza> so without caps is good
[18:12:43] <LeoNerd> breadboards are /terrible/ for stray cap
[18:12:47] <Jartza> yep
[18:12:49] <LeoNerd> which is what you want in an xtal, and almost nothing else
[18:12:59] <LeoNerd> ... kinda useful for power rail decoupling too I suppose
[18:13:06] <LeoNerd> Those two long strips at the top and bottom you often get
[18:13:11] <Jartza> yep
[18:13:26] <LeoNerd> though I imagine that's in the pF range, and not the ~100nF you typically want
[18:13:35] <LeoNerd> Hm.. I wonder how long a board would have to be to make 100nF
[18:16:42] <Jartza> heje.
[18:16:51] <Jartza> or even 10nF
[18:35:20] <phinxy> how much could a real time clock drift in a week/month/year if it runs on the internal oscillator on a atmega128
[18:36:37] <Lambda_Aurigae> minutes.
[18:36:39] <LeoNerd> Ithink the internal oscillator is only good for something silly like 2%
[18:36:52] <LeoNerd> So you could lose or gain more than 1 second per minute
[18:37:36] <LeoNerd> You should get one of those 32kHz watch crystals and put it on the async timer
[18:38:46] <phinxy> Does the accuracy differ depending on how fast you run it?
[18:39:01] <phinxy> the internal oscillator that is
[18:39:48] <LeoNerd> Um, the internal oscillator is a fixed frequency
[18:39:56] <phinxy> oh shit
[18:40:03] <phinxy> im using an external oscillator
[18:40:53] <phinxy> ill just look at the specs for that one. i guess.
[18:44:08] <phinxy> "..so if you want to use a 20 ppm crystal to build an alarm clock, it may have an error of 1 minute per month."
[18:44:54] <Lambda_Aurigae> add an AM receiver and tune in and sync to WWVB
[18:45:47] <phinxy> thats hilarious. and clever
[18:45:56] <Lambda_Aurigae> and been done multiple times.
[18:46:36] <LeoNerd> Get one of the TCXOs like the DS3231.. you can get better than 5ppm out of them
[18:47:56] <Lambda_Aurigae> you could use a gps module to pull time off of too.
[18:48:17] <LeoNerd> That's a whole new ballpark for a whole new level of cost/fun/...
[18:55:42] <phinxy> TRANSMITTING YOUR OWN TIME-SIGNAL IS EVIL.
[19:01:30] <Thrashbarg> there used to be clocks around that would synchronise to the PAL subcarrier of nearby television stations because they were derived from an atomic clock
[19:01:49] <Lambda_Aurigae> you can still buy clocks that sync to wwvb.
[19:01:53] <Thrashbarg> yeah
[19:02:04] <Lambda_Aurigae> and I recently saw one that synced to gps too.
[21:14:43] <tpw_rules> my watch syncs to wwvb and my car syncs to RDS