I am trying to migrate SWAN code development from Arduino IDE to VSCode/Platformio. The imported Arduino code builds and uploads to SWAN (either by DFU or mini ST-Link).
However, after the code is uploaded to the SWAN, Windows 10 shows the SWAN COM port as hidden (i.e. as if device is disconnected).
Resetting the SWAN restarts and runs the code fine, but Windows still shows disconnected. SWAN power cycling and Laptop power cycling has no affect either. The workaround I found is to uninstall the SWAN port via Windows Device Manger and then use Arduino IDE to DFU upload the SWAN code again. I can then use the VSCode/Platformio serial monitor (or Arduino Serial monitor or Putty). Since the SWAN COM port works fine after uploading via Ardunio, I suspect not a Windows issue but either a VScode or Platformio extension problem, but my searches have yet to hit on a similar issue resolution. Thanks!
Hi @JimM ,
This sounds a lot like you are missing a build flag to enable the USB port o the Swan.
Can you confirm that you have the following line in your platformio.ini
file?
build_flags = -D PIO_FRAMEWORK_ARDUINO_ENABLE_CDC
1 Like
@zfields Your prompt reply and additional line for platformio.ini file solved the problem and enabled the SWAN USB port for serial monitor! I missed that configuration detail in the SWAN documentation in the VSCode Platformio extension, or it is missing or too buried. Thanks again!
2 Likes