OSA_TimeDelay hanging on TWR-K64F120M

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 
已解决

OSA_TimeDelay hanging on TWR-K64F120M

跳至解决方案
1,648 次查看
kalden_srcinc
Contributor IV

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

标签 (1)
0 项奖励
回复
1 解答
1,137 次查看
DavidS
NXP Employee
NXP Employee

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

在原帖中查看解决方案

0 项奖励
回复
7 回复数
1,137 次查看
Alice_Yang
NXP TechSupport
NXP TechSupport

Hi Kevin,

Which version of KSDK do you use ?

And there is nothing to be initialized , it can directly use , like this :

pastedImage_0.png

If you still can not use it ,you can send your project to me or tell me how to recurrence your appearance.

BR

Alice

0 项奖励
回复
1,137 次查看
kalden_srcinc
Contributor IV

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?

0 项奖励
回复
1,138 次查看
DavidS
NXP Employee
NXP Employee

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

0 项奖励
回复
1,137 次查看
kalden_srcinc
Contributor IV

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  ?

0 项奖励
回复
1,137 次查看
DavidS
NXP Employee
NXP Employee

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

0 项奖励
回复
1,137 次查看
kalden_srcinc
Contributor IV

I should clarify that I am not using KDS.  This is all built from the command line.

0 项奖励
回复
1,137 次查看
kalden_srcinc
Contributor IV

what do I need to link to to get "CLOCK_SYS_EnableLptimerClock".  I am getting undefined reference.

0 项奖励
回复