【问题标题】:Burning Arduino bootloader with Atmel-ICE results in avrdude throwing a "verification error"使用 Atmel-ICE 烧录 Arduino 引导加载程序会导致 avrdude 引发“验证错误”
【发布时间】:2021-04-05 04:56:32
【问题描述】:

我正在尝试使用Atmel-ICE 探针在Arduino UNO 板上烧录一个Arduino 引导加载程序。不幸的是,avrdude 在验证字节时会抛出错误消息。

1。硬件设置

我的硬件设置如下:

顺便说一句 - 我正在使用 64 位 Windows 10 电脑。

2。 Atmel-ICE 驱动程序

起初我以为Atmel-ICE 不需要安装,因为Windows 将其识别为HID 设备。然而,我很快了解到avrdude - 由 Arduino IDE 启动 - 需要另一个驱动程序才能与 Atmel-ICE 交互。因此,我使用 Zadig 安装了 libusb-win32 驱动程序(正如 GitHub 线程 https://github.com/arduino/Arduino/issues/4368 上所建议的那样):

驱动程序安装成功,我观察到 Windows 设备管理器中的变化。 Atmel-ICE 探针不再显示为 HID 设备,而是显示为 libusb-win32 设备:

我相信Atmel-ICE 现在可以与avrdude 一起使用了。

3。软件设置

我正在 Windows 10 PC 上运行全新安装的 Arduino IDE(版本 1.8.13)。首先,我为控制台输出激活最大冗长(File > Preferences > Show verbose output)。接下来,我选择探针:Tools > Programmer > Atmel-ICE (AVR)

接下来我选择我的板:Tools > Board > Arduino AVR Boards > Arduino UNO

最后,我烧掉了bootloader:Tools > Burn Bootloader

在控制台输出中,我可以看到两个avrdude 命令正在启动。

3.1 第一个avrdude命令

第一个avrdude 命令如下所示:

avrdude -CC:\Program Files (x86)\.../avrdude.conf
        -v
        -patmega328p
        -catmelice_isp
        -Pusb
        -e
        -Ulock:w:0x3F:m
        -Uefuse:w:0xFD:m
        -Uhfuse:w:0xDE:m
        -Ulfuse:w:0xFF:m

这个命令的输出是:

avrdude: Version 6.3-20190619
         Copyright (c) 2000-2005 Brian Dean, http://www.bdmicro.com/
         Copyright (c) 2007-2014 Joerg Wunsch

         System wide configuration file is "C:\Program Files (x86)\Arduino\hardware\tools\avr/etc/avrdude.conf"

         Using Port                    : usb
         Using Programmer              : atmelice_isp
avrdude: usbhid_open(): No device found
avrdude: usbdev_open(): Found Atmel-ICE CMSIS-DAP, serno: J42700007942
avrdude: Found CMSIS-DAP compliant device, using EDBG protocol
         AVR Part                      : ATmega328P
         Chip Erase delay              : 9000 us
         PAGEL                         : PD7
         BS2                           : PC2
         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  3600  3600 0xff 0xff
           flash         65     6   128    0 yes     32768  128    256  4500  4500 0xff 0xff
           lfuse          0     0     0    0 no          1    0      0  4500  4500 0x00 0x00
           hfuse          0     0     0    0 no          1    0      0  4500  4500 0x00 0x00
           efuse          0     0     0    0 no          1    0      0  4500  4500 0x00 0x00
           lock           0     0     0    0 no          1    0      0  4500  4500 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 : JTAG3_ISP
         Description     : Atmel-ICE (ARM/AVR) in ISP mode
         Vtarget         : 5.0 V
         SCK period      : 125.00 us

avrdude: AVR device initialized and ready to accept instructions

Reading | ################################################## | 100% 0.01s

avrdude: Device signature = 0x1e950f (probably m328p)
avrdude: erasing chip
avrdude: reading input file "0x3F"
avrdude: writing lock (1 bytes):

Writing | ################################################## | 100% 0.00s

avrdude: 1 bytes of lock written
avrdude: verifying lock memory against 0x3F:
avrdude: load data lock data from input file 0x3F:
avrdude: input file 0x3F contains 1 bytes
avrdude: reading on-chip lock data:

Reading | ################################################## | 100% 0.01s

avrdude: verifying ...
avrdude: WARNING: invalid value for unused bits in fuse "lock", should be set to 1 according to datasheet
This behaviour is deprecated and will result in an error in future version
You probably want to use 0xff instead of 0x3f (double check with your datasheet first).
avrdude: 1 bytes of lock verified
avrdude: reading input file "0xFD"
avrdude: writing efuse (1 bytes):

Writing | ################################################## | 100% 0.09s

avrdude: 1 bytes of efuse written
avrdude: verifying efuse memory against 0xFD:
avrdude: load data efuse data from input file 0xFD:
avrdude: input file 0xFD contains 1 bytes
avrdude: reading on-chip efuse data:

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

avrdude: verifying ...
avrdude: 1 bytes of efuse verified
avrdude: reading input file "0xDE"
avrdude: writing hfuse (1 bytes):

Writing | ################################################## | 100% 0.09s

avrdude: 1 bytes of hfuse written
avrdude: verifying hfuse memory against 0xDE:
avrdude: load data hfuse data from input file 0xDE:
avrdude: input file 0xDE contains 1 bytes
avrdude: reading on-chip hfuse data:

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

avrdude: verifying ...
avrdude: 1 bytes of hfuse verified
avrdude: reading input file "0xFF"
avrdude: writing lfuse (1 bytes):

Writing | ################################################## | 100% 0.09s

avrdude: 1 bytes of lfuse written
avrdude: verifying lfuse memory against 0xFF:
avrdude: load data lfuse data from input file 0xFF:
avrdude: input file 0xFF contains 1 bytes
avrdude: reading on-chip lfuse data:

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

avrdude: verifying ...
avrdude: 1 bytes of lfuse verified

avrdude done.  Thank you.

看起来不错。

3.2 第二个 avrdude 命令

第二个avrdude 命令是:

avrdude -CC:\Program Files (x86)\.../avrdude.conf
        -v
        -patmega328p
        -catmelice_isp
        -Pusb
        -Uflash:w:C:\Program Files (x86)\.../optiboot_atmega328.hex:i
        -Ulock:w:0x0F:m 

输出如下:

avrdude: Version 6.3-20190619
         Copyright (c) 2000-2005 Brian Dean, http://www.bdmicro.com/
         Copyright (c) 2007-2014 Joerg Wunsch

         System wide configuration file is "C:\Program Files (x86)\Arduino\hardware\tools\avr/etc/avrdude.conf"

         Using Port                    : usb
         Using Programmer              : atmelice_isp
avrdude: usbhid_open(): No device found
avrdude: usbdev_open(): Found Atmel-ICE CMSIS-DAP, serno: J42700007942
avrdude: Found CMSIS-DAP compliant device, using EDBG protocol
         AVR Part                      : ATmega328P
         Chip Erase delay              : 9000 us
         PAGEL                         : PD7
         BS2                           : PC2
         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  3600  3600 0xff 0xff
           flash         65     6   128    0 yes     32768  128    256  4500  4500 0xff 0xff
           lfuse          0     0     0    0 no          1    0      0  4500  4500 0x00 0x00
           hfuse          0     0     0    0 no          1    0      0  4500  4500 0x00 0x00
           efuse          0     0     0    0 no          1    0      0  4500  4500 0x00 0x00
           lock           0     0     0    0 no          1    0      0  4500  4500 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 : JTAG3_ISP
         Description     : Atmel-ICE (ARM/AVR) in ISP mode
         Vtarget         : 5.0 V
         SCK period      : 125.00 us

avrdude: AVR device initialized and ready to accept instructions

Reading | ################################################## | 100% 0.01s

avrdude: Device signature = 0x1e950f (probably m328p)
avrdude: NOTE: "flash" memory has been specified, an erase cycle will be performed
         To disable this feature, specify the -D option.
avrdude: erasing chip
avrdude: reading input file "C:\Program Files (x86)\Arduino\hardware\arduino\avr/bootloaders/optiboot/optiboot_atmega328.hex"
avrdude: writing flash (32768 bytes):

Writing | ################################################## | 100% -0.00s

avrdude: 32768 bytes of flash written
avrdude: verifying flash memory against C:\Program Files (x86)\Arduino\hardware\arduino\avr/bootloaders/optiboot/optiboot_atmega328.hex:
avrdude: load data flash data from input file C:\Program Files (x86)\Arduino\hardware\arduino\avr/bootloaders/optiboot/optiboot_atmega328.hex:
avrdude: input file C:\Program Files (x86)\Arduino\hardware\arduino\avr/bootloaders/optiboot/optiboot_atmega328.hex contains 32768 bytes
avrdude: reading on-chip flash data:

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

avrdude: verifying ...
avrdude: 32768 bytes of flash verified
avrdude: reading input file "0x0F"
avrdude: writing lock (1 bytes):

Error while burning bootloader.
Writing | ################################################## | 100% 0.00s

avrdude: 1 bytes of lock written
avrdude: verifying lock memory against 0x0F:
avrdude: load data lock data from input file 0x0F:
avrdude: input file 0x0F contains 1 bytes
avrdude: reading on-chip lock data:

Reading | ################################################## | 100% 0.01s

avrdude: verifying ...
avrdude: verification error, first mismatch at byte 0x0000
         0xff != 0x0f
avrdude: verification error; content mismatch

avrdude done.  Thank you.

3.3 错误信息

如您所见,avrdude 抛出此错误消息:

avrdude: verifying ...
avrdude: verification error, first mismatch at byte 0x0000
         0xff != 0x0f
avrdude: verification error; content mismatch

我应该怎么做才能解决这个问题?

【问题讨论】:

    标签: arduino bootloader atmega atmel avrdude


    【解决方案1】:

    我刚刚尝试了一些东西。我在 Windows 终端中输入了与 Arduino IDE 在其控制台中打印的完全相同的命令。

    1。相同的命令 - 但在 Windows 终端中

    我打开了一个 Windows 终端并输入了两个 avrdude 命令,就像我在 Arduino IDE 控制台中看到的那样。

    1.1 第一个avrdude命令

    我输入的第一个命令是这个:

    "C:\Program Files (x86)\Arduino\hardware\tools\avr/bin/avrdude" -C"C:\Program Files (x86)\Arduino\hardware\tools\avr/etc/avrdude.conf" -v -patmega328p -catmelice_isp -Pusb -e -Ulock:w:0x3F:m -Uefuse:w:0xFD:m -Uhfuse:w:0xDE:m -Ulfuse:w:0xFF:m
    

    重新设计和重新格式化后,它看起来像这样(另见我的原始帖子):

    avrdude -C C:/Program Files (x86)/.../avrdude.conf
            -v
            -patmega328p
            -catmelice_isp
            -Pusb
            -e
            -Ulock:w:0x3F:m
            -Uefuse:w:0xFD:m
            -Uhfuse:w:0xDE:m
            -Ulfuse:w:0xFF:m
    

    输出与以前完全相同(请参阅我的原始帖子),但有一些例外。打印带有内存信息的表格后,avrdude 打印以下行:

    avrdude: AVR device initialized and ready to accept instructions

    在原始输出中(来自 Arduino IDE 控制台),在该行之后打印以下内容:

    Reading | ################################################## | 100% 0.01s
    
    avrdude: Device signature = 0x1e950f (probably m328p)
    avrdude: erasing chip
    avrdude: reading input file "0x3F"
    

    在 Windows 终端输出中,我看到的是:

    Reading | ################################################## | 100% 0.02s
    
    avrdude: Device signature = 0x1e950f (probably m328p)
    avrdude: safemode: lfuse reads as FF
    avrdude: safemode: hfuse reads as DE
    avrdude: safemode: efuse reads as FD
    avrdude: erasing chip
    avrdude: reading input file "0x3F"
    

    另一个区别是在输出的末尾。原始输出(来自 Arduino IDE 控制台,请参阅原始帖子)如下所示:

    Reading | ################################################## | 100% 0.00s
    
    avrdude: verifying ...
    avrdude: 1 bytes of lfuse verified
    
    avrdude done.  Thank you.
    

    当 Windows 终端输出这个时:

    Reading | ################################################## | 100% 0.02s
    
    avrdude: verifying ...
    avrdude: 1 bytes of lfuse verified
    
    avrdude: safemode: lfuse reads as FF
    avrdude: safemode: hfuse reads as DE
    avrdude: safemode: efuse reads as FD
    avrdude: safemode: Fuses OK (E:FD, H:DE, L:FF)
    
    avrdude done.  Thank you.
    

    这是完整的输出:

    avrdude: Version 6.3-20190619
             Copyright (c) 2000-2005 Brian Dean, http://www.bdmicro.com/
             Copyright (c) 2007-2014 Joerg Wunsch
    
             System wide configuration file is "C:\Program Files (x86)\Arduino\hardware\tools\avr/etc/avrdude.conf"
    
             Using Port                    : usb
             Using Programmer              : atmelice_isp
    avrdude: usbhid_open(): No device found
    avrdude: usbdev_open(): Found Atmel-ICE CMSIS-DAP, serno: J42700007942
    avrdude: Found CMSIS-DAP compliant device, using EDBG protocol
             AVR Part                      : ATmega328P
             Chip Erase delay              : 9000 us
             PAGEL                         : PD7
             BS2                           : PC2
             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  3600  3600 0xff 0xff
               flash         65     6   128    0 yes     32768  128    256  4500  4500 0xff 0xff
               lfuse          0     0     0    0 no          1    0      0  4500  4500 0x00 0x00
               hfuse          0     0     0    0 no          1    0      0  4500  4500 0x00 0x00
               efuse          0     0     0    0 no          1    0      0  4500  4500 0x00 0x00
               lock           0     0     0    0 no          1    0      0  4500  4500 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 : JTAG3_ISP
             Description     : Atmel-ICE (ARM/AVR) in ISP mode
             Vtarget         : 5.1 V
             SCK period      : 125.00 us
    
    avrdude: AVR device initialized and ready to accept instructions
    
    Reading | ################################################## | 100% 0.02s
    
    avrdude: Device signature = 0x1e950f (probably m328p)
    avrdude: safemode: lfuse reads as FF
    avrdude: safemode: hfuse reads as DE
    avrdude: safemode: efuse reads as FD
    avrdude: erasing chip
    avrdude: reading input file "0x3F"
    avrdude: writing lock (1 bytes):
    
    Writing | ################################################## | 100% 0.00s
    
    avrdude: 1 bytes of lock written
    avrdude: verifying lock memory against 0x3F:
    avrdude: load data lock data from input file 0x3F:
    avrdude: input file 0x3F contains 1 bytes
    avrdude: reading on-chip lock data:
    
    Reading | ################################################## | 100% 0.02s
    
    avrdude: verifying ...
    avrdude: WARNING: invalid value for unused bits in fuse "lock", should be set to 1 according to datasheet
    This behaviour is deprecated and will result in an error in future version
    You probably want to use 0xff instead of 0x3f (double check with your datasheet first).
    avrdude: 1 bytes of lock verified
    avrdude: reading input file "0xFD"
    avrdude: writing efuse (1 bytes):
    
    Writing | ################################################## | 100% 0.10s
    
    avrdude: 1 bytes of efuse written
    avrdude: verifying efuse memory against 0xFD:
    avrdude: load data efuse data from input file 0xFD:
    avrdude: input file 0xFD contains 1 bytes
    avrdude: reading on-chip efuse data:
    
    Reading | ################################################## | 100% 0.02s
    
    avrdude: verifying ...
    avrdude: 1 bytes of efuse verified
    avrdude: reading input file "0xDE"
    avrdude: writing hfuse (1 bytes):
    
    Writing | ################################################## | 100% 0.10s
    
    avrdude: 1 bytes of hfuse written
    avrdude: verifying hfuse memory against 0xDE:
    avrdude: load data hfuse data from input file 0xDE:
    avrdude: input file 0xDE contains 1 bytes
    avrdude: reading on-chip hfuse data:
    
    Reading | ################################################## | 100% -0.00s
    
    avrdude: verifying ...
    avrdude: 1 bytes of hfuse verified
    avrdude: reading input file "0xFF"
    avrdude: writing lfuse (1 bytes):
    
    Writing | ################################################## | 100% 0.10s
    
    avrdude: 1 bytes of lfuse written
    avrdude: verifying lfuse memory against 0xFF:
    avrdude: load data lfuse data from input file 0xFF:
    avrdude: input file 0xFF contains 1 bytes
    avrdude: reading on-chip lfuse data:
    
    Reading | ################################################## | 100% 0.02s
    
    avrdude: verifying ...
    avrdude: 1 bytes of lfuse verified
    
    avrdude: safemode: lfuse reads as FF
    avrdude: safemode: hfuse reads as DE
    avrdude: safemode: efuse reads as FD
    avrdude: safemode: Fuses OK (E:FD, H:DE, L:FF)
    
    avrdude done.  Thank you.
    

    1.2 第二个 avrdude 命令

    我输入的第二个avrdude 命令是这个:

    "C:\Program Files (x86)\Arduino\hardware\tools\avr/bin/avrdude" -C"C:\Program Files (x86)\Arduino\hardware\tools\avr/etc/avrdude.conf" -v -patmega328p -catmelice_isp -Pusb -Uflash:w:"C:\Program Files (x86)\Arduino\hardware\arduino\avr/bootloaders/optiboot/optiboot_atmega328.hex":i -Ulock:w:0x0F:m
    

    重新设计和重新格式化后,它看起来像这样(另见我的原始帖子):

    avrdude -C C:/Program Files (x86)/.../avrdude.conf
            -v
            -patmega328p
            -catmelice_isp
            -Pusb
            -Uflash:w:"C:/Program Files (x86)/.../optiboot_atmega328.hex":i
            -Ulock:w:0x0F:m 
    

    输出和之前一样,只是在Arduino IDE中的输出是这样结束的:

    Reading | ################################################## | 100% 0.01s
    
    avrdude: verifying ...
    avrdude: verification error, first mismatch at byte 0x0000
             0xff != 0x0f
    avrdude: verification error; content mismatch
    
    avrdude done.  Thank you.
    

    Windows 终端的输出结果如下:

    Reading | ################################################## | 100% 0.02s
    
    avrdude: verifying ...
    avrdude: WARNING: invalid value for unused bits in fuse "lock", should be set to 1 according to datasheet
    This behaviour is deprecated and will result in an error in future version
    You probably want to use 0xcf instead of 0x0f (double check with your datasheet first).
    avrdude: 1 bytes of lock verified
    
    avrdude: safemode: lfuse reads as FF
    avrdude: safemode: hfuse reads as DE
    avrdude: safemode: efuse reads as FD
    avrdude: safemode: Fuses OK (E:FD, H:DE, L:FF)
    
    avrdude done.  Thank you.
    

    这是完整的输出:

    avrdude: Version 6.3-20190619
             Copyright (c) 2000-2005 Brian Dean, http://www.bdmicro.com/
             Copyright (c) 2007-2014 Joerg Wunsch
    
             System wide configuration file is "C:\Program Files (x86)\Arduino\hardware\tools\avr/etc/avrdude.conf"
    
             Using Port                    : usb
             Using Programmer              : atmelice_isp
    avrdude: usbhid_open(): No device found
    avrdude: usbdev_open(): Found Atmel-ICE CMSIS-DAP, serno: J42700007942
    avrdude: Found CMSIS-DAP compliant device, using EDBG protocol
             AVR Part                      : ATmega328P
             Chip Erase delay              : 9000 us
             PAGEL                         : PD7
             BS2                           : PC2
             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  3600  3600 0xff 0xff
               flash         65     6   128    0 yes     32768  128    256  4500  4500 0xff 0xff
               lfuse          0     0     0    0 no          1    0      0  4500  4500 0x00 0x00
               hfuse          0     0     0    0 no          1    0      0  4500  4500 0x00 0x00
               efuse          0     0     0    0 no          1    0      0  4500  4500 0x00 0x00
               lock           0     0     0    0 no          1    0      0  4500  4500 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 : JTAG3_ISP
             Description     : Atmel-ICE (ARM/AVR) in ISP mode
             Vtarget         : 5.0 V
             SCK period      : 125.00 us
    
    avrdude: AVR device initialized and ready to accept instructions
    
    Reading | ################################################## | 100% 0.02s
    
    avrdude: Device signature = 0x1e950f (probably m328p)
    avrdude: safemode: lfuse reads as FF
    avrdude: safemode: hfuse reads as DE
    avrdude: safemode: efuse reads as FD
    avrdude: NOTE: "flash" memory has been specified, an erase cycle will be performed
             To disable this feature, specify the -D option.
    avrdude: erasing chip
    avrdude: reading input file "C:\Program Files (x86)\Arduino\hardware\arduino\avr/bootloaders/optiboot/optiboot_atmega328.hex"
    avrdude: writing flash (32768 bytes):
    
    Writing | ################################################## | 100% 0.02s
    
    avrdude: 32768 bytes of flash written
    avrdude: verifying flash memory against C:\Program Files (x86)\Arduino\hardware\arduino\avr/bootloaders/optiboot/optiboot_atmega328.hex:
    avrdude: load data flash data from input file C:\Program Files (x86)\Arduino\hardware\arduino\avr/bootloaders/optiboot/optiboot_atmega328.hex:
    avrdude: input file C:\Program Files (x86)\Arduino\hardware\arduino\avr/bootloaders/optiboot/optiboot_atmega328.hex contains 32768 bytes
    avrdude: reading on-chip flash data:
    
    Reading | ################################################## | 100% 0.02s
    
    avrdude: verifying ...
    avrdude: 32768 bytes of flash verified
    avrdude: reading input file "0x0F"
    avrdude: writing lock (1 bytes):
    
    Writing | ################################################## | 100% 0.00s
    
    avrdude: 1 bytes of lock written
    avrdude: verifying lock memory against 0x0F:
    avrdude: load data lock data from input file 0x0F:
    avrdude: input file 0x0F contains 1 bytes
    avrdude: reading on-chip lock data:
    
    Reading | ################################################## | 100% 0.02s
    
    avrdude: verifying ...
    avrdude: WARNING: invalid value for unused bits in fuse "lock", should be set to 1 according to datasheet
    This behaviour is deprecated and will result in an error in future version
    You probably want to use 0xcf instead of 0x0f (double check with your datasheet first).
    avrdude: 1 bytes of lock verified
    
    avrdude: safemode: lfuse reads as FF
    avrdude: safemode: hfuse reads as DE
    avrdude: safemode: efuse reads as FD
    avrdude: safemode: Fuses OK (E:FD, H:DE, L:FF)
    
    avrdude done.  Thank you.
    

    2。结论?

    我不知道从中得出什么结论。与在 Windows 终端中手动输入它们相比,相同的 avrdude 命令在 Arduino IDE 控制台中运行时会给出不同的结果吗?

    我想到的一件事是时间问题。在 Arduino IDE 中,它们一个接一个地快速运行。当我手动输入它们时,它们之间的时间要长得多。但是,这并不能解释第一个命令的输出差异。

    为了测试时序问题理论,我将两个命令都放在了.bat 文件中。我运行了.bat 文件,它成功了。由于这两个命令现在都从 .bat 文件运行,因此它们之间几乎没有时间。这应该非常接近地模仿 Arduino IDE 控制台的行为。

    3。补充问题

    嗯 - 它似乎在 Windows 控制台中工作,这对我来说最终很重要(当然,如果它也能在 Arduino IDE 中得到修复,那就太好了)。

    但是,下面的输出让我有点害怕(它在第二个命令的输出末尾):

    Reading | ################################################## | 100% 0.02s
    
    avrdude: verifying ...
    avrdude: WARNING: invalid value for unused bits in fuse "lock", should be set to 1 according to datasheet
    This behaviour is deprecated and will result in an error in future version
    You probably want to use 0xcf instead of 0x0f (double check with your datasheet first).
    avrdude: 1 bytes of lock verified
    
    avrdude: safemode: lfuse reads as FF
    avrdude: safemode: hfuse reads as DE
    avrdude: safemode: efuse reads as FD
    avrdude: safemode: Fuses OK (E:FD, H:DE, L:FF)
    
    avrdude done.  Thank you.
    

    尤其是这句话:"This behaviour is deprecated and will result in an error in future version"

    我认为它与第二个命令中的最后一个标志有关:-Ulock:w:0x0F:m。我应该将该标志更改为:-Ulock:w:0xCF:m?输出建议查看数据表。但是,我对这个芯片并不熟悉,所以我不知道在哪里可以查看数据表。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2017-06-24
      • 2013-08-14
      • 1970-01-01
      • 1970-01-01
      • 2019-01-28
      • 1970-01-01
      • 2011-02-01
      相关资源
      最近更新 更多