WIZnet Developer Forum

Watchdog problem

Hi,
Trying to implement simple watchdog from example.

[code]
/* -----------------------------------------------------------/
#include <stdio.h>
#include “W7500x_gpio.h”
#include “W7500x_ssp.h”
/
-----------------------------------------------------------/
typedef struct
{
__IO uint32_t REMAP; /
!< Offset: 0x000 Remap Control Register (R/W) /
__IO uint32_t PMUCTRL; /
!< Offset: 0x004 PMU Control Register (R/W) /
__IO uint32_t RESETOP; /
!< Offset: 0x008 Reset Option Register (R/W) /
__IO uint32_t EMICTRL; /
!< Offset: 0x00C EMI Control Register (R/W) /
__IO uint32_t RSTINFO; /
!< Offset: 0x010 Reset Information Register (R/W) /
} W7500x_SYSCON_TypeDef;
/
-----------------------------------------------------------*/

#define W7500x_SYSCON ((W7500x_SYSCON_TypeDef ) W7500x_SYSCTRL_BASE)
#define W7500x_SYSCTRL_BASE (0x4001F000)
#define SYSRESETREQ_Msk 0x1
#define WDTRESETREQ_Msk 0x2
WDT_InitTypeDef WDT_InitStructure;
//int reset_test = 0;
int rst_info = 0;
/
-----------------------------------------------------------*/

void SRAM_Init (void)
{
SSP_InitTypeDef SSP0_InitStructure;

SRAM_CS_DISABLE();

/* SPI0 Config */

// SSP_StructInit(&SSP0_InitStructure);
SSP0_InitStructure.SSP_SerialClockRate = 0x00;
// SSP0_InitStructure.SSP_SerialClockRate = 0x07;
SSP0_InitStructure.SSP_FrameFormat = SSP_FrameFormat_MO;
SSP0_InitStructure.SSP_CPHA = SSP_CPHA_2Edge;//SSP_CPHA_1Edge;
SSP0_InitStructure.SSP_CPOL = SSP_CPOL_High;//SSP_CPOL_Low;
SSP0_InitStructure.SSP_DataSize = SSP_DataSize_8b;
SSP0_InitStructure.SSP_SOD = SSP_SOD_RESET;
SSP0_InitStructure.SSP_Mode = SSP_Mode_Master;
SSP0_InitStructure.SSP_NSS = SSP_NSS_Hard;
SSP0_InitStructure.SSP_LBM = SSP_LBM_RESET;
SSP0_InitStructure.SSP_SSE = SSP_SSE_SET;
// SSP0_InitStructure.SSP_BaudRatePrescaler = SSP_BaudRatePrescaler_2;
SSP0_InitStructure.SSP_BaudRatePrescaler = SSP_BaudRatePrescaler_254;
SSP_Init(SSP0,&SSP0_InitStructure);
}
/* -----------------------------------------------------------*/

int main()
{
SystemInit();
SRAM_Init(); /* SRAM_Initialization /
SRAM_Test(); /
SRAM_Test */

// WDT Setup ------------------------------------------------------------------

/* NVIC Configuration */

// NVIC_Configuration();

rst_info = W7500x_SYSCON->RSTINFO;
// 0 : SYSRESETREQ
// 1 : Watchdog reset
// 2 : Processor LOCKUP reset

if((rst_info & WDTRESETREQ_Msk) != 0) //Reset request is caused by WDT
{
    WDT_IntClear();
		
    WDT_InitStructure.WDTLoad = 0xFFF0000;

// WDT_InitStructure.WDTControl_RstEn = WDTControl_RstEnable;
// WDT_Init(&WDT_InitStructure);
// while(1);
}

else if((rst_info & SYSRESETREQ_Msk) != 0) //Reset request is caused by SYSTEM
{
    WDT_InitStructure.WDTLoad = 0xFFF0000;
    WDT_InitStructure.WDTControl_RstEn = WDTControl_RstEnable;
    WDT_Init(&WDT_InitStructure);

    WDT_Start();
} 	
while(1);

}
[/code]
After PowerOn SRAM_Test is completed successfully.
After Watchdog Reset (~30sec.) SRAM is not functioning - it is necessary to PowerOff system.

Thank you.

hello, tuxxas.

Thank you for your test.

do you think that Watchdog reset impacts SRAM ?

this problem may solve with firmware work…

thank you

lawrence

Hi,
This issue is left for the future or some bright idea from our community.
I really think that something is not initialized properly after software reset.

Thank you

Hi,
In adition to this issue:
nvic_systemreset() also causes SPI malfunctioning. Reset button doesn’t help - only power off.

1 Like

Copyright © 2017 WIZnet Co., Ltd. All Rights Reserved.