How to correctly configure AVR fuse bits

Publisher:TranquilDreamsLatest update time:2020-02-21 Source: eefocus Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere

Introduction: The configuration of AVR fuse bits is a relatively delicate task, and users often overlook its importance or find it difficult to master. Here are some key points and related matters that need to be paid attention to when configuring AVR fuse bits.


(1) In the AVR device manual, the fuse bit states are defined as programmed (Programmed) and unprogrammed (Unprogrammed). "Unprogrammed" means the fuse state is "1" (disabled); "Programmed" means the fuse state is "0" (allowed). Therefore, the process of configuring the fuse bit is actually "configuring the fuse bit to be in the unprogrammed state "1" or in the programmed state "0"". The fuse bit status display box shows the detailed status of each fuse bit of the chip. AVR fuse bits with a check mark indicate 0, indicating that the option is enabled; unchecked indicates 1, indicating that the option is not enabled. Please note this.


(2) When using programming tool software that determines the fuse bit status value by selecting the check mark “√”, please first read the software instructions carefully to understand whether “√” means setting the fuse bit status to “ or “.


(3) When using the programming download program in CVAVR, special attention should be paid. Since the initial state of most fuse bits is defined as " when the CVAVR programming download interface is initially opened, do not use the "all" option in its programming menu options. At this time, the "all" option will configure the fuse bits of the chip according to the initial state definition of the fuse bits, but in fact it is often not the configuration result required by the user. If you want to use the "all" option, you should first use "read->fusebits" to read the actual state of the fuse bits in the chip, and then use the "all" option.


(4) Before using a new AVR chip, you should first check the configuration of its fuse bits, then configure the fuse bits according to actual needs, and record the status of each fuse bit for filing.


(5) After the AVR chip is encrypted, only the data in the internal Flash and E2PROM of the chip cannot be read. The status of the fuse bits can still be read, but the configuration cannot be modified. The chip erase command clears the data in the Flash and E2PROM, and at the same time configures the status of the two lock bits to ", which is in an unlocked state. However, the chip erase command does not change the status of other fuse bits.


(6) The correct operation procedure is: when the chip is unlocked, download the running code and data, configure the relevant fuse bits, and finally configure the chip lock bits. After the chip is locked, if the fuse bits are found to be incorrectly configured, the chip erase command must be used to clear the data in the chip and unlock it. Then re-download the running code and data, modify the configuration-related fuse bits, and finally configure the chip lock bits again.


(7) When using ISP serial download programming, the SPIEN fuse bit should be configured to "". The default state of the SPIEN bit when the chip leaves the factory is ", indicating that ISP serial download data is allowed. Only when this bit is in the programmed state ", can ISP download be performed through the AVR's SPI port. If this bit is configured as "unprogrammed", ISP serial download data is immediately prohibited. At this time, the SPIEN state can only be reset to " through parallel mode or JTAG programming mode to open ISP. Under normal circumstances, the SPIEN state should be kept ". Allowing ISP programming will not affect the I/O function of its pins, as long as the ISP interface and the devices connected in parallel are isolated when designing the hardware circuit, such as using series resistors or circuit breaker jumpers.


(8) When your system does not use the JTAG interface for download programming or real-time online simulation debugging, and the pins of the JTAG interface need to be used as I/O ports, the fuse bit JTAGEN must be set to "". The JTAGEN status defaults to " when the chip leaves the factory, indicating that the JTAG interface is allowed, and the external pins of JTAG cannot be used as I/O ports. When the JTAGEN status is set to ", the JTAG interface is immediately disabled. At this time, JTAG can only be reset to " and JTAG can be opened through parallel mode or ISP programming.


(9) In general, do not set the fuse to define the RESET pin as I/O (such as setting the ATmega8 fuse RSTDISBL to "). This will cause the ISP download programming to fail, because before entering the ISP mode programming, the RESET pin needs to be pulled low to put the chip into the reset state first.


(10) When using an AVR chip with an internal RC oscillator, pay special attention to the configuration of the fuse bit CKSEL. Generally, the default state of the CKSEL bit when the chip leaves the factory is to use the internal 1MHz RC oscillator as the system clock source. If you use an external oscillator as the system clock source, do not forget to correctly configure the CKSEL fuse bit first, otherwise the timing of your entire system will be problematic. When your design does not use an external oscillator (or a specific oscillation source) as the system clock source, do not misoperate or mistakenly configure the CKSEL fuse bit to use an external oscillator (or other different types of oscillation sources). Once this happens, the chip cannot be operated using the ISP programming method (because the ISP method requires the chip's system clock to work and generate timing control signals), and the chip looks "broken". At this time, the only way to save it is to remove the chip and use the parallel programming method, or use the JTAG method (if JTAG is allowed and there is a JTAG interface on the target board). Another way to solve the problem is to try to temporarily add different types of oscillation clock signals to the crystal pins of the chip. Once the ISP can operate the chip, immediately configure CKSEL to use the internal 1MHz RC oscillator as the system clock source, and then reconfigure CKSEL correctly according to the actual situation.


(11) When using an AVR chip that supports IAP, if you do not use the BOOTLOADER function, be careful not to set the fuse bit BOOTRST to the "state", which will cause the chip to execute the program not from 0x0000 of the Flash when it is powered on. The default state of the BOOTRST bit is " when the chip leaves the factory. For the configuration of BOOTRST, the design of the BOOTLOADER program and the application of IAP, please refer to the relevant content in this chapter.


(12) CKOPT: When CKOPT is not programmed, that is, unchecked, it is in the 0 state for a crystal oscillator; when checked, it is selected for a resonator; XTAL1 and XTAL2 are respectively used as the input and output of the reverse amplifier of the on-chip oscillator, as shown in Figure 12. This oscillator can use a quartz crystal or a ceramic resonator. The fuse bit CKOPT is used to select one of these two amplifier modes.


When CKOPT is programmed, the oscillator generates full amplitude oscillation at the output pin. This mode is suitable for noisy environments and when a second clock buffer needs to be driven through XTAL2. In addition, the frequency range of this mode is relatively wide. When CKOPT is kept unprogrammed, the output signal amplitude of the oscillator is relatively small. Its advantage is that the power consumption is greatly reduced, but the frequency range is relatively narrow and it cannot drive other clock buffers.


For resonators, the maximum frequency is 8MHz when CKOPT is not programmed and 16MHz when CKOPT is programmed. The values ​​of C1 and C2 should be the same regardless of whether a crystal or resonator is used. The best value depends on the crystal or resonator used, as well as on stray capacitance and environmental electromagnetic noise.

Reference address:How to correctly configure AVR fuse bits

Previous article:Design of I SP1362OTG based on AVR microcontroller
Next article:Design of a Home Voice Controller Based on AVR32

Recommended ReadingLatest update time:2024-11-16 11:53

MCU AVR C language binary decimal hexadecimal fast conversion
Binary data is a number represented by two digits, 0 and 1. Its base is 2, the carry rule is "add one whenever there are two", and the borrow rule is "borrow one as two", such as: 8-bit binary number: "00110101"; in C language, it is represented as 0b00110101; Decimal numbers are the counting method we use in daily
[Microcontroller]
MCU AVR C language binary decimal hexadecimal fast conversion
Design and EMC analysis of inverter power supply based on AVR microcontroller
Introduction: This paper introduces a design scheme for an inverter power system. The inverter power system uses a high-performance AVR microcontroller as the core control chip. The hardware circuits in the inverter power system are analyzed and designed. Combining the advantages of fuzzy adaptive control and digital
[Microcontroller]
Design and EMC analysis of inverter power supply based on AVR microcontroller
AVR MCU fuse settings
       The configuration of AVR fuse bits is a relatively delicate task, and users often overlook its importance or find it difficult to master. The following are some key points and related matters that need to be paid attention to when configuring the AVR fuse bits. (1) In the AVR device manual, the fuse bit is defi
[Microcontroller]
Transplantation of MCU 51 to AVR Program
Summarize the conversion from C51 to ICCAVR  1. Header file Replace the header files that define registers in C51, such as reg51.h and at89x51.h, with the corresponding AVR header files, such as io8515.h  and io2313.h. 2. Interrupt handling function In C51, the interrupt keyword is used to indicate that a function
[Microcontroller]
How to operate a single IO port in AVR
How to operate a single IO port in WinAVR Use PORTA|=(1 7) PORTA|=(1 7) means shift 00000001 left by 7 bits and then OR it with porta PORTB |= _BV(n) and PORTB &= ~_BV(n) After installing the 05 version that can use sbi(), sbi() and cbi() cannot be used. After looking at the information carefully, I found th
[Microcontroller]
AVR Programming_How to reset the AVR via software
Question How to reset an AVR via software? Answer If you want to reset the AVR via software, you should use the internal watchdog. Simply enable it and let it overflow. When the watchdog triggers, the program counter wraps back to 0, clearing all registers and other
[Microcontroller]
AVR microcontroller high-precision delay program assembly language can be used directly
The baud rate is 7.3728MHZ, the delay is 1ms, and the accuracy error is 10us ;******************************** delay_1ms:            ldi r27,41    delay_11:           ldi r28,35   delay_22:         nop         nop        dec r28       brne delay_22        dec r27      brne delay_11    ret ;***************************
[Microcontroller]
AVR microcontroller electronic clock C program
#include #include macros.h #define uchar unsigned char #define uint unsigned int #define setb(val,bitn) (val|=(1 (bitn)))//Set a bit of an IO port to 1 #define clr(val,bitn) (val&=~(1 (bitn)))//Set a bit of an IO port to 0 #define get(val,bitn) (val&(1 (bitn)))//Read a bit status uchar shi=20,fen=39,miao,a=0xff,num;
[Microcontroller]
Latest Microcontroller Articles
  • Download from the Internet--ARM Getting Started Notes
    A brief introduction: From today on, the ARM notebook of the rookie is open, and it can be regarded as a place to store these notes. Why publish it? Maybe you are interested in it. In fact, the reason for these notes is ...
  • Learn ARM development(22)
    Turning off and on interrupts Interrupts are an efficient dialogue mechanism, but sometimes you don't want to interrupt the program while it is running. For example, when you are printing something, the program suddenly interrupts and another ...
  • Learn ARM development(21)
    First, declare the task pointer, because it will be used later. Task pointer volatile TASK_TCB* volatile g_pCurrentTask = NULL;volatile TASK_TCB* vol ...
  • Learn ARM development(20)
    With the previous Tick interrupt, the basic task switching conditions are ready. However, this "easterly" is also difficult to understand. Only through continuous practice can we understand it. ...
  • Learn ARM development(19)
    After many days of hard work, I finally got the interrupt working. But in order to allow RTOS to use timer interrupts, what kind of interrupts can be implemented in S3C44B0? There are two methods in S3C44B0. ...
  • Learn ARM development(14)
  • Learn ARM development(15)
  • Learn ARM development(16)
  • Learn ARM development(17)
Change More Related Popular Components

EEWorld
subscription
account

EEWorld
service
account

Automotive
development
circle

About Us Customer Service Contact Information Datasheet Sitemap LatestNews


Room 1530, 15th Floor, Building B, No.18 Zhongguancun Street, Haidian District, Beijing, Postal Code: 100190 China Telephone: 008610 8235 0740

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京ICP证060456号 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号