Design Objective
I am developing a motor control system using the S32K344 microcontroller. The system is designed to control a motor driver via PWM signals applied to both IN1 and IN2 , enabling control of both the direction and speed of the motor. A key requirement is to ensure that current feedback (motor current) is sampled by the ADC only during the ON period of the PWM cycle on both IN1 and IN2.
My Questions
1- Is OPWMCB Mode the Most Suitable Option for PWM Generation?
I am considering using the eMIOS module in OPWMCB (Output Pulse Width Modulation Center-Aligned Buffered) mode to generate complementary PWM signals with built-in dead-time insertion. This approach appears well-suited for driving both IN1 and IN2 in a synchronized and safe manner.
2- Can eMIOS alone generate complementary PWM signals without LCU intervention?
My understanding is that a single eMIOS channel in OPWMCB mode (specifically EMIOS_PWM_IP_MODE_OPWMCB_TRAIL_EDGE) can generate both the primary and complementary PWM signals, and that the same channel can be used to trigger ADC conversion at the center of the PWM cycle to obtain current feedback.
I would like to confirm how this can be achieved in practice. I have attempted to implement this, but it is not functioning as expected. I have attached my project for review.
3- Is it only possible to generate complementary PWM using the LCU?
If eMIOS cannot generate complementary PWM signals independently, is the LCU required to implement this functionality?
4- Using eMIOS for Independent PWM Channels
As an alternative, I am also considering using two separate eMIOS channels to generate independent PWM signals for IN1 and IN2. However, I would like to understand how to synchronize these channels effectively to avoid timing mismatches or shoot-through conditions. Since both channels would share the same period and time base, would that be sufficient?
4- Most Important Requirement: Triggering ADC Conversion at the Center of OPWMCB?
I would like to use the same PWM signal for both IN1 and IN2 to trigger the ADC for sampling current feedback during the ON period of the PWM cycle.
- How can this be achieved?
- Which PWM mode is best suited for this purpose?
- Can this be done using eMIOS OPWMCB mode, or is another configuration more appropriate?