DMA write to ADC SC1

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

DMA write to ADC SC1

跳至解决方案
1,464 次查看
Joey_van_Hummel
Contributor IV

Hi all,

 

We have > 8 ADC inputs that I want to sample, synchronized with FTM PWM INIT trigger.

We're using the PDB for this. But since we have a non-W S32K, I can't use back-to-back linking of CH0 and CH1 in the PDB.

I figured a solution would work where the DMA (triggered by ADC COCO) will rewrite ADC_SC1n in order to "link" more inputs, pulse-by-pulse. However it seems like writing to SC1n via DMA causes the PDB to be unable to trigger the ADC again (ES for the first channel becomes high).

Can anyone advice on how to achieve this?

 

Thanks,

Joey

 

 

0 项奖励
回复
1 解答
1,409 次查看
danielmartynek
NXP TechSupport
NXP TechSupport

Hi @Joey_van_Hummel,

I haven't testing it, but it should work.

Do you see any PDB error flags?

Can you check all the PDB and ADC registers after the DMA transfer?

Is there a chance you accidentally overwrite other ADC registers?

 

Regards,

Daniel

在原帖中查看解决方案

0 项奖励
回复
4 回复数
1,422 次查看
Joey_van_Hummel
Contributor IV

Hi Daniel,

Thanks for your reply. We are using an S32K142. Sadly the hardware is already definitive, and due to an oversight we have up to 11 channels on ADC0. Thus I would have liked to chain PDB0_CH0 and PDB0_CH1, but this requires PDB_BB_SEL[1] which is not available to us.

I was hoping to work around this by having the ADC trigger the DMA, which copies the results and then rewrites ADC-SC1n. The idea is that on the next INIT-trigger from the FTM, the remaining inputs are sampled.

Can you tell me if this should theoretically work? It seems like the PDB refuses to trigger ADC after writes to ADC->SC1 have occurred by the DMA. So I am doubting my strategy.

Kind regards,

Joey

0 项奖励
回复
1,410 次查看
danielmartynek
NXP TechSupport
NXP TechSupport

Hi @Joey_van_Hummel,

I haven't testing it, but it should work.

Do you see any PDB error flags?

Can you check all the PDB and ADC registers after the DMA transfer?

Is there a chance you accidentally overwrite other ADC registers?

 

Regards,

Daniel

0 项奖励
回复
1,377 次查看
Joey_van_Hummel
Contributor IV

Hi Daniel,

Thanks for your confirmation. It works now.

I had set ADC_SC1_AIEN of the last ADC channel, expecting that last channel exclusively to trigger the DMA. DMA copied then all results in one minor loop. But I re-read the RM and saw that every COCO triggers the DMA.

SC1 and the PDB were being altered while conversion was still active.

By setting DMA to move one result per minor loop, fixing my mistake, it now works as expected.

1,432 次查看
danielmartynek
NXP TechSupport
NXP TechSupport

Hi @Joey_van_Hummel,

Which S32K1xx part do you use?

CHIPCTL[PDB_BB_SEL] is supported not only on S32K14xW but S32K14x too.

The S32K14x parts allow chaining PDB0_Ch0 and PDB1_Ch0 back-to-back.

danielmartynek_0-1724140284262.png

 

Regards,

Daniel

 

0 项奖励
回复