From my Linux box (Debian 12) I'd like to program a STM32F103C6T8, also known as a Blue Pill, using the USB connector and from the Arduino IDE.
For this, I first uploaded the HID 2.2.2 bootloader using a FT232 serial device and the STM32CubeProgrammer. No problems there.
Then, trying to upload the Blink sketch from within the Arduino IDE, I was greeted with the message that no upload port could be found, even though the upload method HID was chosen. From what I could find this is a thing that began with IDE 2.x. Workaround is to attach another USB device with DTR, and choose the port for that device.
Now, the IDE does look for the HID device, finds it, but when the upload starts, it fails quickly with an error : Segmentation fault.
I was able to find exactly one post stating that this can be fixed creating a udev rule, making the HID device known and accessible for all users.
I did create that udev rule, rebooted the machine, but..
still the same segmentation fault error.
I'm at my wit's end here.
Anyone knows what else I can do ?
However, that bug has been fixed since Arduino IDE 2.0.1.
I'm going to ask you to post the full verbose output from an upload attempt.
This procedure is not intended to solve the problem. The purpose is to gather more information.
Please do this:
Select File > Preferences... (or Arduino IDE > Settings... for macOS users) from the Arduino IDE menus.
The "Preferences" dialog will open.
Uncheck the box next to Show verbose output during: ☑ compilation in the "Preferences" dialog.
Check the box next to Show verbose output during: ☐ upload.
Click the "OK" button.
Attempt an upload, as you did before.
Wait for the upload to fail.
You will see a "Upload error: ..." notification at the bottom right corner of the Arduino IDE window. Click the "COPY ERROR MESSAGES" button on that notification.
Open a forum reply here by clicking the "Reply" button.
Click the <CODE/> icon on the post composer toolbar.
This will add the forum's code block markup (```) to your reply to make sure the error messages are correctly formatted.
Press the Ctrl+V keyboard shortcut (Command+V for macOS users).
This will paste the error output from the upload into the code block.
Move the cursor outside of the code block markup before you add any additional text to your reply.
Let's focus on the port issue first.
The only error I get when uploading is Sketch uses 24056 bytes (36%) of program storage space. Maximum is 65536 bytes. Global variables use 4416 bytes (21%) of dynamic memory, leaving 16064 bytes for local variables. Maximum is 20480 bytes. Failed uploading: no upload port provided
What I did sofar is:
Completely reinstall Debian 12
On this fresh install I then installed Arduino IDE 1.8.19 and Arduino IDE 2.2.1.
With both jumpers on the Bluepill in the 0 position, I tried to upload blink.ino, with upload method set to HID 2.2.
This results in the no upload port error.
I believe I followed all the instructions for using a HID bootloader, but it still does not work.
There are also no further logs available. Not in /var/log/messages, not in dmesg.
So, still no joy...
Made some progress.
The segmentation fault was, in the end, a problem with my udev rules after all. It turned out that the syntax I had used for my udev rules was slightly different from what was expected in Debian 12.
A fresh install of IDE 2.2.1 still acts strange when uploading for the very first time.
Only after inserting a device that creates a port (/dev/ttyUSB0 or /dev/ttyACM0), this port is seen by the IDE. Although this port is not used when uploading using HID, subseqent uploads work without problems.
Not sure if this is the intended way of working, though, but I can proceed.