Failed to open serial Ubuntu - RC Groups
Shop our Airplanes Products Drone Products Sales
Thread Tools
Jun 09, 2017, 08:18 AM
Registered User
Discussion

Failed to open serial Ubuntu


Does anyone have any experience working with betaflight F3 and linux? I've been having issues with the drivers from the word go.
It detects when I plug in on /dev/ttyACM0, whne I click connect in betaflight configurator it disconnects and give "Failed to open serial port". There is not /dev/ttyUSB* I'm using Ubunut 17.04 .
Sign up now
to remove ads between posts
Jun 09, 2017, 08:30 PM
Registered User
Ace12GA's Avatar
EDIT: to anyone hitting this from google, or searching the boards, skip on down to post 4 for a more convenient method.

sudo chmod 0777 /dev/ttyACM0

It's a permissions thing.

EDIT: Sorry, Ubuntu, you probably need a little more.

1. Plug in the FC to USB.
2. Wait roughly 20 seconds for it to connect and boot.
3. Open Configurator
4. Open a terminal and execute the above command. Leave the terminal open, you may need it.
5. Click "Connect" in configurator.
6. If it fails to connect, wait a few seconds, and run the command in the terminal again (up arrow key to repeat the last command)

That should work. You may find that you need to rerun the permissions command after a reflash, or even after a reboot. Depends on the FC and the USB interface.

There is a way to set this permission automatically, but I can't be bothered to myself.
Last edited by Ace12GA; Nov 11, 2017 at 12:43 PM.
Nov 09, 2017, 05:56 AM
Registered User
hi,
I have the same issue and your help is very nice.
just a little line command.... 1 week of search.

Thank you

It's good

Mamat
Nov 10, 2017, 09:54 AM
My quadcopter is not a drone!
unseen's Avatar
This is completely the wrong way to do this!

When the device file is created, it gets created as owner:root, group:dialout and permissions 660. Changing the permissions on the device file is the wrong way to get access to it as a user, especially when you have to do it every time the device is connected.

A much better idea (and the correct way to do this) is to add your user to the 'dialout' group:

sudo usermod -a -G dialout <username>
Nov 11, 2017, 12:42 PM
Registered User
Ace12GA's Avatar
Quote:
Originally Posted by unseen
This is completely the wrong way to do this!

When the device file is created, it gets created as owner:root, group:dialout and permissions 660. Changing the permissions on the device file is the wrong way to get access to it as a user, especially when you have to do it every time the device is connected.

A much better idea (and the correct way to do this) is to add your user to the 'dialout' group:

sudo usermod -a -G dialout <username>
That is a simpler and more convenient way to do it, which I personally started using around August when I was setting up a dozen quads with my club. I wouldn't say altering the permissions on the device is wrong though, as it accomplishes the same thing, granting the user account the rights to use the device. Where it is a pain is when setting up F4 flight controllers which have a lengthy reboot as compared to a F1 or F3 based device, forcing the reset of the permissions.

Sorry, I'm annoyed by the "wrong" part of your post. It's not wrong, just a little more effort. Less convenient.

To anyone reading this in the future, adding yourself to the group is a one time thing, and works great. I recommend it.
Nov 11, 2017, 04:59 PM
My quadcopter is not a drone!
unseen's Avatar
How about "suboptimal" instead?

Devices are assigned to groups and have their permissions set through the udev rules in /lib/udev/rules.d and /etc/udev/rules.d. Although repetitively changing the permissions on the device each time the device file is created will achieve the purpose of granting access to all unprivileged users, it is not a recommended or security conscious way to control device permissions.

Permissions should always be set as restrictively as possible. Using groups to give users access to resources is a secure and safe way to do that. Manually changing file permissions as the superuser is a bad habit to get into, regardless of how experienced you are with Linux or any UNIX system.
Nov 11, 2017, 05:34 PM
My quadcopter is not a drone!
unseen's Avatar
As an aid to anyone having problems flashing a flight controller that uses DFU flashing mode on Linux, you don't need to install any drivers, but you may need to let the operating system know about the flight controller when it is in DFU mode.

When you flash a flight controller that uses a Virtual Comm Port instead of a dedicated external UART-USB chip like the CP2102 on the SP Racing F3, the flight controller disconnects and then reconnects in DFU mode with a different identity on the USB bus.

All you need to do is create a text file named 45-stdfu-permissions.rules and edit it to contain the following:

Code:
# DFU (Internal bootloader for STM32 MCUs)
SUBSYSTEM=="usb", ATTRS{idVendor}=="0483", ATTRS{idProduct}=="df11", MODE="0664", GROUP="plugdev"
Once you have created the file, copy it to /etc/udev/rules.d with:
Code:
sudo cp 45-stdfu-permissions.rules /etc/udev/rules.d
and add your user to the group 'plugdev' with:
Code:
sudo usermod -a -G dialout <username>
That's it!

These instructions apply for flight controllers designed to run Cleanflight , iNav or Betaflight only and having a compatible bootloader. Flight controllers designed for OpenPilot/LibrePilot/dRonin/Arducopter will create different interfaces and may require the installation of rules specific that that flight controller and specific bootloader.
Nov 13, 2017, 09:31 AM
Registered User
Ace12GA's Avatar
Quote:
Originally Posted by unseen
How about "suboptimal" instead?
Works for me.

Quote:
Originally Posted by unseen
Permissions should always be set as restrictively as possible. Using groups to give users access to resources is a secure and safe way to do that. Manually changing file permissions as the superuser is a bad habit to get into, regardless of how experienced you are with Linux or any UNIX system.
Agree, in a multi-user or enterprise environment.


Thread Tools

Similar Threads
Category Thread Thread Starter Forum Replies Last Post
Discussion Cleanflight "failed to open serial port" MicrometUK Multirotor Drone Electronics 3 Nov 22, 2016 01:13 PM
Discussion Cleanflight Failed to open serial port niels0608 Beginner Multirotor Drones 10 Sep 17, 2016 12:11 PM
Help! Failed to open serial port.Windows 8.1 fireshovel Multirotor Drone Electronics 4 Sep 04, 2016 01:23 PM
Help! Cleanflight failed to open serial port upon trying to flash! Skyline 32 in Nighthawk Bfreak Beginner Multirotor Drones 4 Jun 02, 2016 02:58 AM
Help! Failed to open serial port.Windows 8.1 fireshovel Beginner Multirotor Drones 0 May 25, 2016 04:45 PM