#avr | Logs for 2015-11-07

Back
[00:14:54] <gorroth> from the atmega88 datasheet, how come the UART error values don't match what i'm getting? basically, i can compute all the error values they get for U2X=1, but for U2X=0, my UBBR comes out as 1 less than what they are using for the error calculation
[00:15:13] <gorroth> i'm wondering how they get that, because the UBBR computation is straightforward
[00:15:27] <gorroth> so i'm wondering why their error calculation doesn't subtract 1 from UBBR
[00:15:43] <gorroth> for U2X=0 (sorry, didn't finish that last thought before pressing enter)
[00:18:29] <Casper> maybe an error...
[00:19:09] <Xark> gorroth: Hmm, do you match -> http://wormfood.net/avrbaudcalc.php
[00:21:35] <gorroth> so, not for all baud/fcpu values do i get a mismatch from their datasheet. for example, i can get their ubbr value for u2x=0 for fcpu=1000000, baud = 57600, but i cannot get it for fcpu=1000000, baud = 38400
[00:22:29] <gorroth> for the latter, i get ubbr1 = 0 and ubbr2 = 2, where ubbr1 is the u2x=0 value and ubbr2 is the u2x=1 value. ubbr2 is correct in this case
[00:25:06] <gorroth> however, then with fcpu = 2000000, baud = 38400, it's the opposite. i can match ubbr1 but not ubbr2. i'm guessing the datasheet has some incorrect values?
[00:25:36] <Xark> gorroth: Do they match -> http://wormfood.net/avrbaudcalc.php
[00:25:43] <gorroth> Xark: sorry, that page is wrong too
[00:25:55] <Xark> gorroth: So it matches datasheet?
[00:26:12] <gorroth> the datasheet and that site are wrong based on the formulas in the datasheet
[00:26:55] <Xark> gorroth: I guess get a scope (or logic analyzer) and see who is right. :)
[00:27:08] <gorroth> in python: fcpu=2000000; baud=38400; ubbr1=fcpu/(16*baud)-1; ubbr2=fcpu/(8*baud)-1; print ubbr1, ubbr2
[00:27:20] <gorroth> compare to the sheets, and you will see the sheet is wrong, based on the formulas they've given
[00:27:47] <gorroth> Xark: 1) i'm not going to buy a scope for this and 2) i don't know how i would use a scope for this and 3) just on the math alone, it looks like their sheet is wrong.
[00:27:53] <gorroth> i'm just wondering if someone else has seen this
[00:28:01] <gorroth> so i don't feel as crazy
[00:29:00] <Xark> Did you google? Top hit -> http://www.atmel.com/webdoc/AVRLibcReferenceManual/FAQ_1faq_wrong_baud_rate.html
[00:30:21] <gorroth> ah, they rounded
[00:30:32] <gorroth> makes sense
[00:30:38] <gorroth> i was thinking of it as integer math
[00:30:44] <gorroth> derp
[00:30:46] <gorroth> thanks
[00:30:47] <Xark> Yep. :)
[00:30:52] <Xark> NP
[00:31:05] <gorroth> feelin' dumb now
[00:39:26] <Xark> Hehe, no. Good on you to investigate. :)
[00:49:17] <gorroth> thanks :-)
[00:52:44] <Xark> And now I am aware of that hazard too (I was not previously). :)
[01:00:19] <WormFood> gorroth, I made sure my calculator (http://wormfood.net/avrbaudcalc.php) matched the data sheets.
[01:00:54] <Xark> WormFood: Your page rocks BTW. :)
[01:01:07] <WormFood> if you'd like to see the math used on that page, it's pretty simple. I'd be happy to copy/paste it for you.
[01:01:09] <WormFood> thanks
[01:03:12] <gorroth> WormFood: i already figured it out; thank you :)
[01:03:27] <gorroth> as i said above, i was doing integer mathematics
[01:03:30] <gorroth> actually, i still do
[01:03:35] <gorroth> but i do it differently now
[01:03:51] <WormFood> Right, but you have to account for the rounding, as you've already discovered.
[01:04:20] <gorroth> yes, i delay one of my 1/2 divisions until the end, which accounts for it
[01:05:45] <WormFood> I've also done the interrupt driven serial port stuff...with a software uart...and I can definitely tell you, that a debugger (emulation) will be very helpful
[01:12:03] <gorroth> well, if it doesn't work, i'll load the win10 vm
[01:12:25] <WormFood> on the avr?
[01:12:50] <WormFood> That, I'd like to see.
[01:13:48] <gorroth> you know, for the simulator
[01:13:58] <gorroth> i haven't learned how to use simavr or simulavr yet
[01:14:20] <gorroth> also, i didn't say it earlier, but i like your site
[01:14:37] <gorroth> it helped me when i was just figuring out how this all worked and just needed to get any kind of uart working at all
[01:14:43] <gorroth> since i was still bootstrapping everything
[01:15:02] <WormFood> the site is nothing...but that one page, is actually the most popular page on my whole website.
[01:15:20] <gorroth> hehehe
[01:16:05] <WormFood> now I'm looking at that page http://www.atmel.com/webdoc/AVRLibcReferenceManual/FAQ_1faq_wrong_baud_rate.html and thinking if I need to change my page.
[01:19:11] <gorroth> WormFood: i don't know. but if you used integer math, just set the 8 or 16 divisor to 4 or 8 and move a divisor of 2 to AFTER you subtract the 1
[01:19:16] <gorroth> then you'll get the right UBBR
[01:19:44] <gorroth> WormFood: when i looked at your site, your numbers matched the datasheet where i was having problems
[01:19:48] <gorroth> so you're probably doing it right
[02:42:05] <rue_bed> WormFood, !
[02:42:14] <rue_bed> still use your calc, good stuff
[10:14:48] <WormFood> rue_bed, I want to make another, similar one, for other stuff, such as the programmable fuse bits, and lock bits, and whatnot.
[10:59:06] <aandrew> hey wf, how goes?
[11:23:15] <orzel> hello. Do you know of a great page to find out matching adapters for stk600 ?
[11:23:39] <orzel> the officiel page about attiny828 mentions ATSTK600-DIP which doesn't exist anymore
[11:26:14] <orzel> http://www.atmel.com/Images/stk600_socket_selection.html says the same
[15:11:09] <Xark> orzel: What do you want? A devkit? Or some adapter socket?
[15:33:06] <orzel> i got a stk600, i'm looking for socket and routing cards
[15:33:11] <orzel> adapters, yes
[15:33:15] <orzel> Xark: ^
[16:10:01] <orzel> what a mess. Stuff on the official site like STK600-TQFP64 is marked obsolate on mainstream resellers (digikey,mouser). It's kinda replaced by ATSTK600-SC02, but listed supported devices is different ..
[16:10:19] <orzel> atmel does a pretty bad job at selling its own stuff :/
[16:10:39] <orzel> moreover it seems like all those cards have changed name 2 or 3 times ...
[16:12:26] <sabesto> never seen an stk600 with anything else then an atmega2560 board on it
[16:12:45] <sabesto> had a stack of routing boards, but no target boards
[16:17:53] <orzel> even these 2560 can't be bought by itself ... :-(
[16:18:50] <orzel> am I the only one in this world trying to buy this kind of stuff??? There are a lot or routing/socket cards on digikey, so i guess not
[17:09:02] <Jartza> sabesto: I had stk600 with attiny5 on it just a few days ago :)
[17:13:12] <orzel> with proper adapters ?
[17:15:02] <Jartza> yes
[17:15:51] <Jartza> https://drive.google.com/file/d/0B2dTzW9TMeBxZnVKOHhUendISEE/view
[17:16:09] <Jartza> blinking two leds in there, though it doesn't show :D
[17:16:26] <Jartza> https://drive.google.com/file/d/0B2dTzW9TMeBxUWhRVVJDaXV3OE0/view
[17:17:32] <Jartza> the adapter is "attiny10" -adapter, but the chip I used was attiny5
[17:29:06] <Lambda_Aurigae> just run wires from the stk600 to a solderless breadboard and be done with it.
[17:38:36] <Jartza> indeed
[17:40:37] <Lambda_Aurigae> there is a 6 pin isp port on it I do believe.
[17:43:18] <sabesto> them its just the biggest and most awkward programmer ever :P
[17:44:27] <Lambda_Aurigae> pretty much.
[17:45:00] <Lambda_Aurigae> if he wants to work with dip chips that's as effective as and cheaper than an adapter board.
[17:50:01] <Jartza> yea. I got the stk600 and adapter from atmel directly, but it was just a loaner :)
[17:50:08] <Jartza> and I needed it for 2 days
[17:50:21] <Lambda_Aurigae> I have an old stk500 that I never use anymore.
[17:52:27] <sabesto> i just use xplained pro boards now
[17:52:51] <Lambda_Aurigae> bit pricey for me.
[17:53:01] <Lambda_Aurigae> I use mostly free samples.
[17:53:54] <Lambda_Aurigae> sometimes I buy chips in large quantity....20 or 40 at a time.
[17:54:21] <Lambda_Aurigae> but always dip stuff for me.
[17:55:45] <Lambda_Aurigae> the chips I buy are for permanent projects...for learning I love my free samples though.
[17:55:55] <Jartza> atmel gives xplained boards as samples sometimes :)
[17:58:34] <Lambda_Aurigae> hmmm.
[17:58:50] <Lambda_Aurigae> not much on them I really could use though.
[17:59:27] <Jartza> sure that depends on the need
[18:37:57] <orzel> Jartza: attiny5 is compatible ? same pinout for common pins i guess....?