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

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

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

530 Views
liyangcheng
Contributor II

請問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++);

}

0 Kudos
1 Reply

412 Views
Robin_Shen
NXP TechSupport
NXP TechSupport

Hi LIYANG,

Please refer the code in S32DS_ARM_v2.0, you can find these files after download the S32DS: S32 Design Studio IDE.

MC33903_routines.png

I have also attached MC33903_routines here, you can download them.

Best Regards,

Robin

 

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

0 Kudos