When using the S32K396 eFlexPWM to output complementary PWM, only PWMA has an output.

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

When using the S32K396 eFlexPWM to output complementary PWM, only PWMA has an output.

279 Views
qingwang_a
Contributor III

When I use the eFlexPWM submodule 0 of the S32K396 to generate complementary PWM, the PWMA channel has output, but the PWMB channel does not. However, when I use PWMB to output PWM separately, the PWMB channel outputs normally. Below are my configurations and code in the S32DS.

Snipaste_2024-08-22_18-08-54.pngSnipaste_2024-08-22_18-13-00.pngSnipaste_2024-08-22_18-13-20.pngSnipaste_2024-08-22_18-13-42.pngSnipaste_2024-08-22_18-14-00.pngSnipaste_2024-08-22_18-15-20.png

 

*/
 
/* Including necessary configuration files. */
#include "Mcal.h"
//#include "Siul2_Dio_Ip.h"
#include "Siul2_Port_Ip.h"
#include "Clock_Ip.h"
#include "FlexPwm_Ip.h"
 
#define INSTANCE_0 (uint8)0U
#define SubModule_0       (uint8)0U
#define SubModule_1       (uint8)1U
#define SubModule_2       (uint8)2U
/* User includes */
 
/*!
  \brief The main function for the project.
  \details The startup initialization sequence is the following:
 * - startup asm routine
 * - main()
*/
int main(void)
{
    /* Write your code here */
Clock_Ip_Init(Clock_Ip_aClockConfig);
 
Siul2_Port_Ip_Init(NUM_OF_CONFIGURED_PINS_PortContainer_0_BOARD_InitPeripherals, g_pin_mux_InitConfigArr_PortContainer_0_BOARD_InitPeripherals);
 
 
FlexPwm_Ip_Init(INSTANCE_0,&FlexPwm_Ip_InstanceCfg_I0);
 
//    FlexPwm_Ip_ClearLoadValue(INSTANCE_0, 1U << SubModule_0);
//    FlexPwm_Ip_UpdateDutyCycle(INSTANCE_0, SubModule_0, FLEXPWM_IP_PWMA, 200);
//    FlexPwm_Ip_LoadValue(INSTANCE_0, 1U << SubModule_0, TRUE);
//
//    FlexPwm_Ip_ClearLoadValue(INSTANCE_0, 1U << SubModule_1);
//    FlexPwm_Ip_UpdateDutyCycle(INSTANCE_0, SubModule_1, FLEXPWM_IP_PWMA, 0x200);
//    FlexPwm_Ip_LoadValue(INSTANCE_0, 1U << SubModule_1, TRUE);
//
//    FlexPwm_Ip_ClearLoadValue(INSTANCE_0, 1U << SubModule_2);
//    FlexPwm_Ip_UpdateDutyCycle(INSTANCE_0, SubModule_2, FLEXPWM_IP_PWMA, 0x300);
//    FlexPwm_Ip_LoadValue(INSTANCE_0, 1U << SubModule_2, TRUE);
 
 
    while(1)
    {
 
    }
 
}

 

Could you please tell me how to configure it so that the complementary channel PWMB outputs normally? Thank you.

0 Kudos
Reply
2 Replies

179 Views
_Leo_
NXP TechSupport
NXP TechSupport

Hi,

Thank you so much for your interest in our products and for using our community.

You could refer to the attached project created in S32DS-S32PLATFORM v.3.5 and RTD 3.0.0 (for SW detail please refer to Getting Started With S32K396-BGA-DC1 Evaluation Board).

The demo outputs the PWM signals, in complementary mode, in PWM1_A_0 (PTC31) and PWM1_B_0 (PTA6), you will need to use the S32X-MB and connect the scope in P13-1 and P13-5, respectively.

Hope it helps you.

Have a nice day!

0 Kudos
Reply

149 Views
qingwang_a
Contributor III

Thank you, I found the reason. When I enabled the error channels, the complementary channels defaulted to opening all the error channels. Although I was only using error channels 1 and 2, everything worked fine after I individually disabled error channels 3 and 4 of the complementary channels.

Tags (2)