Announcements

Help us improve the Power & Sensing Selection Guide. Share feedback

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

cross mob
Jonson
Level 3
Level 3
50 sign-ins 10 questions asked 25 replies posted

Infineon Engineers:
Hello! I obtained the routine for motor control of TC387 according to Infineon's official link address, which is as follows:

Infineon-AURIX_TC3xx_Motor_Control_Application_Kit_TOOL_Instructions_External-UserManual-v01_00-EN.p...

Unfortunately, "PmsmFoc_Evadc_PhaseCurSense_Isr" in the code seems to be missing and cannot be opened, as shown below:

微信图片_20240221230859.png

Therefore, I have the following questions for the guidance of Infineon engineers:
1. I need to obtain the PmsmFoc_Evadc_PhaseCurSense_Isr function in the code so that I can better understand the code.
2. If it is written as the above "PmsmFoc_Evadc_PhaseCurSense_Isr" function, it seems to be an interrupt function, and this function is used to trigger ADC, then does it mean that the ADC is triggered by an interrupt rather than a PWM trigger? What this code seems to express is that it wants to use PWM as an ADC trigger source:

IFX_INLINE void Gtm_initTrigToEvadcCurSense(void)
{
/* ADC G0 Triggered by GTM TOM1 CH7 */
IfxGtm_Trig_toEVadc(&MODULE_GTM, IfxGtm_Trig_AdcGroup_0, IfxGtm_Trig_AdcTrig_1,IfxGtm_Trig_AdcTrigSource_tom1,IfxGtm_Trig_AdcTrigChannel_7);

/* ADC G1 Triggered by GTM TOM1 CH7 */
IfxGtm_Trig_toEVadc(&MODULE_GTM, IfxGtm_Trig_AdcGroup_1, IfxGtm_Trig_AdcTrig_1,IfxGtm_Trig_AdcTrigSource_tom1,IfxGtm_Trig_AdcTrigChannel_7);

/* ADC G2 Triggered by GTM TOM1 CH7 */
IfxGtm_Trig_toEVadc(&MODULE_GTM, IfxGtm_Trig_AdcGroup_2, IfxGtm_Trig_AdcTrig_1,IfxGtm_Trig_AdcTrigSource_tom1,IfxGtm_Trig_AdcTrigChannel_7);

/* ADC G3 Triggered by GTM TOM1 CH7 */
IfxGtm_Trig_toEVadc(&MODULE_GTM, IfxGtm_Trig_AdcGroup_3, IfxGtm_Trig_AdcTrig_1,IfxGtm_Trig_AdcTrigSource_tom1,IfxGtm_Trig_AdcTrigChannel_7);
}

3. I attach Infineon's official routine source code, I think it is impossible to trigger ADC sampling through PWM in the code, if Infineon engineers have a way to achieve it, please let me know, I have studied here for a long time, but still do not understand, thank you!

0 Likes
1 Solution
Kunqiao_L
Moderator
Moderator
Moderator
50 likes received 250 sign-ins First comment on blog

Hi Jonson,

For connection of TOM signal to EVADC, it should be used.

Kunqiao_L_2-1708675313625.png

Please check the configuration setting of PHASE_CURRENT_RECONSTRUCTION

From GTM to EVADC connection:

Kunqiao_L_0-1708675214126.png

Kunqiao_L_4-1708676265238.png

From EVADC side connection

Kunqiao_L_5-1708676347300.png

 

:

Kunqiao_L_3-1708676213260.png

 

View solution in original post

0 Likes
5 Replies
Erick_G
Moderator
Moderator
Moderator
10 likes received 100 sign-ins 25 solutions authored

Hi @Jonson,

PmsmFoc_Evadc_PhaseCurSense_Isr is the name of the ISR that is being set up in this part of the code.

 

// You can set it up like this:
IFX_INTERRUPT(PmsmFoc_Evadc_PhaseCurSense_Isr, 0, INTERRUPT_PRIORITY_EVADC_CUR)
{
	PmsmFoc_StateMacine_doControlLoop(&g_motorControl);

	OneEye_osciStep();
}
// or like this:
IFX_INTERRUPT(PmsmFoc_Evadc_PhaseCurSense_Isr, 0, INTERRUPT_PRIORITY_EVADC_CUR);

void PmsmFoc_Evadc_PhaseCurSense_Isr()
{
	PmsmFoc_StateMacine_doControlLoop(&g_motorControl);

	OneEye_osciStep();
}

// It is the same.

 

The ADC is being triggered by TOM, at the end of the conversion call back it triggers this interrupt.

The GTM have connections to all ADC modules (EDSADC and EVADC) that you can use to set up a pwm as a trigger for the ADC conversions. You can see more details in the GTM section of the TC3xx User Manual Vol 2 (Section 28.25.10 GTM ADC Interface page 836, you can find more details on these connections or section 28.14.3.7 Trigger Generation page 294 on details about configuration of TOM). There is also external triggers that you can set up or use a external gate to control a external trigger (section 32.5.2 Triggers and Gate Signals  page 1149).

Best regards,

Erick

0 Likes
Jonson
Level 3
Level 3
50 sign-ins 10 questions asked 25 replies posted

hello Erick,

Could you please send me the complete project? I feel that the project I downloaded is incomplete.

Best regards,

Jonson

0 Likes
Jonson
Level 3
Level 3
50 sign-ins 10 questions asked 25 replies posted

I set it like this:

IFX_INTERRUPT(PmsmFoc_Evadc_PhaseCurSense_Isr, 0, INTERRUPT_PRIORITY_EVADC_CUR);

void PmsmFoc_Evadc_PhaseCurSense_Isr()
{
PmsmFoc_StateMacine_doControlLoop(&g_motorControl);

OneEye_osciStep();
}

It does trigger ADC, but this code doesn't seem to be used, because I found that blocking here can still trigger:

IFX_INLINE void Gtm_initTrigToEvadcCurSense(void)
{
/* ADC G0 Triggered by GTM TOM1 CH7 */
IfxGtm_Trig_toEVadc(&MODULE_GTM, IfxGtm_Trig_AdcGroup_0, IfxGtm_Trig_AdcTrig_1,IfxGtm_Trig_AdcTrigSource_tom1,IfxGtm_Trig_AdcTrigChannel_7);

/* ADC G1 Triggered by GTM TOM1 CH7 */
IfxGtm_Trig_toEVadc(&MODULE_GTM, IfxGtm_Trig_AdcGroup_1, IfxGtm_Trig_AdcTrig_1,IfxGtm_Trig_AdcTrigSource_tom1,IfxGtm_Trig_AdcTrigChannel_7);

/* ADC G2 Triggered by GTM TOM1 CH7 */
IfxGtm_Trig_toEVadc(&MODULE_GTM, IfxGtm_Trig_AdcGroup_2, IfxGtm_Trig_AdcTrig_1,IfxGtm_Trig_AdcTrigSource_tom1,IfxGtm_Trig_AdcTrigChannel_7);

/* ADC G3 Triggered by GTM TOM1 CH7 */
IfxGtm_Trig_toEVadc(&MODULE_GTM, IfxGtm_Trig_AdcGroup_3, IfxGtm_Trig_AdcTrig_1,IfxGtm_Trig_AdcTrigSource_tom1,IfxGtm_Trig_AdcTrigChannel_7);
}

This code is configured with PWM to trigger the ADC. In theory, deleting this code will not trigger the ADC through PWM, but I try to find that it is not the case.

 

0 Likes
Kunqiao_L
Moderator
Moderator
Moderator
50 likes received 250 sign-ins First comment on blog

Hi Jonson,

For connection of TOM signal to EVADC, it should be used.

Kunqiao_L_2-1708675313625.png

Please check the configuration setting of PHASE_CURRENT_RECONSTRUCTION

From GTM to EVADC connection:

Kunqiao_L_0-1708675214126.png

Kunqiao_L_4-1708676265238.png

From EVADC side connection

Kunqiao_L_5-1708676347300.png

 

:

Kunqiao_L_3-1708676213260.png

 

0 Likes

Hi,Kunqiao_L:

Thank you for your patient reply. I have carefully studied the screenshot you sent above, and it is exactly what you said.

Best regards,

Jonson

0 Likes