Luckfox (also written as LUCKFOX) is based in Shenzhen, China, and was founded in 2020. The company specialises in a wide range of electronics including microcontrollers, development boards, displays, sensors, and so on.
The official website can be found at:
And their YouTube channel at:
https://www.youtube.com/channel/UC7eqvogdM5fdqoBQXHi-EVA
Please read on to learn about the various Luckfox products I have come across and my experiences of using them.
Note: the images on this page can be downloaded from the bottom of the page for better viewing.
Please note: while this entry is primarily concerned with the Luckfox Pico Max it should still be useful for those that have the Luckfox Pico Pro, which is very similar.
My first Luckfox product was the Pico Max, which I got from Temu for £13.87 ($18.05), a small Linux development board with a similar form factor to the Raspberry Pi Zero, measuring just 21 x 72mm. The Max features a RV1106G3 SoC (System on Chip), containing an Arm Cortex-A7 CPU and RISC-V MCU, along with 256MB RAM and 256MB flash memory. A similar board, the Luckfox Pico Pro, features a RV1106G2 SoC (with similar internals to the G3), 128MB RAM and 256MB flash memory. At the time of buying, the Max version with pre-soldered GPIO headers was the same price as without, and the Max was cheaper than the Pro, so it made sense to go with the Max.
I took the following information from the Temu page to detail the spec.:
RV1106 Linux Micro Development Board - Arm Cortex-A7, RISC-V MCU, NPU and ISP Processors
The user manual, available from Temu, has this data:
Processor
Cortex A7@1.2GHz
NPU
0.5TOPS. supports int4, int8 and int16
ISP
Input 5M @ 30fps (Max)
Memory
256Mb DDR2
USB
USB 2.0 Host/Device
Camera
MIPI CSI 2-lane
GPIO
26 x GPIO
Ethernet port
10/100M Ethernet controller and embedded PHY
Note: the user manual lists the memory as '256Mb DDR2' (as does the Temu page) but the board actually has 256MB DDR3 RAM, which I've confirmed from the RV1106 datasheet, of which you can find here:
https://files.luckfox.com/wiki/Luckfox-Pico/PDF/Rockchip%20RV1106%20Datasheet%20V1.7-20231218.pdf
Further information from the Temu page tells us:
Features TF card slot, camera interface, ethernet port, SLC NAND flash.
Suggested uses: smart home devices, industrial automation devices, robots and drones, smart monitoring devices, smart transportation devices, and new retailing.
Operating System: Linux.
Supports MIPI CSI, GPIO, UART, SPI, I2C, etc.
Third generation ISP input 5M@30fps
Note: ISP = Image Signal Processor.
The official product page for the Pro/Max can be found at:
https://www.luckfox.com/EN-Luckfox-Pico-Max
Where it is selling for $14.99 (£11.56) without headers soldered, +$1 (£0.77) to include pre-soldered headers. On the page is a detailed spec, pinout, list of key PCB components, dimensions, product list comparison, and link to the quick start page:
https://wiki.luckfox.com/zh/Luckfox-Pico/Luckfox-Pico-quick-start/
The page defaults to Chinese, you can select 'English' from the drop-down top-right to the right of 'GitHub'
Going into more detail, on the top side of the PCB are:
USB-C connector
Red USER LED (left of USB-C)
BOOT and RESET switches
Micro SD card slot
Rockchip RV1106G3 SoC
RTC battery connector
x4 unlabelled round contacts, possibly for testing
Camera connector
Ethernet connector
x4 circular holes that look to be electrical connections, located to the side of the Ethernet connector
x40 GPIO/power connections numbered (x20 both long sides)
And on the PCB underside:
VBUS, VSYS, GND (x2), TXD, and RXD GPIO connections labelled
TP1, TP2, and TP3 test connections
x2 unlabelled round contacts, possibly for testing
Winbond 25N02KVZEIR 2Gb Serial NAND flash memory
On the PCB is written: ‘Luckfox Pico Pro/Max’ along with Luckfox logo, and 256MB written in a circle
The Luckfox Pico Pro/Max is supposed to have a default test image on its on board flash for testing, but I didn't know for sure it had SSH (Secure SHell) set up to remotely log in. It's not like we are using a computer we can easily plug a keyboard, mouse and screen to, so we need to connect to it over Ethernet. I plugged an Ethernet cable into the Max, connected to the same router as my laptop. I then plugged a USB-C cable from the Max into my Windows 11 laptop (you can of course power the Max off a phone charger). The Max's USER LED, which is an activity indicator, flashed rapidly and then shortly after it came on intermittently. Under Universal Serial Bus devices in Device Manager was ‘ADB Interface’.
I measured 5V between VBUS (pin 40) and GND (pin 3), 4.70V between VSYS (pin 39) and GND, 3.3V between 3V3 ( pin 36) and GND.
To log in to the Max I used PuTTY set to 'SSH' (or you can use alternative software that supports SSH), set the host name to luckfox, you can alternatively use LUCKFOX or the board's IP address - use IP scanner software to find the IP address. From my experience the board appears to have a fixed IP address of 192.168.1.42. In PuTTY leave port set to 22, connection type as SSH and click the Open button. If the screen is blank, which happened to me multiple times, close PuTTY and open the connection again. Sometimes I had to use the IP address otherwise I couldn't log in.
If you get the warning ‘The host key is not cached for this server.’ click the Accept button.
Enter root for the username and luckfox for the password and you will be greeted with a simple #prompt.
Very handily, luckfox provide a Linux tutorial:
https://wiki.luckfox.com/Luckfox-Pico/Getting-started-with-Linux
As you will see in the screenshot that follows I started by running a few commands. The ls command, which lists the contents of a directory, returned no results and this is due to the currently selected directory being empty. We use cd to change the directory, for example, which on it own will return us to the user’s home directory. So if we follow cd with ls we get a single directory, usr. If we then used cd .. to go up one level and then do ls we see the following:
At this point we know the Max is working and we can use other commands to explore. If we use df -h, which gives information about disk usage, it reports that ubi0:rootfs has a size of 181.3M, 60.2M used, 121.1M available. This confirms the 256MB on-board flash in which Linux is stored.
If you have a micro SD card inserted then you can access it from Linux. To check it's detected, you can use df -h or fdisk -l.
We can also get information about the version of Linux installed by using:
cat /etc/os-release
which returns :
NAME=Buildroot
VERSION=-g68ee52d1d
ID=buildroot
VERSION_ID=2023.02.6
PRETTY_NAME="Buildroot 2023.02.6"
Which reveals that the Buildroot toolkit was used to build Linux, which is geared towards less powerful systems.
cat /proc/version
gives:
Linux version 5.10.110 (ydk@luckfox-System-Product-Name) (arm-rockchip830-linux-uclibcgnueabihf-gcc (crosstool-NG 1.24.0) 8.3.0, GNU ld (crosstool-NG 1.24.0) 2.32) #1 Tue Nov 14 18:06:04 CST 2023
Using uname -r gives:
5.10.110
uname -a returns:
Linux luckfox 5.10.110 #1 Tue Nov 14 18:06:04 CST 2023 armv7l GNU/Linux
To check the RAM we can use:
grep MemTotal /proc/meminfo
Which returns:
MemTotal: 186388 kB
Alternatively, you can use the free command, which tells us: 186388 total, 14720 used, and 156620 free. This agrees with the supposed 256MB RAM.
It's always good practice to shut down a system properly but I found that:
shutdown -h now
doesn't work but you can use poweroff, however the Max's USER LED will continue to flash as if the system is still running. As reported here:
https://forums.luckfox.com/viewtopic.php?t=522
poweroff appears to restart the Max rather than shut down. Instead we can use halt, which results in no USER LED activity.
You can find a lot of information about the Max's GPIO interfaces at:
Which is well worth a thorough read. The GPIO layout is shown, the type of interfaces, logic voltage level, along with the numbering. As can be seen, only two GPIO - 145/GPIO4_C1_z (pin 32) and 144/GPIO4_C0_z (pin 31) are limited to 1.8V max, which are the 2 analogue inputs, the other GPIO work on 3.3V logic level.
In the following sections I'll be going over testing some of the interfaces with reference to the previously linked site.
The information on the site explains how you can use the sysfs file system to work with the GPIO - of course you can also use Python, etc. and indeed, sample programs in Code.zip are provided for download, which has various examples both for C and Python. I found Python 3.11.6 was already installed but using C is more involved.
I started with using the file system, first to test GPIO 55/GPIO1_C7_d (pin 4) as an input:
echo 55 > /sys/class/gpio/export
echo in > /sys/class/gpio/gpio55/direction
cat /sys/class/gpio/gpio55/value
Which will return with ‘0’ if the pin is floating or connected to GND, or ‘1’ if connected to 3.3V (I used a 1K series resistor to keep the current flow low). You can repeat the last line (cat…) to get the current state of the GPIO pin.
An example is also given for using GPIO 55 as an output:
echo out > /sys/class/gpio/gpio55/direction
echo 1 > /sys/class/gpio/gpio55/value
echo 0 > /sys/class/gpio/gpio55/value
Connect an LED with limiting resistor (I used 1K), anode side to GPIO 55, cathode side to GND. Line 2 turns the LED on, line 3 turns the LED off.
When you're finished you should use:
echo 55 > /sys/class/gpio/unexport
The page continues with Python examples of controlling GPIO, which makes use of the periphery library. I modified the example program to flash an LED with limiting resistor connected to GPIO 55 on/off every second:
from periphery import GPIO
import time
Write_Pin = 55
Write_GPIO = GPIO(Write_Pin, "out")
try:
while True:
try:
Write_GPIO.write(True)
print("On")
time.sleep(1)
Write_GPIO.write(False)
print("Off")
time.sleep(1)
except KeyboardInterrupt:
Write_GPIO.write(False)
break
except IOError:
print("Error")
finally:
Write_GPIO.close()
Moving on to the UART section in which it's explained how to send text over UART to another computer:
https://wiki.luckfox.com/Luckfox-Pico/Luckfox-Pico-RV1106/Luckfox-Pico-Pro-Max/Luckfox-Pico-UART
Unfortunately, my Windows 11 laptop didn't like the USB serial adapters I had so I switched to using my Surface Studio, which runs Windows 10, and was successful in using a FT232R based USB UART adapter set to 3.3V.
I connected the FT232R's GND to the Max's GND and the FT232R's RX to the Max's UART3_TX_M1 (pin 19). In PuTTY I opened a serial connection set to 115200. I then powered on the Max, which caused some garbled characters to appear in PuTTY.
On the site previously linked to it shows how to configure UART3:
stty -F /dev/ttyS3 ispeed 115200 ospeed 115200
stty -F /dev/ttyS3 -echo
They give examples of sending text:
echo Hello > /dev/ttyS3
echo "world !" > /dev/ttyS3
Which worked as expected. On the site they also give Python and C program examples to send and receive data over the serial port.
Looking deeper into the Max's UARTs I came across:
https://wiki.luckfox.com/Luckfox-Pico/Luckfox-Pico-UART/
Which states:
"LuckFox Pico Pro/Max has five serial ports: UART0, UART1, UART2,UART3 and UART4, with UART2 being the debugging serial port.
The serial ports UART3, UART4, and the debugging serial port are enabled by default."
To check for boot debug test I used the same approach as with the test example but wired the FT232R's RX to the Max's UART2_TX_M1 (pin 1). As soon as I powered the Max I saw debug text in the PuTTY window. This is very useful for ensuring the Max is booting and gives some interesting info. A few snippets:
Model: Rockchip RV1106 EVB Board
DRAM: 256 MiB
Model: Luckfox Pico Max
[ 0.000000] Booting Linux on physical CPU 0x0
[ 0.000000] Linux version 5.10.110 (ydk@luckfox-System-Product-Name) (arm-rockchip830-linux-uclibcgnueabihf-gcc (crosstool-NG 1.24.0) 8.3.0, GNU ld (crosstool-NG 1.24.0) 2.32) #1 Tue Nov 14 18:06:04 CST 2023
[ 0.000000] CPU: ARMv7 Processor [410fc075] revision 5 (ARMv7), cr=50c53c7d
Welcome to luckfox pico
After it finishes booting if there is no network connection it will continually print:
udhcpc: broadcasting discover.
If there is a network connection there will be various udhcpc messages specifying IP addresses.
The debug text also let me time how long the Max takes to fully boot; timing from applying power to the Max, the 'Welcome to luckfox pico' was displayed at ~12 seconds, so that is the boot time.
After issuing the halt command there will be various additional debug text, ending with:
reboot: System halted.
Looking at the ADC section:
https://wiki.luckfox.com/Luckfox-Pico/Luckfox-Pico-RV1106/Luckfox-Pico-Pro-Max/Luckfox-Pico-ADC
We can see the analog inputs are on GPIO 144/SARADC_IN0 and 145/SARADC_IN1 (pins 31 AND 32 respectively), AND are limited to 0V to 1.8V.
The previously linked to site gives examples of reading the ADC channels using shell script, Python and C.
Because the analog channels are limited to 1.8V but there is no 1.8V reference easily accessible from the board I connected an 8.2K resistor from 3V3 (pin 36) to a 10K resistor, the other end of the 10K connected to GND. Where the two resistors meet is ~1.8V referenced to GND. For testing purposes we can then connect that point to one end of a potentiometer, the other end to GND. The wiper connection can then be wired to either analog input for testing purposes - adjusting the wiper will alter the voltage from around ~0V to ~1.8V. It's a good idea to have a volt meter connected between pot wiper and GND to verify the readings.
I used the Python example, when I ran it with the pot wiper connected first to SARADC_IN0 and made sure that the IN0_Voltage reported as I adjusted the pot wiper was close to the volt meter reading. I then did the same with SARADC_IN1 instead of SARADC_IN0.
The Max's RV1106 handily features a built-in RTC (Real-time Clock) and the relevant section on the luckfox's site is:
https://wiki.luckfox.com/Luckfox-Pico/Luckfox-Pico-RV1106/Luckfox-Pico-Pro-Max/Luckfox-Pico-RTC
To output date and time information from the RTC use:
hwclock --show
Examples on the previously linked to site are given for reading/writing to the RTC using Python and C. I used the Python example program, which display the RTC date and time, then sets the RTC time to the current system time. What isn't mentioned is how to manually set the RTC. First, set the current date and time using the date command since it doesn't automatically synchronize to the Internet:
date -s "2024-11-02 11:55:00"
hwclock --systohc
The second line synchronizes the current system time to RTC.
Then use:
hwclock --show
Now the date and time should match what it was set to. Note that '0.000000 seconds' always appear at the end, which appears to be the drift amount.
Since I got an RTC battery free with the Max (it wasn't mentioned on the Temu listing) it made sense to test it - the battery plugs into the connector labelled 'RTC Battery'. I powered on the Max with the battery connected, set the date and time, and synchronized the RTC to the system time. I powered off the Max and back on again a day later, the date command reported the correct date and time, as also did the RTC using hwclock --show. Evidently, having the RTC Battery connected will keep system date and time running as well as the RTC.
All content of this and related pages is copyright (c) James S. 2024