Dec 04, 2019
01:52 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Dec 04, 2019
01:52 AM
Hi All,
I am working on TC387 micro and configuring the Oscillator watchdog to monitor the crystal oscillator.
After configuring the correct value also its reporting the alarm.
Please some one can suggest any way to implement the SMU.
Find the below piece of code for SM implementation.
/******************************************************START*********************************************************/
Std_ReturnType RetVal;
Enable_safetyendinit(0); /* Disable the safety endinit */
/*********************** for crystal oscillator monitoring ************************************/
/*Step 1. De activate monitor alarm */
RetVal = Smu_SetAlarmAction(SMU_ALARM_GROUP8, SMU_ALARM_0, SMU_ALARM_ACTION_NONE, SMU_FSP_ACTION_MSK);
if(RetVal != E_NOT_OK)
{
/*Step 2. Define the monitor frequency- OSCCON.OSCVAL (To define the osc freq for monitor => fOSC = OSCCON.OSCVAL - 1 + 16MHz)*/
SCU_OSCCON.B.OSCVAL = 5U; /* fosc = 5 - 1 + 16 MHz i.e. Configured Fosc = 20MHz*/
/*Step 3. Reset the clock monitor (OSCCON.OSCRES= 1) */
SCU_OSCCON.U |= (1U << IFX_SCU_OSCCON_OSCRES_OFF);
/*Step 4. Activate the alarm to monitor in SMU Module */
do{Smu_SetAlarmAction(SMU_ALARM_GROUP8, SMU_ALARM_0,SMU_ALARM_ACTION_NMI, SMU_FSP_ACTION_MSK);
}while(RetVal == E_NOT_OK);
}
/************************************************************************************************/
/****************************** for backup oscillator monitoring ********************************/
RetVal = Smu_SetAlarmAction(SMU_ALARM_GROUP8, SMU_ALARM_1, SMU_ALARM_ACTION_NONE, SMU_FSP_ACTION_MSK);
if(RetVal != E_NOT_OK)
{
SCU_CCUCON4.U |= ( (1 << IFX_SCU_CCUCON4_UP_OFF) | (1 << IFX_SCU_CCUCON4_MONTST_OFF) );
/* Step 1: Disable the backup clock monitor- CCUCON4.MONEN = 0 to avoid the false alarm */
SCU_CCUCON4.U |= ( (1 << IFX_SCU_CCUCON4_UP_OFF)|(0U << IFX_SCU_CCUCON4_MONEN_OFF));
/* Step 2: Set the Upper and lower threshold according to fpll0: CCUCON4.LOTHR and CCUCON4.UPTHR (12 bit each)*/
SCU_CCUCON4.B.UPTHR = 0xBB;/*If Fpll0=300MHz and Backup clock=100MHz: Upper threshold (512/fPLL0 * 1.1 * x MHz) = 187.73(Dec) => 0xBB */
SCU_CCUCON4.B.LOTHR = 0x99;/*If Fpll0=300MHz and Backup clock=100MHz: Upper threshold (512/fPLL0 * 0.9 * x MHz) = 153.60(Dec) => 0x99 */
/* Step 3: Enable the backup clock monitor: CCUCON4.MONEN = 1 */
SCU_CCUCON4.U |= ( (1 << IFX_SCU_CCUCON4_UP_OFF)|(1 << IFX_SCU_CCUCON4_MONEN_OFF));
/*Step 4. Activate the alarm to monitor in SMU module */
do{Smu_SetAlarmAction(SMU_ALARM_GROUP8, SMU_ALARM_1,SMU_ALARM_ACTION_NMI, SMU_FSP_ACTION_MSK);
}while(RetVal == E_NOT_OK);
}
/**********************************************************************************************/
Enable_safetyendinit(1); /* Enabling the safety endinit */
/********************************************************END***********************************************************************/
I am working on TC387 micro and configuring the Oscillator watchdog to monitor the crystal oscillator.
After configuring the correct value also its reporting the alarm.
Please some one can suggest any way to implement the SMU.
Find the below piece of code for SM implementation.
/******************************************************START*********************************************************/
Std_ReturnType RetVal;
Enable_safetyendinit(0); /* Disable the safety endinit */
/*********************** for crystal oscillator monitoring ************************************/
/*Step 1. De activate monitor alarm */
RetVal = Smu_SetAlarmAction(SMU_ALARM_GROUP8, SMU_ALARM_0, SMU_ALARM_ACTION_NONE, SMU_FSP_ACTION_MSK);
if(RetVal != E_NOT_OK)
{
/*Step 2. Define the monitor frequency- OSCCON.OSCVAL (To define the osc freq for monitor => fOSC = OSCCON.OSCVAL - 1 + 16MHz)*/
SCU_OSCCON.B.OSCVAL = 5U; /* fosc = 5 - 1 + 16 MHz i.e. Configured Fosc = 20MHz*/
/*Step 3. Reset the clock monitor (OSCCON.OSCRES= 1) */
SCU_OSCCON.U |= (1U << IFX_SCU_OSCCON_OSCRES_OFF);
/*Step 4. Activate the alarm to monitor in SMU Module */
do{Smu_SetAlarmAction(SMU_ALARM_GROUP8, SMU_ALARM_0,SMU_ALARM_ACTION_NMI, SMU_FSP_ACTION_MSK);
}while(RetVal == E_NOT_OK);
}
/************************************************************************************************/
/****************************** for backup oscillator monitoring ********************************/
RetVal = Smu_SetAlarmAction(SMU_ALARM_GROUP8, SMU_ALARM_1, SMU_ALARM_ACTION_NONE, SMU_FSP_ACTION_MSK);
if(RetVal != E_NOT_OK)
{
SCU_CCUCON4.U |= ( (1 << IFX_SCU_CCUCON4_UP_OFF) | (1 << IFX_SCU_CCUCON4_MONTST_OFF) );
/* Step 1: Disable the backup clock monitor- CCUCON4.MONEN = 0 to avoid the false alarm */
SCU_CCUCON4.U |= ( (1 << IFX_SCU_CCUCON4_UP_OFF)|(0U << IFX_SCU_CCUCON4_MONEN_OFF));
/* Step 2: Set the Upper and lower threshold according to fpll0: CCUCON4.LOTHR and CCUCON4.UPTHR (12 bit each)*/
SCU_CCUCON4.B.UPTHR = 0xBB;/*If Fpll0=300MHz and Backup clock=100MHz: Upper threshold (512/fPLL0 * 1.1 * x MHz) = 187.73(Dec) => 0xBB */
SCU_CCUCON4.B.LOTHR = 0x99;/*If Fpll0=300MHz and Backup clock=100MHz: Upper threshold (512/fPLL0 * 0.9 * x MHz) = 153.60(Dec) => 0x99 */
/* Step 3: Enable the backup clock monitor: CCUCON4.MONEN = 1 */
SCU_CCUCON4.U |= ( (1 << IFX_SCU_CCUCON4_UP_OFF)|(1 << IFX_SCU_CCUCON4_MONEN_OFF));
/*Step 4. Activate the alarm to monitor in SMU module */
do{Smu_SetAlarmAction(SMU_ALARM_GROUP8, SMU_ALARM_1,SMU_ALARM_ACTION_NMI, SMU_FSP_ACTION_MSK);
}while(RetVal == E_NOT_OK);
}
/**********************************************************************************************/
Enable_safetyendinit(1); /* Enabling the safety endinit */
/********************************************************END***********************************************************************/
Labels
- Labels:
-
Technical Center
- Tags:
- IFX
0 Replies