瑞萨单片机论坛
直播中

jf_43382582

1年用户 314经验值
擅长:可编程逻辑 嵌入式技术 EMC/EMI设计 存储技术
私信 关注
[经验]

【瑞萨RA6E2地奇星开发板试用】+ 1.点灯测试1500ms跳转一次

1500ms交替点亮熄灭

很高兴收到了瑞萨电子给与的地奇星RA6E2开发板,这个板子和STM32F103RC8T6板子很像,但是因为地奇星RA6E2是100MHz Arm® Cortex®-M33内核架构的核心板,比STM32F103RC8T6板子强一个内核级别,所以很开心,用这个板子做很多低功耗的应用了。
9bde12a9ebb4a8a82c068908c5361102.png

ScreenShot_2025-12-08_155818_111.png

话不多少了,直接上干货。
论坛给出了原理图,非常的好用。
image.png

有原理图可知,LED连接的是P402引脚,所以只需要配好P402设置为输出即可
image.png

生成代码,打开KEIL工程
加入主函数,即可
#include "hal_data.h"
#include "main.h"

FSP_CPP_HEADER
void R_BSP_WarmStart(bsp_warm_start_event_t event);
FSP_CPP_FOOTER

/*******************************************************************************************************************//**

  • main() is generated by the RA Configuration editor and is used to generate threads if an RTOS is used. This function

  • is called by main() when no RTOS is used.
    *********************************************************************************************************************/
    void hal_entry(void)
    {
    /
    TODO: add your own code here */

    while(1)
    {

    LED_ON;
     delay_ms(1500);
    
     LED_OFF;
     delay_ms(1500);
    

    }

#if BSP_TZ_SECURE_BUILD
/* Enter non-secure code */
R_BSP_NonSecureEnter();
#endif
}

/*******************************************************************************************************************//**

  • This function is called at various points during the startup process. This implementation uses the event that is

  • called right before main() to set up the pins.

  • @param[in] event Where at in the start up process the code is currently at
    **********************************************************************************************************************/
    void R_BSP_WarmStart (bsp_warm_start_event_t event)
    {
    if (BSP_WARM_START_RESET == event)
    {
    #if BSP_FEATURE_FLASH_LP_VERSION != 0

    /* Enable reading from data flash. */
     R_FACI_LP->DFLCTL = 1U;
    
     /* Would normally have to wait tDSTOP(6us) for data flash recovery. Placing the enable here, before clock and
      * C runtime initialization, should negate the need for a delay since the initialization will typically take more than 6us. */
    

#endif
}

if (BSP_WARM_START_POST_C == event)
{
    /* C runtime environment and system clocks are setup. */

    /* Configure pins. */
    R_IOPORT_Open(&IOPORT_CFG_CTRL, &IOPORT_CFG_NAME);

#if BSP_CFG_SDRAM_ENABLED

/* Setup SDRAM and initialize it. Must configure pins first. */
    R_BSP_SdramInit(true);

#endif
}
}

#if BSP_TZ_SECURE_BUILD

FSP_CPP_HEADER
BSP_CMSE_NONSECURE_ENTRY void template_nonsecure_callable ();

/* Trustzone Secure Projects require at least one nonsecure callable function in order to build (Remove this if it is not required to build). */
BSP_CMSE_NONSECURE_ENTRY void template_nonsecure_callable ()
{

}
FSP_CPP_FOOTER

#endif

板子预先的LED是闪烁的,但是闪的很快,我就改个慢的,防止蠢货说是一样的!!!!!
烧录代码,即可看到LED以1500ms的周期进行交替点亮熄灭

见顶部示意视频

来个常亮的
#include "hal_data.h"
#include "main.h"

FSP_CPP_HEADER
void R_BSP_WarmStart(bsp_warm_start_event_t event);
FSP_CPP_FOOTER

/*******************************************************************************************************************//**

  • main() is generated by the RA Configuration editor and is used to generate threads if an RTOS is used. This function

  • is called by main() when no RTOS is used.
    *********************************************************************************************************************/
    void hal_entry(void)
    {
    /
    TODO: add your own code here */

    while(1)
    {

    LED_ON;
    

// delay_ms(1500);
//
// LED_OFF;
// delay_ms(1500);

}

#if BSP_TZ_SECURE_BUILD
/* Enter non-secure code */
R_BSP_NonSecureEnter();
#endif
}

/*******************************************************************************************************************//**

  • This function is called at various points during the startup process. This implementation uses the event that is

  • called right before main() to set up the pins.

  • @param[in] event Where at in the start up process the code is currently at
    **********************************************************************************************************************/
    void R_BSP_WarmStart (bsp_warm_start_event_t event)
    {
    if (BSP_WARM_START_RESET == event)
    {
    #if BSP_FEATURE_FLASH_LP_VERSION != 0

    /* Enable reading from data flash. */
     R_FACI_LP->DFLCTL = 1U;
    
     /* Would normally have to wait tDSTOP(6us) for data flash recovery. Placing the enable here, before clock and
      * C runtime initialization, should negate the need for a delay since the initialization will typically take more than 6us. */
    

#endif
}

if (BSP_WARM_START_POST_C == event)
{
    /* C runtime environment and system clocks are setup. */

    /* Configure pins. */
    R_IOPORT_Open(&IOPORT_CFG_CTRL, &IOPORT_CFG_NAME);

#if BSP_CFG_SDRAM_ENABLED

/* Setup SDRAM and initialize it. Must configure pins first. */
    R_BSP_SdramInit(true);

#endif
}
}

#if BSP_TZ_SECURE_BUILD

FSP_CPP_HEADER
BSP_CMSE_NONSECURE_ENTRY void template_nonsecure_callable ();

/* Trustzone Secure Projects require at least one nonsecure callable function in order to build (Remove this if it is not required to build). */
BSP_CMSE_NONSECURE_ENTRY void template_nonsecure_callable ()
{

}
FSP_CPP_FOOTER

#endif
只需注释掉一些即可

常亮见底部视屏

LED常亮

更多回帖

发帖
×
20
完善资料,
赚取积分