RGBLED Example

Source path: example/rt_device/rgbled

Supported Platforms

  • sf32lb52-lcd_n16r8

  • sf32lb58-lcd_n16r64n4

Overview

This example demonstrates rgbled driver based on rt-device (using rt-thread), including:

  • rgb_ cycling RGB light display;

Tip

This example is based on HCPU and uses PWM DMA driver.

Example Usage

Hardware Requirements

Before running this example, you need to prepare a development board supported by this example

Compilation and Programming

Switch to the example project directory and run the scons command to execute compilation:

scons -j8 --board=sf32lb52-lcd_n16r8 

Run build_sf32lb52-lcd_n16r8_hcpu\uart_download.bat, select the port as prompted to download:

$ ./uart_download.bat

     Uart Download

please input the serial port num:5

For detailed steps on compilation and downloading, please refer to the relevant introduction in Getting Started Guide.

Expected Results

After the example starts, the serial port cyclically outputs color characters, and the hardware rgbled also displays corresponding colors:

12-25 11:51:46:770    start display color!
12-25 11:51:47:266    -> black
12-25 11:51:49:261    -> blue
12-25 11:51:50:257    -> green
12-25 11:51:51:264    -> cyan
12-25 11:51:51:283    -> red
12-25 11:51:52:262    -> purple
12-25 11:51:54:278    -> yellow
12-25 11:51:55:275    -> white

Exception Diagnosis

  1. Confirm PWM/DMA configuration status through PWM/DMA registers:

  2. Enable rgb configuration error

GTIM2 register status: PWM_DMA DMAC1 register status: PWM_DMA

Reference Documentation

Update Log

Version

Date

Release Notes

0.0.1

12/2024

Initial version