Need help on ATTiny24a fuse and lock bits

Go To Last Post
10 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hi guys.

 

I have plenty of programmed AVR ATTiny24A wich both of lockbits are enabled...

The programming routine is the same for all of them but for about 70% of these AVRs the CKDIV8 fuse bit is enabled that it shouldn't be...

is there any solution to disable CKDIV8 fuse bit while IC is locked??

...

Last Edited: Mon. Nov 13, 2017 - 06:06 AM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

is there any solution to disable CKDIV8 fuse bit while IC is locked??

No:

"Experience is what enables you to recognise a mistake the second time you make it."

"Good judgement comes from experience.  Experience comes from bad judgement."

"When you hear hoofbeats, think horses, not unicorns."

"Fast.  Cheap.  Good.  Pick two."

"Read a lot.  Write a lot."

"We see a lot of arses on handlebars around here." - [J Ekdahl]

 

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

You will need to erase, reprogram, set fuses, then set lock bits! 

 

Jim

 

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

You can set the CLKPR register for the desired clock divide rate to override the CKDIV8 fuse setting; but that does mean erase, reprogram...
 

David (aka frog_jr)

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

ki0bk wrote:

You will need to erase, reprogram, set fuses, then set lock bits! 

 

yes I did that, I wanted to solve this problem without eraseing.. now I erased and reprogrammed all of them

...

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

yes I did that, I wanted to solve this problem without eraseing.. now I erased and reprogrammed all of them

As mentioned:

You can set the CLKPR register for the desired clock divide rate to override the CKDIV8 fuse setting

That way, regardless of the CKDIV8 fuse, your app can set its own prescaler.  Did you modify your app to do so?

"Experience is what enables you to recognise a mistake the second time you make it."

"Good judgement comes from experience.  Experience comes from bad judgement."

"When you hear hoofbeats, think horses, not unicorns."

"Fast.  Cheap.  Good.  Pick two."

"Read a lot.  Write a lot."

"We see a lot of arses on handlebars around here." - [J Ekdahl]

 

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

joeymorin wrote:
your app can set its own prescaler.  Did you modify your app to do so?

No.. actually I don't understand your meaning

...

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

With the CKDIV8 fuse >>not<< programmed, the default system clock presaler is 1.  When it >>is<< programmed, the default prescaler is /8.

 

Regardless, software can change the system clock prescaler by tickling the CLKPR register as described in the datasheet.  Most toolchains provide an easy way to do this.  AVR GCC  and AVR Libc has <avr/power.h>, containing clock_prescale_set().

 

Had your app set its own prescaler, it wouldn't have mattered whether or not the CKDIV8 fuse had been programmed.

"Experience is what enables you to recognise a mistake the second time you make it."

"Good judgement comes from experience.  Experience comes from bad judgement."

"When you hear hoofbeats, think horses, not unicorns."

"Fast.  Cheap.  Good.  Pick two."

"Read a lot.  Write a lot."

"We see a lot of arses on handlebars around here." - [J Ekdahl]

 

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

ah.. understood..

I should check and test this prescale setting.. i think it might work for my problem

 

...

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

I should check and test this prescale setting.. i think it might work for my problem

It couldn't have solved your earlier problem, but it can help prevent it in the future.  i.e. if you ever forget to change CKDIV8 to your liking, it won't matter since your app will set its own prescaler anyway.

 

I generally leave CKDIV8 programmed, and let my app set its own desired prescaler.  This can be useful in battery operated apps where VCC might be lower than you need it to be.  Say you've designed your widget to run at 8 MHz.  With the t24a, that requires a minimum voltage of about 2.5V.  If your widget powers up from a partially depleted battery providing less than 2.5V, then it would be unsafe to run at 8 MHz.  However, at 1 MHz (actually, anything less than 4 MHz), it is safe to run from as low as 1.8V.  So, leave CKDIV8 programmed, and write your app to first check the level of VCC (with VCC as REF and VBG as MUX) and determine if it is safe to change the prescaler.  You should also think about using BOD (and software BOD disable), but there are situations where it is not sufficient.  For example, if you want to run at 8 MHz down to 2.5V, there is no good choice of BOD for that.  You could choose the 1.8V BOD threshold, and monitor VCC in software.  If it dips below the minimum required for your chosen speed, change prescalers or take other corrective action.

"Experience is what enables you to recognise a mistake the second time you make it."

"Good judgement comes from experience.  Experience comes from bad judgement."

"When you hear hoofbeats, think horses, not unicorns."

"Fast.  Cheap.  Good.  Pick two."

"Read a lot.  Write a lot."

"We see a lot of arses on handlebars around here." - [J Ekdahl]