OKdo ROCK Computers
Introduction
OKdo ROCK computers are a series of low-cost, high performance computers developed by OKdo (a British company) in collaboration with Radxa (a Chinese company), and can be seen as alternatives to other SBCs, such as the Raspberry Pi. ROCK computers are available in a wide range with different hardware capabilities that will suit most user needs, in both Single-Board Computer (SBC) and Compute Module (CM) form. You can get an overview of the various ROCK computers at:
https://www.okdo.com/blog/the-ultimate-guide-to-rock-single-board-computers/
Read on to learn in detail about the various OKdo ROCK computers that I have come across and my experiences of using them.
Note: It is advised that each section be read in turn. The images on this page can also be found at the bottom of the page for downloading for better viewing.
OKdo ROCK 3 Compute Module (CM3)
Overview
I was familiar with the Raspberry Pi compute modules but came across the OKdo ROCK 3 Compute Module (CM) from Radxa, which is available with different amounts of RAM, with/without wireless, and different eMMC capacity options including none. I won a bid for a ROCK 3 Compute Module with 2GB ram and 16GB eMMC for under £7 ($9), sold as new, I later got a second one for a similar price and same spec with the intention of installing Linux on one module and Android on the other. The Compute Module normally retails for £45 ($58) and the product page can be found at:
https://www.okdo.com/p/okdo-rock-3-compute-module-cm3-2gb-16gb-with-wifi-bluetooth/
On the page you'll find detailed specification, link to OKdo Software and Downloads Hub, and toward the bottom there are links to the datasheet, product brief, and schematic.
A summary of the specification for the CM for the particular one I have is as follows:
Rockchip RK3566 64-bit Quad Core SoC with 2GHz featuring Quad-core Arm Cortex-A55 (ARMv8) 64-bit CPU, Arm Mali-G52-2EE GPU, and 1T NPU.
2GB LPDDR4 32-bit RAM.
Support eMMC 5.1 (16GB) and SFC memory.
HDMI2.0, eDP 1.3, Dual MIPI-DSI, combo with single LVDS, 24bit RGB/BT1120 and EBC display interfaces.
4K H.265/H.264/VP9 video decoder and 1080p@60fps H.264/H.265 video encoder support.
8M Pixel ISP and 1 x 4 lanes or 2 x 2 lanes MIPI CSI-2 and DVP video interfaces.
I2S0/I2S1 with 8 channels, IS2/I2S3 with 2 channels, SPDIF0, PDM0 with 8 channels, TDM with 8 channels and Voice Activity Detection (VAD) audio interfaces.
Support PDM with microphone array. I2S.
USB 3.0 host, x2 SATA 3.0, x1 PCIE2.1, x2 SerDes (serialiser/deserialiser) lanes, dual USB 2.0 host and one USB 2.0 OTG and a single RGMII interface.
5VDC at 5A power requirement.
Debian/Ubuntu Linux and Android 11 support.
0°C to 60°C operating temperature.
802.11 b/g/n/ac Wi-Fi 5, Bluetooth 5.0 with BLE, Gigabit Ethernet connectivity.
A list of additional interfaces:
8x I2C
4x SPI
8x UART
9x PWM
50x GPIO
2x ADC
1x SDIO 3.0
3x 0.4mm pitch B2B connector
The specification should be similar for the other variations of the CM.
Please see the Rock CM3 I/O Carrier Board section for details of using the CM with an I/O board.
Rock CM3 I/O Carrier Board
Please note that although this section is specific to using the ROCK 3 Compute module (CM) with the Rock CM3 I/O Carrier Board it should still prove useful for general information on using the I/O board.
Overview
Overview
Compute modules (CM) are designed to be used in some kind of expansion carrier board in which to power the module and provide the required I/O interfaces via various connectors, this can be an existing board that has a range of I/O and power options (which is useful for getting to know the system and general testing) or one designed by the end user (that has the required interfaces only). Since I had paid so little for the ROCK 3 CM I didn't mind paying a significant amount for an I/O board, which I got from RS, sold as ‘Rock CM3 I/O Carrier Board’, for £53.70 ($69):
https://uk.rs-online.com/web/p/rock-sbc-boards/2564697
Note that OKdo is a part of the RS Group.
Considering I found one eBay listing for the same board, selling for £140 ($181), RS was the cheapest.
There is a link to the datasheet under 'Technical Reference' but note that there is a warning that 'This product is not for general use by consumers', likely because they are targeting industrial and business users. The various features and interfaces can be found under 'Product Details', which I've summarised:
Half mini-itx design
Support for multiple display interfaces including HDMI, 2x MIPI DSI/LVDS, eDP, with the option to have dual displays
Support for x1 PCIe card
Up to 2x SATA via USB3.0, or PCIe 2.0
Supports Ubuntu/Debian and Android
5 x USB 2.0 ports (2 x internal USB2 headers, 3 x type connectors)
1 x USB 3.0 port (5Gbps, type A connector)
1x USB 2.0 OTG (Micro USB connector)
1 x PCIe 1-lane Host, Gen 2 (5Gbps, x1 PCIe connector)
2 x SATA 7P connectors (1 x shared with USB 3, 1 x shared with PCIe)
1 x microSD card connector
40 x GPIO pin header
1x Gigabit Ethernet RJ45 with PoE support
1 x HDMI up to 4K x 2K@60HZ
1 x eDP support 4K x 2K@60HZ
2 x MIPI DSI 4 lanes, supporting dual displays up to 1920 x 1080@60HZ
Dual MIPI CSI input
5mm headphone jack with mic support
Lion battery connector
RTC battery connector
FAN connector
You can also find the carrier board on the OKdo site:
https://www.okdo.com/p/rock-3-compute-module-cm3-io-board/
You will also find the product details which gives us some additional information:
Power DC 12V 2.5/5.5mm
Dimensions 160mm x 90mm
SKU 2564697
mpn RC119-CM3-IO
There is a link to the 'Radxa CM3 IO Board Product Brief v0.8' under the Technical Reference section.
On this page in the 'Radxa CM3 IO Board' section are links for hardware information about what appears to be for the Rock CM3 I/O Carrier Board:
https://wiki.radxa.com/Rock3/hardware
This includes schematic, CAD drawings, etc.
When plugging the CM into the I/O board be very careful in doing so and even more when removing, of course you should only ever insert/remove with the power off.
Software
Compute module (CM) of course needs to run an Operating System (O/S) and I decided to start with booting off an SD card so I went to the downloads at:
https://wiki.radxa.com/Rock3/downloads
I downloaded Debian Bullseye (11). After downloading I extracted and wrote to a micro SD card using the Raspberry Pi Imager's 'Use custom' option (you can of course use any other program that does the same job, I just so happened to have the app already installed).
After the image was written to the SD card in the I/O board's slot, for reference I used a Sony 64GB class 10 card which I happened to have spare. The I/O board runs off 12VDC using a centre positive barrel jack connector but I couldn't find any information online about current draw so I used my variable power supply set to 12V. With a monitor connected to the I/O board's HDMI port I plugged in the 12V and saw a 110mA draw but nothing appeared on the screen. I checked one of the fan connectors with my multimeter and saw 12V and 5V so it seemed the board was getting power at least.
Possibly there was issue with the SD card image but to be sure I connected a USB to UART adapter to the I/O board via the GPIO header. The pinout can be found on this page:
https://wiki.radxa.com/Rock3/CM3/IO/GPIO
I used a Waveshare PL2303 USB to UART, connecting its GND to GPIO GND, and its RX to GPIO UART2_TX_M0. We dont need to worry about UART2_RX_M0 since we are just interested in the messages. Using PuTTY I opened the serial port of the USB adapter and set the speed to 1500000 (which I found online was the default speed). When I powered the I/O board again I saw gibberish in the PuTTY window - turns out some USB UART adapters can't cope with the unusual 1500000 speed, indeed, checking the datasheet for the PL2303TA chip that the adapter uses it doesn’t seem to support the specific speed. I tried another adapter, this one using FT232RL, and that worked - the text was readable. Although I wasn’t quite sure what all the information meant it seemed to suggest it wasn’t booting but at least wasn't dead.
What I realised what that I downloaded the 'Radxa CM3 RASPCM4IO' version rather than 'Radxa CM3 IO' so I got the correct version, which has filename radxa-cm3-io_debian_bullseye_xfce_b25.img.xz. Writing that to the SD card and booting off it, it successfully reached the log in screen so indeed the O/S image I first used was the issue. The default username is rock, the password also rock.
I shut down, plugged in a USB dongle for keyboard and mouse and an ethernet cable from my router. From plugging in power (this time using a 12VDC 2A power adapter) it took 8 seconds before the LED lit on the CM, 20 seconds before the Linux loading text appeared, and 1 minute 33 seconds to reach the log in. The default username and password for Debian is rock.
It took 1 minute 18 seconds to load the desktop after logging in, accessing the menus was laggy and occasionally the system froze for a few seconds, but expected considering the spec. You get the expected apps - Terminal Emulator, File Manager, Web Browser, accessible from the Applications menu. Under Development sub menu is only VSCodium, Chromium Browser and Firefox ESR can be found under Internet.
Launching the Terminal took a couple of seconds to appear, running ping www.google.com took about 4 seconds before it responded but it showed a fast internet connection. Opening Chromiumn took 22 seconds to load, navigating to YouTube was 40 seconds to load the home page. Playing a video windowed at 360p resulted in 50 dropped frames in a few seconds. Firefox took 1 minute and 8 seconds to load, 2 minute 5 seconds to reach the YouTube home page. Playing a windowed video I struggled even to pause it as the system was lagging so much, by the time I could set the resolution to 360p and bring up the stats, almost 1000 frames had been dropped.
Using free -m from the Terminal showed less than 1GB RAM free, if wanted more memory then an option would be to use a command line only O/S. Using lsblk in Terminal I found mmcblk0 58.1G, which is the SD card, and mmcblk1 14.6G, which is the eMMC. There is just over 50GB of space on the SD card free to use. Of course this is the 'out of box' experience, an update on the O/S should be performed but I intend to install the O/S to eMMC, which should be faster.
It took 23 seconds for the system to shut down.
The RK3566 chip in particular, located on the CM, was warm to touch initially but then got quite hot so it will need a heatsink and possibly fan for long term use.
Next, I tried to install the O/S to the CM's eMMC. I found a guide at:
https://wiki.radxa.com/Rock3/installusb-install-radxa-cm3-io
I used the same O/S image as I used for the SD card. I completed the 'Install Tools&Drivers' section (installed RKDevTool and drivers) and downloaded the RK356X loader.
When it came to booting the I/O board into maskrom mode, whenever I held the button as instructed and plugged power into the I/O board my Surface Pro running Windows 10 blue screened.
I tried on my Surface Studio running Windows 10 (note I used a different micro USB cable but didn't want to risk blue screening my Surface Pro again) and when I put the board into maskrom mode it didn't bluescreen the computer so perhaps there was a driver fault with the Pro. I couldn't see a new device in the Device Manager nor File Explorer. It would have been nice if there was an LED on the I/O board showing life.
Continuing with the instructions, when I opened rkdeveloptool the text was in Chinese and I even tried V2.81 of the app and that also was in Chinese (which seems to be the case for other users when looking online). Google translating the text at the bottom of the rkdeveloptool window it reported a maskrom device had been found (see image below), so that was a good sign.
Then I clicked the empty box at the far end of 'Loader' and selected the rk356x... file as indicated in the image in the guide and clicked the empty box below and selected the O/S image I had previously downloaded and extracted. I then ended up with:
I then clicked the Run button, which is the first button on the left near the bottom, it took 3 minutes 20 seconds to install, at which point the CM's LED lit and then began flashing along with the LED to the left of the USB 3 port. As can be seen in the next image the progress text at the right side of the window is mostly in Chinese but at least the progress percentage counting up to 100% lets you know something is happening.
Interestingly I now noticed a 'CDC ECM' entry in the Device Manager - unplugging the I/O board caused it to disappear so it was definitely to do with the I/O board.
Connecting my TV to the I/O board I saw that Linux had reached the log in screen, hence the LED activity. I shut down then removed and reinserted power and noted:
10 seconds for loading text to appear.
25 seconds to reach the log in screen.
16 seconds from log in screen to reach the desktop.
So indeed eMMC was faster than the SD card.
Menus were still laggy, as to be expected, as likely they are dependent on the CPU performance but I did see an improvement in the following:
4 seconds for Chromium to load, 15 seconds to reach the YouTube home page (fully loaded). Playing a windowed YouTube video on 360p a much fewer number of frames were dropped.
Firefox took 11 seconds to load, 15 seconds to reach the youtube.com home page. Playing a windowed YouTube video on 360p, however, resulted in 100s of frames being dropped in seconds but at least the browser was more responsive to pausing/playing the video.
So as to be expected, having the O/S run off eMMC is more responsive, but parts will still be laggy due to the processor being underpowered and having very little memory.
Checking the file manager, I saw that there was 9.9GiB available free space.
Since I intend to always run from eMMC I updated the O/S by opening the terminal and issuing:
sudo apt update
sudo apt upgrade
There were only 92MB of updates, which took about 9 mins.
I did a restart but it hung while booting with a flashing cursor in top left. I powered off and on again with shift held and that resulted in a message:
dna-names property of mode '/serial@fe650000' missing or empty
Not having time to investigate too much I just ended up reinstalling to eMMC again. If need be I can in the future update individual packages.
I later returned to Linux to test the effectiveness of a heatsink and to note further the current draw when running off a variable power supply. Oddly, the system wouldn't boot even though I was sure I had reinstalled Linux so I had to install it again.
There was 160mA peak initial current draw and 420mA peak during boot.
Now on to measuring temperature, note that it was cooler in the room than when I first had installed Linux. To check the temperature I used the following in the terminal:
cat /sys/class/thermal/thermal_zone*/temp
Which reported:
40000
40000
Which is 40°C. I then executed the command again and got:
40625
39444
Which is 40.625°C and 39.444°C respectively.
To find out what each value means use:
cat /sys/class/thermal/thermal_zone0/type
Which returned:
soc-thermal
And:
cat /sys/class/thermal/thermal_zone1/type
Which gave:
gpu-thermal
Which appear to be the temperature zones for the CPU and GPU respectively.
I then opened Chromium and played a 480p video to get the system hotter. By the time the video had loaded I paused and checked the thermals in the same way as before, this time I got:
63888
61111
This was with 69 dropped frames out of 605 and current draw was never more than 420ma during video playback.
Next I installed on the RK3566 chip a 14x14x6mm aluminium heatsink with sticky thermal pad from Temu after I had left it to cool for some while. It's almost the perfect size - just a few mm short in 1 dimension.
I booted again, went into the terminal and the temperature readings were:
36111
35555
Checking again I got:
38333
38333
Opening Chromium I played a video, which appeared to play smoother, with 29 dropped frames out of 448.
The temperature values were:
55000
51875
After playing the video some more I then got:
53125
52500
Considering I used a cheap heatsink which probably didn't have the best heat transfer pad it definitely helped - the heatsink was warm so it was definitely absorbing heat.
Next, I installed Android 11 to my second ROCK 3 CM, the download can be found at:
https://wiki.radxa.com/Rock3/downloads
The linked is called 'Android Radxa CM3 IO', filename rock_cm3io-android11-20220408_1204-gpt.img.
This time I used my recently acquired Windows 11 laptop to write to the eMMC - please see the previous section where I detailed installing Linux to eMMC.
Once again RKDevTool appeared in Chinese. I plugged in the micro USB to the I/O board and held the button on the CM and plugged in power. When i opened RKDevTool it said no device was found so I removed power from the board, repeated the process and it detected the MASKROM device.
Note that despite power being applied to the I/O board no LEDs will be lit on the CM or carrier board.
I followed the steps as before to set up RKDevTool but using the previously downloaded Android image. There was also a third entry in RKDevTool, u-boot.itb, which I unchecked. I clicked on the Run button, note, still no LEDs lit on the CM or carrier board. It took 3 minutes and 24 seconds to complete, however, no LEDs lit when finished. In Device Manager there was a Rockusb Device. I tried power cycling the board and connecting to a TV but there was no boot and I connected up a USB to UART adapter but there was no activity in PuTTY.
Comparing RKDevTool to the previous use when installing Linux I noticed that ibloader (second entry) was to set addr 0x00000040 instead of 0x00000000 as seen in the install guide. To fix the address value I double-clicked the value, changed to zero, and clicked away. I then tried writing the image again, after it finished I thought it was unsuccessful but after a few seconds the LED on the CM was blinking rapidly (in the same manner as the LED to the left of the USB 3 port was when running Linux). The LED to the right of the HDMI port was solid red, and the LED to the left of USB 3 port was steadily flashing on/off unlike when running Linux. This shows that when running Linux the LEDs weren't necessarily indicating an issue as I thought may have been the case due to the way they were flashing, clearly Linux uses them in different ways to Android.
I powered off and connected my TV via HDMI, keyboard to USB 2 port and mouse to the keyboard's USB hub. I used my variable PSU to power the board and it took 3 seconds before the Rockchip logo appeared, 14 seconds total for the Android logo to appear, and 26 seconds total for the 'Hi there' setup screen to appear. I changed the language to ENGLISH (UNITED KINGDOM), clicked the START button and selected to set up offline since I didn't have a wireless antenna plugged into the CM. When I selected to set up offline a warning appeared advising you to connect, it refers to the device as a 'tablet', take note. I clicked the CONTINUE button to skip Wi-Fi setup and then I had to set the date and time, as well as the Google services options, and I skipped setting up a screen lock. It then took about 7 seconds to drop into the home screen.
I saw 400mA was the peak current being drawn, dropping to around 250mA after Android had loaded.
As to be expected with Android, compared to GUI Linux, the system is much more responsive and although I was using a keyboard and mouse, a touch screen would have made it even easier to use. There are Google Chrome, Gmail and camera icons, as well as a Google search bar, along the bottom of the screen are volume down, back button, home button, switch app button, and volume up button. The apps only took seconds to launch when their icon was clicked on.
In the top-left of the screen is the time, and you can drag down from the top of the screen using a mouse to access settings, messages, etc. Oddly, it shows battery at 100% even though there is no battery in the system. There was a message warning that the serial console was enabled, impacting performance.
You can pull up from the bottom of the screen to access more apps - calculator, calendar, camera, Play Store, Phone, Sound Recorder, etc.
Under setting->storage it says 35% used, 10.42GB free.
Settings->About tablet reports:
Device name rk356x_rock_cm3_r (model is same)
Android version 11
I couldn't find out how to shut down since there is no power button (I think one can be added to the I/O board) so I just pulled out power supply (which you shouldn't do if eMMC/SD card is being written to, which unfortunately there is no clear indication of).
I connected a wireless antenna to the CM and powered on again, this time using a 12V 1A power adapter. It took 33 seconds to boot and when it reached the home screen there was a 'tablet starting' message for a few seconds, which appears every time I power on to let you know it's still loading.
I set up a Wi-Fi connection but had to manually set the date and time otherwise YouTube (using Chrome) wouldn't load - when using ethernet it retrieved the date and time so I think the Wi-Fi was slow, possibly because of the small antenna, or the generally bad reception from my wireless extender. As there was no battery installed in the I/O board the date and time won't be correct when the system boots unless Android is set to get it from the network, which is the default behaviour.
As mentioned, the Wi-Fi connection wasn't very good so that likely impacted performance, such as page loading, also hindered by the low spec of the CM. It took 13 seconds for YouTube to load and playing a windowed video at 240p (which is what it was set to likely due to the poor Wi-Fi connection) no frames were dropped immediately and only one frame was dropped after about 10 seconds of the video playing.
For testing Bluetooth I just checked it could see Bluetooth devices, and it indeed it picked up my phone, so I didn't test further.
I should add that while using Android I noticed very little high pitch sound from the I/O board, just initially when power is connected, so perhaps Linux 'stresses' the board more than Android does.
I also tried Android with an ethernet connection plugged in, under settings->Network and Internet, I turned off Wi-Fi to ensure it wouldn't try to use Wi-Fi, to ensure testing ethernet was fair. Under Ethernet in settings it had an IP address so that was promising. Under Date and time in settings it was enabled to 'Use network provided time, date & time' and indeed the correct date and time was showing. But this was when I got the message:
This device isn't Play Protect certified.
Now, when I opened certain apps, such as Chrome, Gmail and the Play Store, I couldn't use them due to the Play Protect certified issue, basic apps, such as sound recorder worked, however. I tried to do an update from the settings but it just kept searching and never found an update.
Supposedly you can register a device to fix the Play Protect issue but first you have to get the device's Google ID using Android Debug Bridge (ADB), a tool I had never used before. I found a guide at:
https://developer.android.com/tools/adb
I went with the 'standalone Android SDK Platform Tools package'. To use ADB on the CM we have to enable debugging in Android: in settings I went to About tablet and kept clicking on Build number (you have to scroll down until you reach it) until Developer options was enabled. I went to Developer options in settings->system, click Advanced then Debeloper options. I scrolled down to the USB debugging option and clicked to enable. I plugged a micro USB cable into the I/O board's USB socket and the other end into my computer, there was no pop up on the TV so I was concerned it wasn't working.
In CMD in Windows I CD'd to the platform-tools folder and issued:
adb devices
It responded with:
List of devices attached
GNJ0B3ADJ3 device
I also did:
adb root
And it responded with:
restarting adb as root
I then entered the ADB shell with:
adb shell
And got:
rk356x_rock_cm3_r:/ #
Clearly it was connected to the I/O board.
On the Google site for device registration:
https://www.google.com/android/uncertified/
It has the code to get the Google Services Framework Android ID required to register the device:
adb root
adb shell 'sqlite3 /data/user/$(cmd activity get-current-user)/*/*/gservices.db \
"select * from main where name = \"android_id\";"'
However, when I issued the second command it responded with:
no closing quote
Even though I used copy and paste. I did try putting the second command all on one line but it replied with:
inaccessible or not found
So I did this:
adb shell
sqlite3 /data/user/$(cmd activity get-current-user)/*/*/gservices.db \ "select * from main where name = \"android_id\";"
It gave me the ID (I don't think it pasted the command right but I got the ID anyway) and I entered it into the previously linked to site for device registration and it registered the device. I check the CM the next day and the day after and it still said the device isn't Play Protect certified and this was with an ethernet cable plugged in so there shouldn't have been an internet connection problem. Since it's not possible to sign into a Google account on the CM due to Google Play services not running that cannot be the issue, that is, it stands to reason it just needs an active internet connection to check the device.
I returned to Android at a later date to see if it was finally activated and as an opportunity to measure current draw, powered from my variable power supply. There was 120mA initial draw, 420mA peak during boot, then settled around 400mA when idle, and 450mA peak when opening Chrome. Note this was with a Raspberry Pi keyboard and mouse plugged in.
I found I could open Gmail (I didn't sign in) and I was able to open chrome and played a video windowed on ethernet connection, the page loaded quickly. The video played at 360p by default, stats for nerds showed four frames dropped initially, 12 frames dropped after about a minute of the video playing out of 2293 frames total. I couldn't get the video to properly display full screen, however, possibly because the screen wasn't rotated and I couldn't see how to do that (a phone, etc. would have motion sensors to trigger screen rotation).
When I pulled down from the top of the screen I saw:
This device isn’t Play Protect Certified
Opening the Play Store I got the message:
This device isn’t Play Protect Certified
Google Maps loaded without issue although I skipped signing in.
I closed Chrome and reopened and it said:
This device isn’t certified by Google Play Protect
When I opened Gmail again I got the message:
Gmail won’t run without Google Play Service, which are not supported by your device.
So clearly the device still hasn't been activated and likely won't ever but it is possible to use the 'restricted' apps (Chrome, etc.) initially from power on.
GPIO
This section will deal with the GPIO (General-Purpose Input/Output) pins provided by the Rock CM3 I/O Carrier Board available on the colour coded 20x2 male headers pins and their control within Debian Bullseye.
Looking online for a tutorial I came across several different sites in an attempt to get GPIO working.
Firstly I found 'Python GPIO module for rockchip platform':
https://github.com/radxa/pyRock
I followed the instructions to install as detailed in the readme but got a 'Unable to locate package python-dev'. I had to do:
sudo apt update
Then sudo apt-get install gcc python-dev worked. I then continued with:
git clone https://github.com/radxa/pyRock.git
cd pyRock
sudo python setup.py install
However, it appeared to hang on the last line (but the mouse was responsive and I could close the terminal). I tried restarting but it hung so I had to power off and back on.
After I got back into the desktop and opened the terminal I ran again:
cd pyRock
sudo python setup.py install
This time it did something, it said 'No processor detected' and 'Warning! Detected and target processor mismatch. Do you want to continue [Y/n]?'
I opted for 'n'.
Looking at:
https://github.com/radxa/pyRock/blob/master/CHANGES.txt
Only RK3188 is supported, Rock3 CM uses RK3566, so that was indeed the issue, which I should have checked first.
Next I found:
https://www.okdo.com/project/how-to-install-python-thonny-ide-and-programme-the-gpio-on-rock-4c/
Which is for Rock 4C but I thought it may work. However, it was very involved and didn't go through with all the instructions.
Lastly I stumbled upon the following site, which has instructions for Rock Pi 4 GPIO control:
https://osoyoo.com/2022/07/20/rock-pi-4-gpio-control/
In section 'Install Python GPIO coding library periphery by following terminal command:' I did:
sudo apt-get update
sudo apt-get install python3-pip
sudo pip3 install python-periphery
sudo apt-get install wget
Instead of using the example code I wrote a simpler version using Thonny and used GPIO 135 instead of 73:
from periphery import GPIO
LED_Pin=135
LED_GPIO=GPIO(LED_Pin,"out")
LED_GPIO.write(True)
Which simply turns on an attached LED (with limiting resistor). CM3 module has different GPIO layout to Rock Pi 4, which you can find at:
https://wiki.radxa.com/Rock3/CM3/IO/GPIO
Don't forget you cannot run the code directly in Thonny due to GPIO permission issue, as shown on the osoyoo site previously linked you must use:
sudo python3 rockgpioblink.py
Changing the file name as appropriate.
Note: even if you are just turning a pin on/off you should still use LED_GPIO.close() at the end.
This appears to be the GitHub:
https://github.com/vsergeev/python-periphery
As can be seen in the readme multiple platforms are supported.
Misc
The Rock CM3 I/O Carrier Board can keep the date and time running when powered off if a CR1220 (3V) cell is installed into the holder (located near the GPIO headers), which is useful in circumstances in which an Internet connection isn't available. To test, boot into an O/S and either set the date and time manually or use the Internet to do so (it may take a minute or so for the date and time to be set). After the date and time has been set, disable Wi-Fi if that is what you used, or unplug the ethernet cable, and power off. Wait a couple of minutes, power on again and check that the date and time is correct.
All content of this and related pages is copyright (c) James S. 2024