Yuqiang Wang e1498cabc9 SDK build (#47) 5 月之前
..
.settings 4795f3d206 更新fsp为2.2.0 6 月之前
board 4795f3d206 更新fsp为2.2.0 6 月之前
rzn 0e9a0dfdbd fix iar link source 6 月之前
rzn_cfg 0e9a0dfdbd fix iar link source 6 月之前
rzn_gen 0e9a0dfdbd fix iar link source 6 月之前
script 4795f3d206 更新fsp为2.2.0 6 月之前
src c8a7cfe3e6 upload sample project 1 年之前
.api_xml a7c899dee3 add etherkit sdk 1.0.0 1 年之前
.config 4795f3d206 更新fsp为2.2.0 6 月之前
.cproject 4795f3d206 更新fsp为2.2.0 6 月之前
.gitignore 43669c1c97 Fixed some known issues 1 年之前
.project 4795f3d206 更新fsp为2.2.0 6 月之前
.secure_azone 464d2550d8 Modify the clock rate of xspi0 in the example 1 年之前
.secure_rzone 4795f3d206 更新fsp为2.2.0 6 月之前
.secure_xml 4795f3d206 更新fsp为2.2.0 6 月之前
Kconfig a7c899dee3 add etherkit sdk 1.0.0 1 年之前
README.md e1498cabc9 SDK build (#47) 5 月之前
README_zh.md e1498cabc9 SDK build (#47) 5 月之前
SConscript 0e9a0dfdbd fix iar link source 6 月之前
SConstruct a7c899dee3 add etherkit sdk 1.0.0 1 年之前
buildinfo.ipcf 0e9a0dfdbd fix iar link source 6 月之前
configuration.xml 4795f3d206 更新fsp为2.2.0 6 月之前
envsetup.sh a7c899dee3 add etherkit sdk 1.0.0 1 年之前
mklinks.bat a7c899dee3 add etherkit sdk 1.0.0 1 年之前
mklinks.sh a7c899dee3 add etherkit sdk 1.0.0 1 年之前
ozone_scons.jdebug 384e7a31df 修复scons固件无法运行的问题,添加ozone调试脚本 1 年之前
project.ewd 0e9a0dfdbd fix iar link source 6 月之前
project.ewp 0e9a0dfdbd fix iar link source 6 月之前
project.ewt 0e9a0dfdbd fix iar link source 6 月之前
project.eww a7c899dee3 add etherkit sdk 1.0.0 1 年之前
rtconfig.h 4795f3d206 更新fsp为2.2.0 6 月之前
rtconfig.py 384e7a31df 修复scons固件无法运行的问题,添加ozone调试脚本 1 年之前
rzn_cfg.txt 4795f3d206 更新fsp为2.2.0 6 月之前
template.ewd 0e9a0dfdbd fix iar link source 6 月之前
template.ewp 0e9a0dfdbd fix iar link source 6 月之前
template.eww a7c899dee3 add etherkit sdk 1.0.0 1 年之前

README.md

RGB Usage Instructions

English | 中文

Introduction

This example is the first and simplest example in the SDK, similar to the "Hello World" program that programmers encounter as their first program. The main function of this example is to make the onboard RGB-LED blink periodically.

Hardware Description

image-20241126095713622

image-20241126095728227

As shown in the diagram above, the EtherKit provides three user LEDs: LED0 (RED), LED1 (BLUE), and LED2 (GREEN). The RED LED corresponds to pin P14_3 on the MCU. To turn on the LED, a low level signal is output from the MCU pin, and to turn it off, a high level signal is output.

The positions of the LEDs on the development board are shown in the diagram below:

image-20241126095740420

Software Description

The source code for this example is located in /projects/etherkit_blink_led. The MCU pin definitions for the RGB LEDs and the RGB control logic can be found in src/hal_data.c.

/* Configure LED pins */
#define LED_PIN_R    BSP_IO_PORT_14_PIN_3 /* Onboard RED LED pin */
#define LED_PIN_B    BSP_IO_PORT_14_PIN_0 /* Onboard BLUE LED pin */
#define LED_PIN_G    BSP_IO_PORT_14_PIN_1 /* Onboard GREEN LED pin */
    do
    {
        /* Get the group number */
        group_current = count % group_num;

        /* Control RGB LEDs */
        rt_pin_write(LED_PIN_R, _blink_tab[group_current][0]);
        rt_pin_write(LED_PIN_B, _blink_tab[group_current][1]);
        rt_pin_write(LED_PIN_G, _blink_tab[group_current][2]);

        /* Output LOG information */
        LOG_D("group: %d | red led [%-3.3s] | | blue led [%-3.3s] | | green led [%-3.3s]",
            group_current,
            _blink_tab[group_current][0] == LED_ON ? "ON" : "OFF",
            _blink_tab[group_current][1] == LED_ON ? "ON" : "OFF",
            _blink_tab[group_current][2] == LED_ON ? "ON" : "OFF");

        count++;

        /* Delay for a short time */
        rt_thread_mdelay(500);
    } while(count > 0);

Compilation & Download

  • RT-Thread Studio: In RT-Thread Studio's package manager, download the EtherKit resource package, create a new project, and compile it.

  • IAR: First, double-click mklinks.bat to create symbolic links between RT-Thread and the libraries folder. Then, use the Env tool to generate the IAR project. Finally, double-click project.eww to open the IAR project and compile it.

After compilation, connect the development board's JLink interface to the PC and download the firmware to the development board.

Run Effect

After pressing the reset button to restart the development board, observe the actual effect of the RGB-LED on the development board. When the program is running normally, the RGB LEDs will change periodically, as shown in the image below:

image-20241126095753974

At this point, you can also open the default serial port of the development board using a terminal tool on the PC, with the baud rate set to 115200N. The board's runtime log information will be output in real-time.

[D/main] group: 0 | red led [OFF] | | blue led [OFF] | | green led [OFF]
[D/main] group: 1 | red led [ON ] | | blue led [OFF] | | green led [OFF]
[D/main] group: 2 | red led [OFF] | | blue led [ON ] | | green led [OFF]
[D/main] group: 3 | red led [OFF] | | blue led [OFF] | | green led [ON ]
[D/main] group: 4 | red led [ON ] | | blue led [OFF] | | green led [ON ]
[D/main] group: 5 | red led [ON ] | | blue led [ON ] | | green led [OFF]
[D/main] group: 6 | red led [OFF] | | blue led [ON ] | | green led [ON ]
[D/main] group: 7 | red led [ON ] | | blue led [ON ] | | green led [ON ]