Adafruit QT Py M0在PlatformIO上传代码失败:COM4无设备
问题:Adafruit QT Py M0 在PlatformIO中代码上传失败
环境信息
- 系统:Windows 10
- 开发环境:VSCode + PlatformIO
- 设备:疑似Adafruit QT Py M0(朋友赠送,通过图片对比判断)
- 具备编程基础,首次尝试Arduino开发
测试代码
#include <Arduino.h> // the setup function runs once when you press reset or power the board void setup() { Serial.begin(115200); Serial.println("Starting demo..."); } // the loop function runs over and over again forever void loop() { Serial.println("Start of Loop"); delay(1000); }
platformio.ini配置
[env:adafruit_qt_py_m0] platform = atmelsam board = adafruit_qt_py_m0 framework = arduino upload_protocol = sam-ba
问题现象
- 代码编译正常,但上传失败
- 设备LED常亮,触发上传时LED熄灭,电脑发出设备断开提示音
- 已尝试重新连接设备、重启电脑,问题未解决
错误日志
Processing adafruit_qt_py_m0 (platform: atmelsam; board: adafruit_qt_py_m0; framework: arduino) -------------------------------------------------------------------------------------------------------------------------------------Verbose mode can be enabled via `-v, --verbose` option CONFIGURATION: https://docs.platformio.org/page/boards/atmelsam/adafruit_qt_py_m0.html PLATFORM: Atmel SAM (8.1.0) > Adafruit QT Py M0 HARDWARE: SAMD21E18A 48MHz, 32KB RAM, 256KB Flash DEBUG: Current (atmel-ice) External (atmel-ice, blackmagic, jlink) PACKAGES: - framework-arduino-samd-adafruit @ 1.7.10 - framework-cmsis @ 2.50400.181126 (5.4.0) - framework-cmsis-atmel @ 1.2.2 - tool-bossac @ 1.10700.190624 (1.7.0) - toolchain-gccarmnoneeabi @ 1.90301.200702 (9.3.1) LDF: Library Dependency Finder -> https://docs.platformio.org/en/latest/librarymanager/ldf.html LDF Modes: Finder ~ chain, Compatibility ~ soft Found 11 compatible libraries Scanning dependencies... No dependencies Building in release mode Checking size .pio\build\adafruit_qt_py_m0\firmware.elf Advanced Memory Usage is available via "PlatformIO Home > Project Inspect" RAM: [= ] 8.0% (used 2608 bytes from 32768 bytes) Flash: [ ] 3.9% (used 10208 bytes from 262144 bytes) Configuring upload protocol... AVAILABLE: atmel-ice, blackmagic, jlink, sam-ba CURRENT: upload_protocol = sam-ba Looking for upload port... Auto-detected: COM4 Forcing reset using 1200bps open/close on port COM4 Waiting for the new upload port... Uploading .pio\build\adafruit_qt_py_m0\firmware.bin No device found on COM4 *** [upload] Error 1
解决步骤
1. 手动触发BOOTLOADER模式
QT Py M0需要手动进入引导加载模式才能正常上传:
- 按住设备上的
BOOT小按钮 - 按一下
RESET按钮,随后松开BOOT按钮 - 此时设备会生成新的COM端口(可能和原COM4不同),LED会进入闪烁状态
2. 调整PlatformIO上传配置
修改platformio.ini,指定新的上传端口:
[env:adafruit_qt_py_m0] platform = atmelsam board = adafruit_qt_py_m0 framework = arduino upload_protocol = sam-ba upload_port = COMx # 替换为手动进入BOOTLOADER后出现的新COM端口 upload_flags = -v
3. 检查驱动安装
Windows 10可能缺失Adafruit SAMD设备驱动:
- 打开设备管理器,查看是否有带感叹号的"未知设备"或"Adafruit QT Py M0"设备
- 若存在,安装对应SAMD驱动包
4. 确认设备型号
若以上步骤无效,需验证设备型号准确性:
- 查看设备底部的丝印标识,确认具体型号
- 对应修改
platformio.ini中的board参数
5. 换Arduino IDE测试
如果PlatformIO问题仍存在,用Arduino IDE验证设备可用性:
- 在Arduino IDE中添加Adafruit板库,选择"Adafruit QT Py M0"
- 选择正确的COM端口,上传测试代码,确认设备是否能正常响应
内容的提问来源于stack exchange,提问作者JDH
相关产品推荐
相关产品推荐

