# Problem Uploading to my Swan MCU using PlatformIO

**URL:** https://discuss.blues.com/t/problem-uploading-to-my-swan-mcu-using-platformio/1698
**Category:** Hardware
**Created:** [October 4, 2023, 12:48am UTC](https://discuss.blues.com/t/problem-uploading-to-my-swan-mcu-using-platformio/1698 "2023-10-04T00:48:33Z")
**Posts on this page:** 16
**Page:** 1

<div class="post-metadata">

### Author: ![skruglewicz](https://avatars.discourse-cdn.com/v4/letter/s/d2c977/32.png) [@skruglewicz](https://discuss.blues.com/u/skruglewicz)
#### Post date: [October 4, 2023, 12:48am UTC](https://discuss.blues.com/t/problem-uploading-to-my-swan-mcu-using-platformio/1698/1 "2023-10-04T00:48:33Z")

</div>

I am using the tutorial quickstart for the Swan and I’m having a problem flashing the code in this [section](https://dev.blues.io/quickstart/swan-quickstart/#flash-firmware).  
i do not have a STLINK-V3MINI , so I connected to the swan in this section [Programming Swan without the STLINK-V3MINI](https://dev.blues.io/quickstart/swan-quickstart/#programming-swan-the-stlink-v3mini)

I was able to build but not upload. I received the following error  
No DFU capable USB device available  
\*\*\* [upload] Error 74  
==========[FAILED] Took 56.52 seconds =============

 ![image](https://us1.discourse-cdn.com/flex020/uploads/blues/original/1X/e1d77c231792b9af9d03e25cc06541524271e7a0.png)

I followed all the steps and as you can see COM7 is available. What am I doing wrong?

---

<div class="post-metadata">

### Author: ![skruglewicz](https://avatars.discourse-cdn.com/v4/letter/s/d2c977/32.png) [@skruglewicz](https://discuss.blues.com/u/skruglewicz)
#### Post date: [October 4, 2023, 1:33am UTC](https://discuss.blues.com/t/problem-uploading-to-my-swan-mcu-using-platformio/1698/2 "2023-10-04T01:33:42Z")

</div>

Here is the terminal output for the UPLOAD  
Executing task in folder My First Swan Project: .platformio\penv\Scripts\platformio.exe run --target upload --upload-port COM7

Processing bw\_swan\_r5 (platform: ststm32; board: bw\_swan\_r5; framework: arduino)  
-----------------------------------------------------------------------------------------------Verbose mode can be enabled via `-v, --verbose` option  
CONFIGURATION:  
[docs.platformio.org/page/boards/ststm32/bw\_swan\_r5.html](http://docs.platformio.org/page/boards/ststm32/bw_swan_r5.html)  
PLATFORM: ST STM32 (17.0.0) \> BluesWireless Swan R5  
HARDWARE: STM32L4R5ZIY6 120MHz, 640KB RAM, 2MB Flash  
DEBUG: Current (blackmagic) External (blackmagic, cmsis-dap, jlink, stlink)  
PACKAGES:

- framework-arduinoststm32 @ 4.20600.231001 (2.6.0)
- framework-cmsis @ 2.50700.210515 (5.7.0)
- tool-dfuutil @ 1.11.0
- tool-openocd @ 3.1200.0 (12.0)
- tool-stm32duino @ 1.0.2
- toolchain-gccarmnoneeabi @ 1.120301.0 (12.3.1)  
LDF: Library Dependency Finder → [Library Dependency Finder (LDF) — PlatformIO latest documentation](https://bit.ly/configure-pio-ldf)  
LDF Modes: Finder ~ chain, Compatibility ~ soft  
Found 13 compatible libraries  
Scanning dependencies…  
Dependency Graph  
|-- Wire @ 1.0.0  
|-- Blues Wireless Notecard @ 1.5.0  
Building in release mode  
Checking size .pio\build\bw\_swan\_r5\firmware.elf  
Advanced Memory Usage is available via “PlatformIO Home \> Project Inspect”  
RAM: [] 0.8% (used 5124 bytes from 655360 bytes)  
Flash: [] 1.4% (used 29300 bytes from 2097152 bytes)  
Configuring upload protocol…  
AVAILABLE: blackmagic, cmsis-dap, dfu, jlink, mbed, serial, stlink  
CURRENT: upload\_protocol = dfu  
Uploading .pio\build\bw\_swan\_r5\firmware.bin  
dfu-util 0.11

Copyright 2005-2009 Weston Schmidt, Harald Welte and OpenMoko Inc.  
Copyright 2010-2021 Tormod Volden and Stefan Schmidt  
This program is Free Software and has ABSOLUTELY NO WARRANTY

No DFU capable USB device available  
\*\*\* [upload] Error 74  
================================= [FAILED] Took 5.15 seconds =================================

- The terminal process platformio\penv\Scripts\platformio.exe ‘run’, ‘–target’, ‘upload’, ‘–upload-port’, ‘COM7’" terminated with exit code: 1.
- Terminal will be reused by tasks, press any key to close it.

---

<div class="post-metadata">

### Author: ![skruglewicz](https://avatars.discourse-cdn.com/v4/letter/s/d2c977/32.png) [@skruglewicz](https://discuss.blues.com/u/skruglewicz)
#### Post date: [October 4, 2023, 1:39am UTC](https://discuss.blues.com/t/problem-uploading-to-my-swan-mcu-using-platformio/1698/3 "2023-10-04T01:39:49Z")

</div>

I might add that I do the following everytime before an upload as directed

 ![image](https://us1.discourse-cdn.com/flex020/uploads/blues/original/1X/0dda2aafa5dc8f998abce219d73baeb3f5413cf1.png)

---

<div class="post-metadata">

### Author: ![RobLauer](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.blues.com/roblauer/32/1567_2.png) [@RobLauer](https://discuss.blues.com/u/RobLauer)
#### Post date: [October 4, 2023, 2:18pm UTC](https://discuss.blues.com/t/problem-uploading-to-my-swan-mcu-using-platformio/1698/4 "2023-10-04T14:18:59Z")

</div>

Hi @skruglewicz,

Sorry to hear you’ve hit a roadblock with the Swan. It looks like you’re doing everything correctly, but I have a few tricks you can try:

1. The classic “reboot your Windows PC” has fixed serial issues in the past 🙂.
2. Try a different USB cable, just in case.
3. Triple check that you are pressing/holding`BOOT` the entire time, then press and release `RESET` a couple of times, then release `BOOT`.
4. Worst case scenario? I always recommend the [STLINK](https://shop.blues.io/collections/accessories/products/stlink-v3mini) as it makes life with STM32 much simpler.

Rob

---

<div class="post-metadata">

### Author: ![skruglewicz](https://avatars.discourse-cdn.com/v4/letter/s/d2c977/32.png) [@skruglewicz](https://discuss.blues.com/u/skruglewicz)
#### Post date: [October 4, 2023, 2:36pm UTC](https://discuss.blues.com/t/problem-uploading-to-my-swan-mcu-using-platformio/1698/5 "2023-10-04T14:36:55Z")

</div>

Thanks I will try to reboot my windows PC and see if that helps.

I tried multiple USB cables and even used the one that is working with my notecarrier-a? So it’s not the cable.

I have done the DFU boot sequence the same way many times. One thing I observed though is that before I do it the com port shows on my device manager, then after the DFU buttons are pressed it disappears from the device manager. I have done a lot of embedded projects including Arduino IDE and have many USB drivers installed on this PC. Could that be It?

I’m doing a contest for [Hackster.io](http://Hackster.io) and was awarded the Blues Kit for the project, that I submitted. I’m retired and on a fixed budget. I checked out the STLINK connection and looks like I also need to purchase a Lipo battery to make the connection? I’m not in the market right now to make this purchase.

I’ll let you know what happens with the reboot.  
THanks  
Steve K

---

<div class="post-metadata">

### Author: ![skruglewicz](https://avatars.discourse-cdn.com/v4/letter/s/d2c977/32.png) [@skruglewicz](https://discuss.blues.com/u/skruglewicz)
#### Post date: [October 4, 2023, 5:35pm UTC](https://discuss.blues.com/t/problem-uploading-to-my-swan-mcu-using-platformio/1698/6 "2023-10-04T17:35:23Z")

</div>

I just tried to reboot my PC and trried it again… Same problem.  
I tried it on another windows PC and I have the same problem  
the PlatformIO version is  
Core: 6.1.11 Home: 3.4.4

And VS code is  
 ![image](https://us1.discourse-cdn.com/flex020/uploads/blues/original/1X/56d98f1dab23b08b3500222106df646991711278.png)

This is very wierd that it does not work?I even tried to  
Install a generic USB driver that supports `libusb` . Download [Zadig](https://zadig.akeo.ie/) to install “WinUSB” and [consult this article](https://www.hanselman.com/blog/how-to-fix-dfuutil-stm-winusb-zadig-bootloaders-and-other-firmware-flashing-issues-on-windows) for more information.

And this did not help. The SAME DFU error. I’m stuck here with programming my SWAN. Could it be that I’m missing something in my VSCode PlatformIO instalation on 2 Windows PC’s ???

---

<div class="post-metadata">

### Author: ![skruglewicz](https://avatars.discourse-cdn.com/v4/letter/s/d2c977/32.png) [@skruglewicz](https://discuss.blues.com/u/skruglewicz)
#### Post date: [October 5, 2023, 3:16am UTC](https://discuss.blues.com/t/problem-uploading-to-my-swan-mcu-using-platformio/1698/7 "2023-10-05T03:16:40Z")

</div>

I ended up using the Arduino IDE and was sucessful with the example . I did not receive the DFU Connected device. I followed the tutorial at [https://discuss.blues.com/t/problem-uploading-to-my-swan-mcu-using-platformio/1698/6](https://discuss.blues.com/t/problem-uploading-to-my-swan-mcu-using-platformio/1698/6)  
There must be something wrong with using VScode, platformIO or the platformIO tutorial. because I could never get the Code to the Swan.  
THe Arduino code built and the firmware was sent to the swan the First time I completed the tutorial. I will be using the ArduinoIDE for now unless I find a fix for the PlatformIO tutorial.

---

<div class="post-metadata">

### Author: ![robouden](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.blues.com/robouden/32/336_2.png) [@robouden](https://discuss.blues.com/u/robouden)
#### Post date: [October 5, 2023, 3:47am UTC](https://discuss.blues.com/t/problem-uploading-to-my-swan-mcu-using-platformio/1698/8 "2023-10-05T03:47:40Z")

</div>

[skruglewicz](https://discuss.blues.com/u/skruglewicz)

You tried to do the flashing within VSCode instead of t use the : .platformio\penv\Scripts\platformio.exe run --target upload --upload-port COM7 command. Just press the Upload icon?

 ![image](https://us1.discourse-cdn.com/flex020/uploads/blues/original/1X/47533312c52e458dd65cef3165e4c56e4a6d20b9.png)

Regards,  
Rob Oudendijk

---

<div class="post-metadata">

### Author: ![mat](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.blues.com/mat/32/230_2.png) [@mat](https://discuss.blues.com/u/mat)
#### Post date: [October 6, 2023, 3:57pm UTC](https://discuss.blues.com/t/problem-uploading-to-my-swan-mcu-using-platformio/1698/9 "2023-10-06T15:57:39Z")

</div>

To help with troubleshooting, could you try installing `dfu-util` from [here](https://dfu-util.sourceforge.net/releases/dfu-util-0.11-binaries.tar.xz).

When you run `dfu-util -l` it will show you which DFU-capable devices are connected to your PC.

---

<div class="post-metadata">

### Author: ![skruglewicz](https://avatars.discourse-cdn.com/v4/letter/s/d2c977/32.png) [@skruglewicz](https://discuss.blues.com/u/skruglewicz)
#### Post date: [October 8, 2023, 6:29am UTC](https://discuss.blues.com/t/problem-uploading-to-my-swan-mcu-using-platformio/1698/10 "2023-10-08T06:29:49Z")

</div>

> [@mat](#):
>
> fu-util -l

This utility shows noting.  
I finally was able to get it working on my PC consistantly, but I don’t know why. I installed the STM32CubeIDE and the STM32Cube Programmer and ever since then I am able to use PlatformIO and ArduinoIDE on my windows10 PC.  
Here are the results of the DFU-util -i run show nothing and the Device manager showing com8 and the sucessful Upload to the swan.

 ![image](https://us1.discourse-cdn.com/flex020/uploads/blues/original/1X/1329e62617af658e24b3bf989ef8a8d3f683c0a3.png)

The install of the STM32Cube software MUST have Fixed the DFU driver?  
My other WIN10 PC still has the same problem. But I cannot install the STMCUBE software on it , because I’ve ran out of disk space

---

<div class="post-metadata">

### Author: ![skruglewicz](https://avatars.discourse-cdn.com/v4/letter/s/d2c977/32.png) [@skruglewicz](https://discuss.blues.com/u/skruglewicz)
#### Post date: [October 8, 2023, 6:39am UTC](https://discuss.blues.com/t/problem-uploading-to-my-swan-mcu-using-platformio/1698/11 "2023-10-08T06:39:17Z")

</div>

I noticed an error but it seems to have fixed itsel and the Upload was able to complete.  
Can you make anything out of the highlighted text below? seems like the device firmware is corupt? should I get a replace ment SWAN?

 ![image](https://us1.discourse-cdn.com/flex020/uploads/blues/original/1X/4dbf693b17f7555b131af4f6b1ff3f11a029354a.png)  
Not sure why I was able to get this working?

---

<div class="post-metadata">

### Author: ![skruglewicz](https://avatars.discourse-cdn.com/v4/letter/s/d2c977/32.png) [@skruglewicz](https://discuss.blues.com/u/skruglewicz)
#### Post date: [October 8, 2023, 6:43am UTC](https://discuss.blues.com/t/problem-uploading-to-my-swan-mcu-using-platformio/1698/12 "2023-10-08T06:43:25Z")

</div>

I finally was able to get it working on my PC consistantly, but I don’t know why. I installed the STM32CubeIDE and the STM32Cube Programmer and ever since then I am able to use PlatformIO and ArduinoIDE on my windows10 PC.

---

<div class="post-metadata">

### Author: ![robouden](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.blues.com/robouden/32/336_2.png) [@robouden](https://discuss.blues.com/u/robouden)
#### Post date: [October 8, 2023, 6:55am UTC](https://discuss.blues.com/t/problem-uploading-to-my-swan-mcu-using-platformio/1698/13 "2023-10-08T06:55:33Z")

</div>

> [@skruglewicz](#):
>
> i

Maybe the STM32CubeIDE and the STM32Cube Programmer programs did install the right drivers?

Regards,  
rob oudendijk

---

<div class="post-metadata">

### Author: ![mat](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.blues.com/mat/32/230_2.png) [@mat](https://discuss.blues.com/u/mat)
#### Post date: [October 8, 2023, 11:03pm UTC](https://discuss.blues.com/t/problem-uploading-to-my-swan-mcu-using-platformio/1698/14 "2023-10-08T23:03:55Z")

</div>

This is a small glitch in the DFU utility. You can safely ignore this error.

---

<div class="post-metadata">

### Author: ![mat](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.blues.com/mat/32/230_2.png) [@mat](https://discuss.blues.com/u/mat)
#### Post date: [October 8, 2023, 11:05pm UTC](https://discuss.blues.com/t/problem-uploading-to-my-swan-mcu-using-platformio/1698/15 "2023-10-08T23:05:41Z")

</div>

I’m glad to hear you got things working! Yes, I imagine installing the ST tools fixed the DFU driver. Thank you for dillhigently reporting and finding a solution.

---

<div class="post-metadata">

### Author: ![Francois](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.blues.com/francois/32/15_2.png) [@Francois](https://discuss.blues.com/u/Francois)
#### Post date: [August 30, 2024, 5:43pm UTC](https://discuss.blues.com/t/problem-uploading-to-my-swan-mcu-using-platformio/1698/16 "2024-08-30T17:43:05Z")

</div>

Duh. After hours of battling this issue, both on my Win11 and Mac, this is exactly it!
