Toggle navigation
首页
问答
文章
积分商城
专家
专区
更多专区...
文档中心
返回主站
搜索
提问
会员
中心
登录
注册
Bootloader
Linux下通过USBTinyISP为Arduino开发板烧?写Bootloader
发布于 2011-10-20 18:37:23 浏览:4192
订阅该版
[tocm] 系统环境:Ubuntu10.10 板子型号:Arduino2009 烧录工具:USBTinyISP Arduino是什么?一款很火的用来搭建电子积木的开发板,既然叫积木,所以入手很简单,更多介绍去搜索。 USBTinyISP是一个方便使用的高速的AVR编程器,是Arduino官方支持的一款固件烧录器(还有常用的如USBAsp烧录器)。 对于Linux和Mac系统,USBTinyISP是可以直接使用的,不需要安装驱动(Windows下是需要安装驱动的,链接参见后面,主要用于连接参考) 1. 通过USB转串口线将USBTinyISP连接到PC。(注意:USBTinyISP不是一个USB-Serial设备,它有自己的Avrdude支持的USB协议,所以当你插入到PC时将看不到一个COM端口或者ttyUSB串口建立。) 2. 注意检查跳线“PWR”应该短接,短接后就不需要再为后面的Arduino开发板单独供电了。  3. 将USBTinyISP上那根6针的ISP连接线与Arduino开发板的6针ICSP相连(注意不要插反了!!)  我是参照上图中插入的,但好像是反了,一直提示“avrdude: initialization failed, rc=-1”之类的错误,害得折腾半天也没找到原因,后来折腾过程中"插错"了一回竟然可以了,所以对于网络上的文档不可尽信才是(当然也并非是文档错了,而是要与USBTinyISP上一端的插法保持一致才行),反正遇到问题时都试一下就对了。 4. 关于Arduino开发板的Bootloader都在它的开发包里面,现在最新的好像是arduino-0022,所以需要先下载这个包。(对于 ubuntu也可以直接通过apt安装arduino软件包,版本好像是0018,但不知道是否包含了Bootloader文件,我没去找过);还有一点需要注意的就是Arduino有很多版本,一定要清楚自己板子的型号然后找到正确的Bootloader文件。可以在 arduino-0022/hardware/arduino/boards.txt 里找到对应板子的型号,如Arduino2009的板子对应是boards.txt 中关于 Arduino Diecimila, Duemilanove, or Nano w/ ATmega168 的部分: ```############################################################## diecimila.name=Arduino Diecimila, Duemilanove, or Nano w/ ATmega168 diecimila.upload.protocol=stk500 diecimila.upload.maximum_size=14336 diecimila.upload.speed=19200 diecimila.bootloader.low_fuses=0xff diecimila.bootloader.high_fuses=0xdd diecimila.bootloader.extended_fuses=0x00 diecimila.bootloader.path=atmega diecimila.bootloader.file=ATmegaBOOT_168_diecimila.hex diecimila.bootloader.unlock_bits=0x3F diecimila.bootloader.lock_bits=0x0F diecimila.build.mcu=atmega168 diecimila.build.f_cpu=16000000L diecimila.build.core=arduino ##############################################################``` 上面的那些参数在后面的烧写命令中都会用到,通过上面文件可以得知需要使用的Bootloader文件是ATmegaBOOT_168_diecimila.hex 5. 开始烧写操作: 详细的操作指令如下,大部分参数都已经在上面boards.txt所对应的段落里写明了,但需要注意一下“-c usbtiny”参数,因为这里使用的是USBTinyISP烧录器;而如果使用的是USBAsp烧录器,则需要改成“-c usbasp”了;对于其它的烧录器,可以在“-c”后面随便给串字符执行,然后会报错并给出所有支持设备列表的。(可以先不加最后的那个“-F”参数执行试试,如果不成功再加上,该参数理论是不需要的,但我这边必须得加) 就两条命令(注意需要ROOT权限执行),第一条先unlock 芯片并修改 fuse bit,fuse bit 的值: ```zwang@wzc-laptop:~/source/arduino-0022/hardware/arduino/bootloaders/atmega$ sudo avrdude -p m168 -c usbtiny -e -u -U lock:w:0x3f:m -U efuse:w:0x00:m -U hfuse:w:0xDD:m -U lfuse:w:0xFF:m -F avrdude: AVR device initialized and ready to accept instructions Reading | ################################################## | 100% 0.01s avrdude: Device signature = 0x1e940b avrdude: Expected signature for ATMEGA168 is 1E 94 06 avrdude: erasing chip avrdude: reading input file "0x3f" avrdude: writing lock (1 bytes): Writing | ################################################## | 100% 0.00s avrdude: 1 bytes of lock written avrdude: verifying lock memory against 0x3f: avrdude: load data lock data from input file 0x3f: avrdude: input file 0x3f contains 1 bytes avrdude: reading on-chip lock data: Reading | ################################################## | 100% 0.00s avrdude: verifying ... avrdude: 1 bytes of lock verified avrdude: reading input file "0x00" avrdude: writing efuse (1 bytes): Writing | ################################################## | 100% 0.00s avrdude: 1 bytes of efuse written avrdude: verifying efuse memory against 0x00: avrdude: load data efuse data from input file 0x00: avrdude: input file 0x00 contains 1 bytes avrdude: reading on-chip efuse data: Reading | ################################################## | 100% 0.00s avrdude: verifying ... avrdude: 1 bytes of efuse verified avrdude: reading input file "0xDD" avrdude: writing hfuse (1 bytes): Writing | ################################################## | 100% 0.00s avrdude: 1 bytes of hfuse written avrdude: verifying hfuse memory against 0xDD: avrdude: load data hfuse data from input file 0xDD: avrdude: input file 0xDD contains 1 bytes avrdude: reading on-chip hfuse data: Reading | ################################################## | 100% 0.00s avrdude: verifying ... avrdude: 1 bytes of hfuse verified avrdude: reading input file "0xFF" avrdude: writing lfuse (1 bytes): Writing | ################################################## | 100% 0.00s avrdude: 1 bytes of lfuse written avrdude: verifying lfuse memory against 0xFF: avrdude: load data lfuse data from input file 0xFF: avrdude: input file 0xFF contains 1 bytes avrdude: reading on-chip lfuse data: Reading | ################################################## | 100% 0.00s avrdude: verifying ... avrdude: 1 bytes of lfuse verified avrdude done. Thank you.``` 第二条写入Bootloader文件并lock AVR: ```zwang@wzc-laptop:~/source/arduino-0022/hardware/arduino/bootloaders/atmega$ sudo avrdude -p m168 -c usbtiny -U flash:w:ATmegaBOOT_168_diecimila.hex -U lock:w:0x0f:m -F avrdude: AVR device initialized and ready to accept instructions Reading | ################################################## | 100% 0.01s avrdude: Device signature = 0x1e940b avrdude: Expected signature for ATMEGA168 is 1E 94 06 avrdude: NOTE: FLASH memory has been specified, an erase cycle will be performed To disable this feature, specify the -D option. avrdude: erasing chip avrdude: reading input file "ATmegaBOOT_168_diecimila.hex" avrdude: input file ATmegaBOOT_168_diecimila.hex auto detected as Intel Hex avrdude: writing flash (16294 bytes): Writing | ################################################## | 100% 9.55s avrdude: 16294 bytes of flash written avrdude: verifying flash memory against ATmegaBOOT_168_diecimila.hex: avrdude: load data flash data from input file ATmegaBOOT_168_diecimila.hex: avrdude: input file ATmegaBOOT_168_diecimila.hex auto detected as Intel Hex avrdude: input file ATmegaBOOT_168_diecimila.hex contains 16294 bytes avrdude: reading on-chip flash data: Reading | ################################################## | 100% 8.53s avrdude: verifying ... avrdude: 16294 bytes of flash verified avrdude: reading input file "0x0f" avrdude: writing lock (1 bytes): Writing | ################################################## | 100% 0.02s avrdude: 1 bytes of lock written avrdude: verifying lock memory against 0x0f: avrdude: load data lock data from input file 0x0f: avrdude: input file 0x0f contains 1 bytes avrdude: reading on-chip lock data: Reading | ################################################## | 100% 0.00s avrdude: verifying ... avrdude: 1 bytes of lock verified avrdude: safemode: Fuses OK avrdude done. Thank you.``` 参考链接: [1] Arduino bootloader:[url]http://www.atommann.com/learn/arduino/arduino-bootloader.html[/url] [2] Arduino 官方支持下载线 USBtinyISP 使用手册:[url]http://blog.flamingoeda.com/2009/05/01/arduino-%E5%AE%98%E6%96%B9%E6%94%AF%E6%8C%81%E4%B8%8B%E8%BD%BD%E7%BA%BF-usbtinyisp-%E4%BD%BF%E7%94%A8%E6%89%8B%E5%86%8C/[/url]
查看更多
1
个回答
默认排序
按发布时间排序
撰写答案
登录
注册新账号
关注者
0
被浏览
4.2k
关于作者
wzc0066
这家伙很懒,什么也没写!
提问
14
回答
16
被采纳
0
关注TA
发私信
相关问题
1
请教修改NVIC后RTT调度函数失效的问题[已解决 bootloader中打开了不必要的中断]
2
进入bootloader的方式探讨
3
求助:IAP里的APP使用的RTT,跳转后出错。[已解决]
4
有没有人在STM32F103上用UART IAP跑过RT-Thread?
5
想做网口的IAP远程升级,不知可不可行
6
IAP问题
7
[已解决]请教基于RTT的IAP程序切换到应用程序不成功的问题(基于STM32F4)?
8
stm32f4xx-----IAP移植APP程序需要注意的地方
9
在调试IAP网络升级遇到跳转之后bootloader程序网络不通
10
stm32f103+dm9000的IAP操作
推荐文章
1
RT-Thread应用项目汇总
2
玩转RT-Thread系列教程
3
五分钟玩转RT-Thread新社区
4
机器人操作系统 (ROS2) 和 RT-Thread 通信
5
【技术三千问】之《玩转ART-Pi》,看这篇就够了!干货汇总
6
国产MCU移植系列教程汇总,欢迎查看!
7
关于STM32H7开发板上使用SDIO接口驱动SD卡挂载文件系统的问题总结
8
STM32的“GPU”——DMA2D实例详解
9
RT-Thread隐藏的宝藏之completion
10
【ART-PI】RT-Thread 开启RTC 与 Alarm组件
最新文章
1
RS485驱动包的使用
2
当做一件事,坚持到第二十年 ——Open-SkyEye强势回归!
3
stm32f407zgt6新建工程
4
【github】rt-thread BSP 目录所有支持开发板整理展示
5
使用 D1s (RDC2022 纪念版) 连接 thingspeak
热门标签
RT-Thread Studio
串口
LWIP
SPI
Env
AT
FinSH
ART-Pi
Bootloader
CAN总线
Hardfault
文件系统
USB
DMA
RT-Thread
线程
stm32
RT-Thread Nano
SCons
MQTT
ESP8266
ota
packages_软件包
UART
rtthread
RTC
freemodbus
I2C
flash
cubemx
W5500
rt-smart
定时器
FAL
PWM
ADC
BSP
SDIO
msh
AB32VG1
Debug
C++_cpp
socket
SFUD
中断
编译报错
MicroPython
keil
LVGL
dfs
本月问答贡献
出出啊
1424
个答案
315
次被采纳
小小李sunny
1327
个答案
262
次被采纳
crystal266
490
个答案
144
次被采纳
whj467467222
1210
个答案
141
次被采纳
张世争
581
个答案
131
次被采纳
本月文章贡献
出出啊
4
篇文章
4
次点赞
小小李sunny
1
篇文章
1
次点赞
crystal266
1
篇文章
1
次点赞
whj467467222
2
篇文章
2
次点赞
张世争
1
篇文章
1
次点赞
回到
顶部
发布
问题
分享
好友
手机
浏览
扫码手机浏览
投诉
建议
回到
底部