S32k144 DMA Pulse Counting Interrupt

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

S32k144 DMA Pulse Counting Interrupt

跳至解决方案
1,893 次查看
Adhi_11
Contributor I

Hello i am a student and for my project i needed a 4-CH pulse counter which i used DMA based pulse counting. My code was working without interrupt, now i enabled the interrupt after one major loop and theres no response. KINDLY check what is wrong. I also observed that the MCU has problems in handling multiple interrupt. What should i do in this situation.

0 项奖励
回复
1 解答
1,854 次查看
Robin_Shen
NXP TechSupport
NXP TechSupport

Why you read the frequency_chx in DMA interrupt handler? The NOTE said: You can read the eDMA channel counter at any time in your application before the major iteration count is exhausted (when CITER reaches 0).

Measured FTM PWM Frequency.png

在原帖中查看解决方案

0 项奖励
回复
6 回复数
1,779 次查看
Adhi_11
Contributor I

Hi Robin,

i needed to adopt this example for my S32k144 64pin self made board. How do i select the trigger source. Example uses PTA8, PTB8, PTC8, PTD8.. etc for channel source 49,50,51,52 what should be channel number if i want to use PTA12, PTE3, PTD2, PTC7. Where do i find this information

0 项奖励
回复
1,879 次查看
Robin_Shen
NXP TechSupport
NXP TechSupport

Hi Adhi_11,

Seems that you are refer to the S32K_Pulse_Count_via_eDMA example in AN5258SW.
Please set the INTMAJOR bit in the TCDn_CSR register by refer:
DMA->TCD[0].CSR |= DMA_TCD_CSR_INTMAJOR_MASK;

From which pin are you counting the external pulse?(PTA8 or PTB8 or PTC8 or PTD8?)
Is the number of pulses input through this pin enough for CITER to reach 0?

INTMAJOR.png


Best Regards,
Robin
-------------------------------------------------------------------------------
Note:
- If this post answers your question, please click the "Mark Correct" button. Thank you!

- We are following threads for 7 weeks after the last post, later replies are ignored
Please open a new thread and refer to the closed one, if you have a related question at a later point in time.
-------------------------------------------------------------------------------

0 项奖励
回复
1,871 次查看
Adhi_11
Contributor I

Hi Robin,

Yes, i referred the same documentation. i modified my code like you commented. I used now a 10khz PWM signal generated using PTD0 and used it in PTC8 and then PTD8. But the result is still 0. Im not sure if the number of pulses are enough for CITER to be 0. What needs to be done here to fix this issue. I needed 4xPWM counters implemented to count 4xexternal pulses 

0 项奖励
回复
1,865 次查看
Robin_Shen
NXP TechSupport
NXP TechSupport

Connect PTD0(10kHz PWM) to PTC8 or PTD8 will trigger DMA2_IRQHandler and DMA3_IRQHandler.

DMAMUX_CHCFG_SOURCE.png

0 项奖励
回复
1,862 次查看
Adhi_11
Contributor I
Yes, the interrupt triggered like you said. But the pulse counting did not occur, the output is still 0
0 项奖励
回复
1,855 次查看
Robin_Shen
NXP TechSupport
NXP TechSupport

Why you read the frequency_chx in DMA interrupt handler? The NOTE said: You can read the eDMA channel counter at any time in your application before the major iteration count is exhausted (when CITER reaches 0).

Measured FTM PWM Frequency.png

0 项奖励
回复