FTM-PDB-ADC trigger goes wrong on S32K148

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

FTM-PDB-ADC trigger goes wrong on S32K148

1,430 次查看
renhaochen
Contributor II

Hi, I'm developing a DC motor control project based on S32K148, and I basically follow the MTR-148 example code to write code. Now the problem is that adc interrupt randomly stopped after successful working few seconds or few minutes.

 

Since I use the FTM-PDB-ADC trigger sequence, I had tried to change PDB MOD, Delay time...etc, but the interrupt is acting the same, sometimes even not work since beginning. When I check the register after the interrupt stopped, the COCO flag of last ADC channel (which also is configured to generate interrupt) is not set, but the COCO flag before this channel had all set.

ADCCOCO.JPG

Do you have any idea to this problem? Or is there any reference could help to this problem?

 

There's my initial settings below:

FTM with 80us,12.5kHz

FTM.JPG

TRGMUX:

TRGMUX.JPG

 

PDB:

PDB.JPG

ADC:

ADC1.JPGADC2.JPG

 

Thank you very much!!

0 项奖励
5 回复数

1,420 次查看
PetrS
NXP TechSupport
NXP TechSupport

Hi,

do you see some sequence error reported on PDB_CH0S?
Generally, be sure PDB pretriggers delays are properly set to be sure a conversion is finished between two petriggers. Also be sure ADC result registers are always read after conversion.
You can try to use DMA to read all result registers, trigger DMA from PDB using IDLY set for right time with respect of expected last conversion.

BR, Petr

0 项奖励

1,401 次查看
renhaochen
Contributor II

Hi @PetrS ,

Thank you for the fast replying,

I checked PDB0.CH0S register and it shows Sequence error not detected.

PDB_CH0S.JPG

 

And I had tried to set DMA enable configuration for ADC module and add DMA channel for ADC0, it works fine until I enable UART0 through DMA. While UART0 is working ADC interrupt goes unstable again. Is this one of the issue?

 

Also you had mentioned " trigger DMA from PDB using IDLY ", is there more specific settings information I could know? For now I just simply configured ADC and DMA on Processor Expert tool, and PDB initial codes shows below:

PDBINIT.JPG

 

Thank you !

 

0 项奖励

1,385 次查看
PetrS
NXP TechSupport
NXP TechSupport

Hi,

I am not aware of the example for trigger DMA from PDB. Anyway you should do

- disable DMA from ADC and enable DMA from PDB within ADC and PDB components
- assign PDB as request to DMA channel in DMA component
- use PDB_SetValueForTimerInterrupt to configure IDLY register, to specify a time when DMA is 
triggered
- configure DMA channel to read all ADC result registers upon single DMA request

BR, Petr

1,363 次查看
renhaochen
Contributor II

Hi @PetrS :

I had followed the first 3 steps, but I don't really get the 4th step,

I only use ADC_DRV_GetChanResult() function to get the result, and it end up the same.

I'm a little confuse with this part, It would be better if you could explain more details,

Thank you!

Best regards,

 

0 项奖励

1,342 次查看
PetrS
NXP TechSupport
NXP TechSupport

Hi,

when using DMA to read result registers then you need not to use ADC_DRV_GetChanResult() function.
You can try to refer to https://community.nxp.com/t5/S32K-Knowledge-Base/Example-S32K144-PDB-ADC-DMA-S32DS-ARM-2018-R1/ta-p/...
to see how DMA is used. It is set up differently, to be triggered from ADC directly, but you can modify it for your need. 

BR, Petr