Calling OSA_TimeDelay on the TWR-K64F120M is hanging my application. If I step through with the debugger it gets into OSA_TimeGetMsec and never returns. Is there something special that needs to be initialized for these functions to work, or is this possibly a bug in the board specific files for this demo board?
Thanks
已解决! 转到解答。
Hi Kevin,
Try following please and let us know what happens.
#if 1 | /* //DES 1=test, 0=default code */ | ||||||||
CLOCK_SYS_EnableLptimerClock(NULL); | /* //DES enable clock to LPTMR0 module */ | ||||||||
LPTMR_HAL_SetFreeRunningCmd(LPTMR0, 1); | /* //DES set LPTMR0 to free running */ | ||||||||
LPTMR_HAL_SetPrescalerClockSourceMode(LPTMR0, kPortLPOClock); | /* //DES set LPTMR0 clock source to LPO */ | ||||||||
LPTMR_HAL_Enable(LPTMR0_BASE); | /* //DES enable LPTMR0 module */ |
#endif
RTC_DRV_SetDatetime(FSL_RTCTIMER1, &datetime_des);
/* For example: for(;;) { } */
while(1) {
OSA_TimeDelay(1000/2); | /* //DES test function that uses the lptmr. */ | ||
PORT_HAL_SetHighGlobalPinCtrl(PORTB_BASE,21, 0x100); | |||
counter++; | |||
counter++; | |||
counter++; | |||
counter++; | |||
if(!(counter % 0x10000)) { | |||
RTC_DRV_GetDatetime(FSL_RTCTIMER1, &datetime_now); | |||
} |
}
Regards,
David
Hi Kevin,
Which version of KSDK do you use ?
And there is nothing to be initialized , it can directly use , like this :
If you still can not use it ,you can send your project to me or tell me how to recurrence your appearance.
BR
Alice
Hi Kevin,
Try following please and let us know what happens.
#if 1 | /* //DES 1=test, 0=default code */ | ||||||||
CLOCK_SYS_EnableLptimerClock(NULL); | /* //DES enable clock to LPTMR0 module */ | ||||||||
LPTMR_HAL_SetFreeRunningCmd(LPTMR0, 1); | /* //DES set LPTMR0 to free running */ | ||||||||
LPTMR_HAL_SetPrescalerClockSourceMode(LPTMR0, kPortLPOClock); | /* //DES set LPTMR0 clock source to LPO */ | ||||||||
LPTMR_HAL_Enable(LPTMR0_BASE); | /* //DES enable LPTMR0 module */ |
#endif
RTC_DRV_SetDatetime(FSL_RTCTIMER1, &datetime_des);
/* For example: for(;;) { } */
while(1) {
OSA_TimeDelay(1000/2); | /* //DES test function that uses the lptmr. */ | ||
PORT_HAL_SetHighGlobalPinCtrl(PORTB_BASE,21, 0x100); | |||
counter++; | |||
counter++; | |||
counter++; | |||
counter++; | |||
if(!(counter % 0x10000)) { | |||
RTC_DRV_GetDatetime(FSL_RTCTIMER1, &datetime_now); | |||
} |
}
Regards,
David
Hi Kevin,
Glad it is working for you.
Not certain if it should have been included so need time to dig into that. At very least I would have thought the osa1:fsl_os_abstraction would have GUI to configure the lptmr.
Regards,
David