Execution authority (permission) and port name (/ dev/ttyACM0, etc.) will be required when connecting the microcomputer and URG via USB for serial communication.
When there are multiple serial devices in this way, the port names are assigned in the order in which they are connected, so the serial setting must be changed each time multiple devices are connected. In addition, it is necessary to grant execution authority for serial communication.
Since it is troublesome to set each time when connecting a device, we will deal with it.
Microcomputer: STM Nucleo F446RE LiDAR : Hokuyo UTM-30lx
First, check the device information of the microcomputer. Execute the following command.
dmesg
Then, the product name of the connected device will appear at the bottom of the log, so record the three [idVendor] [idProduct] [Serial Number] above that device name.
【URG】 [Microcomputer]
Next, create a configuration file. Execute the following command to open the text with root privileges.
sudo vim /etc/udev/rules.d/99-serial.rules
If the three numbers you checked earlier, the port name you want to set, and the execution authority are as follows
Set as follows and save.
KERNEL=="ttyACM*", ATTRS{idVendor}=="15d1", ATTRS{idProduct}=="0000", SYMLINK+="ttyACM_URG", MODE="0666"
SUBSYSTEM=="tty", ATTRS{idVendor}=="0483", ATTRS{idProduct}=="374b", ATTRS{serial}=="**3**", SYMLINK+="ttyACM_STM", MODE="0666"
This completes the settings. There is a way to reload it, but please restart it for sure.
Connect the device and type the following command.
reo@reo-desktop:~$ ls -la /dev/ttyACM_STM
lrwxrwxrwx 1 root root 7 January 9 18:36 /dev/ttyACM_STM -> ttyACM1
reo@reo-desktop:~$ ls -la /dev/ttyACM_URG
lrwxrwxrwx 1 root root 7 January 9 18:36 /dev/ttyACM_URG -> ttyACM0
If it is output like this, the setting is successful.
Recommended Posts