Difference between revisions of "Getting Started with BPI-M4 Berry"
(→WiFi) |
|||
Line 221: | Line 221: | ||
[[File:Bpi_m4_berry_ubuntu_6.jpg]] | [[File:Bpi_m4_berry_ubuntu_6.jpg]] | ||
:3.Play audio. | :3.Play audio. | ||
+ | |||
+ | ===Use Bluetooth=== | ||
+ | :Open settings in the Ubuntu desktop and connect a Bluetooth device, such as a Bluetooth mouse or keyboard, in the Bluetooth bar. | ||
+ | [[File:Bpi_m4_berry_ubuntu_7.jpg]] | ||
+ | |||
+ | ===Use IR Receiver=== | ||
+ | :1. You need to prepare an infrared remote control using NEC format. | ||
+ | :2. Enter the following command in the terminal to start receiving infrared signals. | ||
+ | sudo ir-keytable -c -p NEC -t | ||
+ | |||
+ | Old keytable cleared | ||
+ | Protocols changed to nec | ||
+ | Testing events. Please, press CTRL-C to abort. | ||
+ | 258.553895: lirc protocol(nec): scancode = 0x45 | ||
+ | 258.553926: event type EV_MSC(0x04): scancode = 0x45 | ||
+ | 258.553926: event type EV_SYN(0x00). | ||
+ | 260.667648: lirc protocol(nec): scancode = 0x46 | ||
+ | 260.667671: event type EV_MSC(0x04): scancode = 0x46 | ||
+ | 260.667671: event type EV_SYN(0x00). | ||
+ | 260.719552: lirc protocol(nec): scancode = 0x46 repeat | ||
+ | 260.719568: event type EV_MSC(0x04): scancode = 0x46 | ||
+ | 260.719568: event type EV_SYN(0x00). | ||
+ | 273.263728: lirc protocol(nec): scancode = 0x47 | ||
+ | 273.263753: event type EV_MSC(0x04): scancode = 0x47 | ||
+ | 273.263753: event type EV_SYN(0x00). | ||
+ | 273.315591: lirc protocol(nec): scancode = 0x47 repeat | ||
+ | 273.315608: event type EV_MSC(0x04): scancode = 0x47 | ||
+ | 273.315608: event type EV_SYN(0x00). | ||
+ | |||
+ | For other commands and specific application methods, please see [https://manpages.ubuntu.com/manpages/focal/en/man1/ir-keytable.1.html ir-keytable reference document] |
Revision as of 01:27, 16 October 2023
Contents
- 1 development
development
Linux
Prepare
- 1. Linux image support SDcard or EMMC bootup, but you should read the [Boot_Sequence boot sequence] at first.
- 2. It’s recommended to use A1 rated cards, 8GB at least.
- 3. Make sure bootable EMMC is formatted if you want bootup from SDcard.
- 4. Make sure SDcard is formatted without Linux image flashed if you want bootup from EMMC and use Sdcard as storage.
- 5. Download latest [Linux Linux Image], and confirm that the md5 checksum is correct.
- 6. Default login: pi/bananapi or root/bananapi
- 7. The wiki guide is only for [bananapi 4.9 bsp ubuntu/debian images].
Install Image to SDcard
- 1. Install Image with Balena Etcher on Windows, Linux and MacOS.
- Balena Etcher is an opensource GUI flash tool by Balena, Flash OS images to SDcard or USB drive.
- 2. Install Image with Balena Cli on Windows, Linux and MacOS.
- Balena CLI is a Command Line Interface for balenaCloud or openBalena. It can be used to flash linux image. Download the installer or standalone package from balena-io and install it correctly to your PC, then you can use the "local flash" command option of balena to flash a linux image to sdcard or usb drive.
sudo balena local flash path/to/xxx-bpi-m4-berry-xxx.img.zip sudo balena local flash path/to/xxx-bpi-m4-berry-xxx.img.zip --drive /dev/disk2 sudo balena local flash path/to/xxx-bpi-m4-berry-xxx.img.zip --drive /dev/disk2 --yes
- 3. Install Image with dd command on Linux, umount SDcard device /dev/sdX partition if mounted automatically. Actually bpi-copy is the same as this dd command.
sudo apt-get install pv unzip sudo unzip -p xxx-bpi-m4-berry-xxx.img.zip | pv | dd of=/dev/sdX bs=10M status=noxfer
- 4. Install image with bpi-tools on Linux, plug SDcard to Linux PC and run
sudo apt-get install pv unzip sudo bpi-copy xxx-bpi-m4-berry-xxx.img.zip /dev/sdX
Start
Ubuntu Desktop
- 1. Using the Ubuntu desktop version system image, you can get a graphical operation interface.
- 2. You need to prepare a monitor with an HDMI interface and an HDMI cable.
- 3. Use an HDMI cable to connect the monitor and BPI-M4 Berry, switch the monitor input interface to the corresponding HDMI interface, power on, and wait a moment to see the desktop.
Debug UART
- 1. Prepare a 3.3v USB to TTL module.
- 2. Use the USB to TTL module to connect the PC USB port and the Debug UART port on the board.
- 3. Open a serial terminal software on the PC, such as mobaxterm or putty.
- 4. Taking mobaxterm as an example, after setting the serial port number and 115200 baud rate, you can open the BPI-M4 Berry UART terminal.
SSH
- 1. Prepare a network cable and a router.
- 2. Use a network cable to connect the LAN port of the router to the BPI-M4 Berry, and also connect the PC to another LAN port.
- 3. Check the IP address of BPI-M4 Berry on the router management interface, or use the following command on the BPI-M4 Berry UART terminal to check the IP address.
ifconfig
eth0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500 inet 192.168.3.10 netmask 255.255.255.0 broadcast 192.168.3.255 inet6 fe80::3e1f:688f:81ab:d8b7 prefixlen 64 scopeid 0x20<link> ether 02:00:54:a0:d6:a6 txqueuelen 1000 (Ethernet) RX packets 553 bytes 92549 (92.5 KB) RX errors 0 dropped 0 overruns 0 frame 0 TX packets 329 bytes 26023 (26.0 KB) TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0 device interrupt 42
- 4. Open an SSH terminal software on the PC, such as mobaxterm or putty.
- 5. Taking mobaxterm as an example, fill in the obtained IP address, such as 192.168.3.10 above, in the IP address column and 22 in the Port port.
- 6. Open the SSH terminal and enter the login username/password: pi/bananapi or root/bananapi. There will be no prompt when entering the password. Please enter it normally and press Enter when finished.
NoMachine Remote Desktop
- 1. Make sure BPI-M4 Berry is connected to the Internet and use the following command to download the nomachine DEB installation package in the system.
wget https://download.nomachine.com/download/8.9/Arm/nomachine_8.9.1_1_arm64.deb
- 2. Or open NoMachine for ARM - arm64 download page in a PC browser, download the DEB installation package, and then copy it to BPI-M4 Berry user directory through SSH or USB disk.
- 3. After the download is completed, install it through the following command. Note that the file name is based on the actual downloaded file name.
sudo dpkg -i nomachine_8.9.1_1_arm64.deb
- 4. PC side also needs to download and install NoMachine. NoMachine download page Select the installation package suitable for the PC operating system, download it locally and complete the installation.
- 5. Pay attention to keeping the PC and BPI-M4 Berry in the same LAN. You can try SSH connection first to ensure normal communication within the LAN.
- 6. Open NoMachine on the PC, click the Add button, enter the IP address of BPI-M4 Berry in the Host bar in the window after the jump, and then click the Add button.
- 7. Click the recognized port icon, enter the username/password in the new window that pops up, and then click the OK button.
- 8. After completing the subsequent settings, you can see the desktop.
- 9. If no device is connected to the HDMI interface, the NoMachine remote desktop will display a black screen. It is recommended to keep the HDMI connection or connect an HDMI decoy device.
WiFi
- Use the nmcli command to scan WiFi hotspots, connect to hotspots, and create AP hotspots.
nmcli device #List devices nmcli device wifi list # List available wifi access points, list can be omitted nmcli device wifi connect [SSID] password [PASSWORD] # Connect to the hotspot mySSID. After the connection is successful, the configuration file will be automatically generated. If you want to connect again in the future, you can use the nmcli connection up [SSID] command. nmcli device disconnect [device name] # Disconnect wifi, use the wifi device name displayed in the nmcli device command nmcli device wifi hotspot con-name [NAME] ifname [device name] ssid [SSID] password [PASSWORD] # Create AP hotspot
nmcli connection show #List network connection configuration nmcli connection down [NAME] # Activate a connection nmcli connection up [NAME] # Deactivate a connection nmcli connection delete [SSID] #Delete a configuration and no longer save information and automatically connect
nmcli radio wifi off # Turn off wifi nmcli radio wifi on # Turn on wifi
Set static IP, DNS
- 1. To set a static IP, you need to maintain the connection first. If you want to set an Ethernet static IP, you must first maintain the Ethernet connection; if you want to set a wireless network static IP, you must first maintain a connection to a WIFI.
- 2. If the upper-level router has assigned the IP address you want to set to other devices, please change it to an idle IP, or ask other devices to give up the IP.
- 3. Use the nmcli connection show command to display all connections, for example:
pi@bpi-m4berry:~$ nmcli connection show NAME UUID TYPE DEVICE TP-LINK_5G_7747 e4a49726-adf1-44d7-a621-0e3af96cc390 wifi wlx2cc3e6acd5d7 Wired connection 1 612eda94-55dc-3c85-b05e-f16c41775b4e ethernet --
- 4. Use the nmcli connection show [NAME] command to display all the properties of a specific connection, such as:
nmcli connection show TP-LINK_5G_7747 #If you want to see Ethernet, change to Wired connection 1
#Only list three common items ipv4.dns: 192.168.3.1 #The default is the gateway address ipv4.addresses: 192.168.3.10/24 #The default is the IP address assigned by the router DHCP ipv4.gateway: 192.168.3.1 #Gateway address, the default is the IP address of the router
- 5.Set static IP:
nmcli connection modify TP-LINK_5G_7747 ipv4.addresses 192.168.3.2
- 6.Set DNS:
nmcli connection modify TP-LINK_5G_7747 ipv4.dns 8.8.8.8 #Google DNS
- 7.Reset:
reboot
- 8. After restarting, check whether the modification is successful:
ifconfig nmcli connection show TP-LINK_5G_7747
Network time synchronization
- Chrony is an open source free Network Time Protocol NTP client and server software. It allows the computer to keep the system clock synchronized with the clock server (NTP), thus allowing your computer to maintain accurate time. Chrony can also be used as a server software to provide time synchronization services for other computers.
timedatectl set-ntp false #Disable NTP-based network time synchronization
sudo apt install chrony #Install chrony systemctl start chrony #Start chrony systemctl enable chrony systemctl status chrony systemctl restart chrony #Restart service
timedatectl status #View time synchronization status timedatectl list-timezones #View time zone list timedatectl set-timezone Asia/Shanghai #Modify time zone timedatectl set-ntp true #Enable NTP network time synchronization
date #View time sudo hwclock -w #Set hardware clock sudo hwclock -s #Set the system clock sudo hwclock -r #View hardware clock
View hardware temperature
Enter the following command to view the temperature data returned by the sensor built into the chip on the BPI-M4 Berry board.
sensors
Modify HDMI output resolution
- When using the Ubuntu desktop operating system, you can find the Displays column in Settings and modify the resolution.
Use USB disk
- 1. Prepare a USB disk that has been partitioned normally and insert it into the USB interface of BPI-M4 Berry.
- 2. In the Ubuntu desktop version, you can see that the USB flash drive has been recognized and can be opened in the file manager, or partition management can be performed through the GParted tool.
- 3. In the terminal, mount the USB disk to the local directory:
mkdir mnt #Create a separate directory in the ~/user directory for mounting for easy management cat /proc/partitions | grep "sd*" #List partitions starting with sd sudo mount /dev/sda1 ~/mnt/ #Mount /dev/sda1 to ~/mnt/ ls ~/mnt/ #After mounting, you can list the files in the USB disk sudo umount -v /dev/sda1 #umount, then you can remove the USB disk
Use Audio Devices
- Prepare an audio file and copy it to the BPI-M4 Berry Ubuntu desktop system through a USB flash drive or SSH.
HDMI Audio
- 1. Prepare a monitor with HDMI audio input function, turn on the relevant functions in the monitor settings, and use an HDMI cable to connect the monitor.
- 2. Set the output device to HDMI Audio in the Sound column of the settings.
- 3.Play audio.
3.5mm audio interface
- 1. Prepare a headset or other audio device that uses a 3.5mm plug.
- 2Set the output device to Audio Codec in the Sound column of the settings.
- 3.Play audio.
Use Bluetooth
- Open settings in the Ubuntu desktop and connect a Bluetooth device, such as a Bluetooth mouse or keyboard, in the Bluetooth bar.
Use IR Receiver
- 1. You need to prepare an infrared remote control using NEC format.
- 2. Enter the following command in the terminal to start receiving infrared signals.
sudo ir-keytable -c -p NEC -t
Old keytable cleared Protocols changed to nec Testing events. Please, press CTRL-C to abort. 258.553895: lirc protocol(nec): scancode = 0x45 258.553926: event type EV_MSC(0x04): scancode = 0x45 258.553926: event type EV_SYN(0x00). 260.667648: lirc protocol(nec): scancode = 0x46 260.667671: event type EV_MSC(0x04): scancode = 0x46 260.667671: event type EV_SYN(0x00). 260.719552: lirc protocol(nec): scancode = 0x46 repeat 260.719568: event type EV_MSC(0x04): scancode = 0x46 260.719568: event type EV_SYN(0x00). 273.263728: lirc protocol(nec): scancode = 0x47 273.263753: event type EV_MSC(0x04): scancode = 0x47 273.263753: event type EV_SYN(0x00). 273.315591: lirc protocol(nec): scancode = 0x47 repeat 273.315608: event type EV_MSC(0x04): scancode = 0x47 273.315608: event type EV_SYN(0x00).
For other commands and specific application methods, please see ir-keytable reference document