Hi NXP team,
I'm trying to prepare a project to make S32K344 controller to produce complimentary PWM outputs with a single eMIOS instance. I've tried using the presentation example, which was attached in one of the questions in the forum, which I've attached it for your reference. I've also gone through the application notes of the 3-phase sensorless PMSM controller from NXP. The main.c file of my code is,
int main(void)
{
/* Initialize clock () */
Clock_Ip_Init(&Clock_Ip_aClockConfig[0]);
/* Initialize all pins using the Port driver */
Siul2_Port_Ip_Init(NUM_OF_CONFIGURED_PINS0, g_pin_mux_InitConfigArr0);
/* Initialize Emios_Mcl driver */
Emios_Mcl_Ip_Init(INSTANCE_0, &Emios_Mcl_Ip_0_Config_BOARD_INITPERIPHERALS);
/* Initialize Emios_Pwm_Ip driver */
Emios_Pwm_Ip_InitChannel(EMIOS_PWM_IP_I0_CH1_CFG, &Emios_Pwm_Ip_I0_Ch1);
/* Set new period for the channels that used external counter bus */
Emios_Mcl_Ip_SetCounterBusPeriod(INSTANCE_0, CHANNEL_0, 0x8000);
/* Duty cycle = 50% */
Emios_Pwm_Ip_SetDutyCycle(INSTANCE_0, CHANNEL_0, 0x4000);
/* De-Initialize Emios_Pwm_Ip driver */
//Emios_Pwm_Ip_DeInitChannel(INSTANCE_0, CHANNEL_0);
Trgmux_Ip_Init(&Trgmux_Ip_xTrgmuxInitPB);
//Lcu_Ip_SetSyncInputMuxSelect (LCU_IP_SYNC_SEL_INPUT0, 1U);
Lcu_Ip_Init(&Lcu_Ip_xLcuInitPB);
Comp_PWMList[0U].Value = LCU_IP_OUTPUT_ENABLE;
Comp_PWMList[1U].Value = LCU_IP_OUTPUT_ENABLE;
Lcu_Ip_SetSyncOutputEnable (&Comp_PWMList[0U], 2);
return 0U;
}
I have attached the entire project file for your reference. I've been on this code for over a week and I'm able to find out the bugs in my program. Please look into the errors I've made in preparing the code and also suggest me the solution to it. It would be really helpful.
#S32K344 #emios #LCU #TRGMUX #PWM