Banana Pi BPI-M2C is Banana Pi’s new generation single board computer, equipped with Unisoc uis7885 processor. It has 4GB LPDDR4 memory and 128GB EMMC storage onboard, and supports 4 USB 2.0 interfaces, 1 Gigabit network port, headphone interface, speaker interface, onboard 5G and WCN functions.
| More Infomation: Banana Pi BPI-M2C |
Prepare 8G/above TF card, USB-Serial cable, Ubuntu System.
5V3A type-c adapter power supply
Download tool:
Windows: ResearchDownload
Linux: Yunji
Or an open-source flashing tool: balenaEtcher
Download the image to be burned
Using your USB-Serial cable(3.3V TTL,Baud=921600) Connect to debug console on BPI-M2C G=GND; RX=BPI-M2C input; TX=BPI-M2C output0
Use the balenaEtcher tool to flash the SD image.
Download the SD image. (Formats such as .zip, .xz, .gz, and .bz2 can be selected directly; however, compound archives like .tar.gz or .tar.xz must be extracted first.)
Format the TF card using the SDFormatter tool.
Open balenaEtcher, select the image file you wish to flash, choose your TF card, and click to begin the flashing process. (Be careful to ensure you have selected the correct TF card.)
Use the ResearchDownload tool to flash the PAC package.
Download the SD image. (If it is a compressed archive, please extract it beforehand.)
Set the SD DIP switch on the back of the development board to the ON position.
Open the tool and click "Load packet," then select the PAC package you wish to flash.
Click "Settings," then click "Options," and check the boxes for "Repartition," "Keep Charge," and "Power Off."
xxx
xxx
xxx
xxx
uname -a
cat /etc/os-release
cat /proc/cpuinfo | head
cat /proc/meminfo | head
df -h
The current kernel console parameters are as follows:
| Parameter | Setting |
|---|---|
Device |
|
Baud Rate |
|
Data Format |
|
Flow Control |
Disabled |
On a Linux host, you can use picocom:
sudo picocom -b 921600 /dev/ttyUSB0
Alternatively, you can use minicom, PuTTY, or MobaXterm; in each case, configure the settings to 921600 8N1 and ensure that hardware flow control is disabled.
Connect an Ethernet cable to the BPI-M2C. The current system will initialize eth0 and attempt to obtain an IP address via DHCP.
To check the interface status and IP address:
ip link show eth0
ip addr show eth0
ip route
To manually request a new DHCP address, run the following commands:
ip link set eth0 up
udhcpc -i eth0
cat /sys/class/net/eth0/operstate
cat /sys/class/net/eth0/speed
cat /sys/class/net/eth0/duplex
First, check the wireless interface:
ip link show wlan0
ps | grep -E '[h]ostapd|[w]pa_supplicant'
Check the current operating mode:
iw dev wlan0 info
wpa_cli -i wlan0 status 2>/dev/null
To configure wlan0 as a wireless hotspot—or before switching to standard Wi-Fi client mode—you should first stop any hostapd instance currently using the interface:
/etc/init.d/hostapd stop 2>/dev/null || true
killall wpa_supplicant 2>/dev/null || true
Generate a WPA Supplicant configuration. After running the command, enter your Wi-Fi password when prompted; the password will not be displayed in the terminal:
wpa_passphrase "Your Wi-Fi Name" > /tmp/wpa_supplicant.conf
chmod 600 /tmp/wpa_supplicant.conf
Connect to the wireless network and obtain an IP address via DHCP:
ip link set wlan0 up
wpa_supplicant -B -i wlan0 -c /tmp/wpa_supplicant.conf
udhcpc -i wlan0
After connecting, check the IP address and routing:
ip addr show wlan0
ip route
ping -c 4 8.8.8.8
Check the connection status and the current access point (AP):
wpa_cli -i wlan0 status
iw dev wlan0 link
Disconnect or reconnect:
wpa_cli -i wlan0 disconnect
wpa_cli -i wlan0 reconnect
Rescan for networks:
wpa_cli -i wlan0 scan
sleep 3
wpa_cli -i wlan0 scan_results
The bluetoothd daemon starts during system boot; the controller is typically identified as hci0.
Check the Bluetooth service and controller:
ps | grep '[b]luetoothd'
bluetoothctl list
bluetoothctl show
If the controller is not powered on:
bluetoothctl power on
Enter interactive mode:
bluetoothctl
Enter the following commands in sequence:
power on
agent on
default-agent
scan on
Wait for the target device to appear, note its MAC address (e.g., 11:22:33:44:55:66), and then execute:
pair 11:22:33:44:55:66
trust 11:22:33:44:55:66
connect 11:22:33:44:55:66
info 11:22:33:44:55:66
scan off
quit
During pairing, follow the prompts in the terminal to confirm the PIN or verify that the numbers displayed on both devices match. HID devices, such as keyboards and mice, are generally ready for use once successfully connected. Disconnecting or removing a device:
bluetoothctl disconnect 11:22:33:44:55:66
bluetoothctl remove 11:22:33:44:55:66
Once an A2DP audio device is connected, PulseAudio creates an output with a name beginning with bluez_sink:
pactl list short sinks
Set the full bluez_sink… name (as shown in the output) as the default output:
pactl set-default-sink bluez_sink.11_22_33_44_55_66.a2dp_sink
paplay /mnt/data/test.wav
The sink name used above is just an example; you must copy the actual name from the output of pactl list short sinks. If no Bluetooth sink appears, verify that the device supports A2DP, that it is properly connected, and that the Bluetooth module for PulseAudio is loaded:
pactl list short modules | grep bluetooth
Once you have confirmed that your development computer and the BPI-M2C can communicate with each other, execute the following command on your development computer:
Upon your first connection, the host fingerprint will be displayed. After verifying that the address is correct, type yes.
|
The fact that the serial console allows login with an empty password does not mean that SSH will also allow it.
If SSH returns a Do not use empty or weak passwords on networks accessible by untrusted devices. |
If you are unable to connect, check the following in order:
ip addr show eth0
ps | grep '[s]shd'
netstat -lnt 2>/dev/null | grep ':22'
If the SSH service is not running, you can attempt to start it from the serial console terminal:
/etc/init.d/sshd start
Copying files from the development computer to the board:
scp example.bin [email protected]:/tmp/
Copying files from the board to the development computer:
scp [email protected]:/var/log/messages ./
Use the -r flag when copying directories.
cat /proc/cpuinfo
cat /proc/meminfo | head
lsblk
df -h
mount
List temperature sensors:
for zone in /sys/class/thermal/thermal_zone*; do
printf '%s: ' "$(cat "$zone/type" 2>/dev/null)"
cat "$zone/temp" 2>/dev/null
done
For most nodes, the value is in thousandths of a degree Celsius (e.g., 45000 represents approximately 45 °C); refer to the type associated with each node for the specific meaning.
After inserting a USB device, run the following commands:
dmesg | tail -n 30
lsusb
lsblk
Example of mounting a USB flash drive:
mkdir -p /mnt/usb
mount /dev/sda1 /mnt/usb
ls -la /mnt/usb
sync
umount /mnt/usb
|
|
The M2C board features an onboard speaker interface and a 3.5 mm headphone jack; the default sound card is sprdphone-sc2730. Media playback uses PCM hw:0,5, while standard recording uses PCM hw:0,4.
The current configuration behaves as follows:
When no 3.5 mm headphones are plugged in, audio is routed to the speaker connected to the speaker interface.
When 3.5 mm headphones are plugged in, the kernel reports a "Headset Jack" event, and PulseAudio automatically switches the output to the headphones.
When the headphones are unplugged, PulseAudio automatically reverts the output to the speaker interface.
A four-segment (TRRS) headphone plug supports both playback and a microphone; a three-segment (TRS) plug supports playback only.
To check the sound card, PulseAudio outputs, and headphone connection status, use the following commands:
cat /proc/asound/cards
aplay -l
pactl list short sinks
cat /sys/class/extcon/extcon1/state
When no headphones are connected, it displays HEADPHONE=0; once headphones are plugged in, this should change to HEADPHONE=1.
With PulseAudio 15.0 and module-unisoc-card, the speaker_output and headphone_output ports are not explicitly listed in the output of pactl list sinks. Executing the following commands on the actual hardware will result in the error Failure: No such entity; therefore, do not use these commands to switch outputs:
# Not available on M2C
pactl set-sink-port @DEFAULT_SINK@ speaker_output
pactl set-sink-port @DEFAULT_SINK@ headphone_output
The following methods involve directly configuring the ALSA mixer, which is useful for debugging or forcing a specific audio route. Playback must be started before executing these routing commands. If you configure your headphones before starting playback, PulseAudio—upon waking from a suspended state—will re-enable the default speaker path, resulting in both the headphones and the speakers being active simultaneously. For example, first play a long audio file in the background:
gst-launch-1.0 -q playbin uri=file:///mnt/data/music.mp3 &
audio_pid=$!
sleep 1
Force switch to 3.5 mm headphones:
tinymix 'Speaker Function' 0
tinymix 'AOL EAR Sel' EAR
tinymix 'DA AOR Switch' 0
tinymix 'AO Mixer AOL Switch' 0
tinymix 'AO Mixer AOR Switch' 0
tinymix 'HP mix mode' 0
tinymix 'DAC LRCLK Select' invert
tinymix 'HPL Mixer DACLHPL Switch' 1
tinymix 'HPR Mixer DACRHPR Switch' 1
tinymix 'HPL EAR Sel' HPL
tinymix 'HP Virt Switch' 1
tinymix 'HeadPhone Function' 1
tinymix 'HP_CROSSTALK_EN' 1
tinymix 'HP_CROSSTALK_GAIN' 16400 16400
Force switching to the speaker interface:
tinymix 'DAC LRCLK Select' normal
tinymix 'HeadPhone Function' 0
tinymix 'HP Virt Switch' 0
tinymix 'HPL Mixer DACLHPL Switch' 0
tinymix 'HPR Mixer DACRHPR Switch' 0
tinymix 'HPL EAR Sel' EAR
tinymix 'HP mix mode' 1
tinymix 'HP_CROSSTALK_EN' 0
tinymix 'HP_CROSSTALK_GAIN' 0 0
tinymix 'DAC LRCLK Select' invert
tinymix 'AO Mixer AOL Switch' 1
tinymix 'AO Mixer AOR Switch' 1
tinymix 'DA AOR Switch' 1
tinymix 'AOL EAR Sel' AOL
tinymix 'AO Gain AO Playback Volume' 2
tinymix 'Speaker Function' 1
To stop playback that was started in the background:
kill "$audio_pid"
wait "$audio_pid" 2>/dev/null
Once all playback streams have stopped and the PulseAudio sink has entered the SUSPENDED state, the current firmware will disable the hardware paths for the speakers and headphones. During subsequent playback, the system will automatically determine the routing based on whether or not headphones are plugged in.
To adjust the volume or unmute:
pactl set-sink-volume @DEFAULT_SINK@ 60%
pactl set-sink-mute @DEFAULT_SINK@ 0
To play a WAV file:
paplay /mnt/data/test.wav
Alternatively, you can use ALSA to play WAV files:
aplay -D default /mnt/data/test.wav
To play MP3, AAC, FLAC, or other media files supported by GStreamer:
gst-launch-1.0 -q playbin uri=file:///mnt/data/music.mp3
Press kbd:[Ctrl+C] to stop playback. Under normal usage, the system automatically handles routing based on the headphone connection status; the tinymix routing commands mentioned above should only be used for manual switching during debugging. === Audio Input and Switching
To view available audio input sources:
arecord -l
pactl list short sources
PulseAudio sources do not expose ports; executing the following commands on the board will result in the error Failure: No such entity. Do not use these commands to force a specific audio input path:
# Not supported on M2C
pactl set-source-port @DEFAULT_SOURCE@ sprd-input-internal-mic
pactl set-source-port @DEFAULT_SOURCE@ sprd-input-headphone-mic
For standard audio recording, module-unisoc-card automatically selects either the onboard microphone or the microphone on a 4-pole (TRRS) headset, based on the headset detection status. If a 3-pole (TRS) headset—which lacks a microphone contact—is connected, the system will continue to use the onboard microphone for recording.
To record a 48 kHz, 16-bit, mono WAV file (press kbd:[Ctrl+C] to stop):
mkdir -p /mnt/data/audio
parec --file-format=wav --format=s16le --rate=48000 --channels=1 \
/mnt/data/audio/record.wav
To play back the recording:
paplay /mnt/data/audio/record.wav
To perform a diagnostic recording by accessing the PCM device directly (bypassing PulseAudio):
arecord -D hw:0,4 -f S16_LE -r 48000 -c 1 -d 10 \
/mnt/data/audio/record-10s.wav
|
Directly accessing |
Uses Wayland/Weston. Check the relevant processes:
ps | grep -E '[w]eston|[w]ayland'
ls -l /dev/dri/ 2>/dev/null
The current software configuration includes an 800 × 1280 MIPI-DSI display and a 1920 × 1080 HDMI output.
The current M2C software supports the IMX258 sensor and includes a UniSoc V4L2 adaptation layer, the unisv4l2src GStreamer plugin, and a graphical application called UnisocCameraApp. For other camera modules—even those with the same connector type—you must verify the pinout, voltage, clock settings, device tree configuration, and drivers.
ls -l /dev/video* 2>/dev/null
v4l2-ctl --list-devices
gst-inspect-1.0 unisv4l2src
The onboard camera is mapped to /dev/video0 by default. Do not rely solely on the device number to identify the camera; verify it by checking the output of v4l2-ctl --list-devices.
First, create directories for photos and videos:
mkdir -p /mnt/data/pic /home/user
export XDG_RUNTIME_DIR=/run/user/0
Launch the camera preview and enable the recording button:
/usr/share/UnisocCameraApp -b 0 -W 640 -H 480 --video 1 \
-p /mnt/data/pic -platform wayland &
Once the interface is open:
Click the photo button to save a JPEG image.
Click the record button to start recording; click it again to stop and finalize the MP4 file.
Do not cut the power while recording; you must stop the recording first. Otherwise, the MP4 file may lack an index and become unplayable. Storage locations are as follows:
| Content | Default Directory | Example Filename |
|---|---|---|
Standard Photos |
|
|
HD Video Snapshots |
|
|
Standard Videos |
|
|
HD Videos |
|
|
To view the most recently generated files:
ls -lht /mnt/data/pic | head
ls -lht /home/user/*.mp4 2>/dev/null | head
To take photos at 3264 × 2448 resolution with a 640 × 480 preview:
/usr/share/UnisocCameraApp -b 0 -W 640 -H 480 \
--cw 3264 --ch 2448 --ct 2 --jpeg 1 \
-p /mnt/data/pic -platform wayland &
Here, --jpeg 1 indicates the use of hardware-accelerated JPEG encoding. If hardware encoding is unavailable in the current firmware, you can change this to --jpeg 0 to use software-based encoding. === Taking Photos via Command Line
You can use GStreamer to capture a 640 × 480 JPEG image without opening the CameraApp:
mkdir -p /mnt/data/pic
gst-launch-1.0 -e unisv4l2src device=/dev/video0 num-buffers=1 \
! 'video/x-raw,width=640,height=480,framerate=15/1' \
! jpegenc ! filesink location=/mnt/data/pic/photo.jpg
The photo will be saved at /mnt/data/pic/photo.jpg. If format negotiation fails, run the following commands to check the formats and resolutions actually supported by the camera, then adjust the caps accordingly:
gst-inspect-1.0 unisv4l2src
v4l2-ctl -d /dev/video0 --list-formats-ext
The following command records video in H.264 MP4 format. Pressing kbd:[Ctrl+C] triggers the -e flag, which sends an EOS (End-of-Stream) signal to finalize the file container:
mkdir -p /mnt/data/video
gst-launch-1.0 -e unisv4l2src device=/dev/video0 \
! 'video/x-raw,width=640,height=480,framerate=30/1' \
! autovideoconvert ! omxh264enc \
! h264parse ! mp4mux \
! filesink location=/mnt/data/video/camera.mp4
The video will be saved at /mnt/data/video/camera.mp4. Verification after recording:
ls -lh /mnt/data/video/camera.mp4
gst-launch-1.0 -q playbin uri=file:///mnt/data/video/camera.mp4
The BPI-M2C features an integrated cellular modem. It currently utilizes ChannelManager, oFono, and app_demo to manage SIM cards, registration status, and packet data.
|
Before powering on the board, ensure that a SIM card is inserted and the appropriate cellular antenna (for the relevant frequency band) is connected. Never operate the modem without an antenna while it is transmitting. The specific supported frequency bands, SIM card slots, carrier certifications, and service plan capabilities depend on the hardware SKU, the RF front-end, the firmware, and the local network operator. |
ps | grep -E '[o]fonod|[c]hannelmanager|[t]eleservice'
app_demo test_get_modems
app_demo test_modem_get_info
app_demo test_modem_get_powered
app_demo test_modem_get_online
If the modem is not powered on or is offline:
app_demo test_modem_set_powered 1
app_demo test_modem_set_online 1
app_demo test_sim_get_info
This command displays the SIM power status, SIM state, whether a PIN is required, the IMSI, ICCID, MCC/MNC, and the number of remaining retry attempts.
If the SIM requires a PIN:
app_demo test_sim_enter_pin 1234
|
Replace |
app_demo test_network_get_registration_info
app_demo test_network_get_operator_name
app_demo test_network_get_signal_strength
app_demo test_network_get_mode
app_demo test_network_get_network_selection_mode
Register to the network automatically:
app_demo test_network_auto_register
Scanning for available operators may take several minutes:
app_demo test_network_scan_operators
The primary status codes for test_network_get_registration_info are: 0 (not registered), 1 (registered to home network), 2 (searching), 3 (registration denied), and 5 (roaming).
First, check the existing PDP contexts:
app_demo test_connman_get_contexts
If no Internet context exists, create one:
app_demo test_connman_add_context 2
Query the contexts again and copy the actual path. In the example below, the path is assumed to be /unc_0/context1, the APN is cmnet, and the protocol 2 indicates an IPv4/IPv6 dual-stack configuration:
app_demo test_connman_set_context /unc_0/context1 cmnet 2
app_demo test_connman_set_powered 1
app_demo test_connman_activate_context /unc_0/context1
app_demo test_connman_get_context_info /unc_0/context1
Ensure that /unc_0/context1 and cmnet are replaced with the actual context path on your device and the APN provided by your carrier, respectively. Once activation is successful, test_connman_get_context_info will display the interface name, IP address, gateway, and DNS. On the current platform, the data interface is typically named something like sipa_eth0; please refer to the actual command output for confirmation:
ip addr show sipa_eth0
ip route
ping -I sipa_eth0 -c 4 8.8.8.8
To stop cellular data:
app_demo test_connman_deactivate_context /unc_0/context1
app_demo can also be used to send AT commands via oFono. The following commands are used solely to retrieve basic information:
app_demo test_modem_send_at_sync AT+CGMI
app_demo test_modem_send_at_sync AT+CGMM
app_demo test_modem_send_at_sync AT+CGSN
|
Do not execute AT commands from unknown sources that perform write operations, calibration, or RF testing. Such commands may alter NV parameters, the IMEI, frequency bands, or transmission status, and could even prevent the modem from registering on the network. |