Linux(Ubuntu)でPlatformIOを使用する場合
マイコンボードのUSB-Serialチップデバイスの登録が必要です。
99-platformio-udev.rules — PlatformIO latest documentation
マイコンボードのUSB-Serialチップデバイスの VID(Vender ID) と PID(Product ID) は、VSCodeのPlatformIOのターミナル(新規ターミナル)から以下のコマンドで確認できます。
pio device list — PlatformIO latest documentation
$ pio device list
/dev/cu.SLAB_USBtoUART
----------
Hardware ID: USB VID:PID=10c4:ea60 SNR=0001
Description: CP2102 USB to UART Bridge Controller
/dev/cu.uart-1CFF4676258F4543
----------
Hardware ID: USB VID:PID=451:f432 SNR=1CFF4676258F4543
Description: Texas Instruments MSP-FET430UIF
デバイスルールのダウンロードとコピー
$ curl -fsSL https://raw.githubusercontent.com/platformio/platformio-core/develop/platformio/assets/system/99-platformio-udev.rules | sudo tee /etc/udev/rules.d/99-platformio-udev.rules
udev(userspace dev)サービスの再起動
$ sudo service udev restart
現ユーザをグループdialout, plugdevへ追加 (再ログインが必要)
$ sudo usermod -a -G dialout $USER
$ sudo usermod -a -G plugdev $USER
Arduino Nanoでプロジェクトを作成する場合のボードの選択は、新規にブートローダをアップロードしたため下記のデバイスとします。
Arduino Nano ATmega328 (New Bootloader) — PlatformIO latest documentation
platformio.ini
; PlatformIO Project Configuration File
;
; Build options: build flags, source filter
; Upload options: custom upload port, speed and extra flags
; Library options: dependencies, extra library storages
; Advanced options: extra scripting
;
; Please visit documentation for the other options and examples
; https://docs.platformio.org/page/projectconf.html
[env:nanoatmega328new]
platform = atmelavr
board = nanoatmega328new
framework = arduino