Arduino IDE可以使用avrdude来刷新十六进制文件,但是ubuntu上的命令行无法

时间:2018-07-22 15:05:41

标签: arduino hex avrdude

大家好,

我有一个arduino pro micro(中文仿冒版),可以使用arduino IDE闪烁到该版本,但无法在Ubuntu 16.04的终端中使用avrdude来重新创建相同的效果

这是我从arduino IDE上的详细输出中观察到的:

Forcing reset using 1200bps open/close on port /dev/ttyACM0
PORTS {/dev/ttyACM0, } / {} => {}
PORTS {} / {/dev/ttyACM0, } => {/dev/ttyACM0, }
Found upload port: /dev/ttyACM0
/home/philip/Desktop/arduino-1.8.5/hardware/tools/avr/bin/avrdude -C/home/philip/Desktop/arduino-1.8.5/hardware/tools/avr/etc/avrdude.conf -v -patmega32u4 -cavr109 -P/dev/ttyACM0 -b57600 -D -Uflash:w:/tmp/arduino_build_182426/strandtest.ino.hex:i 

avrdude: Version 6.3, compiled on Jan 17 2017 at 11:00:16
         Copyright (c) 2000-2005 Brian Dean, http://www.bdmicro.com/
         Copyright (c) 2007-2014 Joerg Wunsch

     System wide configuration file is "/home/philip/Desktop/arduino-1.8.5/hardware/tools/avr/etc/avrdude.conf"
     User configuration file is "/home/philip/.avrduderc"
     User configuration file does not exist or is not a regular file, skipping

     Using Port                    : /dev/ttyACM0
     Using Programmer              : avr109
     Overriding Baud Rate          : 57600
     AVR Part                      : ATmega32U4
     Chip Erase delay              : 9000 us
     PAGEL                         : PD7
     BS2                           : PA0
     RESET disposition             : dedicated
     RETRY pulse                   : SCK
     serial program mode           : yes
     parallel program mode         : yes
     Timeout                       : 200
     StabDelay                     : 100
     CmdexeDelay                   : 25
     SyncLoops                     : 32
     ByteDelay                     : 0
     PollIndex                     : 3
     PollValue                     : 0x53
     Memory Detail                 :

                              Block Poll               Page                       Polled
       Memory Type Mode Delay Size  Indx Paged  Size   Size #Pages MinW  MaxW   ReadBack
       ----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- ---------
       eeprom        65    20     4    0 no       1024    4      0  9000  9000 0x00 0x00
       flash         65     6   128    0 yes     32768  128    256  4500  4500 0x00 0x00
       lfuse          0     0     0    0 no          1    0      0  9000  9000 0x00 0x00
       hfuse          0     0     0    0 no          1    0      0  9000  9000 0x00 0x00
       efuse          0     0     0    0 no          1    0      0  9000  9000 0x00 0x00
       lock           0     0     0    0 no          1    0      0  9000  9000 0x00 0x00
       calibration    0     0     0    0 no          1    0      0     0     0 0x00 0x00
       signature      0     0     0    0 no          3    0      0     0     0 0x00 0x00



    Programmer Type : butterfly
         Description     : Atmel AppNote AVR109 Boot Loader
Connecting to programmer: .
Found programmer: Id = "CATERIN"; type = S
    Software Version = 1.0; No Hardware Version given.
Programmer supports auto addr increment.
Programmer supports buffered memory access with buffersize=128 bytes.

Programmer supports the following devices:
    Device code: 0x44

avrdude: devcode selected: 0x44
avrdude: AVR device initialized and ready to accept instructions

Reading | ################################################## | 100% 0.00s

avrdude: Device signature = 0x1e9587 (probably m32u4)
avrdude: reading input file "/tmp/arduino_build_182426/strandtest.ino.hex"
avrdude: writing flash (5918 bytes):

Writing | ################################################## | 100% 0.45s

avrdude: 5918 bytes of flash written
avrdude: verifying flash memory against /tmp/arduino_build_182426/strandtest.ino.hex:
avrdude: load data flash data from input file /tmp/arduino_build_182426/strandtest.ino.hex:
avrdude: input file /tmp/arduino_build_182426/strandtest.ino.hex contains 5918 bytes
avrdude: reading on-chip flash data:

Reading | ################################################## | 100% 0.05s

avrdude: verifying ...
avrdude: 5918 bytes of flash verified

avrdude done.  Thank you.

我通过以下代码尽了最大的努力来复制:

stty -F /dev/ttyACM0 speed 1200
stty -F /dev/ttyACM0 speed 57600
/home/philip/Desktop/arduino-1.8.5/hardware/tools/avr/bin/avrdude -v -p m32u4 -C /home/philip/Desktop/arduino-1.8.5/hardware/tools/avr/etc/avrdude.conf -c avr109 -P /dev/ttyACM0 -b 57600 -D -U flash:w:layout.hex

在某种程度上使用与IDE相同的avrdude文件和配置

但是,当我这样做时,会遇到以下错误:

/home/philip/Desktop/arduino-1.8.5/hardware/tools/avr/bin/avrdude -v -p m32u4 -C /home/philip/Desktop/arduino-1.8.5/hardware/tools/avr/etc/avrdude.conf -c avr109 -P /dev/ttyACM0 -b 57600 -D -U flash:w:layout.hex

avrdude: Version 6.3, compiled on Jan 17 2017 at 11:00:16
         Copyright (c) 2000-2005 Brian Dean, http://www.bdmicro.com/
         Copyright (c) 2007-2014 Joerg Wunsch

         System wide configuration file is "/home/philip/Desktop/arduino-1.8.5/hardware/tools/avr/etc/avrdude.conf"
         User configuration file is "/home/philip/.avrduderc"
         User configuration file does not exist or is not a regular file, skipping

         Using Port                    : /dev/ttyACM0
         Using Programmer              : avr109
         Overriding Baud Rate          : 57600
         AVR Part                      : ATmega32U4
         Chip Erase delay              : 9000 us
         PAGEL                         : PD7
         BS2                           : PA0
         RESET disposition             : dedicated
         RETRY pulse                   : SCK
         serial program mode           : yes
         parallel program mode         : yes
         Timeout                       : 200
         StabDelay                     : 100
         CmdexeDelay                   : 25
         SyncLoops                     : 32
         ByteDelay                     : 0
         PollIndex                     : 3
         PollValue                     : 0x53
         Memory Detail                 :

                                  Block Poll               Page                       Polled
           Memory Type Mode Delay Size  Indx Paged  Size   Size #Pages MinW  MaxW   ReadBack
           ----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- ---------
           eeprom        65    20     4    0 no       1024    4      0  9000  9000 0x00 0x00
           flash         65     6   128    0 yes     32768  128    256  4500  4500 0x00 0x00
           lfuse          0     0     0    0 no          1    0      0  9000  9000 0x00 0x00
           hfuse          0     0     0    0 no          1    0      0  9000  9000 0x00 0x00
           efuse          0     0     0    0 no          1    0      0  9000  9000 0x00 0x00
           lock           0     0     0    0 no          1    0      0  9000  9000 0x00 0x00
           calibration    0     0     0    0 no          1    0      0     0     0 0x00 0x00
           signature      0     0     0    0 no          3    0      0     0     0 0x00 0x00

         Programmer Type : butterfly
         Description     : Atmel AppNote AVR109 Boot Loader

**Connecting to programmer: .avrdude: butterfly_recv(): programmer is not responding

avrdude: butterfly_recv(): programmer is not responding
avrdude: butterfly_recv(): programmer is not responding
avrdude: butterfly_recv(): programmer is not responding
avrdude: butterfly_recv(): programmer is not responding
avrdude: butterfly_recv(): programmer is not responding
Found programmer: Id = ""; type = 
    Software Version =  .; Hardware Version = .
avrdude: butterfly_recv(): programmer is not responding
avrdude: butterfly_recv(): programmer is not responding
avrdude: error: buffered memory access not supported. Maybe it isn't
a butterfly/AVR109 but a AVR910 device?**
avrdude: initialization failed, rc=-1
         Double check connections and try again, or use -F to override
         this check.

avrdude: butterfly_recv(): programmer is not responding
avrdude: error: programmer did not respond to command: leave prog mode
avrdude: butterfly_recv(): programmer is not responding
avrdude: error: programmer did not respond to command: exit bootloader

所以我的问题是,当完全相同的avrdude可执行文件通过终端运行而无法刷新hex文件时,为什么Arduino IDE能够检测到编程器的类型?

我最好的选择是,它与使用波特率进行的强制复位有关,并且arduino IDE的操作与我不同,但是我不确定我需要更改什么

任何帮助将不胜感激!谢谢。

1 个答案:

答案 0 :(得分:0)

该死,我在发布问题后的5秒钟内修复了问题,这是我的解决方法

我没有使用波特率进行重置,而是按下了重置开关并运行完全相同的代码

所以错误在这里

stty -F /dev/ttyACM0 speed 1200
stty -F /dev/ttyACM0 speed 57600

但是我不确定到底是什么错误,无论如何请澄清一下:)