progisp1.72 下载地址:
http://web2110575.bgpphp564.badudns.cc/channel.asp?id=21
板子照片:
usbasp照片
10pin转6pin转接板照片
1. 插入usbasp到电脑中
查看设备管理器:
指定驱动搜寻目录为:progisp172\windows7_driver\1.12.0.1
始终安装此驱动
然后,查看 设备管理器:
2.然后启动软件 :progisp1.72
界面如下:
首先选择 芯片 :ATmega32U4
然后按下按钮 RD
在下面会显示读出ID成功
3. 查看熔丝位
不要改动
4.烧写Hex
32U4_Breakout_Board-master
代码为:
https://github.com/sparkfun/32U4_Breakout_Board/tree/master/Examples/32U4_digital_output
将该代码下载来,然后win7下安装WinAVR-20100110-install.exe,
cmd DOS 窗口 ,进入该目录,输入make,会生成main.hex。
按照下图的顺序:
1, 调入Flash main.hex文件
2,取消编程熔丝
3,点击自动
成功之后,会看到 arduino leonardu 板子的 TX 对应的LED灯 闪烁。
结合程序看一下:
/* Created 05/20/2012 by Jordan McConnell at Sparkfun Electronics
* This code is beerware, you know what I'm sayin'?
*
* Built on WinXP SP3 and WinAVR-20100110, AVRDUDE 5.10
*
* This code is a simple example of digital output for Sparkfun's
* 32U4 Breakout Board using C and standard AVR libraries. It
* teaches you how to set a pin high or low or toggle it from one
* state to the other using pin PD5 as an example.
*
* The user can use a multimeter or LED on pin PD5 to verify that
* the pin is indeed changing state between HIGH and LOW each second.
*/
// Libraries for register names (DDRD, PORTD) and the delay function
#include <avr/io.h>
#include <util/delay.h>
// Macros to make bit manipulation easier
// Macro tutorial found here: http://www.cprogramming.com/tutorial/cpreprocessor.html
// Bit manipulation tutorial found here: http://www.avrfreaks.net/index.php?name=PNphpBB2&file=viewtopic&t=37871
#define set_bit(address,bit) (address |= (1<<bit)) // sets BIT to 1 in the register specified with ADDRESS
#define clear_bit(address,bit) (address &= ~(1<<bit)) // sets BIT to 0 in the register specified with ADDRESS
#define toggle_bit(address,bit) (address ^= (1<<bit)) // sets BIT to the opposite of what it's set to currently in the register specified with ADDRESS
int main(void)
{
// The following line sets bit 5 high in register DDRD
set_bit(DDRD,5); // Pin PD5 is now configured as an OUTPUT
set_bit(PORTD,5); // Pin PD5 is now HIGH
_delay_ms(1000); // Delay for 1 second
// The following line sets bit 5 low in register PORTD
clear_bit(PORTD,5); // Pin PD5 is now LOW
while(1)
{
_delay_ms(1000);
toggle_bit(PORTD,5); // PD5 switches from LOW to HIGH or vice versa
}
return 0;
}
结合 arduino leonardo的原理图看一下:
arduino-leonardo-schematic_3b.pdf
现在的问题是,代码是烧写到Bootloader的位置了,还是APP的位置了
经过验证是烧写到Bootloader的位置了
参考网页:
使用UsbAsp给UNO烧写bootloader ATMEGA16U2、ATMEGA328P固件烧写教程
http://www.yfrobot.com/thread-2218-1-1.html
atmega32u4制作leonardo最小系统
https://www.cnblogs.com/xiaowuyi/p/4942306.html
参考:
使用arduino拯救你的arduino开发板(含arduino拯救16u2/8u2的usbserial)
使用arduino拯救你的arduino开发板(含arduino拯救16u2/8u2的usbserial)
https://blog.csdn.net/menglongfc/article/details/78853961
五,使用arduino as isp烧写16u2(8u2同)的usbserial固件:
1,重新将D10,11,12,13的线链接到16u2的ICSP口上(D10接RESET,D11接MOSI,D12接MISO,D13接SCK,vcc接5v,GND接GND);
2,编写一份cmd脚本,内容如下:
C:\Progra~2\Arduino\hardware\tools\avr/bin/avrdude -CC:\Progra~2\Arduino\hardware\tools\avr/etc/avrdude.conf -v -patmega328p -cstk500v1 -PCOM4
-b19200 -e -Ulock:w:0x0F:m -Uefuse:w:0xF4:m -Uhfuse:w:0xD9:m -Ulfuse:w:0xFF:m
C:\Progra~2\Arduino\hardware\tools\avr/bin/avrdude -CC:\Progra~2\Arduino\hardware\tools\avr/etc/avrdude.conf -v -patmega328p -cstk500v1 -PCOM4
-b19200 -Uflash:w:C:\Progra~2\Arduino\hardware\arduino\avr/firmwares/atmegaxxu2/Arduino-COMBINED-dfu-usbserial-atmega16u2-Uno-Rev3.hex:i -Ulock:w:0x0F:m@echo offecho 按下任意键退出…pause>null
3,将该代码保存成.cmd格式,设置权限运行;
4,出现如下图所示信息则证明刷写成功
注意:批处理中,“C:\Progra~2\Arduino\”为你arduinoIDE的安装路径,请自行完全替换,“-PCOM4”,替换为你pc端口识别的com口序号,“Ulock:w:0x0F:m -Uefuse:w:0xF4:m -Uhfuse:w:0xD9:m -Ulfuse:w:0xFF:m”这些为16u2/8u2熔丝位,不必更改。
至此,16u2的usbserial烧写完毕。
猜测 是烧写到 bootloader 还是 烧写 到 app区域和 熔丝位有关