Reset fsl_ostimer to 0

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 

Reset fsl_ostimer to 0

ソリューションへジャンプ
503件の閲覧回数
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 解決策
493件の閲覧回数
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 返信
494件の閲覧回数
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