Miscellaneous Configurations

To identify device as serial on USB

            All devices connected to USB are allotted different identity /dev/ttyUSB* which can change depending upon various factors resulting in error while executing python scripts for mmWave radar orrs485 to USB convertor. In order to uniquely identify USB connected devices we need to define rules.

Step1       Connect all USB devices to companion computer and use the below command to identify unique identifiers.

udevadm info --name=/dev/ttyUSB0 --attribute-walk

Console output of walkthrough for USB device connected
Console output of walkthrough for USB device connected

Similarly do for udevadm info –name=/dev/ttyUSB1 –attribute-walk, udevadm info –name=/dev/ttyUSB2 –attribute-walk, udevadm info –name=/dev/ttyUSB3 –attribute-walk and so on

Step2     Add the rules as given below to uniquely identify USB connected devices-

sudo nano /etc/udev/rules.d/99-usb-serial.rules

SUBSYSTEM=="tty", ATTRS{idVendor}=="1a86", ATTRS{idProduct}=="7523", SYMLINK+="usb2uart"
SUBSYSTEM=="tty", ATTRS{interface}=="Standard Com Port", ATTRS{bInterfaceClass}=="ff", SYMLINK+="data"
SUBSYSTEM=="tty", ATTRS{interface}=="Enhanced Com Port", ATTRS{bInterfaceNumber}=="00", SYMLINK+="config"
SUBSYSTEM=="tty", ATTRS{idVendor}=="2109", ATTRS{bDeviceClass}=="09" ,ATTRS{version}==" 2.10", SYMLINK+="rs485"

Creating  /etc/udev/rules.d/99-usb-serial.rules
Creating /etc/udev/rules.d/99-usb-serial.rules

Step3    Update the rules

sudo udevadm control --reload-rules && udevadm trigger

Now for example in my case instead of /dev/ttyUSB0 for a convertor (RS485 to USB), I can use /dev/usb2uart in python script and it won’t change.

Backup of Raspberry Pi 4 or Beagle Bone Blue       

            We require to take backup of SD card to save our OS with configuration from any SD card failure and the ability to quickly restore the configuration incase of SD card failure. I have used Win32DiskImager. This application can take backup of SD card of Beagle Bone Blue or Raspberry Pi 4but not for Jetson Nano. The process is explained in the photo below. Need to provide the directory path for backup including the destination filename i.e backup file name. The extension of backup must be .img (image file). We click Read to begin the backup process as SD card is auto detected unless working on more than two SD cards simultaneously. The backup generated is the replica of the original SD card containing the OS with all configurations done till now and can be readily used.

Using Win32 Disk Imager to take SD card backup for Beagle Bone Blue or Raspberry Pi 4
Using Win32 Disk Imager to take SD card backup for Beagle Bone Blue or Raspberry Pi 4

            Backup of Jetson Nano SD Card      The backup of Jetson Nano SD card is quite different from the process above. We need a Linux machine to take backup. We will use the dd command which is the oldest disk imaging tool on Linux.

Step 1      Use Disks GUI application to check for the SD card details still in use.

SD card details on Linux PC/Laptop
SD card details on Linux PC/Laptop

Step 2      Make sure the SD card is unmounted.
sudo umount /dev/sdX
 where X is SD card name

Step 3      Now we create backup in the home directory
sudo dd if=/dev/sdX conv=sync,noerror bs=64K | gzip -c > ~/backup_image.img.gz

Step 4.   Now we can move this backup to windows and use any SD card flashing tool to flash SD card as discussed in earlier chapters.

Step 5      If we wish to restore back on SD card in Linux itself
sudo su
$ gunzip -c ~/backup_image.img.gz | dd of=/dev/sdX bs=64K

Remote Desktop in Raspberry Pi 4         

            Xrdp is an open-source implementation of the Microsoft Remote Desktop Protocol (RDP) .It allows GUI based system access. We login to Raspberry Pi and run the below mentioned commands to install Pixel desktop:

Update system
sudo apt update
sudo apt-get install raspberrypi-ui-mods xinit xserver-xorg
sudo reboot

As Xrdp package is available in the default Raspbian Buster repositories, we can install it right away
sudo apt install xrdp

After installation process is completed, the Xrdp service will automatically start. We verify it by
systemctl show -p SubState --value xrdp

Now we need to add the user to the group
sudo adduser xrdp ssl-cert

To access Raspberry Pi 4 through remote session
Open RDP client on Windows, add IP address and establish connection.

For establishing Remote Desktop Session of Raspberry Pi 4 over VPN for remote configuration is quite helpful
For establishing Remote Desktop Session of Raspberry Pi 4 over VPN for remote configuration is quite helpful

Put user and password for remote connection

User credentials for establishing Remote Desktop Session of Raspberry Pi 4 over VPN for remote configuration is quite helpful
User credentials for establishing Remote Desktop Session of Raspberry Pi 4 over VPN for remote configuration is quite helpful
Remote Desktop Session of Raspberry Pi 4 over VPN established successfully
Remote Desktop Session of Raspberry Pi 4 over VPN established successfully

About the Author

Leave a Reply

Your email address will not be published. Required fields are marked *

You may also like these