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
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.
The PDB Block
The Sensors Block
The PDB ISR Block
The PWM Block
I have also done the hotfix for the rev3.0 but nothing changes. Could someone help me with this issue??
Thanks in advance
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.