Skip to main content

luckfox-config Configuration

Luckfox Pico pins have multiple multiplexing functions. Depending on the needs of the actual project, adjustments to the device tree are often required. This section introduces two methods for configuring Luckfox Pico pin multiplexing during the compilation and system runtime stages, allowing flexible configuration of Luckfox-Pico pin interface functions.

1. luckfox-config Overview

luckfox-config is a tool in the Luckfox Pico root file system that allows for quick configuration of device functions on Luckfox Pico. By using the dynamic device tree mechanism and the fdt tool, most device configurations can be completed without recompiling the dtb.

  • Terminal Support

    System TypeBuildroot
    Serial PortSupported
    SSHSupported
    ADBThe arrow keys on the keyboard are not functioning.
  • Functionality

    System TypeBuildroot
    GPIOSupported
    PWMSupported
    UARTSupported
    I2CSupported
    SPISupported
    FBTFTSupported only on Luckfox Pico / Plus / Pro / Max
    RGBSupported only on Luckfox Pico Ultra / Ultra W
    TouchScreenSupported only on Luckfox Pico Ultra / Ultra W
    USBSupported
    CSISupported

2. luckfox-config Configuration

Note: The configuration of luckfox-config is based on the default device tree file. If the device tree has been adjusted during image compilation, some functions may not work properly.

2.1 Structure

  • luckfox-config dynamic device tree configuration tool, can perform graphical interactive configuration
  • /etc/luckfox.cfg stores configuration information, which users can edit. The configuration items are loaded each time the root filesystem starts
  • luckfox-config Pin diagram is used to temporarily store key information about the system configuration, allowing users to intuitively understand the current pin configuration status.

2.2 Basic Usage

  1. Open the graphical configuration interface:

    luckfox-config 
    • Effect Preview::

2.Use the and keys to select menu items, the enter key to enter, and the , keys or Tab to select the OK and cancel buttons. Use the Esc key to cancel and return, and the space bar to select an option. Any changes will take effect after restarting. Note: When logging in via ADB, you cannot use the direction keys or Tab. Instead, use numbers to select options and enter to confirm.

  1. View the configuration status. When a pin is enabled, it will be marked with an "*" and locked. If the newly enabled interface contains locked pins, it cannot proceed. You can view the current pin lock status in the about menu of luckfox-config or by using the following command:

    luckfox-config show
    • If the pin reuse function is not specified in the pin diagram, the corresponding GPIO will be directly marked.
    • In the Luckfox Pico Ultra series, since I2C4 and the CSI camera share pins, the CSI interface is enabled by default, and the pinctrl-0 configuration includes the I2C4 pins, so all I2C4 and RGB pins are marked at the first boot.
  2. Save the configuration

    Common pin reuse configurations (e.g., PWM, UART, I2C, SPI) take effect immediately. Devices whose drivers do not support dynamic detection (e.g., FBTFT, RGB, touch screen, CSI) need a reboot to take effect.

    Note: Settings that need a reboot to take effect are made by directly modifying the dtb. The ENABLE status in luckfox.cfg is only for record. Simply modifying luckfox.cfg does not take effect during configuration loading.

  3. Load the configuration:

    luckfox-config load

    Note: Configuration loading is automatically executed during the root filesystem startup phase. A dtboverlay node is created and the configuration is written according to the /etc/luckfox.cfg file. Normally, this command does not need to be executed manually.

2.3 Common Configurations

2.3.1 PWM Configuration

  1. Enter the Advanced Options -> PWM interface, and luckfox-config will display all supported PWM configurations.
    xxx

  2. Select the desired option, choose enable to enable, and disable to disable. To cancel the configuration, use the direction keys to select Cancel and return to the previous interface.
    xxx

  3. If the pin is already reused for another function and marked, selecting enable will display a prompt. The conflicting configuration needs to be disabled for successful enabling.
    xxx
    xxx

2.3.2 UART Configuration

  1. Enter the Compatible Devices -> UART interface, and luckfox-config will display all supported UART configurations.
    xxx

  2. Select the desired option, choose enable to enable, and disable to disable. To cancel the configuration, use the direction keys to select Cancel and return to the previous interface.

  3. If the pin to be configured is reused for another function and marked, selecting enable will display a prompt. The conflicting configuration needs to be disabled for successful enabling.

2.3.3 I2C Configuration

  1. Enter the Advanced Options -> I2C interface, and luckfox-config will display all supported I2C configurations.
    xxx

  2. Select the desired option, choose enable to enable, and disable to disable. To cancel the configuration, use the direction keys to select Cancel and return to the previous interface. Selecting enable will enter the speed configuration interface.
    xxx

  3. In the Luckfox Pico Ultra system, enabling CSI will prevent the configuration of I2C4, and enabling the touch screen will prevent the configuration of I2C3.
    xxx

  4. If the pin to be configured is reused for another function and marked, selecting enable will display a prompt. The conflicting configuration needs to be disabled for successful enabling.

  5. When the touch screen is enabled, I2C3 cannot be configured. When CSI is enabled, I2C4 cannot be configured.

2.3.4 SPI Configuration

  1. Enter the Advanced Options -> SPI interface, and luckfox-config will display all supported SPI configurations.
    xxx

  2. Select the desired option, choose enable to enable, and disable to disable. To cancel the configuration, use the direction keys to select Cancel and return to the previous interface.
    xxx
    xxx
    xxx

3.If the pin to be configured is reused for another function and marked, selecting enable will display a prompt. The conflicting configuration needs to be disabled for successful enabling.

2.3.5 CSI Configuration

  1. Navigate to Advanced Options -> CSI screen, select enable to enable and select disable to disable.
    xxx

  2. It is recommended to configure CSI once after booting the Luckfox Pico Ultra series to prevent affecting subsequent configurations.

  3. If other I2C4 pins are used, CSI cannot be configured to prevent enabling and disabling CSI from affecting ongoing I2C4 tasks.
    xxx

    • Note: CSI configuration requires a reboot to take effect.

2.4.6 USB Configuration

  1. avigate to Advanced Options -> USB screen, configure the USB mode as peripheral or host.
    xxx
  • Note: USB configuration requires a reboot to take effect.