瑞萨单片机william hill官网
直播中

jf_15811252

3年用户 249经验值
擅长:嵌入式技术
私信 关注
[经验]

【瑞萨RA4系列开发板体验】+RA4M2 之WDT

WDT简介

瑞萨RA4M2的窗口看门狗定时器(WDT)是一个14位递减计数器,可用于在计数器下溢时复位MCU,如果系统失控导致WDT无法在窗口值间刷新计数器,就会发生不可屏蔽中断或看门狗定时器复位。

WDT介绍

WDT描述:
1.jpg
WDT框图:
2.jpg

WDT刷新寄存器说明:

3.jpg

WDT控制寄存器说明:
4.jpg

RASC新建WDT工程

新建WDT工程:
5.jpg
选择开发板型号:

6.jpg
选择闪灯工程:

7.jpg
生成WDT代码:

点击”stacks”,点击”New Stack”,在弹出的界面中,选择”Monitoring”,然后选中”Watchdog(r_wdt)”或选择”Search”然后搜索”WDT”关键字,然后点击”Generate Project Context”生成代码。
8.jpg

添加WDT代码

/***********************************************************************************************************************
 * Copyright [2020-2022] Renesas Electronics Corporation and/or its affiliates.  All Rights Reserved.
 *
 * This software and documentation are supplied by Renesas Electronics America Inc. and may only be used with products
 * of Renesas Electronics Corp. and its affiliates ("Renesas").  No other uses are authorized.  Renesas products are
 * sold pursuant to Renesas terms and conditions of sale.  Purchasers are solely responsible for the selection and use
 * of Renesas products and Renesas assumes no liability.  No license, express or implied, to any intellectual property
 * right is granted by Renesas. This software is protected under all applicable laws, including copyright laws. Renesas
 * reserves the right to change or discontinue this software and/or this documentation. THE SOFTWARE AND DOCUMENTATION
 * IS DELIVERED TO YOU "AS IS," AND RENESAS MAKES NO REPRESENTATIONS OR WARRANTIES, AND TO THE FULLEST EXTENT
 * PERMISSIBLE UNDER APPLICABLE LAW, DISCLAIMS ALL WARRANTIES, WHETHER EXPLICITLY OR IMPLICITLY, INCLUDING WARRANTIES
 * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, AND NONINFRINGEMENT, WITH RESPECT TO THE SOFTWARE OR
 * DOCUMENTATION.  RENESAS SHALL HAVE NO LIABILITY ARISING OUT OF ANY SECURITY VULNERABILITY OR BREACH.  TO THE MAXIMUM
 * EXTENT PERMITTED BY LAW, IN NO EVENT WILL RENESAS BE LIABLE TO YOU IN CONNECTION WITH THE SOFTWARE OR DOCUMENTATION
 * (OR ANY PERSON OR ENTITY CLAIMING RIGHTS DERIVED FROM YOU) FOR ANY LOSS, DAMAGES, OR CLAIMS WHATSOEVER, INCLUDING,
 * WITHOUT LIMITATION, ANY DIRECT, CONSEQUENTIAL, SPECIAL, INDIRECT, PUNITIVE, OR INCIDENTAL DAMAGES; ANY LOST PROFITS,
 * OTHER ECONOMIC DAMAGE, PROPERTY DAMAGE, OR PERSONAL INJURY; AND EVEN IF RENESAS HAS BEEN ADVISED OF THE POSSIBILITY
 * OF SUCH LOSS, DAMAGES, CLAIMS OR COSTS.
 **********************************************************************************************************************/

#include "hal_data.h"

void R_BSP_WarmStart(bsp_warm_start_event_t event);

extern bsp_leds_t g_bsp_leds;

/*******************************************************************************************************************//**
 * [url=home.php?mod=space&uid=2666770]@Brief[/url]  Blinky example application
 *
 * Blinks all leds at a rate of 1 second using the software delay function provided by the BSP.
 *
 **********************************************************************************************************************/
void hal_entry (void)
	
{

     R_BSP_PinAccessEnable();
	 (void)R_WDT_Open(&g_wdt0_ctrl, &g_wdt0_cfg);
	 (void) R_WDT_Refresh(&g_wdt0_ctrl);
   

    while (1)
    {
        (void)R_WDT_Refresh(&g_wdt0_ctrl);
        R_BSP_PinWrite(BSP_IO_PORT_04_PIN_15, BSP_IO_LEVEL_LOW);
        R_BSP_SoftwareDelay(500, 1000);
		R_BSP_PinWrite(BSP_IO_PORT_04_PIN_15, BSP_IO_LEVEL_HIGH);
        R_BSP_SoftwareDelay(500, 1000);
    }
}

结果

吐糟:板子的OLED接口刚好插不上,电源反的,同时官方软件只能用J-link调试但不能用J-link下载。
image.png

回帖(1)

xiaopeng

2022-12-9 12:22:17
问一下,最后这个波形是怎么抓的?
举报

更多回帖

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