#avr | Logs for 2015-04-02

Back
[05:41:40] <LeoNerd> Hrm...
[05:42:05] <LeoNerd> I think I'm getting some weird problems on my (attiny + nrf) radio board now that I've bumped the clock prescaler down to 1 (it was on /8)
[05:42:38] <LeoNerd> Namely: the ADC seems much less accurate, it waves around a lot more reading the battery or button analog chain. also I seem to be getting a lot more "retried" packets
[05:44:23] <hypermagic> try adding 100nf ceramic cap to vcc and avcc ?
[05:45:38] <LeoNerd> There is no AVCC; this is a triny84
[05:45:39] <LeoNerd> *tiny
[05:46:37] <hypermagic> :/
[05:46:45] <hypermagic> noise reduction mode?
[05:47:10] <hypermagic> you can integrate a few results maybe to cancel noise
[05:49:04] <LeoNerd> That's what I'm already doing. Well, two results
[05:50:22] <malinus> LeoNerd: you have to change the adc speed, depending on the nrf
[05:50:28] <malinus> LeoNerd: depending on the fcpu, that is
[05:50:37] <LeoNerd> Yup, didthat
[05:50:45] <malinus> double check the values
[05:50:46] <malinus> :D
[05:50:50] <LeoNerd> prescaling at 128
[05:50:58] <malinus> and what is your fcpu?
[05:51:04] <LeoNerd> 8MHz
[05:51:09] <LeoNerd> (internal osc, no prescale)
[05:51:42] <malinus> shouldn't the adc be like 50khz or so?
[05:51:46] <malinus> or 250khz
[05:51:57] <malinus> what should it be?
[05:52:44] <LeoNerd> 50-200 it wants
[05:52:53] <malinus> hmm, should be fine then
[05:53:13] <malinus> why did you crank up the speed LeoNerd ?
[05:53:17] <malinus> just wondering
[05:54:16] <LeoNerd> To test my idea about battery life
[05:54:27] <LeoNerd> Though I think I've broken something else in the code unrelated to that.. :/
[05:54:34] <hypermagic> would a smoothed result do?
[05:54:42] <hypermagic> you can try weighted average
[05:54:44] <LeoNerd> It it smooth
[05:54:46] <LeoNerd> It's just wrong
[05:54:46] <LeoNerd> :)
[05:54:48] <hypermagic> oh
[05:54:53] <hypermagic> offset?
[05:54:59] <hypermagic> use a ground plane
[05:55:34] <malinus> LeoNerd: your idea? You think the datasheet lies :)?
[05:56:16] <LeoNerd> malinus: I think that the datasheet is giving part of the answer; I want to measure realworld performance of my entire system
[05:57:02] <malinus> sure, that's understandable. You should try comparing 128khz fcpu with 8mhz. That would make a hugggge difference in power usage.
[05:57:28] <LeoNerd> I'm not sure my application would run properly that slow :P
[05:57:51] <LeoNerd> Huh.. I think I've just discovered a weird timing race
[05:57:59] <malinus> What kind of calculations are you doing?
[05:58:02] <LeoNerd> Leading to my "how on earth *was* the code working before?"
[05:58:11] <malinus> haha
[05:59:57] <LeoNerd> Hrm... that hasn't *directly* helped.. /
[06:06:12] <LeoNerd> Ah I wonder if the bug is in fact in the base station
[06:08:18] <hypermagic> so if you have ground offset in your measurement you must do differential measurement using 2 adcs or add a ground-plane
[06:08:25] <hypermagic> or both :)
[06:08:42] <hypermagic> a groundplane is always nice
[06:10:23] <LeoNerd> I'm measuring VCC against INTREF. Explain how a ground plane helps :)
[06:10:37] <hypermagic> intref is ground referenced
[06:10:47] <hypermagic> a groundplane will act as a shield
[06:10:56] <hypermagic> and a low resistance path
[06:11:23] <hypermagic> so you connect everything ground directly to the groudnplane
[06:17:01] * Xark links http://www.ikalogic.com/avr-monitor-power-supply-voltage-for-free/
[06:21:12] <hypermagic> but... atmega48 has 10 bit adc not 8 bit lol
[06:21:34] <hypermagic> Xark, interesting the guy never read the datasheet, nor parameters
[06:26:30] <Xark> hypermagic: Looks like he does >> 2 to toss the low bits
[06:27:00] <Xark> Probably for efficiency (8-bit multiple is "cheap").
[06:27:07] <Xark> multiply*
[06:29:53] <LeoNerd> Well uhhmm.. this is unfortunate. My base station seems to be dead :(
[06:32:47] <LeoNerd> BAH stupid subtle interactions with SPI module and self-reset :(
[07:56:40] <Juris4cm> hello
[07:56:48] <Juris4cm> maybe someone know how can I calculate selectivity of LC circuit to work in desired frequency range?
[08:18:51] <malinus> if you want it to osciallte at a desired frequency, you just need to choose values, so their impedance match.
[08:19:06] <xrlk2> if you want to induct use an inductor
[08:31:45] <Casper> Juris4cm: f=L*C*k
[08:32:25] <Juris4cm> Casper realy so simple?
[08:32:54] <xrlk2> i took a course in classical mechanics
[08:32:56] <xrlk2> is that enough
[08:33:30] <Juris4cm> f=L*C*Q you mean?
[08:36:34] <Juris4cm> Casper what is k?
[08:37:07] <xrlk2> Kharge
[08:37:10] <xrlk2> Kapacitance
[08:37:38] <Juris4cm> kalories
[08:38:35] <Casper> Juris4cm: a multiplier
[08:38:48] <Casper> like a basic 555 circuit is 1.3 iirc
[08:38:57] <Casper> some other arrangement is 1.1
[08:39:15] <Casper> (ok, 555 is R*C*k)
[08:39:15] <Juris4cm> hmm first time hear it
[09:25:12] <LeoNerd> FUCKING GCC
[09:25:40] <LeoNerd> It compiles fairly sensible code for array-index operations where array members have sizeof()==4, but really stupid for size 3
[09:25:51] <LeoNerd> Like... it inlines a call to __mulhi3 with the index and the constant '3'
[09:25:55] <LeoNerd> As opposed to a shift-and-add
[09:29:17] * LeoNerd wonders who to grumble at
[09:29:28] <LeoNerd> Actually who really maintains it? I wonder if I could get a patch in
[09:53:57] <malinus> LeoNerd: write to the mailing list
[09:54:37] <LeoNerd> "the"?
[09:54:43] <LeoNerd> Hrm.. I'll have to go find it then I gues
[09:55:11] <malinus> LeoNerd: ttp://www.nongnu.org/avr-libc/
[09:56:36] <LeoNerd> Hmm. that's libc, but do they look after the compiler as well?
[09:58:02] <LeoNerd> Ah; I see. Same group, different list
[10:32:53] <LeoNerd> So... level-based interrupts on INT0... it says it "keeps firing" as long as the condition is held
[10:33:20] <LeoNerd> So.. does that mean that if the pin stays low, and all the interrupt handler function does is marks an internal flag in memory then returns, it will immediately invoke again..? Running in a continuous loop?
[10:34:15] <LeoNerd> If so, I suppose could I do something like turning off the INT0 flag in the handler so it won't fire, and then later on when I think I've dealt with it turn the flag back on, and if the condition still holds it'll fire again..? (and hence disable tiself)
[10:34:21] <LeoNerd> effectively, I want a oneshot that I have to re-arm again
[11:48:20] <uskerine> UCSR0B |= (1<<RXCIE0) | (1<<RXEN0) | (1<<TXEN0); Error 1 called object is not a function or function pointer
[11:50:21] <LeoNerd> Random question: Why aren't you using _BV() ?
[11:52:19] <uskerine> what is _BV?
[11:52:29] <uskerine> (I guess that answers the question)
[11:53:54] <LeoNerd> Oh, it's orthogonal to the question... I was just curious why
[11:55:53] <uskerine> well I found I forgot the ; in the above line (:-!). However, now I am curious about _BV
[11:55:58] <uskerine> what does it do?
[11:57:00] <LeoNerd> _BV(n) is just (1 << (n))
[11:57:11] <LeoNerd> It just reads a little neater, a little less nosily
[11:57:25] <uskerine> indeed. Where is _BV actually defined?
[11:57:26] <LeoNerd> UCSR0B |= _BV(RXCIE0) | _BV(RXEN0) | _BV(TXEN0)
[11:57:40] <LeoNerd> Somewhere in <avr/io.h> or one of its children. I don't know exactly where
[12:00:53] <uskerine> it is enough to know it is defined in io.h
[12:00:54] <uskerine> thanks
[12:01:30] <uskerine> the only advantage of using (1<< FOOBIT) is that code might be more easily ported, that's universal to all architectures and compilers
[12:01:52] <uskerine> although when you are dealing with register bits you usually have to touch that part anyway
[12:03:43] <Ad0> hello :)
[12:17:45] <uskerine> hi
[12:19:02] <Ad0> just getting into avr
[12:19:23] <Ad0> I ordered attiny ATTINY45-20PU
[12:19:39] <Ad0> But I sort of need a programmer for it
[12:19:44] <Ad0> and for the full size 8 bit ones
[12:20:00] <LeoNerd> The tiny45's an 8bit
[12:20:30] <LeoNerd> For a programmer, I just use one of the dirt-cheap USBASP things
[12:21:07] <Ad0> does that take the full size ones too
[12:21:24] <Ad0> the AVRISP2 doesn't seem to be in production anyumore
[12:21:29] <Ad0> seems like the AVR Dragon has taken over?
[12:22:18] <LeoNerd> Hm?
[12:22:44] <LeoNerd> http://www.amazon.co.uk/3-3V-USBasp-Downloader-Programmer-Adapter/dp/B00AVRHVPO <== anything like that or similar
[12:22:50] <LeoNerd> There's billions of the things around
[12:23:08] <Ad0> cool
[12:23:35] <LeoNerd> Pololu make quite a nice one that appears as a dual-function USB device, having the programmer and a UART
[12:24:31] <Ad0> http://www.ebay.co.uk/itm/AVR-Minimum-System-Board-ATMEGA16-ATmega32-USB-ISP-USBasp-Programmer-For-ATMEL-/301553213525?pt=LH_DefaultDomain_3&var=&hash=item4635f8e055
[12:25:08] <Ad0> that does indeed look nice
[12:26:30] <LeoNerd> USBASP2.0 :)
[12:26:34] <LeoNerd> Same one I have
[12:26:44] <LeoNerd> Not sure I'd bother with that ZIF board though
[12:30:24] <Ad0> zif is nice isn't it ?
[12:31:01] <LeoNerd> Well it's more a matter of what you'd use that board for.
[12:31:10] <LeoNerd> That's quite specifically for mega16/mega32
[12:31:30] <LeoNerd> You might as well go for something like a mega328, otherwise known as the chip that's on most of the tiny little arduino boards... they're easy and cheap to get
[12:31:47] <Ad0> yeah
[12:31:52] <Ad0> mega 328
[12:33:09] <Ad0> so what do I actually need to get my ass going?
[12:33:22] <Ad0> is that crystal important to set the clock or can I program it to run at a specific speed?
[12:34:11] <LeoNerd> They have internal oscillator if you want to run at something -around- 8MHz.. that's often good enough if you don't have very critical timing requirements
[12:34:25] <Ad0> yeah
[12:34:40] <Ad0> my idea is to have a small temperature sensor that can send RF
[12:34:59] * LeoNerd does that with ATtiny ;)
[12:35:02] <Ad0> pretty classical so I ordered that attiny
[12:35:07] <LeoNerd> Yah
[12:35:09] <Ad0> they didn'
[12:35:13] <Ad0> didnt have picopower so
[12:35:20] <Ad0> so I got the 45
[12:35:39] <Ad0> I got the DS18B20
[12:35:43] <Ad0> but that might be overkill
[12:35:53] <LeoNerd> Soudns shockingly similar to mine
[12:36:10] <Ad0> since that already is digital maybe it can be connected directly to the RF
[12:36:43] <Ad0> the RF is ALPHA-TRX433S
[12:36:53] <Ad0> it's a transceiver so I can use it bidirectional
[12:37:37] <Ad0> LeoNerd: did you use a normal thermistor or some smartypants thermistor with integrated digital stuff
[12:37:47] <Ad0> like the DS18B20
[12:37:54] <LeoNerd> 18B20 ;)
[12:38:38] <Ad0> LOL
[12:38:40] <Ad0> same as me
[12:39:30] <Ad0> do you use RF 433 mhz ?
[12:39:36] <LeoNerd> No; nRF20L01
[12:40:16] <LeoNerd> https://twitter.com/cpan_pevans/status/562416772205522946 <== my boards
[12:40:33] <malinus> the 433mhz are a paaain, compared to the nrf
[12:41:03] <malinus> especially considering the price
[12:42:48] <Ad0> hm
[12:42:57] <Ad0> that nrf is expired
[12:43:35] <Ad0> nRF24LE1 is the shit now appearently
[12:43:51] <LeoNerd> 24L01+
[12:45:40] <Ad0> ah
[12:45:41] <Ad0> thanks
[12:45:56] <Ad0> why is 433 so hard compared to this, doesn't it depends on what kinda transciever you get?
[12:46:31] <LeoNerd> Well a lot of the 433 systems tend to be fairly low-level... basically just a modulator/demodulator
[12:46:36] <LeoNerd> Whereas these have an entire packet engine in them
[12:46:44] <Ad0> ok
[12:47:03] <Ad0> well I won't settle with such a low level module so I ordered ALPHA-TRX433S
[12:47:12] <Ad0> http://www.rfsolutions.co.uk/acatalog/info_ALPHA_TRX433S.html
[12:47:37] <skroon> i'm trying to understand how to use statemachines in combination with the super loop()... I understand how statemachine it self work, but i'm just not sure how to start using them... for example do I have my main loop call it like: void main() { SerialMonitor_run(); } and then have the state machine inside my SerialMonitor_run() method implementation? hopefully my question is a bit clear, since i'm utterly
[12:47:44] <skroon> lost :)
[12:48:18] <Ad0> LeoNerd: what tools did you use to design such a board that you posted on twitter?
[12:50:03] <Ad0> I am gonna try the alpha transciever and get back to you but I really need a programmer first :)
[12:54:10] <Ad0> http://www.ebay.co.uk/itm/USBasp-USB-ISP-Programmer-3-3V-5V-AVR-ATMEL-ATMega8-Download-Pin-IDC-Cable-USB-/350887076068?pt=LH_DefaultDomain_3&hash=item51b27fe0e4 I will just get this
[12:56:12] <LeoNerd> Ad0: KiCad for the board layout, then sent it to oshpark.com to fab it
[12:57:42] <Ad0> awesome
[12:59:07] <Ad0> I found an app called fritzing
[13:10:00] <aandrew> you want to generally stay away from fritzing
[13:10:16] <aandrew> start out with kicad or eagle or even some of hte online ones like upverter
[13:10:23] <aandrew> fritzing will teach you many bad habits
[13:10:29] <aandrew> may as well learn the standard ways :-)
[13:11:39] <LeoNerd> kicad is nice.. plus they're right next door in #kicad ;)
[13:11:58] <LeoNerd> (Well, I say "next door"; this is window 29, they're up on 40. So a few doors down)
[13:12:50] <Ad0> thanks
[13:15:15] <Ad0> whoa 202 mb
[13:25:05] <Ad0> http://www.ebay.co.uk/itm/Breadboard-Prototyping-Starter-Kit-for-Arduino-PIC-General-Electronics-/251665439081?pt=LH_DefaultDomain_3&var=&hash=item3a986dd969
[13:25:08] <Ad0> heh nice
[13:32:21] <malinus> yeah Kicad is easy and intuitve'
[13:32:24] <malinus> imho
[13:56:15] <superbia> goede avond
[16:26:48] <Ad0> malinus: kewl
[19:40:38] <xrlk> crazy that i have avr microcontrollers
[19:41:21] <Lambda_Aurigae> most of us here do.
[19:47:35] <ferdna> xrlk, what is your point?
[22:03:12] <CovertOps> has anyone used the cc3000 wifi card?
[22:42:06] <leedleLoo> Hi, I'm trying to program an atmega328p-PU with dasa. avrdude will read a different signature everytime. When it does happen to read the correct signature, programming will fail because the lfuse bits cannot be read properly. Is there a common reason why avrdude will display a different device signature everytime?
[22:42:44] <N1njaneer> Your clock speed may be too high.
[22:44:08] <leedleLoo> I thought it may have been too low so I attached a 16mhz clock on the device. What can I do to program it now (first time doing embedded work)
[22:51:47] <Casper> leedleLoo: clock speed, signal corruption, bad powersupply, lack of decoupling cap at the avr
[22:52:25] <N1njaneer> leedleLoo: If you haven't successfully programmed the fuses of the device, it will be internally starting up at 1Mhz off the RC oscillator. Lower your clock speed to 125Khz or less.
[22:52:42] <Casper> dasa... isn't that a parallel port programmer that bitbang it? some parallel port are 3.3V, which is borderline of working with 5V device, set the parport mode to standard in the bios, see if it help
[22:55:43] <leedleLoo> Dasa is serial. I'll try lowering the clock speed and adding decoupling caps then, thanks guys
[22:59:37] <leedleLoo> I used '-i' flag to increase the delay between bits. That did it! Thanks again
[23:06:03] <N1njaneer> Cool :)