Resource Download
- Baidu Netdisk (permanently valid) link: https://pan.baidu.com/s/1cgUFYpFr3KWQicozyP-d1g?pwd=97eq
Password: 97eq
Contributed By: Bilibili user 搞linux的旺仔 (with their permission to upload the data) The contents after extraction are as follows:
1. Introduction
The origin of this project was that my Raspberry Pi broke, and coincidentally, I noticed that LCSC Taishan-RK3566-Linux Dev Board was holding an event, with good specifications. So, I purchased one. Currently, I’m preparing for the 2024 National Electronics Competition's vision part. I found that there are not many tutorials on using OpenCV for the competition, and most of my peers use OpenMV or K210 for the vision part. Personally, I find OpenMV to be too expensive, and the performance of the low-spec versions isn't great. As for the K210 series, there is still a lack of resources and community support, so I decided to go with OpenCV as it’s highly portable, powerful, and has a lot of open-source resources available. Initially, I planned to use the official Ubuntu system to run OpenCV, but I found it a bit inconvenient, so I found a tutorial on Bilibili by a user called 搞linux的旺仔), which showed how to port the Raspberry Pi system to LCSC Taishan-RK3566-Linux Dev Board. I successfully got it running with OpenCV after some time, and now I’m sharing this tutorial for those using LCSC Taishan-RK3566-Linux Dev Board, so they can get the same results as the Raspberry Pi.
PS: This entire project is completed on Ubuntu 22.04. The host machine must be running a Linux system, and you can either use a virtual machine or install Linux directly. This tutorial does not go into details about how to install the Linux system.
2. Extracting the Package
Use the following command to extract:
tar -zxvf jlc-rk3566-raspi.tar.gz
After extraction, use ls to check the contents. You will see something like the image below. (Brief explanation: The "image" folder contains all the files needed for this operation, while the "kernel" folder contains the source code for this operation. If you're interested, you can watch the tutorial video by the Bilibili user to get a quick understanding.)
Go to the "image" folder.
You will see the following 5 files. First, open the README file to see the image below.
The entire process can be completed with just three commands. The command for opening the upgrade tool may vary for each user.
- Execute
sudo ./upgrade_tool pl
to confirm the starting LBA of the rootfs (in my case, it's 0x00058000) - Execute
sudo ./upgrade_tool wl 0x00058000 rootfs.img
to burn the Raspberry Pi file system - Execute
sudo ./upgrade_tool DI -b boot.img
to burn Linux
3. Flashing the Image
Before flashing, connect the Taishan-Pai board to your computer using a data cable. First, run sudo ./upgrade_tool pl
in the terminal. You should see the message below:
No found any rockusb device,please plug device in!
This message indicates that the LCSC Taishan-RK3566-Linux Dev Board is not in LOADER mode
To enter LOADER mode
, press and hold the REC button, then press the RST button once, and release the REC button to enter LOADER mode
.
If you see the message below, it means you have not entered LOADER mode
. Please repeat the above steps.
After entering the command sudo ./upgrade_tool pl
again, you should see the following:
It will show the following:
NO LBA Size Name
01 0x00004000 0x00002000 uboot
02 0x00006000 0x00002000 misc
03 0x00008000 0x00020000 boot
04 0x00028000 0x00020000 recovery
05 0x00048000 0x00010000 backup
06 0x00058000 0x00c00000 rootfs
07 0x00c58000 0x00040000 oem
08 0x00c98000 0x01086fc0 userdata
2
3
4
5
6
7
8
9
This means the board's chip has been detected.
Now, execute sudo ./upgrade_tool wl 0x00058000 rootfs.img
to start flashing the Raspberry Pi image.
Next, execute sudo ./upgrade_tool DI -b boot.img
to burn the boot image.
Once the flashing is complete, restart the LCSC Taishan-RK3566-Linux Dev Board, and you will see the Raspberry Pi system's initialization interface.
At this point, the Raspberry Pi system is running on the Taishan-Pai board, which means you now have a board similar to the Raspberry Pi 4B. Just remember not to connect to the network or update the Raspberry Pi during the configuration phase.
4. Enabling SSH, VNC, and Serial Port
SSH, VNC, and serial port are essential for allowing the development board to accept commands from the host. So, we'll enable all of them here for convenience.
First, connect a display to the LCSC Taishan-RK3566-Linux Dev Board, and open SSH, VNC, and serial port.
In the terminal of LCSC Taishan-RK3566-Linux Dev Board, type sudo raspi-config
to enter the settings.
Select Interface Options
Enable SSH, VNC, and Serial Port by selecting "Yes" for each. For the serial port, on the first screen, select "No," and on the next screen, select "Yes."
Once done, your Raspberry Pi will be ready to control using SSH and VNC. Note that this version of VNC doesn’t come with a license activated, so you’ll need to get a license and activate it (this step is not covered here).
5. Installing OpenCV on the Development Board via SSH or VNC
Since I have already installed these software, you may notice some differences in the screenshots. Don’t be confused by that.
In the terminal of the LCSC Taishan-RK3566-Linux Dev Board, enter the sudo apt-get install aptitude
to install the dependencies and automatically fetch them:
Next, type the following command to install sudo apt-get install python3-pip
:
Then, enter python3 in the terminal to check the version:
Press ctrl+z
to suspend Python.
Then enter sudo apt-get install python3-opencv
For safety, check the OpenCV version.
Enter python3
and then type import cv2
.
Then, enter cv2.__version__
You should see version 4.5.1.
At this point, OpenCV is installed. Now, you can run your OpenCV code for visual recognition, and it should run smoothly!
6. Notes
- If you're inserting a USB camera, remember to use
ls -al /dev/ | grep video
to check its video device number. My device number is 9, so when initializing the camera, use cap = cv2.VideoCapture(9). - When using the serial port, the device is always
/dev/ttyS3
, which refers to serial port 3. Serial port 1 is reserved for the LCSC Taishan-RK3566-Linux Dev Board's debug interface, which is connected to pins 8 and 10 on the board (TX and RX for serial port 3). - Do not use the Rockchip burning tool on Windows for operations; it will display an error saying the package is unavailable.
These are the issues I've encountered so far. I'll update if I think of anything else.