AVR第10讲复位熔丝位设置
- 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
- 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
- 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。
通过JTAG 接口实现对Flash、EEPROM、熔丝位和锁定位的编程
熔丝位
1.选择时钟源CKSEL0-3和启动时间SUT0, SUT1
2.掉电检测BODLEVEL,BODEN
3.选择BOOT区大小BOOTRST,BOOTSZ0, BOOTSZ1
4.SPIEN=0,串行下载使能;JTAGEN=1,边界扫描功能禁用;OCDEN=1片上调试禁
用
5.EESAVE=1芯片擦出时EEPROM内容不保留
6.CKOPT=1振荡器由CKSEL0-3决定
如果不需要Boot Loader 功能,则整个Flash 都可以为应用代码所用。
Boot Loader 具有
两套可以独立设置的Boot 锁定位。
用户可以灵活地选择不同的代码保护方式。
用户可以选择:
• 保护整个Flash 区,不让MCU 进行软件升级
• 不允许MCU 升级 Boot Loader Flash 区
• 不允许MCU 升级应用Flash 区
• 允许MCU 升级整个Flash 区
ATmega16 有两个熔丝位字节。
Notes: 1. 在SPI 串行编程模式下SPIEN 熔丝位不可访问。
2. CKOPT 熔丝位功能由CKSEL 位设置决定,详见P23 “ 时钟源” 。
3. BOOTSZ1..0 默认值为最大Boot 大小,详见 P244Table 100。
4. 不论锁位与JTAGEN熔丝位设置为什么,产品出厂时不对OCDEN编程。
对OCDEN 熔丝位编程后会使能系统时钟的某些部分在所有的休眠模式下运行。
这会增加功耗。
5. 如果没有连接JTAG 接口,应尽可能取消JTAGEN 熔丝位的编程状态,以消除存在于JTAG 接口之TDO 引脚的静态电流。
熔丝位的状态不受芯片擦除命令的影响。
如果锁定位1(LB1) 被编程则熔丝位被锁定。
在编程锁定位前先编程熔丝位。
ATmega16 提供了6 个锁定位,根据其被编程(“0”) 还是没有被编程(“1”) 的情况可以获得Table 104 列出的附加性能。
锁定位只能通过芯片擦除命令擦写为“1”。
Transferring the Compiled Program to the AVR Chip after Make
This option is available if you select the After Make tab in the Project Configure window.
If you check the Program the Chip option, then after successful compilation/assembly your program will be automatically transferred to the AVR chip using the built-in Programmer software.
The following steps are executed automatically:
?Chip erasure
?FLASH and EEPROM blank check
?FLASH programming and verification
?EEPROM programming and verification
?Fuse and Lock Bits programming
The Merge data from a .ROM File for FLASH Programming option, if checked, will merge in the FLASH programming buffer the contents of the .ROM file,
created by the compiler after Make, with the data from the .ROM file specified in .ROM File Path.
This is useful, for example, when adding a boot loader executable compiled in another project, to an application program that will be programmed in the FLASH memory.
You can select the type of the chip you wish to program using the Chip combo box.
If the chip you have selected has Fuse Bit(s) that may be programmed, then a supplementary Program Fuse Bit(s) check box will appear.
If it is checked, than the chip抯 Fuse Bit(s) will be programmed after Make.
The Fuse Bit(s) can set various chip options, which are described in the Atmel data sheets.
If a Fuse Bit(s) check box is checked, then the corresponding fuse bit will be set to 0, the fuse being considered as programmed (as per the convention from the Atmel data sheets).
If a Fuse Bits(s) check box is not checked, then the corresponding fuse bit will be set to 1, the fuse being considered as not programmed.
If you wish to protect your program from copying, you must select the corresponding option using the FLASH Lock Bits radio box.
If you wish to check the chip's signature before programming you must use the Check Signature option.
To speed up the programming process you can uncheck the Check Erasure check box.
In this case there will be no verification of the correctness of the FLASH erasure.
The Preserve EEPROM checkbox allows preserving the contents of the EEPROM during chip erasure.
To speed up the programming process you can uncheck the Verify check box.
In this case there will be no verification of the correctness of the FLASH
and EEPROM programming.
Changes can be saved, respectively canceled, using the OK, respectively Cancel buttons.
Running an User Specified Program after Make
This option is available if you select the After Make tab in the Project Configure window.
If you check the Execute User抯 Program option, then a program, that you have previously specified, will be executed after the compilation/assembly process.
Using the Program Settings button you can modify the:
?Program Directory and File Name
?Program Command Line Parameters
?Program Working Directory
Changes can be saved, respectively canceled, using the OK, respectively Cancel buttons.。