Hello,
I am trying to test the PMC by applying fault injection using PMC_FIR register.
ismaelwael_0-1732009344792.png
here it says the MC_RGM should reset the MCU in case of fault injection, of course after proper setting of relevant registers. but that never happened whatever i do!
I thought maybe PMC needs to activate the clock, so i added these two lines:
/* Initialize clock gate*/
CLOCK_SYS_Init(g_clockManConfigsArr, CLOCK_MANAGER_CONFIG_CNT,
g_clockManCallbacksArr, CLOCK_MANAGER_CALLBACK_CNT);
CLOCK_SYS_UpdateConfiguration(0U, CLOCK_MANAGER_POLICY_AGREEMENT);
still nothing.
I finally debugged the PMC registers, and found that whatever i write, i could not read it back as in code below:
int main(void)
{
/* Write your local variable definition here */
/*** Processor Expert internal initialization. DON'T REMOVE THIS CODE!!! ***/
#ifdef PEX_RTOS_INIT
PEX_RTOS_INIT(); /* Initialization of the selected RTOS. Macro is defined by the RTOS component. */
#endif
/*** End of Processor Expert internal initialization. ***/
/* Initialize clock gate*/
CLOCK_SYS_Init(g_clockManConfigsArr, CLOCK_MANAGER_CONFIG_CNT,
g_clockManCallbacksArr, CLOCK_MANAGER_CALLBACK_CNT);
CLOCK_SYS_UpdateConfiguration(0U, CLOCK_MANAGER_POLICY_AGREEMENT);
/* Initialize Pins */
PINS_DRV_Init(NUM_OF_CONFIGURED_PINS, g_pin_mux_InitConfigArr);
//PINS_DRV_ClearPins(PORT, (1<<LED)); // Led ON
//PINS_DRV_SetPins(PORT, (1<<LED)); // Led Off
//PMC_init();
//PMC_ADDRESS.ESR_0.R = 0x193E0000; // Clear all flags in PMC_ESR_0 register
*(volatile uint32_t *)0xFFFA0420 = 0x193E0000;//ESR
*(volatile uint32_t *)0xFFFA0470 = 0x40000000;//FIR
//PMC_ADDRESS.REE_0.R = 0x193E0000;
*(volatile uint32_t *)0xFFFA0430 = 0x193E0000;//REE
//PMC_ADDRESS.RES_0.R = 0x193E0000;
*(volatile uint32_t *)0xFFFA0440 = 0x193E0000;//RES
// Clear any previous fault flags to start fresh
//MC_RGM->FES = 0xffffffff; // Clear all detected faults (write-1-to-clear)
// Enable functional reset for specific fault
//MC_RGM->FERD &= ~(1 << 7); // Enable reset for VOR faults
//MC_RGM->FERD &= ~(1 << 28); // Enable reset for software fault
// Set fault action to RESET
//MC_RGM->FEAR |= (1 << 7); // Action: Reset for VOR
//MC_RGM->FEAR |= (1 << 28); // Action: Reset for software fault
//PMC_injectFakeFault(PMC_HVD_FAULT);
//MC_RGM->DES |= (1 << 7);
//MC_RGM->DES |= (1 << 28);
//MC_ME ->MCTL = 0x00005AF0;
//MC_ME ->MCTL = 0x0000A50F;
while(1)
{
/* Insert a small delay to make the blinking visible */
delay(720000);
/* Toggle output value LED1 */
PINS_DRV_TogglePins(PORT, (1<<LED));
//PINS_DRV_ClearPins(PORT, (1<<LED)); // Led ON
//PINS_DRV_SetPins(PORT, (1<<LED));
//PINS_DRV_ClearPins(PORT, (1<<LED));
}
what is the problem?
for the addresses, check below images:
ismaelwael_1-1732009714601.png
ismaelwael_2-1732009752954.png
And if you have a working example of PMC, i will be thankful to you.
regards.