S32k144 DMA Pulse Counting Interrupt

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

S32k144 DMA Pulse Counting Interrupt

Jump to solution
1,896 Views
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 Kudos
Reply
1 Solution
1,857 Views
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

View solution in original post

0 Kudos
Reply
6 Replies
1,782 Views
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 Kudos
Reply
1,882 Views
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 Kudos
Reply
1,874 Views
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 Kudos
Reply
1,868 Views
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 Kudos
Reply
1,865 Views
Adhi_11
Contributor I
Yes, the interrupt triggered like you said. But the pulse counting did not occur, the output is still 0
0 Kudos
Reply
1,858 Views
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 Kudos
Reply