AnsweredAssumed Answered

FRDM-KEAZ128的MC33903要如何開啟Watchdog功能?

Question asked by LIYANG CHENG on Sep 14, 2017
Latest reply on Sep 14, 2017 by Robin_Shen

請問MC33903要如何開啟Watchdog的功能呢?

我在以下的設置wdog似乎沒啟動
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]={0x4C, 0x42}; //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++);

}

Outcomes