ATtiny202 - External Oscillator Circuit

Go To Last Post
99 posts / 0 new

Pages

Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I am having troubles with low outside temperatures which influence the stability of the internal 20 MHz oscillator (/24) for synchronous USART timing (1024 BAUD).

I can't find any ANxxxx suggested external oscillator (TCXO) circuit description for AVR 0-Series ATtiny MCU's which have only one pin available for external oscillator.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Kevil wrote:
for synchronous USART timing

Surely, if it's synchronous, then the variations in the speed don't matter?

 

Kevil wrote:
I can't find any ANxxxx suggested external oscillator (TCXO) circuit description for AVR 0-Series ATtiny MCU's which have only one pin available for external oscillator.

Surely, then, it's just a logic-level input?

 

Top Tips:

  1. How to properly post source code - see: https://www.avrfreaks.net/comment... - also how to properly include images/pictures
  2. "Garbage" characters on a serial terminal are (almost?) invariably due to wrong baud rate - see: https://learn.sparkfun.com/tutorials/serial-communication
  3. Wrong baud rate is usually due to not running at the speed you thought; check by blinking a LED to see if you get the speed you expected
  4. Difference between a crystal, and a crystal oscillatorhttps://www.avrfreaks.net/comment...
  5. When your question is resolved, mark the solution: https://www.avrfreaks.net/comment...
  6. Beginner's "Getting Started" tips: https://www.avrfreaks.net/comment...
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Please read the data sheet carefully.
Since the tiny202 does not include an oscillator circuit, it is not possible to connect a "crystal".
What you can do is correct the baud rate using "SIGROW.OSC20ERR5V" or connect a "crystal oscillator" to EXTCLK.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

If using the uart, adjust the baud register according to temperature. You already have the temperature, now figure out the relationship between temperature to actual baud rate and once known you can adjust the baud register according to the current temperature. I would think that will remain consistent. Its a free fix if it works, and free if it doesn't.

 

You can also check out the OSC20 freq vs temp graph. It looks pretty good over the temp range, and assume you are at the lower voltages which seem to hang around the 20MHz area which helps your calculations. Maybe you have some other problem, but if you measure you will know (or maybe you already have). Having an actual temp vs baud graph of your own would be a good thing to have. The fractional baud rate generator will allow you to tweak the baud register as needed, and you probably have pretty high values with that low baud rate so should have the ability to do fine adjustments.

Last Edited: Tue. May 4, 2021 - 10:41 AM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0


kabasan wrote:
correct the baud rate using "SIGROW.OSC20ERR5V"

curtvm wrote:
adjust the baud register according to temperature.

 

Top Tips:

  1. How to properly post source code - see: https://www.avrfreaks.net/comment... - also how to properly include images/pictures
  2. "Garbage" characters on a serial terminal are (almost?) invariably due to wrong baud rate - see: https://learn.sparkfun.com/tutorials/serial-communication
  3. Wrong baud rate is usually due to not running at the speed you thought; check by blinking a LED to see if you get the speed you expected
  4. Difference between a crystal, and a crystal oscillatorhttps://www.avrfreaks.net/comment...
  5. When your question is resolved, mark the solution: https://www.avrfreaks.net/comment...
  6. Beginner's "Getting Started" tips: https://www.avrfreaks.net/comment...
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I don't know how low the outside temperature is, but OSC20M fluctuates only about 0.5% from 40°C to -40°C.
Did you calibrate enough at room temperature?
Do you still have problems?

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

kabasan wrote:

Please read the data sheet carefully.
Since the tiny202 does not include an oscillator circuit, it is not possible to connect a "crystal".
What you can do is correct the baud rate using "SIGROW.OSC20ERR5V" or connect a "crystal oscillator" to EXTCLK.

That's what I am looking for, suggested crystal oscillator circuit to connect it to EXTCLK pin.
 

ATtiny202 Data Sheet, pdf page 519:

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I am using the ATtiny202 as replacement of the Oregon Scientific temperature sensor THN132N placed on a window from outside and sending data to the Oregon Scientific base station. I was told the base station is sensitive to data baud fluctuation max. 20 µs. When the outside temperature is going down the base station won't receive the data.

 

See my another thread below "ATtiny202 - Oregon Scientific temperature sensor replacement"

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Kevil wrote:
That's what I am looking for, suggested crystal oscillator circuit to connect it to EXTCLK pin.

We would need to know the specifications of the needed circuit or oscillator, as you have not (yet) told us what temperature range you need it to operate at, or answered Andy's question of why in a sync serial comm has a problem at all with a change in clock freq.?

Perhaps something like this will work: https://www.digikey.com/en/produ...

 

Jim

 

 

(Possum Lodge oath) Quando omni flunkus, moritati.

"I thought growing old would take longer"

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

ki0bk wrote:
Andy's question of why in a sync serial comm has a problem at all with a change in clock freq.?

Kevil wrote:
I am using the ATtiny202 as replacement of the Oregon Scientific temperature sensor ... I was told the base station is sensitive to data baud fluctuation max. 20 µs

So, presumably, the USART is not actually being used in a synchronous link - just being used to synthesise the bit timings for an async link?

 

 

Top Tips:

  1. How to properly post source code - see: https://www.avrfreaks.net/comment... - also how to properly include images/pictures
  2. "Garbage" characters on a serial terminal are (almost?) invariably due to wrong baud rate - see: https://learn.sparkfun.com/tutorials/serial-communication
  3. Wrong baud rate is usually due to not running at the speed you thought; check by blinking a LED to see if you get the speed you expected
  4. Difference between a crystal, and a crystal oscillatorhttps://www.avrfreaks.net/comment...
  5. When your question is resolved, mark the solution: https://www.avrfreaks.net/comment...
  6. Beginner's "Getting Started" tips: https://www.avrfreaks.net/comment...
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Even now, I don't know the operating temperature range you want, but if you can't use a resonator, you can use an oscillator.
Probably more accurate than OSC20M.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

ki0bk wrote:

...what temperature range you need it to operate at, or answered Andy's question of why in a sync serial comm has a problem at all with a change in clock freq.?

Perhaps something like this will work: https://www.digikey.com/en/produ...

 

Jim

I need to operate in 5 to 105 Fahrenheit. Sync serial speed has to comply with expected parameters of the Oregon Scientific base station. It is one way communication only.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Looking at:

 

If you pick any one of those Vdd values then the curves themselves are all pretty much identical. There is about a maximum 0.1M variance in about 20M. That is 0.4% potential error (which is presumably +/- 0.2% if you do things right?). What kind of UART is so sensitive that even 0.4% drift is a problem? Usually you can get away with +/-2% or even more before you would usually encounter a problem. So unless things are mis-calibrated so you are already very close to a -2% or +2% bounds of error already then a small extra drift should still be in bounds shouldn't it?

 

While you can add an oscillator (not a crystal) to give a more accurate clock in the first place this just sounds like a calibration thing that needs looking at without the expense of hardware (board space etc).

 

EDIT: 5F is -15C and 105F is 40C so you are only even talking about the "middle bit" of one of those curves anyway - which should further limit the potential drift probably only 0.1% or something?

Last Edited: Tue. May 4, 2021 - 01:21 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

awneil wrote:

So, presumably, the USART is not actually being used in a synchronous link - just being used to synthesise the bit timings for an async link?

USART is working in Master SPI communication mode to allow Manchester encoding through CCL, see AN2371 - Manchester Encoder Using USART and CCL on ATtiny817.

 

ATtiny202 signals:
Yellow CLK 1 024 Hz

Cyan synchronous Master SPI USART output

Magenta Manchester code to 433 MHz transmitter (0xC, LSB first)

 


 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0


Kevil wrote:
Manchester Encoder

I thought one of the advantages of Manchester coding was that it allowed clock recovery?

 

Which takes us back to the question: why does it, then, matter what the actual baud rate is?

 

Or is it just that the receiver can only recover the clock over a very narrow range?

 

EDIT

 

Top Tips:

  1. How to properly post source code - see: https://www.avrfreaks.net/comment... - also how to properly include images/pictures
  2. "Garbage" characters on a serial terminal are (almost?) invariably due to wrong baud rate - see: https://learn.sparkfun.com/tutorials/serial-communication
  3. Wrong baud rate is usually due to not running at the speed you thought; check by blinking a LED to see if you get the speed you expected
  4. Difference between a crystal, and a crystal oscillatorhttps://www.avrfreaks.net/comment...
  5. When your question is resolved, mark the solution: https://www.avrfreaks.net/comment...
  6. Beginner's "Getting Started" tips: https://www.avrfreaks.net/comment...
Last Edited: Tue. May 4, 2021 - 02:32 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Yes, the receiver can only recover the clock over a very narrow range. I have checked the SIGROW.OSC20ERR3V = 0xFD i.e. -3.

 

The original Oregon THN132N PCB is clocked by an external crystal.

Last Edited: Tue. May 4, 2021 - 03:28 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Thought Auto-Baud | tinyAVR® 0-series though auto-baud won't be a fit for this use case.

edit : oops (post #14)

 

"Dare to be naïve." - Buckminster Fuller

Last Edited: Tue. May 4, 2021 - 03:33 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I have tested:

 

Fcpu 20M 24 (prescaler)     1 025,64 1 024,00 Delta %
BAUD BAUD Reg Value *64 Real BAUD Delta    
1 019 409 26 176 1 018,74 -6,90 -5,26 -0,51%
1 020 408 26 112 1 021,24 -4,40 -2,76 -0,27%
1 021 408 26 112 1 021,24 -4,40 -2,76 -0,27%
1 022 408 26 112 1 021,24 -4,40 -2,76 -0,27%
1 023 407 26 048 1 023,75 -1,89 -0,25 -0,02%
1 024 407 26 048 1 023,75 -1,89 -0,25 -0,02%
1 025 406 25 984 1 026,27 0,63 2,27 0,22%
1 026 406 25 984 1 026,27 0,63 2,27 0,22%
1 027 406 25 984 1 026,27 0,63 2,27 0,22%
1 028 405 25 920 1 028,81 3,17 4,81 0,47%
1 029 405 25 920 1 028,81 3,17 4,81 0,47%
1 030 404 25 856 1 031,35 5,71 7,35 0,72%
1 031 404 25 856 1 031,35 5,71 7,35 0,72%
1 032 404 25 856 1 031,35 5,71 7,35 0,72%

 

int8_t USART_0_init()
{

	USART0.BAUD = (uint16_t)USART0_BAUD_RATE(1026) << 6; /* set baud rate register */

    USART0.CTRLB |= USART_TXEN_bm;
    USART0.CTRLC = USART_CMODE1_bm | USART_CMODE0_bm | USART_UDORD_bm | USART_UCPHA_bm;

 

#define USART0_BAUD_RATE(BAUD_RATE) ((float)(833333 / (2 * (float)BAUD_RATE)) + 0.5)

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Kevil wrote:
I can't find any ANxxxx suggested external oscillator (TCXO) circuit description for AVR 0-Series ATtiny MCU's which have only one pin available for external oscillator.
A clock generator has a crystal oscillator and a PLL; current consumption is 1 to 4 mA typical.

Other MHz oscillators consume 5mA plus or minus.

Both have an enable to greatly reduce current consumption; AVRxt are frequency agile.

AVR DD will have a crystal oscillator in SOIC-14.

 

PL611s-18 - Clock and Timing - Clock Generation via Low Power Clock Generation Products - Microchip Technology Inc via Clock and Timing | Microchip Technology

AVR DD Product Brief

 

"Dare to be naïve." - Buckminster Fuller

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

 to 433 MHz transmitter

Perhaps more likely, given the baud rate analysis above, than a baud rate error is that the (cheap) 433 MHz transmitter's frequency drifts with the temperature.

 

If your external sensor has Mains power, then add an NFet and a power resistor to the circuit, within the enclosure.

You can then then measure the outside temperature and turn on your heater, (the power resistor), to warm up the inside of the enclosure.

This will keep the transmitter happy.

 

If the remote is battery powered then this option won't work.

 

JC 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Another option other than making a baud register correction for current temp (by testing), is to simply pick out the baud register range you know you will work and simply send out the temperature data for each of those baud values. So if it seems that the baud register range is 5 values depending on temperature or whatever, you just send out 5 times changing baud register each time, and at least one of those will be received.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

curtvm wrote:

That's a good interesting idea. Maybe I will test it.

Last Edited: Tue. May 4, 2021 - 06:49 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

The PCB. U2 is the ATtiny202, U1 the Boost Converter 1.5 to 3.3 V MCP16251. R1 label should be more to the right, below the resistor below U1. Sorry for my soldering, I am not so experienced yet.

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

you just send out 5 times changing baud register each time, and at least one of those will be received.

Interesting idea, but remember, that the other 4 will likely produce some garbage characters or strings of complete junk...so effective string rejection at the rcv end is a must & some error checking should definitely be included...however, are you changing code at the "base station"?  Maybe no chance to do so.

 

If you have means to rcv a message at the AVR (like sending it "QQQQ"), you can use autobaud methods to adjust the registers accordingly (but doesn't seem like you have this option).

 

some of the following info might prove useful (or not), to tell what the sensor is doing in terms of moving data (however, it could just be some hacker's interpretation of what appears to be happening, rather than an official Oregon Sci protocol)

 

https://www.disk91.com/2013/tech...

 

 

When in the dark remember-the future looks brighter than ever.   I look forward to being able to predict the future!

Last Edited: Tue. May 4, 2021 - 07:32 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

clawson wrote:
... this just sounds like a calibration thing that needs looking at without the expense of hardware (board space etc).
Atmel-ICE can generate a clock signal; required temperature range is freezer to heating pad.

 

Measuring the Calibration Clock Frequency | XMEGA Internal RC Oscillator Calibration

...

The frequency of the calibration clock signal should be in the 32 kHz range.

...

AN2644 XMEGA Internal RC Oscillator Calibration

"Dare to be naïve." - Buckminster Fuller

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

>Interesting idea, but remember, that the other 4 will likely produce some garbage characters 

 

If I recall, the protocol in use for this thing has a preamble and a checksum of some sort, so should be fine I would think.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Yes, you are right. The data includes checksum and polynomial CRC. See Oregon Scientific RF Protocol Description.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

It's AA 1.5V battery powered. 2x 162.8ms@20mA data each 43 seconds, sleep 980µA (incl. 433 MHz transmitter).

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Kevil wrote:

I am having troubles with low outside temperatures which influence the stability of the internal 20 MHz oscillator (/24) for synchronous USART timing (1024 BAUD).

 

What troubles exactly ?

Are you saying in #18 that /406 is ok but /405 or  /407 fail ? 

 

Wow. That's a 0.246% step size, which I'd call baud-paranoid.

 

That tolerance band is way less than the Osc trim step size, so even RC calibrate will not be good enough.

 

It also gives you very little system trim margin, as you have to hope the other end properly centres on the 406 value.  Is the very-fussy other end, Crystal controlled ? 

 

If you really do need that precision, you likely will need an external CMOS crystal oscillator, those are easy enough to find.

±50 ppm are very common and ±10 ppm can be found with a little effort.

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I am sending data (outside temperature) by ATtiny202 and 433 MHz Transmitter to the Oregon Scientifics base station.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Yes, with /406 it works almost perfectly. I will try to switch the internal OSC to 16M (from 20m) with the same prescaler 24 which gives me /325 and 0 Delta for 1025.64 Hz.

 

The original Oregon THN132N PCB is using crystal oscillator.

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Kevil wrote:
The original Oregon THN132N PCB is using crystal oscillator.
32KHz?  If yes there are 32KHz TCXO that are very low current.

Model TT32 HCMOS TCXOs - CTS Electronic Components | Mouser

TG-3541CE (TCXO) Crystal Oscillators - Epson | Mouser

 

"Dare to be naïve." - Buckminster Fuller

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Not sure why you'd mess around with 20 gyrations of madness when a simple & cheap solution is a 10 cent crystal in your system.  Very accurate & cheap & stable.  Might take a ms to stabilize at power--so do watch that. 

When in the dark remember-the future looks brighter than ever.   I look forward to being able to predict the future!

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

avrcandies wrote:

Not sure why you'd mess around with 20 gyrations of madness when a simple & cheap solution is a 10 cent crystal in your system....

 

A crystal does not work too well with the #1 :  which have only one pin available for external oscillator.

Thus an external CMOS oscillator is needed, if only one pin exists.

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Kevil wrote:

The original Oregon THN132N PCB is clocked by an external crystal.

 

Do you have a working original unit, you can carefully check the exact baud rate on ? 

If the overall system, is very baud rate paranoid, you may want to target the actual value, rather than a nominal '1024' paper spec.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Kevil wrote:

The original Oregon THN132N PCB is using crystal oscillator.

 

Strictly technically, that's a 'crystal', not a 'crystal oscillator'.  Yes, it's a crystal, and yes, it oscillates, but not by itself.  It needs a crystal driver (which your Tiny202 doesn't seem to have).

 

It's like the crystal is an auto engine, and a 'crystal oscillator' is the whole automobile (driver included).  There is an important (if somewhat pedantic) distinction to be made here, but if you're off to get the groceries it's good to be careful of the difference.  Hope that helps some.  S.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

A crystal does not work too well with the #1 :  which have only one pin available for external oscillator.

Ummmm....just pick an AVR that has an XTAL connection, that would be the first step (or use an osc & increased cost)

When in the dark remember-the future looks brighter than ever.   I look forward to being able to predict the future!

Last Edited: Wed. May 5, 2021 - 05:00 AM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

avrcandies wrote:

A crystal does not work too well with the #1 :  which have only one pin available for external oscillator.

Ummmm....just pick an AVR that has an XTAL connection, that would be the first step (or use an osc & increased cost)

Sure, if the design does not already have a PCB done....

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

The big assumption here is that the OP's frequency measurements are accurate. They are, after all, using a scope to measure them and the display is only showing two decimal places.

#1 Hardware Problem? https://www.avrfreaks.net/forum/...

#2 Hardware Problem? Read AVR042.

#3 All grounds are not created equal

#4 Have you proved your chip is running at xxMHz?

#5 "If you think you need floating point to solve the problem then you don't understand the problem. If you really do need floating point then you have a problem you do not understand."

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

That's why I need to recover the CLK to be able to measure the CLK frequency with higher accuracy on Rigol Oscilloscope by counter function.

 

See AN1470 Manchester Decoder Using the CLC and NCO.

 

Any suggestion to simple CLK recovery circuit would be appreciated. Maybe I can use another ATtiny202 for clock recovery - Configurable Custom Logic (CCL).

Last Edited: Wed. May 5, 2021 - 07:51 AM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

It's AA 1.5V battery powered.

Note that a typical problem with external oscillators is that they are relatively power-hungry things, compared to an AVR. A couple of 10s of mA is not unusual, and it won't turn off during CPU "sleep" modes.

 

 

Last Edited: Wed. May 5, 2021 - 08:07 AM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 1

Kevil wrote:

That's why I need to recover the CLK to be able to measure the CLK frequency with higher accuracy on Rigol Oscilloscope by counter function.

 

You don't need to do that. Take a step back and measure the actual frequency of the chip's oscillator over the working temperature range. Write a simple bit of code that toggles an output pins as fast as possible and measure the frequency of that. You will now know what the real temperature drift in frequency is.

#1 Hardware Problem? https://www.avrfreaks.net/forum/...

#2 Hardware Problem? Read AVR042.

#3 All grounds are not created equal

#4 Have you proved your chip is running at xxMHz?

#5 "If you think you need floating point to solve the problem then you don't understand the problem. If you really do need floating point then you have a problem you do not understand."

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

westfw wrote:
a typical problem with external oscillators is that they are relatively power-hungry things

There are silicon clock sources available these days - quite low power; eg, https://www.sitime.com/

 

Top Tips:

  1. How to properly post source code - see: https://www.avrfreaks.net/comment... - also how to properly include images/pictures
  2. "Garbage" characters on a serial terminal are (almost?) invariably due to wrong baud rate - see: https://learn.sparkfun.com/tutorials/serial-communication
  3. Wrong baud rate is usually due to not running at the speed you thought; check by blinking a LED to see if you get the speed you expected
  4. Difference between a crystal, and a crystal oscillatorhttps://www.avrfreaks.net/comment...
  5. When your question is resolved, mark the solution: https://www.avrfreaks.net/comment...
  6. Beginner's "Getting Started" tips: https://www.avrfreaks.net/comment...
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Good suggestion although not easy to route wires from outside of the window wink.

 

Another "wireless" option would be to buy the AVR128DA48 Curiosity Nano Development Board and run the Manchester Decoder.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

not easy to route wires from outside of the window

 

Go on - you do this testing on your bench!

 

Use an ice pack, or pop it in the fridge to check low-temperature operation ...

Top Tips:

  1. How to properly post source code - see: https://www.avrfreaks.net/comment... - also how to properly include images/pictures
  2. "Garbage" characters on a serial terminal are (almost?) invariably due to wrong baud rate - see: https://learn.sparkfun.com/tutorials/serial-communication
  3. Wrong baud rate is usually due to not running at the speed you thought; check by blinking a LED to see if you get the speed you expected
  4. Difference between a crystal, and a crystal oscillatorhttps://www.avrfreaks.net/comment...
  5. When your question is resolved, mark the solution: https://www.avrfreaks.net/comment...
  6. Beginner's "Getting Started" tips: https://www.avrfreaks.net/comment...
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Kevil wrote:

Good suggestion although not easy to route wires from outside of the window.

 

LED and a photodiode. A cheap IR LED will be good out to 10MHz or so, a photodiode will not even break a sweat at that rate.

#1 Hardware Problem? https://www.avrfreaks.net/forum/...

#2 Hardware Problem? Read AVR042.

#3 All grounds are not created equal

#4 Have you proved your chip is running at xxMHz?

#5 "If you think you need floating point to solve the problem then you don't understand the problem. If you really do need floating point then you have a problem you do not understand."

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Another option is to up your clock speed so your uart baud register has more values to work with. If you only have 1 value that works when you are /24, then maybe if you go to something like /1,/2,/4 while you transmit you now have more values that will work, and can try them all as mentioned earlier so you get a 'good' one no matter the temp.

 

edit- something else I probably keep forgetting is the code in #18 reminds me your baud rate (spi mode) is no longer using the fractional capabilities which is why the fine tuning ability is not available like in the uart fractional modes. 

 

 

Last Edited: Wed. May 5, 2021 - 11:25 AM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

westfw wrote:

It's AA 1.5V battery powered.

Note that a typical problem with external oscillators is that they are relatively power-hungry things, compared to an AVR. A couple of 10s of mA is not unusual, and it won't turn off during CPU "sleep" modes.

Good point, but many oscillators have an enable pin, or you can simply power thru a port pin.

Allow a startup time, before switching to external clock mode.

 

You could look at these, I've tested this family at 1.5mA (CL=0) and ~ 100us startup time.

lcsc C669067 Yangxing Tech OT252020MJBA4SL 20MHz 10ppm 1.8V~3.3V 4mA SMD-2520-4P
lcsc C669079 Yangxing Tech OT201620MJBA4SL 20MHz 10ppm 1.8V~3.3V 4mA SMD-2016-4P
 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Brian Fairchild wrote:

The big assumption here is that the OP's frequency measurements are accurate. They are, after all, using a scope to measure them and the display is only showing two decimal places.

The time display is 4 digits, and you can zoom on any decent storage scope, to resolve edges to tighter values.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 1

You may be able to zoom to "tighter values" but that does not necessarily mean more accuracy in the absolute sense. It might, but that varies from one model to the next.

 

Jim Wagner

 

Until Black Lives Matter, we do not have "All Lives Matter"!

 

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

ka7ehk wrote:

You may be able to zoom to "tighter values" but that does not necessarily mean more accuracy in the absolute sense. It might, but that varies from one model to the next.

 

Perhaps, but easily checked.

All digital  scopes I've used have a crystal master timebase and the sample rates are digital and very precise.

The screen display is usually what limits the 'visual precision', but the underlying precision is as good as the sample rate, which is usually memory-depth related.  

Pages