前言

关于Arduino as ISP,之前弄过几次,但是每次开搞前都要重新温习一遍官方英文文档,略显麻烦,现在自己全部重新解析一下,记录下来后效率明显提升:一是变成中文方便阅读,二是把重要细节全部暴露出来,比原版文档更加丰富。所以有这一篇就够了,欢迎收藏和转载,也欢迎提出补充修正建议。

1、要让一块芯片成为“Arduino”,需要有一个“Arduino Bootloader”的基因;

2、给Arduino进行ISP烧录,使用的是SPI接口,而每种板子的SPI引脚并不相同,所以有了下图:最经典的当然还是11、12、13啦。

3、ICSP的引脚图如下:注意比照就行,不要用万用表去测出正负极。因为我就这样先入为主了一次,看到5V就以为找到了VCC和GND,误导自己半天。

4、nano icsp引脚需要特别说明一下,我是吃过亏栽过跟头的。我一直以为1号引脚是第二行左边第一脚,有三角形指示的那个,结果却不是………………最终发现是右上角那个,居然还写了一个“1”,焊了排针之后哪里看得到,尤其是第一次买nano的人。

看看这张我还没有焊接的粉色版,原来如此清晰,可细节总是让人容易忽视。

5、这些SPI引脚和ICSP上面的是直通的,但不能直接偷懒直接连接两块板子的ICSP接口来进行编程,因为reset引脚不是那样工作的。

6、The 10µF electrolytic capacitor connected to RESET and GND of the programming board is needed only for the boards that have an interface between the microcontroller and the computer's USB, like Mega, UNO, Mini, Nano. Boards like Leonardo, Esplora and Micro, with the USB directly managed by the microcontroller, don't need the capacitor.板子和计算机之间有一个专门处理USB的芯片的,需要加10µF电容,比如Mega, UNO, Mini, Nano;那种微控制器直接管理USB的,不需要加,比如Leonardo, Esplora and Micro。这也就是说,我们一般人使用的常见的应该都是要加,尤其是我们本土大把的ch340改进版。

7、3.3V和5V的设备如何兼容?将3.3V插到5V的插孔里,反过来就不要想了。我查了电路图,左边的3.3V设备的红色线是3.3V。

8、在Arduino ISP的源代码里也有很多有用的知识

// ArduinoISP
// Copyright (c) 2008-2011 Randall Bohn
// If you require a license, see
// https://opensource.org/licenses/bsd-license.php
//
// This sketch turns the Arduino into a AVRISP using the following Arduino pins:
//
// Pin 10 is used to reset the target microcontroller.
//
// By default, the hardware SPI pins MISO, MOSI and SCK are used to communicate
// with the target. On all Arduinos, these pins can be found
// on the ICSP/SPI header:
//
//               MISO °. . 5V (!) Avoid this pin on Due, Zero...
//               SCK   . . MOSI
//                     . . GND
//
// On some Arduinos (Uno,...), pins MOSI, MISO and SCK are the same pins as
// digital pin 11, 12 and 13, respectively. That is why many tutorials instruct
// you to hook up the target to these pins. If you find this wiring more
// practical, have a define USE_OLD_STYLE_WIRING. This will work even when not
// using an Uno. (On an Uno this is not needed).
//
// Alternatively you can use any other digital pin by configuring
// software ('BitBanged') SPI and having appropriate defines for PIN_MOSI,
// PIN_MISO and PIN_SCK.
//
// IMPORTANT: When using an Arduino that is not 5V tolerant (Due, Zero, ...) as
// the programmer, make sure to not expose any of the programmer's pins to 5V.
// A simple way to accomplish this is to power the complete system (programmer
// and target) at 3V3.
//
// Put an LED (with resistor) on the following pins:
// 9: Heartbeat   - shows the programmer is running
// 8: Error       - Lights up if something goes wrong (use red if that makes sense)
// 7: Programming - In communication with the target

源代码还实现了3个LED的功能,但是可能用的人很少。

#define LED_HB 9

#define LED_ERR 8

#define LED_PMODE 7

待我焊一块原型版,来把它永远固化下来,我不想反反复复学了又忘,忘了又学,永无止境,没完没了…...(二〇二三年二月二十一日)搞定,有了这块下载器扩展板,妈妈再也不担心我搞错引脚了,烧写效率拉到满。绿色LED就是心跳呼吸灯。

  1. 然后要在“工具”菜单选择“开发板”类型为目标板,目标板,目标板。

  2. 继续选择“工具”菜单中的“编程器”为“Arduino as ISP”,一个字都不要错。

  3. 最后一步,还是“工具”菜单,“烧录引导程序(Burn BootLoader)”!

  4. 另外,也可以靠这个硬件连接直接用Arduino给目标板编写代码、编译并烧录到目标板:选择“项目(sketch)”——“使用编程器上传”,这个相貌平平的IDE其实功能非常强大。

  5. 但是这里又有一个坑,如果使用“编程器上传”功能的话,那么它会覆盖掉里面的BootLoader……我好几次搞好之后,立刻测试了一下软件功能,结果又凉凉,一直迷惑,直到后来确认了这条知识……

  6. 底层一点的东西:熔丝位

NANO UNO
UNLOCK 3F 3F
LOCK 0F 0F
E FD FD
H DA DE
L FF FF
ID

1E950F(328)

1E9406(168)

9、烧录NANO的命令行

  • (328p oldBootLoader:ATmegaBOOT_168_atmega328.hex)C:\Users\Administrator\AppData\Local\Arduino15\packages\arduino\tools\avrdude\6.3.0-arduino17/bin/avrdude -CC:\Users\Administrator\AppData\Local\Arduino15\packages\arduino\tools\avrdude\6.3.0-arduino17/etc/avrdude.conf -v -patmega328p -cstk500v1 -PCOM8 -b19200 -Uflash:w:C:\Users\Administrator\AppData\Local\Arduino15\packages\arduino\hardware\avr\1.8.6/bootloaders/atmega/ATmegaBOOT_168_atmega328.hex:i -Ulock:w:0x0F:m

  • (328p newBootloaer:optiboot_atmega328.hex)C:\Users\Administrator\AppData\Local\Arduino15\packages\arduino\tools\avrdude\6.3.0-arduino17/etc/avrdude.conf -v -patmega328p -cstk500v1 -PCOM8 -b19200 -Uflash:w:C:\Users\Administrator\AppData\Local\Arduino15\packages\arduino\hardware\avr\1.8.6/bootloaders/optiboot/optiboot_atmega328.hex:i -Ulock:w:0x0F:m

10、最终,最终,我还是把蓝板Nano救活了,所有的过程都经历了一遍……甚至包括这里

https://support.arduino.cc/hc/en-us/articles/4401874331410--Error-avrdude-when-uploading#avrdude-stk500_recv-and-stk500_getsynchttps://support.arduino.cc/hc/en-us/articles/4401874331410--Error-avrdude-when-uploading#avrdude-stk500_recv-and-stk500_getsync一条一条地看过了。

11、最后记录一个东西:我买的Nano不是用Oldbootloader,不是用Oldbootloader,不是用Oldbootloader。哪怕卖家这么说,宝贝详情里这么写,我的用的是新的BootLoader!

12、对于168和328的区分,其实在烧录的时候是有提示的。

avrdude: Device signature = 0x1e9406 (probably m168)
avrdude: reading input file "F:\Temp\arduino-sketch-9F68FE81888A761378D9D0B4950016EC/Blink.ino.hex"
avrdude: writing flash (922 bytes):

13、原版总结:

Recap: burn the Bootloader in 8 steps

Open the ArduinoISP firmware (in Examples) to your Arduino board.

Note for Arduino 1.0: you need to make one small change to the ArduinoISP code. Find the line in the heartbeat() function that says "delay(40);" and change it to "delay(20);".

Select the items in the Tools > Board and Serial Port menus that correspond to the board you are using as the programmer (not the board being programmed).

Upload the ArduinoISP sketch.

Wire your Arduino boards..

Select the item in the Tools > Board menu that corresponds to the board on which you want to burn the bootloader (not the board that you're using as the programmer). See the board descriptions on the environment page for details.

Select the Arduino as ISP in the Tools>Programmer menu.

Use the Burn Bootloader command.

Arduino as ISP 下载器烧录BootLoader的细节详解相关推荐

  1. 使Arduino支持ATMEGA 168P(烧录BOOTLOADER)

    最近在做一个小玩意,因为第一个DEMO是在Arduino Pro Mini上完成的,使用各种模块用漆包线连接搭起来的,决定还是继续在使用Arduino框架的基础上制作完整的PCB板. 在选购单片机芯片 ...

  2. 基于atmega8的arduino最小系统制作(arduino uno作为下载器)

    我们在最小系统的制作过程中,常常会遇到下载器驱动安装不成功的问题,绝大多数原因是因为下载器驱动不兼容win10系统.而当用arduino uno作为下载器为最小系统烧录程序的话,不但解决了win10下 ...

  3. 【摘要】STC系列单片机ISP编程器/烧录器的说明

    [摘要]STC系列单片机ISP编程器/烧录器的说明 STC-ISP编程工具 STC-ISP下载编程烧录软件目前版本:STC-ISP软件V6.88K版 在系统可编程(ISP)原理使用说明流程图 STC系 ...

  4. ATmega8a单片机ISP下载器

    最近有个项目,自己做了一个雷达信号采集板,里面用到了ATmega8a单片机,检测完板子上电正确之后就开始用ISP扫单片机了,结果各种连不上,元旦假期就这么泡汤了,PCB,原理图各种检查,还去淘宝又买I ...

  5. python装饰器函数-Python函数装饰器常见使用方法实例详解

    本文实例讲述了Python函数装饰器常见使用方法.分享给大家供大家参考,具体如下: 一.装饰器 首先,我们要了解到什么是开放封闭式原则? 软件一旦上线后,对修改源代码是封闭的,对功能的扩张是开放的,所 ...

  6. java spring mvc 上传_Java Spring MVC 上传下载文件配置及controller方法详解

    下载: 1.在spring-mvc中配置(用于100M以下的文件下载) 下载文件代码 @RequestMapping("/file/{name.rp}") public Respo ...

  7. 只需五步学会Maven 3.6.1OR 3.6.3及其他版本的下载安装与配置【图文详解】

    第一步,下载并解压缩包 ​第二步,配置两个环境变量 ​第三步,测试是否安装成功 ​第四步,指定本地仓库的路径 第五步,修改镜像仓库 第一步,下载并解压缩包 Maven官方下载地址:https://ma ...

  8. python 生成器装饰器_对Python生成器、装饰器、递归的使用详解

    1.Python生成器表达式 1).Python生成器表达式 语法格式: (expr for iter_var in iterable) (expr for iter_var in iterable ...

  9. python装饰器详解-Python装饰器基础概念与用法详解

    本文实例讲述了Python装饰器基础概念与用法.分享给大家供大家参考,具体如下: 装饰器基础 前面快速介绍了装饰器的语法,在这里,我们将深入装饰器内部工作机制,更详细更系统地介绍装饰器的内容,并学习自 ...

最新文章

  1. pyspark 学习 Tips
  2. Windows Server 2012 Hyper-V 与2008R2 Hyper-v、VMware的对比
  3. 6、HIVE JDBC开发、UDF、体系结构、Thrift服务器、Driver、元数据库Metastore、数据库连接模式、单/多用户模式、远程服务模式、Hive技术原理解析、优化等(整理的笔记)
  4. [你必须知道的.NET]第二十六回:认识元数据和IL(下)
  5. BugkuCTF-Crypto题Crack it
  6. php网页302错误,swfupload提示“错误302”的解决方法
  7. 软考信息系统项目管理师_项目整体管理---软考高级之信息系统项目管理师010
  8. PHP几种常见魔术方法与魔术变量解析 1
  9. AudioEffect构造流程跟踪 音效库实现(native侧)
  10. 前端上传文件后端到服务器,前端js上传文件 到后端接收文件
  11. JAVA数组首位末位互换_堆和堆傻傻分不清?一文告诉你 Java 集合中「堆」的最佳打开方式...
  12. 【网络】https单向认证和双向认证
  13. SSH登录的两种方式
  14. 第十四章第四节:Java集合框架之二叉树
  15. 曾成功预测H1N1病毒疫情,细数这些年大数据的神应用
  16. peda的帮助文档(自己翻译)
  17. BIGEMAP离线数据包网盘下载地址:中国高清地图数据,中国高清谷歌数据 密码:1111
  18. 树莓派 python 笔记
  19. 如何在 Windows 中 CMD 窗口内使用 ls 命令
  20. sizeof,length和size()的区别

热门文章

  1. matlab模块连接,模块 - MATLAB Simulink - MathWorks 中国
  2. 「建模学习」ZBrush实例教程, LOL丽桑卓建模雕刻,你学会了吗
  3. rabbitmq 发送消息格式注意
  4. javafx 实现Menu的点击事件
  5. 搭建Solr搜索引擎——Linux 爱旅行
  6. 试水自动化——磨刀霍霍向Appium
  7. performClick 默认点击
  8. echarts的边框图片之切图(重要)
  9. Js实现数字动态滚动效果
  10. 数据库系统概念 Relational Model