数码之家

 找回密码
 立即注册

QQ登录

只需一步,快速开始

微信登录

微信扫一扫,快速登录

搜索
查看: 1790|回复: 27

[Arduino] ATmega16写入bootloader,仍然无法在Arduino用串口方式下载

[复制链接]
发表于 2024-5-2 08:19:05 | 显示全部楼层 |阅读模式
ATmega16老板子,8MHz晶振,焊线接出ISP下载接口与AVR-ISP下载器对接,通过Arduino下载启动程序。

下载启动程序时开发板设置:



下载结果如下:


avrdude: Version 7.2-arduino.1
         Copyright the AVRDUDE authors;
         see https://github.com/avrdudes/avrdude/blob/main/AUTHORS

         System wide configuration file is C:\Arduino\portable\packages\MightyCore\hardware\avr\3.0.1\avrdude.conf

         Using Port                    : usb
         Using Programmer              : usbasp
         AVR Part                      : ATmega16
         Chip Erase delay              : 9000 us
         PAGEL                         : PD7
         BS2                           : PA0
         RESET disposition             : possible i/o
         RETRY pulse                   : SCK
         Serial program mode           : yes
         Parallel program mode         : yes
         Timeout                       : 200
         StabDelay                     : 100
         CmdexeDelay                   : 25
         SyncLoops                     : 32
         PollIndex                     : 3
         PollValue                     : 0x53
         Memory Detail                 :

                                           Block Poll               Page                       Polled
           Memory Type Alias    Mode Delay Size  Indx Paged  Size   Size #Pages MinW  MaxW   ReadBack
           ----------- -------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- ---------
           eeprom                  4    20   128    0 no        512    4      0  9000  9000 0xff 0xff
           flash                  33    10   128    0 yes     16384  128    128  4500  4500 0xff 0x00
           lfuse                   0     0     0    0 no          1    1      0  4500  4500 0x00 0x00
           hfuse                   0     0     0    0 no          1    1      0  4500  4500 0x00 0x00
           lock                    0     0     0    0 no          1    1      0  4500  4500 0x00 0x00
           signature               0     0     0    0 no          3    1      0     0     0 0x00 0x00
           calibration             0     0     0    0 no          4    1      0     0     0 0x00 0x00

         Programmer Type : usbasp
         Description     : USBasp ISP and TPI programmer
avrdude: auto set sck period (because given equals null)
avrdude usbasp_spi_set_sck_period() error: cannot set sck period; please check for usbasp firmware update
avrdude: AVR device initialized and ready to accept instructions
avrdude: device signature = 0x1e9403 (probably m16)
avrdude: erasing chip
avrdude: auto set sck period (because given equals null)
avrdude usbasp_spi_set_sck_period() error: cannot set sck period; please check for usbasp firmware update

avrdude: processing -U lock:w:0xff:m
avrdude: reading input file 0xff for lock
         with 1 byte in 1 section within [0, 0]
avrdude: writing 1 byte lock ...
avrdude: 1 byte of lock written
avrdude: verifying lock memory against 0xff
avrdude: 1 byte of lock verified

avrdude: processing -U efuse:w:{bootloader.extended_fuses}:m
avrdude do_op() warning: skipping -U efuse:... as memory not defined for part ATmega16

avrdude: processing -U hfuse:w:0b11000111:m
avrdude: reading input file 0b11000111 for hfuse
         with 1 byte in 1 section within [0, 0]
avrdude: writing 1 byte hfuse ...
avrdude: 1 byte of hfuse written
avrdude: verifying hfuse memory against 0b11000111
avrdude: 1 byte of hfuse verified

avrdude: processing -U lfuse:w:0b10111111:m
avrdude: reading input file 0b10111111 for lfuse
         with 1 byte in 1 section within [0, 0]
avrdude: writing 1 byte lfuse ...
avrdude: 1 byte of lfuse written
avrdude: verifying lfuse memory against 0b10111111
avrdude: 1 byte of lfuse verified

avrdude done.  Thank you.

C:\Arduino\portable\packages\MightyCore\tools\avrdude\7.2-arduino.1/bin/avrdude -CC:\Arduino\portable\packages\MightyCore\hardware\avr\3.0.1/avrdude.conf -v -patmega16 -cusbasp -Uflash:w:C:\Arduino\portable\packages\MightyCore\hardware\avr\3.0.1/bootloaders/empty/empty.hex:i -Ulock:w:0xff:m

avrdude: Version 7.2-arduino.1
         Copyright the AVRDUDE authors;
         see https://github.com/avrdudes/avrdude/blob/main/AUTHORS

         System wide configuration file is C:\Arduino\portable\packages\MightyCore\hardware\avr\3.0.1\avrdude.conf

         Using Port                    : usb
         Using Programmer              : usbasp
         AVR Part                      : ATmega16
         Chip Erase delay              : 9000 us
         PAGEL                         : PD7
         BS2                           : PA0
         RESET disposition             : possible i/o
         RETRY pulse                   : SCK
         Serial program mode           : yes
         Parallel program mode         : yes
         Timeout                       : 200
         StabDelay                     : 100
         CmdexeDelay                   : 25
         SyncLoops                     : 32
         PollIndex                     : 3
         PollValue                     : 0x53
         Memory Detail                 :

                                           Block Poll               Page                       Polled
           Memory Type Alias    Mode Delay Size  Indx Paged  Size   Size #Pages MinW  MaxW   ReadBack
           ----------- -------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- ---------
           eeprom                  4    20   128    0 no        512    4      0  9000  9000 0xff 0xff
           flash                  33    10   128    0 yes     16384  128    128  4500  4500 0xff 0x00
           lfuse                   0     0     0    0 no          1    1      0  4500  4500 0x00 0x00
           hfuse                   0     0     0    0 no          1    1      0  4500  4500 0x00 0x00
           lock                    0     0     0    0 no          1    1      0  4500  4500 0x00 0x00
           signature               0     0     0    0 no          3    1      0     0     0 0x00 0x00
           calibration             0     0     0    0 no          4    1      0     0     0 0x00 0x00

         Programmer Type : usbasp
         Description     : USBasp ISP and TPI programmer
avrdude: auto set sck period (because given equals null)
avrdude usbasp_spi_set_sck_period() error: cannot set sck period; please check for usbasp firmware update
avrdude: AVR device initialized and ready to accept instructions
avrdude: device signature = 0x1e9403 (probably m16)
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: auto set sck period (because given equals null)
avrdude usbasp_spi_set_sck_period() error: cannot set sck period; please check for usbasp firmware update

avrdude: processing -U flash:w:C:\Arduino\portable\packages\MightyCore\hardware\avr\3.0.1/bootloaders/empty/empty.hex:i
avrdude: reading input file C:\Arduino\portable\packages\MightyCore\hardware\avr\3.0.1/bootloaders/empty/empty.hex for flash
         with 0 bytes in 0 sections within [0, -1]
         using 0 pages and 0 pad bytes
avrdude: writing 0 bytes flash ...
Writing | ################################################## | 100% 0.00s
avrdude: 0 bytes of flash written
avrdude: verifying flash memory against C:\Arduino\portable\packages\MightyCore\hardware\avr\3.0.1/bootloaders/empty/empty.hex
Reading | ################################################## | 100% 0.00s
avrdude: 0 bytes of flash verified

avrdude: processing -U lock:w:0xff:m
avrdude: reading input file 0xff for lock
         with 1 byte in 1 section within [0, 0]
avrdude: writing 1 byte lock ...
avrdude: 1 byte of lock written
avrdude: verifying lock memory against 0xff
avrdude: 1 byte of lock verified

avrdude done.  Thank you.

而后拆下ISP下载器连接,将TX、RX接入CH340G的RX、TX,M16的RST通过100u接入CH340G的RTS,然后尝试下载Arduino程序,

用串口下载时,开发板设置:



结果如下:

avrdude: Version 7.2-arduino.1
         Copyright the AVRDUDE authors;
         see https://github.com/avrdudes/avrdude/blob/main/AUTHORS

         System wide configuration file is C:\Arduino\portable\packages\MightyCore\hardware\avr\3.0.1\avrdude.conf

         Using Port                    : COM21
         Using Programmer              : urclock
         Overriding Baud Rate          : 57600
avrdude urclock_getsync() warning: attempt 1 of 10: not in sync
avrdude urclock_getsync() warning: attempt 2 of 10: not in sync
avrdude urclock_getsync() warning: attempt 3 of 10: not in sync
avrdude urclock_getsync() warning: attempt 4 of 10: not in sync
avrdude urclock_getsync() warning: attempt 5 of 10: not in sync
avrdude urclock_getsync() warning: attempt 6 of 10: not in sync
avrdude urclock_getsync() warning: attempt 7 of 10: not in sync
avrdude urclock_getsync() warning: attempt 8 of 10: not in sync
avrdude urclock_getsync() warning: attempt 9 of 10: not in sync
avrdude urclock_getsync() warning: attempt 10 of 10: not in sync
avrdude urclock_recv() warning: programmer is not responding; try -xstrict and/or vary -xdelay=100
avrdude main() error: unable to open programmer urclock on port COM21

avrdude done.  Thank you.

选择的串口
不存在或开发板没有连接




有尝试下面做法,均无效:
1、怀疑RXTX接错,对调无效。
2、M16在下载时碰GND进行人工复位,无效。
3、烧录启动程序时选择低波特率如9600、4800均无效。

为什么会出现这样的问题,难道M16不支持Arduino?请高手指教一下,谢谢!









本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有账号?立即注册 微信登录

x
发表于 2024-5-2 16:53:36 | 显示全部楼层

arduino自动下载,之前发过
回复 支持 反对

使用道具 举报

发表于 2024-5-2 21:03:22 | 显示全部楼层
重启看下什么情况,经常nuo也经常出现这个提示
回复 支持 反对

使用道具 举报

发表于 2024-5-2 23:02:14 | 显示全部楼层
上电的时候按复位?
回复 支持 反对

使用道具 举报

发表于 2024-5-3 13:21:56 | 显示全部楼层
串口 肯定是可以下载的,最底下的 烧录引导程序点过没?
过库有点恶心 串口通信需要延迟1s

回复 支持 反对

使用道具 举报

 楼主| 发表于 2024-5-3 16:08:30 | 显示全部楼层
firseve 发表于 2024-5-3 13:21
串口 肯定是可以下载的,最底下的 烧录引导程序点过没?
过库有点恶心 串口通信需要延迟1s
有的

本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有账号?立即注册 微信登录

x
回复 支持 反对

使用道具 举报

发表于 2024-5-3 18:22:47 | 显示全部楼层
还是用万能的51单片机吧
回复 支持 反对

使用道具 举报

发表于 2024-5-3 21:40:51 | 显示全部楼层
atmega8 88 168 328 16 169 64 128 我都用过了,只有 64 128 169 奇葩一点,其他的都挺正常的
回复 支持 反对

使用道具 举报

发表于 2024-5-3 21:46:34 | 显示全部楼层
用手推车把 我都慢慢放弃 atmega 了,咸鱼上卖 27编程器 用完了手里的片 可惜没啥销量了。。。
后面考虑设计手推车的 还能省个 ch340
回复 支持 反对

使用道具 举报

 楼主| 发表于 2024-5-4 10:09:00 | 显示全部楼层
firseve 发表于 2024-5-3 21:46
用手推车把 我都慢慢放弃 atmega 了,咸鱼上卖 27编程器 用完了手里的片 可惜没啥销量了。。。
后面考虑设 ...

的确是,手推车的带USB芯片好用易用。
回复 支持 反对

使用道具 举报

发表于 2024-5-4 12:02:33 | 显示全部楼层
firseve 发表于 2024-5-3 21:40
atmega8 88 168 328 16 169 64 128 我都用过了,只有 64 128 169 奇葩一点,其他的都挺正常的  ...

确实可以用
回复 支持 反对

使用道具 举报

发表于 2024-5-4 12:03:53 | 显示全部楼层
firseve 发表于 2024-5-3 21:46
用手推车把 我都慢慢放弃 atmega 了,咸鱼上卖 27编程器 用完了手里的片 可惜没啥销量了。。。
后面考虑设 ...

atmega 性价比太差了,除非修理或者有额外要求。
回复 支持 反对

使用道具 举报

发表于 2024-5-5 18:29:05 | 显示全部楼层
换成第三方板子的库和BSP组件,MightyCore,其BSP包可以通过“首选项”里面的“其他开发板管理器地址”来加入(https://mcudude.github.io/Mighty ... ghtyCore_index.json),需要一定的科技上网能力
回复 支持 反对

使用道具 举报

 楼主| 发表于 2024-5-5 19:28:07 | 显示全部楼层
本帖最后由 lmn2005 于 2024-5-5 19:31 编辑
beluga98 发表于 2024-5-5 18:29
换成第三方板子的库和BSP组件,MightyCore,其BSP包可以通过“首选项”里面的“其他开发板管理器地址”来加 ...

我也是用这个的,当前版本是3.01
https://mcudude.github.io/Mighty ... ghtyCore_index.json




本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有账号?立即注册 微信登录

x
回复 支持 反对

使用道具 举报

 楼主| 发表于 2024-5-5 19:30:05 | 显示全部楼层
就是直接下载 这个启动程序也不行:optiboot_flash_atmega16_UART0_57600_8000000L_B0.hex
回复 支持 反对

使用道具 举报

发表于 2024-5-5 23:56:45 | 显示全部楼层

我用的Arduino as isp下载的,可以用的,不过需要注意几个细节:频率设定务必和实际的电路吻合,分清楚内置振荡器还是外部谐振器(这个不能来回换,如果弄错了,需要高压编程器恢复熔丝位的),选择有bootloader的那个(用的串口0),另外保护电压需要按照实际的板子设定(如果供电很稳定,可以全部取消),还有一个重点是自动复位电路需要正确设计,否则无法下载(AVR是下拉复位,和51完全是反的)

本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有账号?立即注册 微信登录

x
回复 支持 1 反对 0

使用道具 举报

 楼主| 发表于 2024-5-6 08:03:51 | 显示全部楼层
beluga98 发表于 2024-5-5 23:56
我用的Arduino as isp下载的,可以用的,不过需要注意几个细节:频率设定务必和实际的电路吻合,分清楚内 ...

你这个不是串口下载模式吧
回复 支持 反对

使用道具 举报

发表于 2024-5-6 11:19:28 | 显示全部楼层
https://oshwhub.com/firseve/eeprom_29
这个是 atmega8 的,也用过 88 168 你可以参考看看电路
只要下载器烧录了 bootloader 就只用usb,不需要下载器了
另外我都是用外置16M晶振,只有型号是 L 的低电压芯片才需要接8M的,电源都是5v
你重点看看我ch340的下载复位电路,一颗电容100n,主要是这里触发的 atmega复位 reset
回复 支持 反对

使用道具 举报

 楼主| 发表于 2024-5-6 11:40:45 | 显示全部楼层
本帖最后由 lmn2005 于 2024-5-6 11:43 编辑
firseve 发表于 2024-5-6 11:19
https://oshwhub.com/firseve/eeprom_29
这个是 atmega8 的,也用过 88 168 你可以参考看看电路
只要下载器 ...

我的板子晶振也是外置的,8MHz
CH340G的RTS有通过电容接到 atmega16L的RST。
准备打个新板试试。旧板可能太旧,现在出现这个问题:可以下载程序,但程序不运行,不知道在哪里出故障。
回复 支持 反对

使用道具 举报

发表于 2024-5-6 13:25:07 | 显示全部楼层
ch340 的 DTR 不是 RTS
另外就是使用8M的话 arduino里面也要选择ex 8M 这个看你截图好像没错
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册 微信登录

本版积分规则

APP|手机版|小黑屋|关于我们|联系我们|法律条款|技术知识分享平台

闽公网安备35020502000485号

闽ICP备2021002735号-2

GMT+8, 2025-7-21 23:40 , Processed in 0.109201 second(s), 9 queries , Redis On.

Powered by Discuz!

© 2006-2025 MyDigit.Net

快速回复 返回顶部 返回列表