網頁

2017年12月12日 星期二

使用 Arduino Pro Micro 當成 Arduino ISP 燒錄程式到 Atmega328P-PU

Arduino 1.8.5

File/Preferences/Additional Boards Manager URLs
https://raw.githubusercontent.com/sparkfun/Arduino_Boards/master/IDE_Board_Manager/package_sparkfun_index.json
Tools/Board/Boards Manager
安裝 SparkFun AVR Boards

修改 File/Examples/11.ArduinoISP/ArduinoISP
重新定義下列程式碼
#define RESET     10 // Use pin 10 to reset the target rather than SS
#define LED_HB    9
#define LED_ERR   8
#define LED_PMODE 7
#define PIN_SCK   15
#define PIN_MOSI  16
#define PIN_MISO  14
Tools/Board/SparkFun Pro Micro
Tools/Processor/Atmega32U4(5V,16MHz)
Tools/Port/(選正確 Com)
Sketch/Upload

主要接線
ProMicro  ->  Atmega328P-PU
VCC  ->  7(VCC)
GND  ->  8(GND)
VCC  ->  20(AVCC)
15(SCK)  ->  19(SCK)
14(MISO)  ->  18(MISO)
16(MOSI)  ->  17(MOSI)
10  ->  1(RESET)
File/Preferences/Additional Boards Manager URLs
https://github.com/Optiboot/optiboot/releases/download/v6.2/package_optiboot_optiboot-additional_index.json
Tools/Board/Boards Manager
安裝 Optiboot 6.2
若找不到, 並且有錯誤訊息
Error downloading https://github.com/Optiboot/optiboot/releases/download/v6.2/package_optiboot_optiboot-additional_index.json
下載並置於
C:\Arduino\arduino-1.8.5-windows\arduino-1.8.5\hardware/package_optiboot_optiboot-additional_index.json
更改 File/Preferences/Additional Boards Manager URLs 為
file://C:\Arduino\arduino-1.8.5-windows\arduino-1.8.5\hardware/package_optiboot_optiboot-additional_index.json

修改 C:\Arduino\arduino-1.8.5-windows\arduino-1.8.5\hardware\arduino\avr\programmers.txt
增加
arduinopromicro.name=Arduino as ISP(Pro Micro)
arduinopromicro.communication=serial
arduinopromicro.protocol=arduino
arduinopromicro.speed=19200
arduinopromicro.program.protocol=stk500v1
arduinopromicro.program.speed=19200
arduinopromicro.program.tool=avrdude
arduinopromicro.program.extra_params=-P{serial.port} -b{program.speed}

Tools/Programmer/Arduino as ISP(Pro Micro)
Tools/Processor/Atmega328p
Tools/Board/Optiboot on 28-pin cpus
Tools/CPU Speed/8MHz (int) (不使用外部震盪晶體)
Tools/Burn Bootloader (好像可以不用,但是時脈會錯誤)
燒錄程式需使用 Sketch/Upload Using Programmer, 不能使用 Upload

沒有留言:

張貼留言