• Witaj na Forum Arduino Polska! Zapraszamy do rejestracji!
  • Znajdziesz tutaj wiele informacji na temat hardware / software.
Witaj! Logowanie Rejestracja


Ocena wątku:
  • 0 głosów - średnia: 0
  • 1
  • 2
  • 3
  • 4
  • 5
Arduino Leonardo (ATmega 32U4) bootloader mode
#7
Jak masz tylko HEX to wgrywanie go przez bootloader do Leonardo czy Micro faktycznie może być upierdliwe. Ja mam np. Micro, które w ogóle nie ma przycisku RST (oczywiście kabelek do masy to rozwiązał). Albo wgraj sobie przez USBASP programem AVR LAB++ , albo zrób sobie programator z wolnego Arduino NANO/UNO i tym samym programem wgraj sobie wybierając AVR ISP. Program jest tu: https://rctruck.pl/forum/viewtopic.php?f...7&start=80
Wgranie przez bootloader jest możliwe używając z linii poleceń AVRDUDE, ale trochę trzeba się nagimnastykować. Jak masz włączone pełne komunikaty to zauważysz, że jak Arduino zlokalizuje port COM bootloadera (pojawia się po resecie na kilka sekund) to wysyła specjalną linijkę do AVRDUDE i proces wgrywania na ten port. Słyszałem, że porty powyżej COM10 mogą mieć problemy, więc jak wyskoczył mi na 73 to wszedłem szybko w opcje i przełączyłem go na COM3, teraz już tak się zgłasza. Zrobiłem sobie katalog Leonardo na dysku D, skopiowałem tu wszystkie pliki z katalogu AVRDUDE z instalki Arduino. W nim utworzyłem plik start.bat z komendą:
Kod:
avrdude -CD:\Leonardo\avrdude.conf -v -patmega32u4 -cavr109 -PCOM3 -b57600 -D -Uflash:w:"D:\Leonardo\BlinkLeonardo.hex":i 
Po 2s od resetu pojawia się port COM3, uruchamiam bat z tą linijką i voila:
Kod:
d:\Leonardo>avrdude -CD:\Leonardo\avrdude.conf -v -patmega32u4 -cavr109 -PCOM3 -
b57600 -D -Uflash:w:"D:\Leonardo\BlinkLeonardo.hex":i

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

        System wide configuration file is "D:\Leonardo\avrdude.conf"

        Using Port                    : COM3
        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  Max
W   ReadBack
          ----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ---
-- ---------
          eeprom        65    20     4    0 no       1024    4      0  9000  90
00 0x00 0x00
          flash         65     6   128    0 yes     32768  128    256  4500  45
00 0x00 0x00
          lfuse          0     0     0    0 no          1    0      0  9000  90
00 0x00 0x00
          hfuse          0     0     0    0 no          1    0      0  9000  90
00 0x00 0x00
          efuse          0     0     0    0 no          1    0      0  9000  90
00 0x00 0x00
          lock           0     0     0    0 no          1    0      0  9000  90
00 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: safemode: lfuse reads as FF
avrdude: safemode: hfuse reads as D8
avrdude: safemode: efuse reads as CB
avrdude: reading input file "D:\Leonardo\BlinkLeonardo.hex"
avrdude: writing flash (32730 bytes):

Writing | ################################################## | 100% 0.54s

avrdude: 32730 bytes of flash written
avrdude: verifying flash memory against D:\Leonardo\BlinkLeonardo.hex:
avrdude: load data flash data from input file D:\Leonardo\BlinkLeonardo.hex:
avrdude: input file D:\Leonardo\BlinkLeonardo.hex contains 32730 bytes
avrdude: reading on-chip flash data:

Reading | ################################################## | 100% 0.23s

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

avrdude: safemode: lfuse reads as FF
avrdude: safemode: hfuse reads as D8
avrdude: safemode: efuse reads as CB
avrdude: safemode: Fuses OK (E:CB, H:D8, L:FF)

avrdude done.  Thank you.


d:\Leonardo>PAUSE
Aby kontynuować, naciśnij dowolny klawisz . . .
sukces!
Możesz sobie sprawdzić zresztą ten port com bez zmieniania. O problemach pisał ktoś z forum linuksa. Skoro Arduino to wgrywa w windows to pewnie jest OK, mnie się nie chciało modyfikować z powrotem.


Załączone pliki
.zip   Leonardo.zip (Rozmiar: 327.33 KB / Pobrań: 3)
Miło być decenianym https://buycoffee.to/kaczakat
 
Odpowiedź
  


Wiadomości w tym wątku
RE: Arduino Leonardo (ATmega 32U4) bootloader mode - przez kaczakat - 28-10-2018, 02:24

Skocz do:


Przeglądający: 3 gości