当然,不只针对AVR,对于其他MCU,也可以使用同样的配置方式,实现熔丝位、锁定位,校准位等功能。现在各个MCU的命令接口基本统一, GUI界面可以很方便的解析处理。
xml里引入的setting结构,可以用于熔丝位、锁定位,甚至校准位,GUI界面中使用同样的方式解析。
主界面:
在Mode中设置编程接口,然后点击AutoDetect,芯片型号就自动出现了。
Fuse设置(按下Fuse按钮):
<warning>
<w mask="0x004000" value="0x004000" msg="WARNING! These fuse settings will disable the JTAG interface!" />
<w mask="0x002000" value="0x002000" msg="WARNING! These fuse settings will disable the ISP interface!" />
</warning>
<setting name="M103C" mask="0x020000" info="ATmega103 Compatibility Mode" checked="0" />
<setting name="WDTON" mask="0x010000" info="Watchdog Timer always on" checked="0" />
<setting name="OCDEN" mask="0x008000" info="On-Chip Debug Enabled" checked="0" />
<setting name="JTAGEN" mask="0x004000" info="JTAG Interface Enabled" checked="0" />
<setting name="SPIEN" mask="0x002000" ban="i" info="Serial program downloading (SPI) enabled" checked="0" />
<setting name="EESAVE" mask="0x000800" info="Preserve EEPROM memory through the Chip Erase cycle" checked="0" />
<setting name="BOOTSZ" mask="0x000600" info="Select Boot Size">
<choice value="0x000600" text="Boot Flash size="512" words start address=$FE00" />
<choice value="0x000400" text="Boot Flash size="1024" words start address=$FC00" />
<choice value="0x000200" text="Boot Flash size="2048" words start address=$F800" />
<choice value="0x000000" text="Boot Flash size="4096" words start address=$F000" />
</setting>
<setting name="EXTENDED" mask="0xFF0000" info="EXTENDED" radix="16" shift="16" bytelen="1" />
<setting name="HIGH" mask="0x00FF00" info="HIGH" radix="16" shift="8" bytelen="1" />
<setting name="LOW" mask="0x0000FF" info="LOW" radix="16" shift="0" bytelen="1" />
其中,warning用于配置警告信息,对于Mega128,当芯片的ISP或者JTAG被关闭的时候,需要警告一下。setting中的ban属性用于禁用,比如ban="i",表示ISP模式下,ISP使能熔丝位无法编程(只读)。
Lock设置:
<lock init="0xFF" bytesize="1">
<setting name="LB" mask="0x03" info="Memory Lock">
<choice value="0x00" text="Further programming and verification disabled" />
<choice value="0x02" text="Further programming disabled" />
<choice value="0x03" text="No memory lock features enabled" />
</setting>
<setting name="BLB0" mask="0x0C" info="Application Protection Mode">
<choice value="0x00" text="LPM and SPM prohibited in Application Section" />
<choice value="0x04" text="LPM prohibited in Application Section" />
<choice value="0x08" text="SPM prohibited in Application Section" />
<choice value="0x0C" text="No lock on SPM and LPM in Application Section" />
</setting>
<setting name="BLB1" mask="0x30" info="Boot Loader Protection Mode">
<choice value="0x00" text="LPM and SPM prohibited in Boot Loader Section" />
<choice value="0x10" text="LPM prohibited in Boot Loader Section" />
<choice value="0x20" text="SPM prohibited in Boot Loader Section" />
<choice value="0x30" text="No lock on SPM and LPM in Boot Loader Section" />
</setting>
<setting name="LOCKBIT" mask="0xFF" info="LOCKBIT" radix="16" shift="0" bytelen="1" />
</lock>
Cali设置:
<calibration init="0xFFFFFFFF" bytesize="4">
<setting name="1.0 MHz" mask="0x000000FF" info="OSCCAL at 1.0 MHz" ban="*" radix="16" shift="0" />
<setting name="2.0 MHz" mask="0x0000FF00" info="OSCCAL at 2.0 MHz" ban="*" radix="16" shift="8" />
<setting name="4.0 MHz" mask="0x00FF0000" info="OSCCAL at 4.0 MHz" ban="*" radix="16" shift="16" />
<setting name="8.0 MHz" mask="0xFF000000" info="OSCCAL at 8.0 MHz" ban="*" radix="16" shift="24" />
</calibration>
这里,ban="*"表示,所有模式下,设置都是只读的。radix表述进制,shift表示偏移。
应该已经发现了吧,这3个界面其实是同一个界面,根据xml中的不同设置,自动变换界面的元素,自动设置数据的使能,自动为某些误操作提供警告。目前,算法和数据的分离应该说,已经做的相当好了(自我感觉)。
文章评论(0条评论)
登录后参与讨论