Hi All,
My software contains BOOT and APP, LPIT CHANNEL1 is used in both BOOT and APP. If I don't stop the LPIT channel before jumpping to APP from BOOT via "LPIT_DRV_StopTimerChannels(INST_LPIT1, (1 << LPIT_CHANNEL1))", in the APP Init phase, in LPIT Init, when exec the init function "LPIT_DRV_InitChannel(INST_LPIT1, LPIT_CHANNEL1, &lpit1_ChnConfig1);", will lead to DefaultISR, I don't know why, Can someone answer my issue? Thanks.
I use LPIT timer interrupt function both in BOOT and APP.
The BOOT and APP is run in PFLASH, and they have own INT VEC.
The BOOT LPIT Init code:
void LPIT_Init(void)
{
LPIT_DRV_Init(INST_LPIT1, &lpit1_InitConfig);
LPIT_DRV_InitChannel(INST_LPIT1, LPIT_CHANNEL1, &lpit1_ChnConfig0);
INT_SYS_InstallHandler(LPIT0_Ch1_IRQn, ISR_LPIT0_Ch1_1ms, (isr_t*)0);
pFunLpitCallback = NULL;
}
The APP LPIT Init code:
void LPIT_Init(void)
{
LPIT_DRV_Init(INST_LPIT1, &lpit1_InitConfig);
LPIT_DRV_InitChannel(INST_LPIT1, LPIT_CHANNEL0, &lpit1_ChnConfig0);
LPIT_DRV_InitChannel(INST_LPIT1, LPIT_CHANNEL1, &lpit1_ChnConfig1);
LPIT_DRV_InitChannel(INST_LPIT1, LPIT_CHANNEL2, &lpit1_ChnConfig2);
INT_SYS_InstallHandler(LPIT0_Ch0_IRQn, ISR_LPIT0_Ch0_1ms, (isr_t*)0);
INT_SYS_InstallHandler(LPIT0_Ch1_IRQn, ISR_LPIT0_Ch1_1ms, (isr_t*)0);
INT_SYS_InstallHandler(LPIT0_Ch2_IRQn, ISR_LPIT0_Ch2_10ms, (isr_t*)0);
LPIT_DRV_StartTimerChannels(INST_LPIT1, 1 << LPIT_CHANNEL0); //channel 0
LPIT_DRV_StartTimerChannels(INST_LPIT1, 1 << LPIT_CHANNEL1); //channel 1
LPIT_DRV_StartTimerChannels(INST_LPIT1, 1 << LPIT_CHANNEL2); //channel 2
pFunLpitCallback = NULL;
}
Dear 赵 子成.
Usually when you exit a bootloader al the timers and peripherals should be deinitialize before enter your application. So I will suggest to call to stop and deinitialize the peripheral before entering your application.
Let me know if this helps you.
Best Regards,
Alexis Andalon
Hi , Yes, it works.
Now I call MCAL_DeInit before jump to APP:
BOOL MCAL_DeInit(void)
{
status_t status = STATUS_SUCCESS;
LPSPI_Type *base = g_lpspiBase[LPSPI_ID2];
LPIT_DRV_Deinit(INST_LPIT1);
status = status || LPSPI_Disable(base);
status = status || FLEXCAN_DRV_Deinit(INST_CANCOM1);
status = status || WDOG_DRV_Deinit(INST_WATCHDOG1);
if(status == STATUS_SUCCESS)
{
return TRUE;
}
else
{
return FALSE;
}
}
Now I deinit LPIT, SPI, CAN, WDOG module.