Yuqiang Wang e1498cabc9 SDK build (#47) преди 7 месеца
..
.settings 4795f3d206 更新fsp为2.2.0 преди 8 месеца
board 4795f3d206 更新fsp为2.2.0 преди 8 месеца
rzn 0e9a0dfdbd fix iar link source преди 7 месеца
rzn_cfg 0e9a0dfdbd fix iar link source преди 7 месеца
rzn_gen 0e9a0dfdbd fix iar link source преди 7 месеца
script 4795f3d206 更新fsp为2.2.0 преди 8 месеца
src c8a7cfe3e6 upload sample project преди 1 година
.api_xml a7c899dee3 add etherkit sdk 1.0.0 преди 1 година
.config 4795f3d206 更新fsp为2.2.0 преди 8 месеца
.cproject 4795f3d206 更新fsp为2.2.0 преди 8 месеца
.gitignore 43669c1c97 Fixed some known issues преди 1 година
.project 4795f3d206 更新fsp为2.2.0 преди 8 месеца
.secure_azone 464d2550d8 Modify the clock rate of xspi0 in the example преди 1 година
.secure_rzone 4795f3d206 更新fsp为2.2.0 преди 8 месеца
.secure_xml 4795f3d206 更新fsp为2.2.0 преди 8 месеца
Kconfig a7c899dee3 add etherkit sdk 1.0.0 преди 1 година
README.md e1498cabc9 SDK build (#47) преди 7 месеца
README_zh.md e1498cabc9 SDK build (#47) преди 7 месеца
SConscript 0e9a0dfdbd fix iar link source преди 7 месеца
SConstruct a7c899dee3 add etherkit sdk 1.0.0 преди 1 година
buildinfo.ipcf 0e9a0dfdbd fix iar link source преди 7 месеца
configuration.xml 4795f3d206 更新fsp为2.2.0 преди 8 месеца
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 преди 7 месеца
project.ewp 0e9a0dfdbd fix iar link source преди 7 месеца
project.ewt 0e9a0dfdbd fix iar link source преди 7 месеца
project.eww a7c899dee3 add etherkit sdk 1.0.0 преди 1 година
rtconfig.h 4795f3d206 更新fsp为2.2.0 преди 8 месеца
rtconfig.py 384e7a31df 修复scons固件无法运行的问题,添加ozone调试脚本 преди 1 година
rzn_cfg.txt 4795f3d206 更新fsp为2.2.0 преди 8 месеца
template.ewd 0e9a0dfdbd fix iar link source преди 7 месеца
template.ewp 0e9a0dfdbd fix iar link source преди 7 месеца
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 ]