Problem to synchronize ADC and PWM using PDB

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

Problem to synchronize ADC and PWM using PDB

1,757 Views
PedroCastro
Contributor III

Hello,

I am developing a bldc motor control using S32K14 and the motor control toolbox rev3.0. In order to read ADC I am trying to use the PDB module to synchronize with the PWM. Below there are some screenshots to show you the configuration. The program compiles and it is uploaded to the board, but them it does not start and I cannot connect to freemaster as soon as the code is uploaded so I am not able to debug it.  Running in open loop is fine.

This is the first page of the model where I do all initialization

pastedImage_1.png

The ADC Config block.

A interesting point that I don't it helps is that when a change the conversion trigger select to Software, the program runs and I can connect to freemaster. Obviously the ADC reading does not work properly.

pastedImage_2.png

The PDB Block

pastedImage_3.png

pastedImage_4.png

The Sensors Block

pastedImage_5.png

The PDB ISR Block

pastedImage_6.png

The PWM Block

pastedImage_7.png

pastedImage_8.png

I have also done the hotfix for the rev3.0 but nothing changes. Could someone help me with this issue??

Thanks in advance

0 Kudos
Reply
1 Reply

1,425 Views
Daniel_Popa
NXP Employee
NXP Employee

Hi Pedro,

Since we have released the toolbox - we have identified a few issues with this complex setup PWM - PDB - ADC.

First, please make sure you install all the patches shown here: HotFix: MBD Toolbox rev3.0.0 for S32K (especially the first 2 of them)

Then, you might want to have a look over the model from Module 6: Current Sensing (Part 1/2) and Module 6: Current Sensing (Part 2/2) . There are few tricks i've to use in order to synchronize the PWM-PDB-ADC using the Simulink Custom Code blocks. 

Basically - i had to perform some additional initialization in TRGMUX and call these functions from the model. For the moment that is the only way we can achieve the synchronization but we plan to update the toolbox in July 2018 to handle all this mechanism automatically.

Please let me know if you managed to have it working.

Thank you!

Daniel

0 Kudos
Reply