Problem in writing 1 on CFD bit from AVRdude

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


Hi,

I am trying to enable CFD feature in ATMEGA328pb but its showing mismatch error

 

And if I am writing any value with 3 bit 0 then its getting written without any issue. (example 0xF4).

How can I solve this issue please help me.

This topic has a solution.
Last Edited: Sat. Oct 19, 2019 - 05:15 AM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 1

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

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

Is there any way from that I can write Extended fuse bit 0xFC with linuxgpio avrdude?

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

Hi everyone,

I am using ATMEGA328PB and compiler is Atmel Studio 7.

I want to write 1 on CFD bit of Extended fuse bit through my application code.

Is that possible? If yes how can I write that.

Please help

Thanks. 

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

You can only program fuses with ISP or HVPP i.e. external programmer.
It is not possible from an application.

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

david.prentice wrote:
You can only program fuses with ISP or HVPP i.e. external programmer. It is not possible from an application.

 

Ok thanks for your reply.

Actually I am trying to write fuse bits from avrdude linuxgpio from raspberry pi. Every thing is working fine but whenever I am trying to write 1 on CFD bit then it is showing miss match error.

How can I resolve this issue? 

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

You already have a thread on this:

 

https://www.avrfreaks.net/forum/...

 

[see #9 below]

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: Fri. Oct 18, 2019 - 08:58 AM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

imrana326 wrote:
I am trying to write 1 on CFD bit then it is showing miss match error.
That may be benign. Only bits 0..3 in the extended byte are used. The other 4 bits are "don't care". Some systems treat this as 0 bits, some as 1 bits. So the mismatch reported may be in the upper 4 bits. What is the actual state of BODLEVEL[2:0] and CFD on read-back after programming?

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

Note that I have now merged your two threads together here. So the "reading order" above many be confused.

 

Please do not start multiple threads about the same thing in future as it causes all kinds of issues trying to merge threads and so on.

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

My 328PB datasheet circa 2015 did not specify the CFD fuse.

The 2017 datasheet does document the CFD fuse

 

My Arduino v1.8.9 avrdude.conf does not accept writing to bit#3 of EFUSE.

 

I have no idea what avrdude.conf you might be using.

It is simple enough to see the "m328"  section e.g.

    memory "efuse"
	size = 1;
	min_write_delay = 4500;
	max_write_delay = 4500;
	read = "0 1 0 1 0 0 0 0 0 0 0 0 1 0 0 0",
	       "x x x x x x x x o o o o o o o o";

	write = "1 0 1 0 1 1 0 0 1 0 1 0 0 1 0 0",
	      	"x x x x x x x x x x x x x i i i";
    ;

If you want to use avrdude to program CFD,  you need to enable bit #3 for write

 

This might cause problems with "other" devices that use "m328 parent" e.g. that do not use bit#3

So you should really create a custom "parent"

 

The real mystery is WHY.

Surely it is unwise to disable the CFD mechanism via the fuse.  i.e. CFD=0

The factory default is to enable CFD i.e. CFD=1

 

It seems an inappropriate name.   CFD implies Clock Failure Detect.

A fuse called CFD implies Clock Failure Disable

CFDDISABLE would be better

 

David.

Last Edited: Fri. Oct 18, 2019 - 09:16 AM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

david.prentice wrote:
I have no idea what avrdude.conf you might be using.
The mega328PB change by a principal at Microchip and AVR Freaks :

http://svn.savannah.gnu.org/viewvc/avrdude?view=revision&revision=1397

 

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

This reply has been marked as the solution. 
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

From your link:

        write = "1 0 1 0 1 1 0 0 1 0 1 0 0 1 0 0",
 	        "x x x x x x x x x x x x x i i i";

So bit#3 has never been made "write"

 

I can only assume that someone had made bit#3 = 0 by mistake.

And the OP wants to restore it to the Factory default. i.e. bit#3 = 1

 

Personally,  I would just use atprogram.exe or AS7.0 to restore the EFUSE

And leave avrdude.conf as it is.

 

David.

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

concur

[avrdude-dev] config for atmega328pb

IIRC, Ron is with AVR Freaks :

[avrdude-dev] [patch #9811] ATmega328pb has efuse bit 3

 

avrdude-dev has threads on linuxgpio and linuxspi.

 

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

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

david.prentice wrote:

 

        write = "1 0 1 0 1 1 0 0 1 0 1 0 0 1 0 0",
 	        "x x x x x x x x x x x x x i i i";

 

Thanks this solved the issue

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

What I did for avrdude with 328pb

 

https://github.com/epccs/RPUpi/blob/master/lib/avrdude/328pb.conf

 

it is added to the avrdude command like in this Makefile

 

https://github.com/epccs/RPUpi/blob/master/Remote/Makefile