Прошивка atmega328p

Есть плата без кварца и мк атемга 328 p. Нужно прошить мк, чтобы работал и без кварца.
Как это сделать?

Залить прошивку и установить фьюзы в режим внутреннего тактирования. Про фьюзы прочитать в даташите на МК.

В файл boards.txt добавить вот этот текст
##############################################################

dior.name=Arduino 328P 8MHz int

dior.upload.tool=avrdude
dior.upload.protocol=arduino
dior.upload.maximum_size=30720
dior.upload.maximum_data_size=2048
dior.upload.speed=57600

dior.bootloader.tool=avrdude
dior.bootloader.low_fuses=0xE2
dior.bootloader.high_fuses=0xDA
dior.bootloader.extended_fuses=0xFD
dior.bootloader.file=atmega/ATmegaBOOT_168_atmega328_pro_8MHz.hex
dior.bootloader.unlock_bits=0x3F
dior.bootloader.lock_bits=0x0F

dior.build.mcu=atmega328p
dior.build.f_cpu=8000000L
dior.build.board=AVR_FIO
dior.build.core=arduino
dior.build.variant=eightanaloginputs

##############################################################
и прописать фьюзы Lock : 0x3F, High: 0xDA, Low: 0xE2, Extended: 0x06
Далее выбираешь плату Arduino 328P 8MHz int и компилируешь скетч.

зачем так сложно, выбрать чип в ядре миникоре внутренний 8 мегагер и записать загрузчик и будет ЩАСТЬЕ

1 лайк


У меня такое меню

Когда изменишь файл boards.txt, то там появится новая плата. Только после изменения, не забудь перегрузить IDE.

Не могу найти этот файл(

чуток ошибся файл называется boards.txt
Путь к нему там где находится exe-шник который стартует IDE в каталоге \hardware\arduino\avr
Кликните правой кнопкой по иконке IDE и на вкладку показатьрасположения файла.

сделал, выбрал плату, нажал записать загрузчик


, но вот что пишет
Property ‘bootloader.tool.’ is undefined

а это где прописыватт?

а это что за ошибка?

заработало, всем спасибо)))))))))))

Здравствуйте, подскажите пожалуйста.

Прошиваю бутлоадер в голый мк (Atmega328p) потом первый раз из ардуины скетч грузиться в мк и работает.
А второй раз уже не грузиться скетч, пока не перезалью бутлоадер.

Куда копать ?

после загрузки лодыря заливать надо через USB-UART

Естественно, так и гружу программу уже через USB-UART после загрузки бутлоадера.
первый раз успешно, потом - “нет связи с программатором”.

Где вывод ИДЕ?
Фьюзы правил?

Сорян, не сообразил сразу выложить логи, повторил операции загрузки.

Вывод IDE при попытке повторной загрузке скетча (поверх ранее загруженного скетча в МК):

Спойлер
  Using Port                    : COM12
     Using Programmer              : arduino
     Overriding Baud Rate          : 57600

avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 1 of 10: not in sync: resp=0xec
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 2 of 10: not in sync: resp=0xec
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 3 of 10: not in sync: resp=0xec

Лог записи бутлоадера:

Спойлер

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                    : COM14
     Using Programmer              : stk500v1
     Overriding Baud Rate          : 19200

Reading | ################################################## | 100% 0.02s

avrdude: verifying …
avrdude: 1 bytes of lfuse verified

avrdude done. Thank you.

     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 : STK500
     Description     : Atmel STK500 Version 1.x firmware
     Hardware Version: 2
     Firmware Version: 1.18
     Topcard         : Unknown
     Vtarget         : 0.0 V
     Varef           : 0.0 V
     Oscillator      : Off
     SCK period      : 0.1 us

avrdude: AVR device initialized and ready to accept instructions

Reading | ################################################## | 100% 0.06s

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/atmega/ATmegaBOOT_168_atmega328.hex”
avrdude: writing flash (32670 bytes):

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

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

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

avrdude: verifying …
avrdude: 32670 bytes of flash verified
avrdude: reading input file “0x0F”
avrdude: writing lock (1 bytes):

Writing | ################################################## | 100% 0.05s

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: 1 bytes of lock verified

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                    : COM12
     Using Programmer              : arduino
     Overriding Baud Rate          : 57600
     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 : Arduino
     Description     : Arduino
     Hardware Version: 2
     Firmware Version: 1.16
     Vtarget         : 0.0 V
     Varef           : 0.0 V
     Oscillator      : Off
     SCK period      : 0.1 us

avrdude: AVR device initialized and ready to accept instructions

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

avrdude: Device signature = 0x1e950f (probably m328p)
avrdude: reading input file “C:\Users\2BA0~1\AppData\Local\Temp\arduino_build_473665/IR-ENC-ATT-CTRL-MUTE-BEEP.ino.hex”
avrdude: writing flash (9644 bytes):

Writing | ################################################## | 100% 2.66s

avrdude: 9644 bytes of flash written
avrdude: verifying flash memory against C:\Users\2BA0~1\AppData\Local\Temp\arduino_build_473665/IR-ENC-ATT-CTRL-MUTE-BEEP.ino.hex:
avrdude: load data flash data from input file C:\Users\2BA0~1\AppData\Local\Temp\arduino_build_473665/IR-ENC-ATT-CTRL-MUTE-BEEP.ino.hex:
avrdude: input file C:\Users\2BA0~1\AppData\Local\Temp\arduino_build_473665/IR-ENC-ATT-CTRL-MUTE-BEEP.ino.hex contains 9644 bytes
avrdude: reading on-chip flash data:

Reading | ################################################## | 100% 1.98s

avrdude: verifying …
avrdude: 9644 bytes of flash verified

avrdude done. Thank you.

@nabiullin.com
Надо Resetнуть в процессе …
На плате с распаянным USB-UART есть механизм сброса через DTR … - вам надо дергать Reset вручную в момент когда начинает стучаться в порт …

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

1 лайк

Так если чип новый он как бы и так без кварца работает, не ?

не, без кварца он не работает.