Помощь - Поиск - Пользователи - Календарь
Полная версия этой страницы: Проблема с прошивкой fuse-bit в ATmega32U4
Форум разработчиков электроники ELECTRONIX.ru > Сайт и форум > В помощь начинающему > MCS51, AVR, PIC, STM8, 8bit
Doka
возникла проблема с atmega32u4 (китайский клон Arduino Pro Micro) - прошивается всё, кроме фьюзов:


Код
sudo /usr/bin/avrdude -C /etc/avrdude/avrdude.conf -p atmega32u4 -c avr109 -P /dev/ttyACM0 -b 19200 -U lfuse:w:0x90:m -U hfuse:w:0xd9:m

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: AVR device initialized and ready to accept instructions

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

avrdude: Device signature = 0x1e9587
avrdude: reading input file "0x90"
avrdude: writing lfuse (1 bytes):

Writing |                                                    | 0% 0.00s ***failed;
Writing | ################################################## | 100% 0.00s

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

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

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

avrdude: safemode: lfuse changed! Was 90, and is now ff
Would you like this fuse to be changed back? [y/n]






все секции memory присутствуют в /etc/avrdude/avrdude.conf и соответствуют даташиту
расширенная диагностика при чтении фьюзов:

Код
sudo /usr/bin/avrdude -C /etc/avrdude/avrdude.conf -p atmega32u4 -c avr109 -P /dev/ttyACM0 -b 19200 -U lfuse:r:-:i -U hfuse:r:-:i -v

avrdude: Version 5.10, compiled on Oct 22 2010 at 08:16:12
         Copyright (c) 2000-2005 Brian Dean, http://www.bdmicro.com/
         Copyright (c) 2007-2009 Joerg Wunsch

         System wide configuration file is "/etc/avrdude/avrdude.conf"
         User configuration file is "/root/.avrduderc"
         User configuration file does not exist or is not a regular file, skipping

         Using Port                    : /dev/ttyACM0
         Using Programmer              : avr109
         avr910_devcode (avrdude.conf) : none
         Overriding Baud Rate          : 19200
         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    10     8    0 no       1024    8      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 : avr910
         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
avrdude: safemode: lfuse reads as FF
avrdude: safemode: hfuse reads as D8
avrdude: safemode: efuse reads as CB
avrdude: reading lfuse memory:

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

avrdude: Device signature = 0x1e9587
avrdude: safemode: lfuse reads as FF
avrdude: safemode: hfuse reads as D8
avrdude: safemode: efuse reads as CB
avrdude: reading lfuse memory:

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

avrdude: writing output file "<stdout>"
0xff
avrdude: reading hfuse memory:

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

avrdude: writing output file "<stdout>"
0xd8
avrdude: reading lock memory:

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

avrdude: writing output file "<stdout>"
0xef

avrdude: safemode: lfuse reads as FF
avrdude: safemode: hfuse reads as D8
avrdude: safemode: efuse reads as CB
avrdude: safemode: Fuses OK

avrdude done.  Thank you.


any ideas?
smalcom
проверьте качество питания МК. Бывает фантомной запитки хватает при потоке данных, а вот с фьюзами начинаются проблемы.
Doka
проверил - эффекта не дало.

PS: на Arduino Pro Micro стоят танталы на 10мкФ до и после LDO + керамика
пробовал подключать коротким качественным кабелем microUSB (20cm) на заднюю панель.
smalcom
плохо вижу или вы не указали "-e". Попробуйте этот ключ.
Doka
Код
$ sudo /usr/bin/avrdude -C /etc/avrdude/avrdude.conf -p atmega32u4 -c avr109 -P /dev/ttyACM0 -b 19200 -e

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: AVR device initialized and ready to accept instructions

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

avrdude: Device signature = 0x1e9587
avrdude: erasing chip

avrdude: safemode: Fuses OK

avrdude done.  Thank you.



Код
$ sudo /usr/bin/avrdude -C /etc/avrdude/avrdude.conf -p atmega32u4 -c avr109 -P /dev/ttyACM0 -b 19200 -e -U lfuse:w:0x90:m -U hfuse:w:0xd9:m

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: AVR device initialized and ready to accept instructions

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

avrdude: Device signature = 0x1e9587
avrdude: erasing chip
avrdude: reading input file "0x90"
avrdude: writing lfuse (1 bytes):

Writing |                                                    | 0% 0.00s ***failed;  
Writing | ################################################## | 100% 0.00s

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

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

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

avrdude: safemode: lfuse changed! Was 90, and is now ff
Would you like this fuse to be changed back? [y/n]
smalcom
Ну у меня последняя идея - притормозить всё как следует

Цитата
$ sudo /usr/bin/avrdude -C /etc/avrdude/avrdude.conf -p atmega32u4 -c avr109 -i 1000 -B 1000 -P /dev/ttyACM0 -b 19200 -e -U lfuse:w:0x90:m -U hfuse:w:0xd9:m


Эммм, а avr109 - это вы не системный загрузчик(SPI) используете, а свой? Может в этом проблема?
Doka
Цитата(smalcom @ Feb 10 2016, 23:38) *
Эммм, а avr109 - это вы не системный загрузчик(SPI) используете, а свой? Может в этом проблема?

да, шью встроенным бутлодером. он не умеет прошивать фьюзы?
могу для чистоты эксперимента попробовать avrisp, но надо будет подпаяться.
smalcom
Цитата
он не умеет прошивать фьюзы?

если честно, то не в курсе. всегда ISP использовал.
Doka
Цитата(smalcom @ Feb 10 2016, 23:38) *
Ну у меня последняя идея - притормозить всё как следует


не очень помогло притормозить((
Код
$ sudo /usr/local/bin/avrdude -C /etc/avrdude/avrdude.conf -p atmega32u4 -c avr109 -P /dev/ttyACM0 -i 1000 -B 1000 -b 9600 -U lfuse:w:0x90:m -U hfuse:w:0xd9:m

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: AVR device initialized and ready to accept instructions

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

avrdude: Device signature = 0x1e9587 (probably m32u4)
avrdude: reading input file "0x90"
avrdude: writing lfuse (1 bytes):

Writing |                                                    | 0% 0.00s ***failed;  
Writing | ################################################## | 100% 0.00s

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

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

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

avrdude: safemode: lfuse changed! Was 90, and is now ff
Would you like this fuse to be changed back? [y/n]
smalcom
Что-то я совсем того... http://microsin.net/programming/AVR/avr109...rogramming.html
Этот загрузчик не умеет записывать fuse-биты. По простой причине: программа МК не имеет никакой возможности менять fuse-биты. Собственно от них[fuses] зависит её[программы] работа )))

Код
Alternatively,
the Boot Reset Fuse can be programmed so that the Reset Vector is pointing to the Boot Flash
start address after a reset. In this case, the Boot Loader is started after a reset. After the applica-
tion code is loaded, the program can start executing the application code. [b]Note that the fuses
cannot be changed by the MCU itself.[/b] This means that once the Boot Reset Fuse is pro-
grammed, the Reset Vector will always point to the Boot Loader Reset and the fuse can only be
changed through the serial or parallel programming interface.
Doka
однако успех через внешний прошивальщик. какая-то загадка со встроенным..

Код
avrdude -p atmega32u4 -c arduino-ft232r -P ft0 -U lfuse:w:0x90:m -U hfuse:w:0xd9:m

avrdude: AVR device initialized and ready to accept instructions

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

avrdude: Device signature = 0x1e9587 (probably m32u4)
avrdude: reading input file "0x90"
avrdude: writing lfuse (1 bytes):

Writing | ################################################## | 100% 0.01s

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

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

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

Writing | ################################################## | 100% 0.01s

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

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

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

avrdude: safemode: Fuses OK (E:CB, H:D9, L:90)

avrdude done.  Thank you.


нда.. рано радовался.. теперь выдает такое после первой перешивки фьюзов:

Код
avrdude -F -p atmega32u4 -c arduino-ft232r -P ft0 -U lfuse:w:0x90:m -U hfuse:w:0xd9:m

avrdude: Device is not responding to program enable. Check connection.
avrdude: initialization failed, rc=-1
avrdude: AVR device initialized and ready to accept instructions
avrdude: Device signature = 0xe80ed1
avrdude: Expected signature for ATmega32U4 is 1E 95 87

avrdude done.  Thank you.


не понимаю - как вообще Device signature могла смениться??
smalcom
Цитата
однако успех через внешний прошивальщик. какая-то загадка со встроенным..

встроенный - это тот, который SPI использует.

Цитата
не понимаю - как вообще Device signature могла смениться??

сигнатура не менялась. просто МК не отвечает.
Там фьюзами случайно SPI не был выключен?
Ещё может быть установлен тип генератора не тот.
Doka
разобрался в чем накосячил - выключил кварцевый генератор - настроил на внешний клок, вот он и затих...

теперь вот какая непонятка: не могу снять защиту с бутсектора.
фьюз LOCK=0x2F а я хочу туда залить 0xFF - как?

Код
$ sudo avrdude -p atmega32u4 -c usbasp  -U lock:w:0xFF:m

avrdude: AVR device initialized and ready to accept instructions

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

avrdude: Device signature = 0x1e9587 (probably m32u4)
avrdude: reading input file "0xFF"
avrdude: writing lock (1 bytes):

Writing |                                                    | 0% 0.00s ***failed;  
Writing | ################################################## | 100% 0.06s

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

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

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

avrdude: safemode: Fuses OK (E:CB, H:D9, L:BF)

остальные фьюзы прошились как мне надо
Для просмотра полной версии этой страницы, пожалуйста, пройдите по ссылке.
Invision Power Board © 2001-2025 Invision Power Services, Inc.