Skip to main content

luckfox-config

Luckfox Lyra 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 Lyra pin multiplexing during the compilation and system runtime stages, allowing flexible configuration of Luckfox Lyra pin interface functions.

1. luckfox-config Overview

luckfox-config is a tool in the Luckfox Lyra root file system that allows for quick configuration of device functions on Luckfox Lyra 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
    PWMSupported
    UARTSupported
    I2CSupported
    SPISupported
    CANSupported
    MIPI DSISupported

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 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. Run the following command in the development board terminal to open the graphical configuration interface:

    luckfox-config 
    • Effect Preview:
      xxx
  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.

  3. 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.
  4. 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., DSI) 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.

  5. Load the configuration:

    luckfox-config load

    *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 Common Configurations

3.1 PWM Configuration

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

  2. Use the arrow keys to select the PWM channel you wish to configure.
    xxx

  3. In the configuration menu, you can perform the following actions:

    • Select enable to activate the PWM channel;
    • Select disable to deactivate the channel;
    • Select Cancel to return to the previous menu without making changes.
    xxx
  4. You can further specify a particular pin (e.g., RMIO12) as the PWM output. The system will bind the selected pin accordingly.
    xxx

3.2 UART Configuration

  1. Navigate to Advanced Options -> UART. The luckfox-config tool will display all supported UART configuration options.
    xxx
    xxx

  2. In the configuration menu, you can perform the following actions:

    • Select enable to activate UART3;
    • Select disable to deactivate this channel;
    • Select Cancel to return to the previous menu without making changes.
    xxx
  3. You can further assign specific pins, such as RMIO3 and RMIO4, as the TX and RX pins for UART3. The system will bind the pins accordingly based on your selection.
    xxx
    xxx

3.3 I2C Configuration

  1. Navigate to Advanced Options -> I2C. The luckfox-config tool will display all supported I2C configuration options.
    xxx
    xxx

  2. In the configuration menu, you can perform the following actions:

    • Select enable to activate I2C0;
    • Select disable to deactivate this channel;
    • Select Cancel to return to the previous menu without making changes.
    xxx
  3. You can further assign specific pins, such as RMIO7 and RMIO8, as the SDA and SCL pins for I2C0. The system will bind the pins accordingly.
    xxx
    xxx

  4. Set the I2C bus speed.
    xxx

3.4 SPI Configuration

  1. Navigate to Advanced Options -> SPI. The luckfox-config tool will display all supported SPI configuration options.
    xxx
    xxx

  2. In the configuration menu, you can perform the following actions:

    • Select enable to activate SPI0;
    • Select disable to deactivate this channel;
    • Select Cancel to return to the previous menu without making changes.
    xxx
  3. You can further assign specific pins, such as RMIO24, RMIO25, RMIO26, and RMIO27, as the CLK, MOSI, MISO, and CS pins for SPI0. The system will bind the pins accordingly.
    xxx
    xxx
    xxx
    xxx

  4. Set the SPI bus speed.
    xxx

3.5 CAN Configuration

  1. Navigate to Advanced Options -> CAN. The luckfox-config tool will display all supported CAN configuration options.
    xxx
    xxx

  2. In the configuration menu, you can perform the following actions:

    • Select enable to activate CAN0;
    • Select disable to deactivate this channel;
    • Select Cancel to return to the previous menu without making changes.
    xxx
  3. You can further assign specific pins, such as RMIO10 and RMIO11, as the TX and RX pins for CAN0. The system will bind the pins accordingly.
    xxx
    xxx

  4. Set the CAN bus speed.
    xxx

3.6 DSI Configuration

  1. Navigate to MIPI DSI -> MIPI DSI MODE. The luckfox-config tool will display all supported screen configurations.
    xxx
    xxx

    • 5/7/10.1-inch DSI-TOUCH-A displays:
      xxx
      xxx
    • Official Raspberry Pi DSI display (800×480 resolution):
      xxx
      xxx
    • Compatible displays from Waveshare:
      xxx
      xxx