OSA_TimeDelay hanging on TWR-K64F120M

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

OSA_TimeDelay hanging on TWR-K64F120M

Jump to solution
1,140 Views
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

Labels (1)
0 Kudos
1 Solution
629 Views
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

View solution in original post

0 Kudos
7 Replies
629 Views
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 Kudos
629 Views
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 Kudos
630 Views
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 Kudos
629 Views
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 Kudos
629 Views
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 Kudos
629 Views
kalden_srcinc
Contributor IV

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

0 Kudos
629 Views
kalden_srcinc
Contributor IV

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

0 Kudos