Problem Uploading to my Swan MCU using PlatformIO

I am using the tutorial quickstart for the Swan and I’m having a problem flashing the code in this section.
i do not have a STLINK-V3MINI , so I connected to the swan in this section Programming Swan without 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 =============

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

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
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
    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.

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

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 :slight_smile:.
  2. Try a different USB cable, just in case.
  3. Triple check that you are pressing/holdingBOOT the entire time, then press and release RESET a couple of times, then release BOOT.
  4. Worst case scenario? I always recommend the STLINK as it makes life with STM32 much simpler.

Rob

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 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

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

This is very wierd that it does not work?I even tried to
Install a generic USB driver that supports libusb . Download Zadig to install “WinUSB” and consult this article 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 ???

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
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.

1 Like

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?

Regards,
Rob Oudendijk

1 Like

To help with troubleshooting, could you try installing dfu-util from here.

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

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.

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

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?


Not sure why I was able to get this working?

1 Like

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.

1 Like

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

Regards,
rob oudendijk

1 Like

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

2 Likes

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.

2 Likes