Arduino 2.0 ide with stm32 and Linux Mint 21

Just installed Arduino ide ver 2.0 on my Linux Mint laptop as Win10 is taking forever to compile even the shortest of sketches.
Works fine with Arduino Uno.
I'm trying to get it working with stm32 Black Pill which works with Win10 but slow.
I've installed the stm32 package so i can select the stm32f401 ok.
I have also installed STM Cube.
However, when it comes to uploading the upload method "STMCubeProgrammer(DFU)"
does not appear in the "Tools " drop down menu as it does with Windows and the device is shown as not connected.
All I see in that lower section of the Tools menu is the same as for the Arduino Uno.
Any advice welcome.
Don

Your topic was MOVED to its current forum category which is more appropriate than the original

Hi @m5aky

Make sure you have selected the STM32 board from the Tools > Board menu of the Arduino IDE.

The Tools > Upload method menu is a custom board option menu that is defined specifically for the STM32 boards, so you won't see that menu if you have any other board selected in the Tools > Board menu.

I have selected the correct 32F401 board in Tools it says it,'s there in the bottom right corner but it says it's disconnected and the upload options that I see in Windows is not appearing. Earlier I successfully uploaded the Blink sketch to an Arduino Uno but on returning to the Arduino it now says that is not connected and
I cannot see the port option when selecting the Uno.
How do I uninstall Arduino 2.0 completely? I would like to start again from scratch. I downloaded the Arduino 2.0 64 bit appimage and installed from that.
I have tried various permission options for the Linux usb ports. As I said it did work earlier but doesn't seem to be seeing the serial ports now.
If I need to provide more info please let me know.
Don

Did you also select a port ?

Hi @m5aky,

I've just completed the same migration away from Windows 10 pro for the same reasons. :wink:
Having also just finished setting up both the Arduino IDE's under Linux Mint 21 I found that I could not see a port for any of my ESP2866 or ESP32's

After a bit of digging around in Google, I found that most ESP 8266 & 32's use a USB to Serial converter CH340 IC that has not been recognized with Linux Mint. Therefore you need to install a CH340 driver for this to work.

I found this it's worked well for me How to Install CH340 Drivers (Look under Linux)

Also, should you happen to come across any errors opening Serial ports? See Fix port access on Linux

P.S You'll find that compiling times will reduce from 10's minutes under Win 10 to 10's seconds under Linux Mint :smiley: :+1:

HTH?

Thanks for the replies

Hi Robrs
. I will follow that advice and report back later.

UKHeliBob.
Initially i was able to select a port for the Arduino as far as i remember and I managed to upload a simple sketch.
I have not been able to select a port for the STM device but i think it's automatic on those boards but I can't find a suitable upload option in linux.
On windows I am using an earlier version.
On returning to Arduino I cannot see the "port" option in tools.
I tried downloading Ver 2.0 via the software manager and it gave advice as to how to enable permissions to access the usb ports by creating a rule in etc/udev/rules.d but that didn't appear to work either.
Don
Don m5aky

There are four significant folders used by Arduino IDE 2.x. You can return the computer to the pre-install environment by deleting or renaming all of them (though you might choose to retain specific ones like the sketchbook if you aren't concerned with their effect).

:warning: Please be very careful when deleting things from your computer. When in doubt, back up!

I'll share the locations of these folders on Linux.

Configuration folder

Arduino IDE stores some configuration data under this folder.

~/.arduinoIDE/

User Data folder

Arduino IDE stores some additional configuration data under this folder.

~/.config/arduino-ide/

Data folder

Arduino IDE uses this folder for storage of the following things:

  • Index files used by Boards Manager and Library Manager
  • The "built-in" libraries that are installed on the first run of the IDE (e.g., "Servo", "Keyboard")
  • The boards platforms installed via Boards Manager
  • Cache of the files downloaded for Boards Manager and Library Manager installations
~/.arduino15/

Sketchbook folder

Arduino IDE shows sketches you save under this folder in the File > Sketchbook menu and also in the "Sketchbook" view accessible via the folder icon on the "Activity Bar" on the left side of the window.

The location of the sketchbook is configurable by opening File > Preferences and then changing the "Sketchbook location" preference.

The default sketchbook location is:

~/Arduino/

I decided to do a clean install of Linux Mint 21.
I installed Arduino2.0 again from the software manager. Didn't bother with the stm32 yet.
I aded the lines to the 50-arduino.rules file.
Still no option in tools to configure the port for the Uno. I am wondering now if I did succeed peviously. If I use the new menu at the top to change the board it says no ports found.
Following the instructions to install the ch341 driver, the command:
"sudo chmod a+rw/dev/ttyUSB0" says the file does not exist. I've used this with success on earlier versions of Mint.
Downloaded the CH341 driver and extracted it and changed to that directory.
entered "clean make" and it seemed ok but when I get to "make" I get errors. That's where I stopped for now.
Don

I don't have experience with Mint, but I use CH340 on Ubuntu without any driver installation.

As for udev rules, I don't think this is needed in order for the port to show in the Tools > Port menu, but rather for you to be able to access the port to upload, which will cause a "permission denied" error during the upload, a distinctly different symptom than what you are experiencing.


In order to gather more information that might help us to troubleshoot your problem, I'm going to ask you to run the lsusb command from the command line and share the output.

  1. Open a terminal.
  2. If it is not already connect the USB cable of your Arduino board to your computer.
  3. Type lsusb
  4. Press Enter
  5. Click and drag the mouse to select all the output in the terminal window.
  6. Press Ctrl+C.
    This will copy the selected text to the clipboard.
  7. Open a forum reply here by clicking the Reply button.
  8. Click the </> icon on the post composer toolbar.
    This will add the forum's code block markup (```) to your reply to make sure the output is correctly formatted.
    Code block
  9. Press Ctrl+V.
    This will paste the output into the code block.
  10. Move the cursor outside of the code block markup before you add any additional text to your reply.
  11. Click the Reply button to post the output.

Please let me know if you have any questions or problems while following those instructions.

1 Like
donhp@donhp-HP-G61-Notebook-PC:~$ lsusb
Bus 002 Device 003: ID 0408:0f41 Quanta Computer, Inc. HP Webcam-101
Bus 002 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 008 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 007 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 006 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 005 Device 002: ID 1a86:7523 QinHeng Electronics CH340 serial converter
Bus 005 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 004 Device 002: ID 046d:c52b Logitech, Inc. Unifying Receiver
Bus 004 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 003 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub

Hi
sorry for the delay in replying but some domestic issues took up my time.
Here is a copy of the terminal using lsusb
Don

As I said i have been away from this project for some days. i have done nothing apart from the above but on return to the Arduino 2.0 ide find that I can now see the port, /dev/ttyUSB0 and upload to an Arduino Uno.
I shall follow the procedure to include the STM32 boards and report back.
Don

1 Like

Well its still not 100%. After a reboot lost the port again. however if i unplug the Uno and plug it back into the usb port it comes up sometimes.
Still no joy with the stm32. downloaded the board manager for that series of boards and STMcube ide but it still says board disconnected.
Don

In order to gather more information that might help us to troubleshoot your problem, I'm going to ask you to run the dmesg command from the command line and share the output.

  1. Close the "Tools" menu in the Arduino IDE if it is open.
    The "Tools" menu contents are only updated when opening the menu, so you won't get an idea about the current ports if it is left open.
  2. Open a terminal.
  3. Disconnect the USB cable of your Arduino board to your computer.
  4. Connect the USB cable of your Arduino board to your computer.
  5. Open the "Tools" menu in the Arduino IDE.
  6. Verify that the port of the board was not added as a Tools > Port menu item.
    If it was added, then repeat the steps above until you are able to reproduce the "lost the port" problem. We need to run the next step when your computer is in that state.
  7. Type this command:
    dmesg | tail --lines=20
    
  8. Press Enter
  9. Click and drag the mouse to select all the output in the terminal window.
  10. Press Ctrl+C.
    This will copy the selected text to the clipboard.
  11. Open a forum reply here by clicking the Reply button.
  12. Click the </> icon on the post composer toolbar.
    This will add the forum's code block markup (```) to your reply to make sure the output is correctly formatted.
    Code block
  13. Press Ctrl+V.
    This will paste the output into the code block.
  14. Move the cursor outside of the code block markup before you add any additional text to your reply.
  15. Click the Reply button to post the output.

Please let me know if you have any questions or problems while following those instructions.

Where exactly does it say this?

Please post the full and exact text of the error message.

donhp@donhp-HP-G61-Notebook-PC:~$ dmesg | tail --lines=20
[ 2160.712033] usb 4-1: USB disconnect, device number 5
[ 2167.679964] usb 4-1: new full-speed USB device number 6 using uhci_hcd
[ 2167.867407] usb 4-1: New USB device found, idVendor=1a86, idProduct=7523, bcdDevice= 2.54
[ 2167.867417] usb 4-1: New USB device strings: Mfr=0, Product=2, SerialNumber=0
[ 2167.867420] usb 4-1: Product: USB2.0-Serial
[ 2167.871224] ch341 4-1:1.0: ch341-uart converter detected
[ 2167.877576] usb 4-1: ch341-uart converter now attached to ttyUSB0
[ 2208.080043] usb 4-1: USB disconnect, device number 6
[ 2208.080845] ch341-uart ttyUSB0: ch341-uart converter now disconnected from ttyUSB0
[ 2208.080890] ch341 4-1:1.0: device disconnected
[ 2224.967964] usb 4-1: new full-speed USB device number 7 using uhci_hcd
[ 2225.150324] usb 4-1: New USB device found, idVendor=1a86, idProduct=7523, bcdDevice= 2.54
[ 2225.150337] usb 4-1: New USB device strings: Mfr=0, Product=2, SerialNumber=0
[ 2225.150340] usb 4-1: Product: USB2.0-Serial
[ 2225.153451] ch341 4-1:1.0: ch341-uart converter detected
[ 2225.160481] usb 4-1: ch341-uart converter now attached to ttyUSB0
[ 2225.999541] input: BRLTTY 6.4 Linux Screen Driver Keyboard as /devices/virtual/input/input31
[ 2226.023388] usb 4-1: usbfs: interface 0 claimed by ch341 while 'brltty' sets config #1
[ 2226.031739] ch341-uart ttyUSB0: ch341-uart converter now disconnected from ttyUSB0
[ 2226.032346] ch341 4-1:1.0: device disconnected

This is with the Arduino connected and the port missing.
stm32 info to follow.

Sketch uses 19700 bytes (7%) of program storage space. Maximum is 262144 bytes.
Global variables use 8048 bytes (12%) of dynamic memory, leaving 57488 bytes for local variables. Maximum is 65536 bytes.
which: no usb-reset in (/app/bin:/app/bin:/app/bin:/usr/bin)
USB Status [unknown]
2022-09-28T16:44:13 WARN src/usb.c: Couldn't find any ST-Link/V2 devices
USB Status [unknown]
Waiting for tty device

should now be available.

this error when uploading to the stm32.
when i hover over the board info at the top, next to the upload button it says disconnected.
At the bottom of the screen, white text on green background,it says [not connected]

We found the rascal responsible for the disappearing port! BRLTTY is a program that interfaces the Linux console with a refreshable braille display to provide accessibility for those with vision impairments. Unfortunately this program does not play nicely with other USB to serial devices like the CH340 chip on your Arduino board.

It seems there are several possible solutions to this, some of which are fairly complex. The most simple seems to be to simply uninstall BRLTTY, as described in this Adafruit tutorial:

https://learn.adafruit.com/ladyadas-learn-arduino-lesson-number-0/install-software-linux#:~:text=uninstall%20brltty%20if%20it%20is%20installed

Obviously this solution will be unacceptable if you use a braille display. Some other solutions are described here which should resolve the conflict between BRLTTY and your Arduino board without the loss of support for braille displays:

Another forum member who recently suffered from the same problem shared the specific solution they used successfully here:

This only means that the serial port previously selected from the Tools > Port menu in the Arduino IDE is no longer available.

As you mentioned before, a serial port is not used for this type of upload to the STM32 boards, so this is no problem and you can simply ignore that "Disconnected" tooltip on the Board Selector menu and the "[not connected]" label on the status bar.

The problem you are having is unrelated.

You can use the same tools to troubleshoot this problem as you did for your Chinese Uno derivative board. I like to start with lsusb because the output is more simple:

  1. Open a terminal.
  2. If it is not already connect the USB cable of your STM32 board to your computer.
  3. Type lsusb
  4. Press Enter

If the board is working as expected for use with that "STM32CubeProgrammer (DFU)" upload method, you should see a line that looks something like this in the lsusb output:

Bus 003 Device 005: ID 0483:3748 STMicroelectronics ST-LINK/V2

Great!
Followed the instructions regarding the ttybrl removal and verified the port, rebooted and now as far as the Arduino is concerned all is well.
I'll have a look at the STM32 later and I'll report back.
Many thanks
Don