CM4-DISP-BASE-7A-BOX

From Waveshare Wiki
Jump to: navigation, search
CM4-DISP-BASE-7A-BOX
CM4-DISP-BASE-7A-BOX
Compute-Module-4-1.jpg


7″ Touch Screen All-In-One Kit Designed for Raspberry Pi CM4, 5MP Camera, Aluminum Case
{{{name2}}}

{{{name3}}}

{{{name4}}}

{{{name5}}}

{{{name6}}}

Overview

This is a 7-inch touch screen all-in-one kit designed for Raspberry Pi CM4. CM4-DISP-BASE-7A-BOX, 7~36V DC power supply, Onboard four-way USB2.0, 7-inch touch screen, etc. the all-in-one kit is convenient for use.

Precautions

1: Do not plug and unplug any device except USB and HDMI when powered on.
2: If the fan needs to be replaced, please confirm the fan voltage and then power it on.
3: The USB SLAVE interface is used to burn the image and cannot be used as an OTG interface.
4: In normal use, it is necessary to provide at least a 12V 1A power supply for CM4. Otherwise, there may be problems such as automatic shutdown, frequency reduction, and so on.
5: Onboard default 4x USB 2.0 interfaces.
6: POE function is not supported.
8: The screen requires a driver for working.

Dimension

CM4-DISP-BASE-7A-BOX
CM4-DISP-BASE-7A-BOX-details-size.jpg

What's on board

CM4-DISP-BASE-7A-BOX-details-intro.jpg

Label Name Description
1 CM4 Connector suitable for all variants of Compute Module 4
2 DC power supply interface 7~36V DC wide voltage power supply, it is recommended to use a 24W or higher power supply
3 CM4 Status Indicator PWR: Raspberry Pi Power Indicator
ACT: Raspberry Pi Working Status Indicator
4 HDMI port Support 4K 30fps output
5 RJ45 Gigabit Ethernet port Support 10 / 100 / 1000M network access
6 USB2.0 interface 4x USB 2.0, for connecting sorts of USB devices
7 Micro SD card interface for connecting a Micro SD card with a pre-burnt image (Lite variant ONLY)
8 USB SLAVE port USB programming port
9 BOOT switch button ON: CM4 will be booted from USB-C interface
OFF: CM4 will be booted from eMMC or Micro SD card
10 MIPI CSI interface connected to the 5MP front camera
11 Isolated I2C for controlling or reading data from devices via I2C
12 Isolated GPIO for controlling or detecting devices via GPIO
13 Isolated RS485 can communicate through the RS485 interface
14 Isolated RS232 can communicate through the RS232 interface
15 DC power supply 7 ~ 36V DC power supply interface
16 RS485 termination resistor and GPIO logic level selection RS485: connect/disconnect the 120R resistor
GPIO: GPIO logic level selection
17 RTC Battery Connector supports CR1220 button cell
18 Touch screen interface connected to the capacitive touch screen
19 Display connector connected to the 7inch 800×480 display
20 M.2 M KEY supports M.2 M KEY NVME SSD, or other communication modules using PCIe channel
21 Speaker interface audio output
22 FAN for connecting the cooling fan, allows speed adjustment and measurement
23 RTC Interrupt Pin Switch GL-EN: CM4 power down on RTC interruption
PI-RUN: CM4 will reboot on RTC interruption
D16: D16 pin is triggered on RTC interruption (default)
24 System function switch BT_DIS: Bluetooth disabled, for CM4 with antenna variant ONLY
WIFi_DIS: WiFi disabled, for CM4 with antenna variant ONLY
WP_DIS: the boot mode switch, ONLY be used when NOT booted from eMMC or SD card
25 FAN Power Supply Selection select 5V (default) or 12V power to drive the fan
26 IO-VREF selection set the CM4 IO logic level as 3.3V (default) or 1.8V
27 RS485 toggle GPIO13/12: using ttyAMA1 device (default)
GPIO15/14: use ttyS0 device
28 I2C bus selection of RTC/FAN SDA0/SCL0: I2C-10 is shared with CSI/DSI
GPIO3/2: I2C-1 is shared with 40PIN GPIO (default)


Writing Image


USB2.0

The USB port is disabled by default on the CM4 to save power. If you need to use it, you need to add the following to the config.txt file:

dtoverlay=dwc2,dr_mode=host

Then reboot the CM4.

If you use the latest Raspberry Pi OS (image after October 30, 2021) USB2.0 is OTG mode by default, CM4 will report an error:

config failed, hub doesn't have any ports! (err -19)

However, USB can still be workable. If you want to remove this error, please remove the line otg_mode=1 in [cm4] of config.txt, and add dtoverlay=dwc2, dr_mode=host (USB cannot be recognized without adding it).
CM4 Burn EMMC 12.png


Enable I2C Interface

Open a terminal and run the following commands:

sudo raspi-config 
Choose Interfacing Options -> I2C -> Yes.

Reboot Raspberry Pi:

sudo reboot

RPI open i2c.png
There are two I2C addresses used by the RTC and FAN, please avoid the address when connecting external I2C devices.

  • RTC: i2c-1 (0x51)
  • FAN: i2c-1 (0x2F)

RS485/RS232

They are disabled by default. If you need to use the RS485 or RS232, you need to modify the config.txt:

sudo nano /boot/config.txt

And add the following lines:

dtoverlay=uart3
dtoverlay=uart5

Then reboot the CM4 and check if the corresponding ports were recognized.

reboot
ls /dev/ttyAMA*

RS232 occupies GPIO5/GPIO4 (BCM code 4/5), device number ttyAMA1.
RS485 occupies GPIO13/GPIO12 (BCM code 13/12), device number ttyAMA2.

RS485 can be switched to GPIO15/14 for device number ttyS0.
Refer to number 27 of the Onboard Resources, and change the corresponding resistance to the corresponding position.

Test

sudo apt-get install minicom
# RS232
sudo minicom -D /dev/ttyAMA1
#RS485
sudo minicom -D /dev/ttyAMA2

GPIO

The GPIO input/output interface only supports a single mode and does not support switching. The following are the corresponding pins of the interface.
OUT CH1 GPIO17
OUT CH2 GPIO27
IN CH1 GPIO22
IN CH2 GPIO23

The module only supports 3.3V and 5V, which can be switched by jumper caps.

Screen and camera turned on

Bullseye & Bookworm

Display

Comment the following statement in the config.txt file (the config file is located in the root directory of the TF card, i.e. in /boot or in /boot/firmware/):
Add the following statement below [all]:

dtoverlay=vc4-kms-dsi-7inch,dsi0

Reboot the Raspberry Pi after saving:

sudo reboot

Camera

libcamera-hello -t 0
Or
libcamera-hello

#The default camera model is ov5647, if you need to change other cameras, you can modify it by yourself 
#Add:
dtoverlay=ov5647,cam1
dtoverlay=ov5647,cam0

#ov5647 is the camera sensor model, and there are other sensors:  
dtoverlay=ov5647,cam0
dtoverlay=imx219,cam0
dtoverlay=ov9281,cam0
dtoverlay=imx477,cam0

#And then reboot
reboot

#Other commands:
#Check whether the camera is detected  
libcamera-hello --list-cameras

#Open the camera
libcamera-hello  --camera 0

#Take photo
libcamera-jpeg -o test.jpg
#And you can add "--camera" to specify the camera

More instructions click me
Reference Raspberry Pi Manual

Buster

I2C-10, I2C-11 and I2C-0 devices are used when using the camera and DSI. Run the following commands:

wget https://files.waveshare.com/upload/7/75/CM4_dt_blob_Source.zip
unzip -o  CM4_dt_blob_Source.zip -d ./CM4_dt_blob_Source
sudo chmod 777 -R CM4_dt_blob_Source
cd CM4_dt_blob_Source/
sudo  dtc -I dts -O dtb -o /boot/dt-blob.bin dt-blob-disp0-double_cam.dts
#After execution, turn off the power and restart the CM4

Note: On December 2, 2021, the Raspberry Pi OS for Raspberry Pi: the Buster branch, and the Bullseye branch.
The Buster branch is a continuation of the old system and is more stable. The Bullseye branch adds some new features and uses open-source libraries and new interfaces.
If you use the Buster branch system, you need to run raspi-config, select Interfacing Options -> Camera -> Yes -> Finish -> Yes, and "enable camera", and reboot it to save the settings.
Load the above bin file and reboot, the image can be directly output. View the first connected camera screen:

sudo raspivid -t 0 -cs 0

View the second connected camera screen:

sudo raspivid -t 0 -cs 1

Audio

Add the following lines to config,txt.

dtparam=audio=on
dtoverlay=audremap,pins_18_19
audio_pwm_mode=2
disable_audio_dither=1

Reboot the CM4 and check if the new play device is recognized by the command aplay -l.
After it is turned on, it can be recognized under the audio selection. There may be a problem that the default sound card is not a GPIO sound card.

RTC FAN

  • Note: Please connect the fan before turning on the power of the expansion board and then complete the test. Please do not connect the fan after the expansion board has been powered on, otherwise the chip will be burned!

I2C-1 is used by default

RTC (PCF85063a) on i2c-1, address is 0x51 (7-bit address)
FAN (EMC2301) on i2c-1, address is 0x2f (7-bit address)

RTC

sudo nano /boot/config.txt
 #Add the following command at the end:
 dtparam=i2c_arm=on
 dtoverlay=i2c-rtc,pcf85063a
 #Save, exit, and reboot 
 sudo reboot

How to use Hwclock

Synchronize system clock to hardware clock

sudo hwclock -w

Synchronize hardware clock to system clock

sudo hwclock  -s
 #Please close the network or the network time synchronization, otherwiese the setting could not be saved
 #This command is only for testing, please open it during usage and the time would be accurate 
 #Close network time synchronization
 # sudo timedatectl set-ntp false 
 #Open network time synchronization
 # sudo timedatectl set-ntp true

Set the hardware clock time:

sudo hwclock --set --date="9/8/2021 16:45:05"

View hardware clock

sudo hwclock -r

Display version information

sudo hwclock --verbose

Fan

1: Check whether the kernel version is or higher than 6.1.31:

uname --all

2. Add the following at config.txt:

dtoverlay=i2c-fan,emc2301,midtemp=45000,maxtemp=65000

3. For more settings, please refer to this link.

Resource

Document

Demo codes

3D Drawing

Software

FAQ

Question:
I cannot find the I2C address of the RTC/FAN controller by using i2cdetect -y 10?


Answer:

a) Check whether dtparam -audio -on is blocked in /boot/config.txt.
b) Check whether the /boot/dt-blob.bin file exists, if it cannot be used, please delete it.


Support



Technical Support

If you need technical support or have any feedback/review, please click the Submit Now button to submit a ticket, Our support team will check and reply to you within 1 to 2 working days. Please be patient as we make every effort to help you to resolve the issue.
Working Time: 9 AM - 6 PM GMT+8 (Monday to Friday)