How do I use MC33903 WatchDog?

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

How do I use MC33903 WatchDog?

849 Views
liyangcheng
Contributor II

How do I use MC33903 watchdog function

I read AN4770 and configured, but watchdog did not work.

Here's my code.

uint8_t spi_SBC_INIT_SEQ_PART0[2]={0xDF, 0x80};            /* Read Vreg register H */ 
uint8_t spi_SBC_INIT_SEQ_PART1[2]={0x5A, 0x00};            /* Enter in Normal mode */ 
uint8_t spi_SBC_INIT_SEQ_PART2[2]={0x5E, 0x90};            /* Enable 5V-CAN and Vaux regulators */ 
uint8_t spi_SBC_INIT_SEQ_PART3[2]={0x60, 0xC0};            /* Set CAN in TxRx mode, fast slew rate */ 
uint8_t spi_SBC_INIT_SEQ_PART4[2]={0x66, 0xC4};            /* Set LIN1 in TxRx mode, slew rate 20kb/s, LIN term ON */ 
uint8_t spi_data_receive16bit[2]={0, 0}; 

uint8_t spi_SBC_INIT_SEQ_PART5[2]={0x52, 0x40}; //change mode init mode 
uint8_t spi_SBC_INIT_SEQ_PART6[2]={0x4A, 0x80}; //init reg 
uint8_t spi_SBC_INIT_SEQ_PART7[2]={0x50, 0x00}; //init misc 
uint8_t spi_SBC_INIT_SEQ_PART8[2]={0x40, 0x40}; //init wdog 
uint8_t spi_SBC_INIT_SEQ_PART9[2]={0x54, 0x1F}; //set TIM_A 

void Enable_SBC() 
{ 

int i = 0; 
FGPIOA->PSOR  = GPIO_PTD3_MASK; 
FGPIOA->PDDR |= GPIO_PTD3_MASK; 

// Delay 500ms for waitting VBAT is stable 
delay = 500; 
while( delay > 0 ) ; 

FGPIOA->PCOR = GPIO_PTD3_MASK; 
SPI_TransferWait(SPI1,spi_data_receive16bit,spi_SBC_INIT_SEQ_PART0,2); 
FGPIOA->PSOR = GPIO_PTD3_MASK; 
for(i=0;i<100;i++); 


FGPIOA->PCOR = GPIO_PTD3_MASK; 
SPI_TransferWait(SPI1,spi_data_receive16bit,spi_SBC_INIT_SEQ_PART1,2); 
FGPIOA->PSOR = GPIO_PTD3_MASK; 
for(i=0;i<100;i++); 

FGPIOA->PCOR = GPIO_PTD3_MASK; 
SPI_TransferWait(SPI1,spi_data_receive16bit,spi_SBC_INIT_SEQ_PART2,2); 
FGPIOA->PSOR = GPIO_PTD3_MASK; 
for(i=0;i<100;i++); 

FGPIOA->PCOR = GPIO_PTD3_MASK; 
SPI_TransferWait(SPI1,spi_data_receive16bit,spi_SBC_INIT_SEQ_PART3,2); 
FGPIOA->PSOR = GPIO_PTD3_MASK; 
for(i=0;i<100;i++); 

FGPIOA->PCOR = GPIO_PTD3_MASK; 
SPI_TransferWait(SPI1,spi_data_receive16bit,spi_SBC_INIT_SEQ_PART4,2); 
FGPIOA->PSOR = GPIO_PTD3_MASK; 
for(i=0;i<100;i++); 

FGPIOA->PCOR = GPIO_PTD3_MASK; 
SPI_TransferWait(SPI1,spi_data_receive16bit,spi_SBC_INIT_SEQ_PART5,2); 
FGPIOA->PSOR = GPIO_PTD3_MASK; 
for(i=0;i<100;i++);   

FGPIOA->PCOR = GPIO_PTD3_MASK; 
SPI_TransferWait(SPI1,spi_data_receive16bit,spi_SBC_INIT_SEQ_PART6,2); 
FGPIOA->PSOR = GPIO_PTD3_MASK; 
for(i=0;i<100;i++); 

FGPIOA->PCOR = GPIO_PTD3_MASK; 
SPI_TransferWait(SPI1,spi_data_receive16bit,spi_SBC_INIT_SEQ_PART7,2); 
FGPIOA->PSOR = GPIO_PTD3_MASK; 
for(i=0;i<100;i++); 

FGPIOA->PCOR = GPIO_PTD3_MASK; 
SPI_TransferWait(SPI1,spi_data_receive16bit,spi_SBC_INIT_SEQ_PART8,2); 
FGPIOA->PSOR = GPIO_PTD3_MASK; 
for(i=0;i<100;i++); 

FGPIOA->PCOR = GPIO_PTD3_MASK; 
SPI_TransferWait(SPI1,spi_data_receive16bit,spi_SBC_INIT_SEQ_PART9,2); 
FGPIOA->PSOR = GPIO_PTD3_MASK; 
for(i=0;i<100;i++); 

FGPIOA->PCOR = GPIO_PTD3_MASK; 
SPI_TransferWait(SPI1,spi_data_receive16bit,spi_SBC_INIT_SEQ_PART1,2); //fed wdog 
FGPIOA->PSOR = GPIO_PTD3_MASK; 
for(i=0;i<100;i++); 

} 

Regards, 

Liyang Cheng

Tags (2)
0 Kudos
1 Reply

669 Views
dustyko
Contributor II

Hi LIYANG :

It seems MC33903 is still in Debug mode , you may try to send a SPI command : 0x1D00 to leave Debug mode.

You can find some of information in MC33903's datasheet :

"When the device is in Debug mode (entered via the DBG pin), the watchdog continues to operate but does not affect the device operation by asserting a reset.

For the user, operation appears without the watchdog.

When Debug mode is left by software (SPI mode reg), the watchdog period starts at the end of the SPI command.

When Debug mode is left by hardware (DBG pin below 8-10 V), the device enters into Reset mode."

The SPI Global commands and effects :

Read device current mode, Leave debug mode. Keep SAFE pin as is. MOSI in hexadecimal: 1D 00

Best Regards

0 Kudos