Hello,
im going through the pmsm closed loop example of s32k144. want to know what does the PDB isr block do . there is already an option to set delays for pre triggers in the pdb config block. is the pdb isr block neccessary for the execution of pmsm closed loop.
thanks
已解决! 转到解答。
Hello @Sriram
The PDB peripheral is an up-counting timer used to trigger ADC conversion at specific timings in order to measure at least 2 phase currents on the right moments. Also, the PDB is hardware triggered by FTM peripheral(responsible for generating the PWM signals) by asserting the FTM-INIT signal.
For dual-shunt current reconstruction method used in this PMSM example, the PDB pre-trigger delay values are set to trigger the ADC conversion for currents A and B in the middle of PWM period and indeed, these values are set using the PDB Configuration Simulink block. The 3-phase currents are reconstructed inside the ADC ISR and also all control loops (slow loop and fast loop) are triggered inside the ADC ISR. To be able to execute all these tasks inside the ADC ISR, it is needed to disable first the FTM-PDB trigger. As you can seen in the following figure, this is the first step we achieve by calling the PWM Init Trigger Disable and then get the ADC raw data for currents.
After all real-time motor control tasks are executed, the hardware trigger from FTM to PDB has to be reinitialized to get new data for 3-phase current reconstruction and this is achieved using the PDB interrupt block that is going to be enabled after the PDB counter has reached the Interrupt Delay value of 4999. Inside the PDB_ISR function the FTM PWM Init Trigger Enable is called.
In the following figure, you can observe the application timing diagram for PWM-ADC synchronization:
For more details on how the PWM-PDB-ADC synchronization is achieved for PMSM motor control application, check out the following application note: AN12235
Hope this helps!
Regards,
Stefan.
Hello @Sriram
The PDB peripheral is an up-counting timer used to trigger ADC conversion at specific timings in order to measure at least 2 phase currents on the right moments. Also, the PDB is hardware triggered by FTM peripheral(responsible for generating the PWM signals) by asserting the FTM-INIT signal.
For dual-shunt current reconstruction method used in this PMSM example, the PDB pre-trigger delay values are set to trigger the ADC conversion for currents A and B in the middle of PWM period and indeed, these values are set using the PDB Configuration Simulink block. The 3-phase currents are reconstructed inside the ADC ISR and also all control loops (slow loop and fast loop) are triggered inside the ADC ISR. To be able to execute all these tasks inside the ADC ISR, it is needed to disable first the FTM-PDB trigger. As you can seen in the following figure, this is the first step we achieve by calling the PWM Init Trigger Disable and then get the ADC raw data for currents.
After all real-time motor control tasks are executed, the hardware trigger from FTM to PDB has to be reinitialized to get new data for 3-phase current reconstruction and this is achieved using the PDB interrupt block that is going to be enabled after the PDB counter has reached the Interrupt Delay value of 4999. Inside the PDB_ISR function the FTM PWM Init Trigger Enable is called.
In the following figure, you can observe the application timing diagram for PWM-ADC synchronization:
For more details on how the PWM-PDB-ADC synchronization is achieved for PMSM motor control application, check out the following application note: AN12235
Hope this helps!
Regards,
Stefan.