๐Ÿ“ฃ๐Ÿ“ช ๐Ÿšš Adafruit will not be shipping USPS orders Monday October 14, 2019 ๐Ÿ—“. Expedited USPS orders placed after 11am ET ๐Ÿ•š Friday October 11 will go out Tuesday October 15 ๐Ÿ“ฃ๐Ÿ“ช๐Ÿšš
0

lfuse and now a change in clock frequency
Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.

lfuse and now a change in clock frequency

by northalb on Sun Sep 19, 2010 10:58 pm

greetings.
My newly assembled POV3 kit worked fine when running all of the firmware code provided.
I tried to load ledcube.hex provided by the online tutorial at make magazine.
Everything seemed fine until the lfuse error appeared during the download.
After looking through the forum, I entered 'n' when asked about changing the
setting. The fuse question was asked three more times..each answered, 'n'...
the execution ended and then 'nothing'.
Using the dasa downloading, all the original .hex files run as before; however,
although files digg.c and minipov.c each download fine they run too fast.
The frequency of the LED's are so high that they almost look like they are just on.
I went through the Makefile and found the line for 'burn-fuse' and ran it
on the command line. There was no change to the LED frequency.
As a newbie, I'm assuming that some prescaler (?) in the Tiny2313 clock setting
must have been changed ?!?
I know I'm close....
I would sure appreciate any suggestions.

northalb
 
Posts: 1
Joined: Sun Aug 29, 2010 8:45 pm

Re: lfuse and now a change in clock frequency

by adafruit on Tue Sep 21, 2010 12:43 pm

dont think so, the minipov3 is already running on the 8mhz internal oscillator and thats as fast as it goes. try mucking with the frequency divider line to change the speed?

adafruit
 
Posts: 12151
Joined: Thu Apr 06, 2006 4:21 pm
Location: nyc

Re: lfuse and now a change in clock frequency

by LEDTim on Wed Sep 22, 2010 10:21 am

Does anyone know if I can slow this Minipov3 waaaaaaaaaaay down??? And how to do it??

Tim
LEDTim
 
Posts: 4
Joined: Tue Sep 21, 2010 4:12 pm

Re: lfuse and now a change in clock frequency

by adafruit_support_bill on Wed Sep 22, 2010 10:42 am

The timing calculation is described in detail at the beginning of the main() function in mypov.c. You can play with the prescale and/or overflow values until you get the effect that you want.

adafruit_support_bill
 
Posts: 74601
Joined: Sat Feb 07, 2009 10:11 am

Re: lfuse and now a change in clock frequency

by LEDTim on Fri Sep 24, 2010 2:57 pm

I'm missing it. I don't do alot of programing. I have changed all kinds of things and can't get it to slow down. Then reloaded the file from source code and started again.
Could you please copy and paste what lines of code I need to change.
Thanks
Tim
LEDTim
 
Posts: 4
Joined: Tue Sep 21, 2010 4:12 pm

Re: lfuse and now a change in clock frequency

by adafruit_support_bill on Fri Sep 24, 2010 3:39 pm

Code: Select all | TOGGLE FULL SIZE
  /*
    the frequency of the interrupt overflow is determined by the
    prescaler and overflow value.
    freq = clock_frequency / ( 2 * prescaler * overflow_val)
    where prescaler can be 1, 8, 64, 256, or 1024
    clock_freq is 8MHz
    and overflow_val is 16bit

    the overflow value is placed in OCR1A, the prescale is set in TCCR1B
    so for example:
    A good POV frequency is around 400Hz
    desired freq = 400Hz
    clock freq = 8MHz
    8MHz / (400Hz * 2) = 10000
    since 10000 is less than 655536 (largest 16 bit number)
    OCR1A = 10000 and the prescale is 1
  */

  TCCR1B = (1 << WGM12) | TIMER1_PRESCALE_1;
  OCR1A = (uint16_t)10000;

  TIMSK |= 1 << OCIE1A;   // Output Compare Interrupt Enable (timer 1, OCR1A)


If you increase the prescale, things will get slower. For example, you could change TIMER1_PRESCALE_1 to TIMER1_PRESCALE_8 to run 8 times slower.
Or you can increase the value assigned to OCR1A. If you change the 1000 to a 2000 it will be half as fast.

adafruit_support_bill
 
Posts: 74601
Joined: Sat Feb 07, 2009 10:11 am

Please be positive and constructive with your questions and comments.