PDB_ISR block - What does it do

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

PDB_ISR block - What does it do

Jump to solution
418 Views
Sriram
Contributor IV

Sriram_0-1713419172946.png

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

Tags (2)
0 Kudos
Reply
1 Solution
370 Views
stefancinipeanu
NXP Employee
NXP Employee

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.

stefancinipeanu_0-1713792101832.png

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.

stefancinipeanu_1-1713792506073.png

In the following figure, you can observe the application timing diagram for PWM-ADC synchronization:

stefancinipeanu_2-1713792659067.png

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.

View solution in original post

1 Reply
371 Views
stefancinipeanu
NXP Employee
NXP Employee

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.

stefancinipeanu_0-1713792101832.png

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.

stefancinipeanu_1-1713792506073.png

In the following figure, you can observe the application timing diagram for PWM-ADC synchronization:

stefancinipeanu_2-1713792659067.png

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.