How to Enable Ethernet on Luckfox Pico Mini

The Luckfox Pico Mini is a thesaurus of a name for a teeny Rockchip RV1103 development board that can run Linux (mainly Ubuntu and buildroot).

It has a bunch of the usual pins and peripherals, but unfortunately there is no traditional networking (WIFI/LAN). You can use RNDIS to run TCP over USB which does work – it just removes the point of an SoC if you need a ‘host’ PC to talk to it.


Fortunately the Mini has a PHY and MAC, broken out to the bottom edge which you can link to an ethernet port. Even better, the Milk Duo V shares a similar interface, so you can use this ethernet adapter.

With a bit of soldering, we have a 5 pin dupont connector added to the exposed pins

Enable ethernet port

You need to enable the MAC by modifying the device tree. This tells the board via firmware which devices to enable.

Open <sdk_dir>/config/dts_config and add:

/**********ETH**********/
&gmac {
   # Change from 'disabled' to 'okay'
   status = "okay";
};

Ref: https://wiki.luckfox.com/Luckfox-Pico/Luckfox-Pico-SDK#4-modifying-device-tree

Rebuild the firmware, plug in the adapter and you’re done!

RJ45 adapter connected to the Mini

Connecting a network cable will get an address via DHCP and everything works… but the LEDs don’t :/

Enable port LEDs

The RJ45 jack on the ethernet board (https://www.lcsc.com/datasheet/lcsc_datasheet_1811141815_HANRUN-Zhongshan-HanRun-Elec-HR911105A_C12074.pdf) has two LEDs which are normally used to show link – cable is connected – and activity – flashing when the network is in use. These LEDs are not broken out like the jack connections, so we’ll need to add connections ourselves with some more soldering.

Two RJ45 breakout boards with heatshrink and nail polish added for resistors.

Its straight-forward – add two 100R resistors to the LED pins, some heatshrink and some nail-polish to mitigate shorts.

We’ll need to also add some extra headers to the Mini’s GPIO. I picked two closest to the ETH pins; 11 and 12. We’ll use 11 (GPIO1_C5_d) for link and 12 (GPIO1_D0_d) for activity. Pretty sure any pin could be used, just avoid the 1.8V ones.

Source: https://wiki.luckfox.com/Luckfox-Pico/Luckfox-Pico-GPIO
Extra pin headers added to GPIO

We need to enable the LED netdev trigger which will add link, rx and tx as triggers to our LEDs.

Open <sdk_dir>/config/kernel_defconfig and make sure you have the following set:

CONFIG_LEDS_GPIO=y
CONFIG_LEDS_TRIGGERS=y
CONFIG_LEDS_TRIGGER_NETDEV=y

We’ll now need to add our two new LEDs to the device tree – the same place we enabled the ETH MAC.

Open <sdk_dir>/config/dts_config and add:

&leds {
   compatible = "gpio-leds";
   /** PIN 11 GPIO1_C5_d */
   eth_link {
      gpios = <&gpio1 RK_PC5 GPIO_ACTIVE_HIGH>;
      linux,default-trigger = "netdev";
      default-state = "off";
   };
   /** PIN 12 GPIO1_D0_d */
   eth_act {
      gpios = <&gpio1 RK_PD0 GPIO_ACTIVE_HIGH>;
      linux,default-trigger = "netdev";
      default-state = "off";
   };
};

Ref: https://stackoverflow.com/questions/63484352/device-tree-config-for-netdev-trigger-sources-to-control-led-based-on-link-statu

Build your firmware as usual and copy to an SD card.

Boot and you’ll see that still, nothing lights up :/

Thats because we need to run a few lines to configure which network port we’re monitoring activity and link for – the device tree doesn’t allow us to do that.

Run:

# Might need 'sudo passwd root' to configure your root account first
su root

# Assumes 'eth0' is the port to monitor
echo eth0 > /sys/class/leds/eth_link/device_name
echo eth0 > /sys/class/leds/eth_act/device_name

# Now we'll assign what triggers should be active
echo 1 > /sys/class/leds/eth_link/link
echo 1 > /sys/class/leds/eth_act/rx
echo 1 > /sys/class/leds/eth_act/tx

Tada!

There are many ways to automate this script, but I’ll leave that up to the reader.

Enclosure

If you’re feeling really adventurous, you can combine the LED mod, or just the ethernet mod with my 3D print – https://makerworld.com/en/models/956989

A short ribbon cable and resistors – looking neat