Author Topic: Atmel Attiny 4313 External Crystal Clock  (Read 2902 times)

0 Members and 1 Guest are viewing this topic.

Offline firstoptionTopic starter

  • Newbie
  • Posts: 5
Atmel Attiny 4313 External Crystal Clock
« on: May 01, 2014, 02:55:32 pm »
Please I need your support on how to sort out this problem.I am clocking Attiny4313 with an External Crystal Clock(7.3728MHz ).The USART of the Microcontroller is used to received data from the Computer through a USB port.I have on the Computer a Grahpic User Interface which has Buttons and Sliders.The buttons turn the Leds ON and OFF while the Sliders control Leds brightness.
The ON and OFF of the Leds by the Buttons are working perfectly however I get error when using the Sliders to control the brightness.If I move the Slider slowly(one step at a time),everything works fine.However if I move the Slider very fast,then I get error.The error looks like this.If the Graphic User Interface shows say 70%,the Oscilloscope will show 13.2%,then if I move the Slider again slowly,the brightness(represented in percentage)on the Oscilloscope and the Grahpic Interface will be equal.If the Slider is moved very fast again,the error reappears.This time around the Graphic Interface can show say 50% but the oscilloscope will still show 13.2%.This 13.2% is what the oscilloscope always show whenever there is an error no matter what the Graphic User Interface shows(20%/40%/60%).
 My assumption is that the USART of the microcontroller is not fast enough to process the DATA it receives from the Computer.If this assumption is correct,then is it possible to solve this problem by replacing the 7.3728MHz crystal with a 16MHz crystal.
 I will highly appreciate your advice and idea in this regards.Once again thank you for the support.
 Firstoption
 

Offline dannyf

  • Super Contributor
  • ***
  • Posts: 8221
  • Country: 00
Re: Atmel Attiny 4313 External Crystal Clock
« Reply #1 on: May 01, 2014, 03:35:30 pm »
".If this assumption is correct,then is it possible to solve this problem by replacing the 7.3728MHz crystal with a 16MHz crystal. "

Yes, if your assumption is correct.

There are limitless possibilities, slow oscillator is one of the unlikely causes, however.
================================
https://dannyelectronics.wordpress.com/
 

Offline scientist

  • Frequent Contributor
  • **
  • !
  • Posts: 317
  • Country: 00
  • User banned.
Re: Atmel Attiny 4313 External Crystal Clock
« Reply #2 on: May 01, 2014, 07:00:52 pm »
Why not have the GUI send data every .1 second so that you don't have the atmel decoding a rapidly changing input?
 

Offline KD0RC

  • Regular Contributor
  • *
  • Posts: 114
  • Country: us
Re: Atmel Attiny 4313 External Crystal Clock
« Reply #3 on: May 11, 2014, 02:40:31 pm »
What baud rate are you using?  This will affect the ability of your system to keep up with the data as well.  I usually go with the fastest clock that my processor will support to make this kind of thing easier (mine are all one-off hobby projects, so component cost and count is not a big issue...).  You do have to be aware of the relationship of clock speed with respect to the desired data rate.  For example, on my current ATMega324 project, I have a 20.356250 MHz crystal to allow me to run 115Kbps.  The odd frequency was chosen to minimize the serial clock error percentage at 115Kbps.  I think that the calculator that I used for this is in ATMEL Studio, but it might have been something standalone - check AVRFreaks or the ATMEL site for how to do this. 
 

Offline MickM

  • Regular Contributor
  • *
  • Posts: 100
Re: Atmel Attiny 4313 External Crystal Clock
« Reply #4 on: May 18, 2014, 05:53:55 pm »
Hi 
  Try a 14.7456 xtal.
This is close to 16MHz, but better for baud rates.

Here is wormfood's calculator:
http://www.wormfood.net/avrbaudcalc.php

I am using an  ATtiny4313-pu with 14.7456 xtal and 22pf xtal caps, works fine.

Mick M.
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf