Arduino IDE может использовать avrdude для прошивки шестнадцатеричного файла, но командная строка в Ubuntu не может

Всем добрый день,

У меня есть arduino pro micro (китайская подделка), с помощью которого я могу прошить с помощью arduino IDE, но я не могу воссоздать тот же эффект с помощью avrdude в терминале на Ubuntu 16.04.

Вот что я заметил из подробного вывода в IDE arduino:

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

В случае использования того же файла и конфигурации avrdude, что и в среде IDE.

Однако, когда я делаю это таким образом, я сталкиваюсь со следующей ошибкой:

/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

Итак, мой вопрос: почему Arduino IDE может определить тип программатора, когда тот же самый исполняемый файл avrdude запускается через терминал и все же не может прошить шестнадцатеричный файл?

Лучше всего предположить, что это как-то связано с принудительным сбросом с использованием скорости передачи и что IDE arduino делает это не так, как я, но я не уверен, что мне нужно изменить

Любая помощь приветствуется! Спасибо.


person Philip Wee    schedule 22.07.2018    source источник


Ответы (1)


Черт, я исправил это в течение 5 секунд после публикации вопроса, вот как я это сделал

Вместо того, чтобы использовать скорость передачи для сброса, я нажал переключатель сброса и запустил тот же самый код.

Значит ошибка здесь

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

Но я не уверен, что именно в этом не так, и в любом случае разъяснения будут оценены :)

person Philip Wee    schedule 22.07.2018