ESP32-C3
USB CDC OnBoot 配置方法
之前用arduino-cli 配置ESP32-C3,编写代码和编译烧录都没有问题, 只是在使用arduino-cli monitor -p /dev/ttyACM0 没有输出, 查了一圈发现是因为USB CDC Onboot 没有开启, 然后各种搜索完全没有结果,直到我直接去github官方下面开了issue,一小时内就解决了我的问题,这个老哥厉害了。
下面是引用它的引文:
Custom board options such as "**USB CDC On Boot**" are set via the FQBN you pass to `arduino-cli` commands via the `--fqbn` flag.
The format of the FQBN is like this:
<vendor ID>:<architecture>:<board ID>[:<menu ID>=<option ID>[,<menu ID>=<option ID>]...]
You can learn all the available menu IDs and option IDs for a given board by running [the following command](https://arduino.github.io/arduino-cli/latest/commands/arduino-cli_board_details/):
arduino-cli board details --fqbn <FQBN>
(where `<FQBN>` is replaced by the fully qualified board name of the board you are using)
For example if you are using the "**ESP32C3 Dev Module**" board (FQBN: `esp32:esp32:esp32c3`):
$ ./arduino-cli board details -b esp32:esp32:esp32c3
Board name: ESP32C3 Dev Module
FQBN: esp32:esp32:esp32c3
Board version: 2.0.4
Package name: esp32
Package maintainer: Espressif Systems
Package URL: https://raw.githubusercontent.com/espressif/arduino-esp32/gh-pages/package_esp32_index.json
Package website: https://github.com/espressif/arduino-esp32
Package online help: http://esp32.com
Platform name: esp32
Platform category: ESP32
Platform architecture: esp32
Platform URL: https://github.com/espressif/arduino-esp32/releases/download/2.0.4/esp32-2.0.4.zip
Platform file name: esp32-2.0.4.zip
Platform size (bytes): 259715595
Platform checksum: SHA-256:832609d6f4cd0edf4e471f02e30b7f0e1c86fdd1b950990ef40431e656237214
Required tool: esp32:riscv32-esp-elf-gcc gcc8_4_0-esp-2021r2-patch3
Required tool: esp32:xtensa-esp32-elf-gcc gcc8_4_0-esp-2021r2-patch3
Required tool: esp32:xtensa-esp32s2-elf-gcc gcc8_4_0-esp-2021r2-patch3
Required tool: esp32:xtensa-esp32s3-elf-gcc gcc8_4_0-esp-2021r2-patch3
Required tool:
尝试使用
arduino-cli board details -b esp32:esp32:esp32c3
然后我突然明白了怎么用了。
<vendor ID>:<architecture>:<board ID>[:<menu ID>=<option ID>[,<menu ID>=<option ID>]...]
这个结构就是我烧录时候需要遵循的。
通过查询找到了USB CDC Onboot的配置是esp32:esp32:esp32c3:USBOnBoot=cdc
menuID: USBOnBoot
optionID: cdc
于是直接烧录:
arduino-cli compile -b esp32:esp32:esp32c3:USBOnBoot=cdc -p /dev/ttyACM0 --upload
烧录完成直接执行:
arduino-cli monitor -p /dev/ttyACM0
顺利看到输出,就非常奈斯。。
希望对你有帮助哈!