ATTINY841 with a TCXO - Page 1
Forum section: electronics / general

author: Dragon88
author_rank: Regular Contributor
timestamp: June 13, 2015, 11:56:43 pm
content: Several months ago I picked up some ATTINY841s. It's a very capable chip considering the tiny size and price. Despite poor documentation at the time (hasn't gotten much better since) I was able to get them programmed with avrdude, but I didn't end up using them for anything serious.I decided to revisit the chip for a project I am working on. I have some stiff requirements for my timing, so I wanted something better and more stable than the internal oscillator or a regular crystal. I found some reasonably priced 16MHz TCXOs on Digikey and decided to build a little breakout board for the chip to use them. The board looks quite nice I think (below). I hid all of the passives on the underside so it's clean and compact. I will transplant this layout directly into a larger project now that I have tested it.Most importantly, performance (of this one sample) of the TCXO I used is outstanding. Reading the clock frequency from PB2 shows that it is less than 0.5 PPM out. (The part is rated +/-2.5PPM stability though, and +/-1.5ppm initial. Still quite good) About 6 Hz out at 16 MHz and very stable. A half hour in the fridge caused no noticeable change. I'm satisfied, and this will work great in my project.EDIT: I removed the part about my Hello World sketch, because some people have such a visceral reaction to certain items of code.I highly recommend trying a TCXO some time with your microcontroller project.

author: oilburner
author_rank: Contributor
timestamp: June 14, 2015, 01:46:35 am
content: Nice! Thanks for the tipWhat TCXO caught your eye on Digikey? That is some good numbers, both in and out of the 'fridge. How did you check, with GPS?

author: con-f-use
author_rank: Unknown
timestamp: June 14, 2015, 08:15:37 am
content: I'm also interested in the oscillator you used...Quote from: Dragon88 on June 13, 2015, 11:56:43 pmSeriously? I mean the data sheet isn't great, but I've seen a lot worse. It's good average.

author: Dragon88
author_rank: Regular Contributor
timestamp: June 14, 2015, 11:55:16 am
content: This is the oscillator:http://www.digikey.com/product-detail/en/FOX924B-16.000/631-1071-1-ND/1024776All measurements made with a calibrated HP 5334B, spot checked against my GPSDOs.Quote from: con-f-use on June 14, 2015, 08:15:37 amThe data sheet it fine, but other community support is still lacking, and that limits accessibility of the chip to general hobbyists.

author: con-f-use
author_rank: Unknown
timestamp: June 14, 2015, 12:42:22 pm
content: Thank you! Its remarkable how much cheaper digikey is for this part when compared to mouser. Over all quantities less than halve the price.Well it's the same architecture as the ATMegaXX8 that is used in the Arduinos and MIT has written a tutoral on howto use the Arduino IDE with ATTiny-uC. You basically can't get any more community support than that.

author: Moondeck
author_rank: Regular Contributor
timestamp: June 15, 2015, 07:41:15 am
content: Quote from: Dragon88 on June 14, 2015, 11:55:16 amHow does lack of community limit accessibility

author: Dragon88
author_rank: Regular Contributor
timestamp: June 15, 2015, 10:51:22 pm
content: Quote from: mojo-chan on June 15, 2015, 08:25:23 amNo, it's not.The frequency of the output was measured externally using a counter, and the resolution I stated above is correct. If I had stated more resolution, then the execution time of the other instructions in the loop would have become an issue.

author: Dave
author_rank: Super Contributor
timestamp: June 16, 2015, 07:11:53 pm
content: Heh, you can achieve 10ppm accuracy with almost any bog standard quartz crystal. You don't need to shell out for a TCXO to do that.

author: Dragon88
author_rank: Regular Contributor
timestamp: June 16, 2015, 10:09:10 pm
content: Quote from: Dave on June 16, 2015, 07:11:53 pmI don't have 10ppm accuracy in my clock signal. Try re-reading the original post.

author: Dave
author_rank: Super Contributor
timestamp: June 16, 2015, 11:54:19 pm
content: You're measuring your 1Hz signal with 10ppm resolution and saying it's bang on.Quote from: Dragon88 on June 15, 2015, 10:51:22 pmBased on this statement, I would assume the lower digits were not bang on anymore, so you decided to limit the number of digits.You know, writing good code that actually uses the internal counters for the clock division isn't that bloody difficult.

author: Dragon88
author_rank: Regular Contributor
timestamp: June 17, 2015, 12:42:05 am
content: No, I am using a 9 digit counter. I also have a 12 digit counter which verified the measurement. There was an additional zero I left off, because I intentionallyavoidedoverstating performance of this part. The TCXOs I purchased have a claimed initial frequency accuracy of +/- 2.5ppm, so even though my one sample performed much better, I would not claim that applies across the board for this part.I could have stated 1.0000001 Hz for this measurement and been well within the capabilities of my equipment and their calibration.I would also never claim that a 1 ms delay plus additional instruction executions is still exactly 1ms. Thus I used the resolutions I used.And it is correct that better code than the delay_ms routine is required for precise timing. Once again, if you re-read the original post, you will see I stated this was a hello world sketch uploaded to the device. No where did I say that I intended to use that in the project, as the requirements are much more stringent than a generic hello world.Also, I would love to see your measurement data to support the claim that bog standard 50-100 ppm crystals are actually 10 ppm.

author: Dragon88
author_rank: Regular Contributor
timestamp: June 17, 2015, 01:29:26 am
content: Ah, stability is 2.5ppm, initial tolerance is1.5ppm.I edited out the part about my hello world sketch in the initial post. Since some people have such a negative reaction to delay_ms.But please continue to make assumptions about my intelligence based on that.I also tried to clarify that the measurement is on this one part only. I'll have to test more to see how well they perform beyond the one sample.

author: jwm_
author_rank: Frequent Contributor
timestamp: June 17, 2015, 02:40:40 am
content: Nice. Roman's algorithm can be pretty easily adapted to the attiny and you have a pretty nice arbitrary frequency synthesizerhttp://www.romanblack.com/one_sec.htmI wrote a variant that can do arbitrary rational periods on the same timer for the attiny, so you can have OSC0A be 3/2 Hz and OSC0B be 1/7Hz and they will be an actual perfect 3 cycles every 2 seconds and one cycle every seven seconds. (jitter being determined by your timer rate) Seems like your boards would be a handy thing to pair it with.