arduino mega 2560 avrdude

GeekElectronics » Arduino от А до Я » Исправляем ошибку avrdude: stk500_getsync(): not in sync: resp=0x00 в китайской Arduino Mega 2560

Моя китайская Arduino Mega 2560 начала барахлить. При загрузке скетча выдает ошибку avrdude: stk500_getsync(): not in sync: resp=0x00.

Долго искать в интернете решение проблемы, но советы пользователей мне не помогали. В результате случайно попал на зарубежный форум, где и нашел инструкцию по перепрошивке Bootloader в Arduino Mega 2560. Это решило проблему с ошибкой avrdude: stk500_getsync(): not in sync: resp=0x00.

Опишу всё пошагово, чтобы у вас не возникло вопросов.

  • Сделайте копию папки с программой arduino — мы будем колупать эту копию, а не вашу рабочую версию
  • В hardwarearduinooards.txt в самый конец файла добавьте:

##############################################
# Added for Emartee in china
mega2560.name=Arduino Mega2560
mega2560.upload.protocol=stk500
mega2560.upload.maximum_size=258048
mega2560.upload.speed=57600
mega2560.bootloader.low_fuses=0xFF
mega2560.bootloader.high_fuses=0xD8
mega2560.bootloader.extended_fuses=0xFD
mega2560.bootloader.path=atmega
mega2560.bootloader.file=ATmegaBOOT_168_mega2560.hex
mega2560.bootloader.unlock_bits=0x3F
mega2560.bootloader.lock_bits=0x0F
mega2560.build.mcu=atmega2560
mega2560.build.f_cpu=16000000L
mega2560.build.core=arduino

  • Добавьте файл ATmegaBOOT_168_mega2560.hex из архива в hardwarearduinoootloadersatmega

Скопируйте содержимое архива в hardwarearduinocoresarduino с заменой файлов

arduino.zip (29,2 KiB, 3 111 hits)

  • Запустите, а потом закройте программу Arduino
  • Снова запустите программу Arduino
  • Выберите свою плату
    • Во время прошивки загрузчика опять выскочит ошибка avrdude: stk500_getsync(): not in sync: resp=0x00.

    • Отключите от Arduino Mega 2560 USB кабель
    • Подключите его заново
    • Попробуйте загрузить скетч ЧЕРЕЗ ВАЩУ ОСНОВНУЮ ПРОГРАММУ Arduino, а не через эту копию, которую мы колупали

    У меня все получилось. Надеюсь, у вас тоже. Всем удачи.

    Correcting falsehoods in tech documentation, lessons learned

    avrdude 5.10, arduino mega 2560, command line uploading

    Note: The following probably applies to the arduino UNO as well, as it also uses an onboard atmega 8u2, rather than the old raw serial converter.

    Part 1 of probably many. I’ve inherited some arduino code, targetting the quite new mega2560 boards. You know, the ones that include an onboard atmega8u2, rather than the original old serial adapters. In many ways, this is a welcome step into the future. Anyway, this place doesn’t even have a regular AVR ISP programmer, and with the onboard real usb, the code running on the 8u2 is actually effectively an AVR ISP programmer itself, talking the stk500 protocol.

    I am trying to move some of this code slowly out of the arduino >

    c: oolsarduino-022hardware/tools/avr/bin/avrdude -CC: oolsarduino-022hardware/tools/avr/etc/avrdude.conf -v -v -v -v -cstk500v2 -p atmega2560 -P COM5 -b 115200
    . version stuff .
    Using Programmer: stk500v2
    Overriding Baud Rate: 115200
    avrdude: ser_open(): setting dtr
    avrdude: Send: . [1b] [20] . [00] . [03] . [0e] . [11] . [01] . [01] ‘ [27]

    Ok, so now I had enough to try and run it myself, using avrdude 5.10, as comes with recent versions of WinAVR

    C:Userskarlp>avrdude.exe -p atmega2560 -P COM5 -c stk500v2 -v -U lfuse:r:-:h -b 115200
    —snip—
    avrdude.exe: stk500_2_ReceiveMessage(): timeout
    avrdude.exe: stk500_2_ReceiveMessage(): timeout

    But, as you can see, this just timed out. Looking at the LEDs, I could see that the board wasn’t getting magically reset. With a bit of reading and searching, I found out that avrdude added a way of resetting the board, if you use the programmer type of “arduino”

    Using Programmer : arduino
    Overriding Baud Rate : 115200
    avrdude.exe: Send: 0 [30] [20]
    avrdude.exe: Send: 0 [30] [20]
    avrdude.exe: Send: 0 [30] [20]

    Interesting, following the lights on the board, I could see that this was now resetting properly, but clearly, those were not the right commands. It seems that the “arduino” programmer type, is set up to talk to the bootloader on the atmega328 of the prior versions of arduino, the Duemilanove and so on, that still had a direct USB-serial bridge, from the FTDI chip. So, if the “arduino” programmer does the reset, but the wrong protocol, looks like I’ll have to reset it myself.

    I finally tried holding reset on the board, issuing the command with the programmer of “stk500v2” and immediately releasing reset. Presto!

    C:Userskarlp>avrdude.exe -p atmega2560 -P COM5 -c stk500v2 -v -b 115200
    . more snipped .
    Programmer Type : STK500V2
    Description : Atmel STK500 Version 2.x firmware
    Programmer Model: AVRISP
    Hardware Version: 15
    Firmware Version Master : 2.10
    Vtarget : 0.0 V
    SCK period : 118.3 us

    avrdude.exe: AVR device initialized and ready to accept instructions

    avrdude.exe: Device signature = 0x1e9801
    . more snipped .

    Hooray! we’re working from the command line again. Now, if only the arduino gang’s pile of extra patches for avrdude would keep making their way back into mainline. It seems they don’t play well with others 🙁

    Оцените статью