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
Solved! Go to Solution.
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
KSDK 1.1.0.
I'll strip my project down into a simple example case and post it here. Just to clarify though, the function takes milliseconds, correct?
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
I just needed to add #include "fsl_clock_manager.h".
Yes this seems to have fixed the problem. Is this code that should have been included in hardware_init ?
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
I should clarify that I am not using KDS. This is all built from the command line.
what do I need to link to to get "CLOCK_SYS_EnableLptimerClock". I am getting undefined reference.