我想通过 Arduino Mega2560 对 Atmega328 进行编程。我的连接如下所示:
Arduino Mega2560 Atmega328
50 MISO ------------- 18 MISO
51 MOSI ------------- 17 MOSI
52 SCK -------------- 19 SCK
53 SS --------------- 16 SS
5V ------------------ 7 Vcc
GND ----------------- 8 GND
此外,我将 ArduinoISP 草图(来自 IDE 中的示例)加载到 Mega2560 中。这似乎有效,因为当它运行时,引脚 9 上有一个绿色 LED 闪烁。
但是,当我尝试使用带有
avrdude
的编程器时,我收到此错误:
bf@localhost:~$ avrdude -c arduino -p m328 -P /dev/ttyACM0 -b 19200 -U flash:r:test.hex:i
avrdude error: programmer is not responding
avrdude warning: attempt 1 of 10: not in sync: resp=0x00
avrdude error: programmer is not responding
avrdude warning: attempt 2 of 10: not in sync: resp=0x00
...
avrdude error: programmer is not responding
avrdude warning: attempt 10 of 10: not in sync: resp=0x00
avrdude error: unable to open port /dev/ttyACM0 for programmer arduino
avrdude error: avrdude built without libserialport support; please compile again with libserialport installed
avrdude done. Thank you.
此外,绿色 LED 停止闪烁。这让我认为
avrdude
正在尝试对 Arduino 进行编程,而不是通过串行端口 to 与 Arduino 进行通信。我必须重置 Arduino 才能让绿色 LED 再次开始闪烁。
我在两种情况下都使用
/dev/ttyACM0
,这会以某种方式发生冲突吗?
更新当我在
avrdude
尝试通信时按下Arduino的重置按钮时,我收到此错误:
bf@localhost:~$ avrdude -c avrisp -p m328 -P /dev/ttyACM1 -b 19200 -U flash:r:test.hex:i
avrdude error: programmer is not responding
avrdude warning: attempt 1 of 10: not in sync: resp=0x00
avrdude: AVR device initialized and ready to accept instructions
avrdude: device signature = 0x000000 (retrying)
avrdude: device signature = 0x000000 (retrying)
avrdude: device signature = 0x000000
avrdude error: Yikes! Invalid device signature.
avrdude error: expected signature for ATmega328 is 1E 95 14
Double check connections and try again, or use -F to override
this check.
avrdude done. Thank you.
我放弃了,买了一个€15 Olimex编程器。连接它,它可以工作。