Reset fsl_ostimer to 0

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

Reset fsl_ostimer to 0

Jump to solution
497 Views
sergei_pilipenko
Contributor I

Hello,

 

Processor: i.MX RT600

On the ARM core (Cortex M33), i am using fsl_ostimer.

I am trying to reset the value of the timer to 0, by command from a user, or SW reset of the proccesor.

 

I tried using the following, but i doesn't seems to work: 

static void OSTIMER_SoftwareReset(OSTIMER_Type * base

void OSTIMER_Deinit(OSTIMER_Type * base

void OSTIMER_Init(OSTIMER_Type * base) - (doesn't clear the existing counter)

 

is it possible?

 

thanks,

Sergei

0 Kudos
1 Solution
487 Views
kerryzhou
NXP TechSupport
NXP TechSupport

Hi @sergei_pilipenko 

  I think when you call the OSTIMER_SoftwareReset, you need to disable the count at first.

Otherwise, even you reset it, it is still counting, then you don't know whether you reset it or not.

 static inline void OSTIMER_SoftwareReset(OSTIMER_Type *base)
{
#if !(defined(FSL_FEATURE_PMC_HAS_NO_OSTIMER_REG) && FSL_FEATURE_PMC_HAS_NO_OSTIMER_REG)
PMC->OSTIMERr |= PMC_OSTIMER_SOFTRESET_MASK;
PMC->OSTIMERr &= ~PMC_OSTIMER_SOFTRESET_MASK;
#endif
}

BTW, you can debug your code, make sure your this code is running:

PMC->OSTIMERr |= PMC_OSTIMER_SOFTRESET_MASK;
PMC->OSTIMERr &= ~PMC_OSTIMER_SOFTRESET_MASK;

You see, code is dark.

kerryzhou_0-1639561219238.png

I think you can comment the #if #endif.

 

Wish it helps you!

Best Regards,

Kerry

View solution in original post

1 Reply
488 Views
kerryzhou
NXP TechSupport
NXP TechSupport

Hi @sergei_pilipenko 

  I think when you call the OSTIMER_SoftwareReset, you need to disable the count at first.

Otherwise, even you reset it, it is still counting, then you don't know whether you reset it or not.

 static inline void OSTIMER_SoftwareReset(OSTIMER_Type *base)
{
#if !(defined(FSL_FEATURE_PMC_HAS_NO_OSTIMER_REG) && FSL_FEATURE_PMC_HAS_NO_OSTIMER_REG)
PMC->OSTIMERr |= PMC_OSTIMER_SOFTRESET_MASK;
PMC->OSTIMERr &= ~PMC_OSTIMER_SOFTRESET_MASK;
#endif
}

BTW, you can debug your code, make sure your this code is running:

PMC->OSTIMERr |= PMC_OSTIMER_SOFTRESET_MASK;
PMC->OSTIMERr &= ~PMC_OSTIMER_SOFTRESET_MASK;

You see, code is dark.

kerryzhou_0-1639561219238.png

I think you can comment the #if #endif.

 

Wish it helps you!

Best Regards,

Kerry