AVR not getting program After External Clock failure.

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

Hi everyone,

I am using ATMEGA328PB with Atmel Studio Compiler. 

1. I have enabled CFD. And Enabled CFD Interrupt. And when I have taken out the crystal from the circuit. Then it starts working on 1 MHz even I have disabled CKDIV8 bit in LFUSE it should work on 8 MHz.

And it jumped to the CFD interrupt and its not returning to main code.

 

2. And in second case I have enabled CFD but not enabled its Interrupt. 

And then when I removed crystal then it started working on 1 MHz and it is executing the main code normally.

 

In both cases after removing crystal I am not able to reprogram it. Why?

 

Actually what I want that, When ever my crystal stops working then controller should start working normally on 8 MHz. And I should able to reprogram it.

 

How can I achieve these things?

Please Help. Thanks

Regard

Imran

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

Glad you're progressing.

imrana326 wrote:
Then it starts working on 1 MHz even I have disabled CKDIV8 bit in LFUSE it should work on 8 MHz.

AN2365 Using CFD for ATmega328PB

[PDF, page 1]

• 1 MHz Fallback Clock

4MHz max for a 1.8V mega328PB per SOA.

imrana326 wrote:
In both cases after removing crystal I am not able to reprogram it. Why?
ISP clock frequency may be greater than the limit for a 1MHz AVR CPU frequency.

 


ATmega328PB - 8-bit AVR Microcontrollers

 

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

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

gchapman wrote:

 

ISP clock frequency may be greater than the limit for a 1MHz AVR CPU frequency.

 


But when I am programming new MCU which is also on 1 MHz then it is getting programmed. How?

 

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

indecision

 

edit :

A CFD errata for revision B mega328PB on the reset signal; work-around is to cycle power.

ATmega328PB

[page 456]

3. Clock Failure Detection (CFD) doesn't resume back to original clock with external reset

Description:

If clock failure has occurred when CFD is enabled and device is operating with 1 MHz fallback clock then external reset doesn't cause the system to try to resume back to its original clock source.

Fix/Workaround: Power-On-Reset can be used to resume back to original clock if clock failure has occurred.

 

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

Last Edited: Sun. Oct 20, 2019 - 09:04 PM