Rock 4SE Tutorial

Last revision 2026/01/13

This tutorial provides a step-by-step guide to setting up the Rock 4SE controller board for Python programming, including hardware and software preparation, enabling I2C7, and running sample code on the RGB LCD KeyPad HAT. Learn how to navigate the Python examples directory and execute programs to display outputs on the LCD.

Hardware Preparation

Software Preparation

Other Preparation Work

  1. Enable I2C7 on Rock 4SE:
    Modify /boot/hw_intfc.conf to set intfc:i2c7=on, then reboot.
    # Hardware Interface Config 
    # For more details, check https://wiki.radxa.com/Rockpi4/hardware/devtree_overlays. 
    # Set "on" to enable the optional hardware interfaces while set "off" to disable
    intfc:pwm0=off
    intfc:pwm1=off
    intfc:uart2=off
    intfc:uart4=off
    intfc:spi1=off
    intfc:spi2=off
    intfc:i2c2=off
    intfc:i2c6=off
    intfc:i2c7=on
    
  2. install smbus

Command:'pip install smbus'

Sample Code

Use the Python example codes from the Raspberry Pi section (e.g., SetColor.py or Button.py).

Result

  1. Navigate to the Python examples directory: cd DFRobot_RGB1602_RaspberryPi/python/examples
  2. Run the program: sudo python3 xxx.py (replace xxx.py with the example file name).
  3. The LCD will display output based on the program (e.g., color changes or button presses).

Additional Information

  • Rock 4SE only supports Python code.
  • Ensure I2C7 is enabled and all libraries are installed before running programs.

Was this article helpful?

TOP