How to use CCU6 PWM Capture?

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
User14442
Level 1
Level 1
Hello,

I am trying to capture a PWM Signal using CCU6.

For this purpose i am trying to use this tutorial:

https://www.infineon.com/dgdl/Infineon-AURIX_GPT12_PWM_Capture_1_KIT_TC397_TFT-Training-v01_00-EN.pd...

Furthermore i am trying to use this code from Matteo Vitturi from github:

https://github.com/Infineon/AURIX_code_examples/tree/master/code_examples/CCU6_PWM_Capture_1_KIT_TC3...

My problem is, that i do not understand how to initialize the Interrupts.

From the training and the example code it seems to me, that you just have to call "init_CCU6_ICU()" in your init section and that's all. But can anyone explain to me where i have to put the IFX_INTERRUPT macros in my code? Because it seems to me that you
have to call them from somewhere!?

What else do i have to do besides calling "init_CCU6_ICU()" to make the pwm capture possible??

Thank you!!
0 Likes
3 Replies
cwunder
Employee
Employee
5 likes given 50 likes received 50 solutions authored
marc.slavin wrote:
I am trying to capture a PWM Signal using CCU6.

For this purpose perhaps you should use this tutorial for input capture on the CCU6, the link you provided was for the GPT12:
https://www.infineon.com/dgdl/Infineon-AURIX_CCU6_PWM_Capture_1_KIT_TC397_TFT-Training-v01_00-EN.pdf...


/* Macro to define the Interrupt Service Routine */
IFX_INTERRUPT(CCU6_edge_detection_isr, 0, ISR_PRIORITY_CCU6_RISING_EDGE);

This macro places an entry into the vector table for CPU0, linked to the ISR function "CCU6_edge_detection_isr" with the priority level "#define ISR_PRIORITY_CCU6_RISING_EDGE 1"

    /* Service Request 0 for interrupt at any rising or falling edge */    
ccu6ChannelConfig.interrupt1.source = IfxCcu6_InterruptSource_cc60RisingEdge; /* Select the interrupt source */
ccu6ChannelConfig.interrupt1.serviceRequest = IfxCcu6_ServiceRequest_0; /* Select the service request output */
ccu6ChannelConfig.interrupt1.priority = ISR_PRIORITY_CCU6_RISING_EDGE; /* Configure the interrupt priority */
ccu6ChannelConfig.interrupt1.typeOfService = IfxSrc_Tos_cpu0; /* Select the type of interrupt service */

This is where the SRC (SRN) is configured and it is written in the function IfxCcu6_Icu_initChannel()

For this example you need to connect two pins together via a jumper wire [P02.1 (PWM signal) and P02.0(CC60 input)].
Doing this and running the program will result in capture interrupts on CCU60.


0 Likes
User14442
Level 1
Level 1
You are right, i gave the wrong link for the tutorial.
I called the init function "init_CCU6_ICU()" of the module in my init section.
I would expect to find the frequency in the global variable g_CCU6Frequency_Hz.
I created a pwm signal of 1000 Hz with TOM Module on P10.7 and connected the pin to P02.0.
Unfortunately I just get the static value 781250 when I look at g_CCU6Frequency_Hz. Do you have an idea why this could be?
0 Likes
Waldi
Level 3
Level 3
10 sign-ins 10 replies posted 5 sign-ins

1000.0 can be found in the g_measuredPwmFreq_Hz. g_CCU6Frequency_Hz holds frequency of timer T12 which is constant.

0 Likes