S32K146 PDB Example ERROR

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

S32K146 PDB Example ERROR

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

Hi, 

I need to understand few things with this example.

How do I get a 1.2ms period (see comment) with this configuration :

f_gaudon_0-1651754920848.png

 

I can read In the RM : Counting uses : (peripheral clock)/(MULT x PRESCALAR)

Here we got 80MHz / (40*128) = 15625 and PDB0->MOD = 14400 so I got a 1,085Hz freq .

Do I get something wrong with this ?

While debugging, I can see that I need more than 1.2ms ton reenter in my interruption but if I comment the line ADC_result = ADC0->R[0]; I reenter in my interruption without delay. Do the reading clear any flag ?

 

ISR code : 

f_gaudon_1-1651754963317.png

 

Thanks for your answers,

Florian

 

タグ(5)
0 件の賞賛
返信
1 解決策
1,681件の閲覧回数
PetrS
NXP TechSupport
NXP TechSupport

Hi,

your calculation is correct and you confirmed it by measurement you did.
Unfortunately example description here is wrong.
You need to read ADC result register to clear COCO flag. An interrupt is generated if the respective SC1n[AIEN] and SC1n[COCO] are set.

BR, Petr

元の投稿で解決策を見る

0 件の賞賛
返信
2 返答(返信)
1,682件の閲覧回数
PetrS
NXP TechSupport
NXP TechSupport

Hi,

your calculation is correct and you confirmed it by measurement you did.
Unfortunately example description here is wrong.
You need to read ADC result register to clear COCO flag. An interrupt is generated if the respective SC1n[AIEN] and SC1n[COCO] are set.

BR, Petr

0 件の賞賛
返信
1,709件の閲覧回数
f_gaudon
Contributor II

I just put this piece of code in the ADC ISR : 

PTB-> PTOR |= 1 << 17; // Toggle

And this is what I see with my scope : 

SDS00001.png

I have the 1,09 Hz freq I calculated ...

When I open the project in SDK example it says : 

f_gaudon_0-1652189332055.png

 

Period = 9ms 

Then in the code comment : 

f_gaudon_1-1652189365945.png

 

But I can see on my scope 0,91s period.

Which one of those periods is the correct one ? 

Thanks

0 件の賞賛
返信