OC_SetCompareValue(.., OC_ABSOLUTE_VALUE) in oc_pal component

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

OC_SetCompareValue(.., OC_ABSOLUTE_VALUE) in oc_pal component

ソリューションへジャンプ
1,431件の閲覧回数
CharlesAlbert
Contributor II

I there,

I try to use a FTM counter to generate interruption at a desired time. Each time the interrup falls, I want to settle the next time (relative) it raises again. Interrupt can also be forced asynchronuously by setting the relative time very close to the current counter value.

I need two channels like because I want this beavior 2 times, I used OC_pal with a disable output. 

This normally allows me to generate interrupt when CnV value matches counter values CNT. Counter values shall count up to Mod values and restart (0-0xFFFF) continuously.

I did the following test with a counter at 1Mhz, at each interrupt I toggle a pin to check timing at scope.

- I use in the interrupt handler, OC_SetCompareValue(.., OC_ABSOLUTE_VALUE) to set a fixed value of 1000. I expect a period of 65,535 ms (one match per period of timer). Instead I have a period of arround 1ms? Why?

Is the CNT reload initial value when loading CnV register? how to avoid that? (I want the counter to always count).

Thanks a lot, 

 

 

0 件の賞賛
返信
1 解決策
1,382件の閲覧回数
CharlesAlbert
Contributor II

I found my issue: OC_SetCompareValue() call FTM_DRV_UpdateOutputCompareChannel(..) with the software trigger as TRUE! I change to not use the SW trigger and then I have the behavior I expect!

Thx.

元の投稿で解決策を見る

0 件の賞賛
返信
5 返答(返信)
1,383件の閲覧回数
CharlesAlbert
Contributor II

I found my issue: OC_SetCompareValue() call FTM_DRV_UpdateOutputCompareChannel(..) with the software trigger as TRUE! I change to not use the SW trigger and then I have the behavior I expect!

Thx.

0 件の賞賛
返信
1,414件の閲覧回数
ZhangJennie
NXP TechSupport
NXP TechSupport

Hi CharlesAlbert 

Please tell us your chip part number thus we can assign right engineer for your issue.

Thanks,

Jun Zhang

0 件の賞賛
返信
1,381件の閲覧回数
CharlesAlbert
Contributor II
Please see my post below. I found that the SW triggers used in OC_SetCompareValue() created my issue.
0 件の賞賛
返信
1,428件の閲覧回数
CharlesAlbert
Contributor II

CharlesAlbert_0-1670320262544.png

Found it myself

0 件の賞賛
返信
1,429件の閲覧回数
CharlesAlbert
Contributor II

I change CNTIN value and it seems used at load of CnV.. How to avoid that reload? 

0 件の賞賛
返信