我正在尝试将我的 atmel ICE 与 platformIO 和 VS Code 一起使用,而不是 Atmel Studio,因为当我想将 Arduino.h 与库一起使用时,这个软件很痛苦。
但是我不能用我的程序员上传。我尝试使用 32 针 ATmega328。
我首先在此页面上使用了 PIO 关于如何使用 Atmel-ICE 的文档:https ://docs.platformio.org/en/latest/plus/debug-tools/atmel-ice.html
If you would like to use this tool for firmware uploading, please change upload
protocol:
[env:myenv]
platform = ...
board = ...
debug_tool = atmel-ice
upload_protocol = atmel-ice
所以这就是我在我的文件中写的:
[env:ATmega328P]
platform = atmelavr
board = ATmega328P
framework = arduino
upload_protocol = atmel-ice
当我在 PIO 上运行上传命令时,我收到了这条消息:
DATA: [ ] 0.4% (used 9 bytes from 2048 bytes)
PROGRAM: [ ] 1.4% (used 444 bytes from 32256 bytes)
Configuring upload protocol...
AVAILABLE: atmel-ice
CURRENT: upload_protocol = atmel-ice
Looking for upload port...
Error: Please specify `upload_port` for environment or use global `--upload-port` option.
For some development platforms it can be a USB flash drive (i.e. /media/<user>/<device name>)
*** [upload] Explicit exit, status 1
那时我不确定要尝试什么。我尝试了下面描述的几件事,但我不确定我是否走在正确的轨道上。例如,与 Arduino 相比,atmel ICE 程序员没有与之关联的 USB 端口号,所以我不知道应该如何在我的 .ini 文件中指定我的 upload_port 参数。
platformIO 文档https://docs.platformio.org/en/latest/projectconf/section_env_upload.html中描述了一些选项, 但我完全迷失了。我觉得我得到的信息是:对于某些开发平台,它可以是 USB 闪存驱动器(即 /media//)可能是一个很好的线索。知道我应该在我的 .ini 文件中更改什么以使我的 atmel ICE 工作吗?谢谢!
我尝试过的其他事情:我在一篇帖子上读到(对不起,我再也找不到链接了)添加
upload_port = usb
可以解决问题。将此行添加到我的 platformio.ini 时,我收到一条不同的错误消息:
avrdude: Can't find programmer id "atmel-ice"
Valid programmers are:
2232HIO = FT2232H based generic programmer
4232h = FT4232H based generic programmer
arduino = Arduino
而这样的例子不胜枚举..
我搜索并找到了这个帖子,它有同样的错误信息!: https ://community.platformio.org/t/atmega-328-internal-8mhz-oscillator-atmel-ice-upload-troubles/10416
这里的解决方案是添加
upload_flags = -e
但这对我没有任何改变。
他还提到他对 328p8m.json 文件进行了更改,在我的例子中是 ATmega328P.json。我什至不知道在哪里可以找到它。这有关系吗?