Reset fsl_ostimer to 0

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

Reset fsl_ostimer to 0

跳至解决方案
507 次查看
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 项奖励
1 解答
497 次查看
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

在原帖中查看解决方案

1 回复
498 次查看
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