Hello All
I tried to use EXT_SYNC for PWM0 module but without success. (for DEVKIT-MPC5744P)
For this I created 2 models (for 2 different board, models are attached)
Somehow the PWM in Syncro_PWM_CTU_External_Board2 (on DEVKIT 2) is not synchronized with Syncro_PWM_CTU_External(on DEVKIT 1)
Could you please suggest what is wrong in model “Syncro_PWM_CTU_External_Board2”?
mariuslucianandrei ext-rafael.barbosa@chassisbrakes.com dumitru-daniel.popa
Hello abhishek.kumar@chassisbrakes.com,
So let's summarize a bit your status. As far as I know, you have obtained the sync between PWM0 and PWM1 on a single MPC controller without any external connection and successfully read 4 ADCs at the same time. Am I right?
Now, you need to sync the PWM0 module from one MPC5744P to PWM1 module from another MPC5744P?
Best Regards,
Marius!
Dear mariuslucianandrei
Let me clarify this.
As far as I know, you have obtained the sync between PWM0 and PWM1 on a single MPC controller without any external connection and successfully read 4 ADCs at the same time. Am I right?
Yes (I have attached a model for this if some one else needs it, 'PWM01_CTU_00_01_ADC0to4.mdl')
Now, you need to sync the PWM0 module from one MPC5744P to PWM1 module from another MPC5744P?
I need to Sync PWM0 (of Board 1) to PWM0 (of Board 2), using EXT_SYNC of PWM0
Hope it is more clear.
Hello abhishek.kumar@chassisbrakes.com,
From the Reference Manual, I understand that the EXT_SYNC is an input signal. So basically now, you have two inputs connected together, with no signal to trigger them. So the PWM modules would be in sync together but you don't have a signal to sync their reload.
For PWM block, what the toolbox is not doing right now is to initialize the EXT_Sync pin as input for the PWM. So you need to insert some custom code in order to initialize the pin as EXT_SYNC for PWM. I would also try the following approach: Use the reload interrupt from the PWM0, BRD0 to toggle a pin and use it as input on the PWM0, BRD1.
What you could also try is to sync the CTUs from different board since the CTU blocks covers the external in and out pins under the "Pins" tab of the CTU.
Hope this helps,
Marius
Dear mariuslucianandrei
I would also try the following approach: Use the reload interrupt from the PWM0, BRD0 to toggle a pin and use it as input on the PWM0, BRD1.
I do something similar (as explained below)
I have 2 PWM submodules in Model 1 (Board 1), so I use the second PWM submodule only to send a signal (pulse) to Board 2 (ext-sync).
In the end, what I want is that to have the all PWM of Board 1 in Sync with all PWM of Board 2. (just as we have in one board, i want in both boards and PWM0 allows that using EXT_SYNC)
What you could also try is to sync the CTUs from different board since the CTU blocks covers the external in and out pins under the "Pins" tab of the CTU.
I have done that in the model (Syncro_PWM_CTU_External_Board2)
Best Regards
Abhishek
Hey abhishek.kumar@chassisbrakes.com,
Regarding what you tried, to sync the modules, as I explained before, the EXT_SYNC pin from the Board 2 should be configured to be input for the PWM0 module. The MBDT now is not doing that initialization, so you need to insert some custom code in order to set PC13 as EXT_SYnc for FLexPWM_0 like in the screenshot added in my last reply.
Hope this helps,
Marius
Dear mariuslucianandrei
I am not able to find the SDK function call (to do INIT_SEL = 3, as in snapshot below), in S32 Design Studio.
Can you help me with this?
I tried searching INIT_SEL in search but can not find it.
FlexPWM0.SUB[0].CTRL2.B.INIT_SEL = 3;
Hello abhishek.kumar@chassisbrakes.com,
The init_sel is performed by the pwm block, but the actual pin must be muxed to provide the actual pin signal to the pwm peripheral by writing in the Imcr[87] register and so on.
Hope this helps,
Marius
Dear mariuslucianandrei
Thank you for the hint but I am not able to use Write_Register block.
Also, I did not find IMCR registers here.
I think I am totally misunderstanding, what you are asking me to do.
We have already said in the Simulink block that it is an external Sync
The only thing needed to be done is to define the PIN for the EXT_SYNC.
I am very lost now.
Best Regards,
Abhishek
Hello abhishek.kumar@chassisbrakes.com,
We will investigate the error regarding the register.
However, in order to initialize the external pin to redirect the signal to the PWM0 you need to insert a custom code, declaring the structure attached tin the text file pwmSyncPinsCfg and then call the two functions below the structure declaration.
If you need an example on how to insert the custom code, in our toolbox you will find a model called "custom_code.mdl". Consider adding the code from the attached file in the System Initialize block like in the model.
Hope this helps you,
Marius
Dear mariuslucianandrei
Thank you for the hint.
I tried to do the changes
1. Added the code you sent in Syncro_PWM_CTU_External_Board2.mdl
2. Removed the CTU block from "Syncro_PWM_CTU_External_Board2.mdl"
Still the synchronization could not be achieved.
I have attached the model which is in Board 1 (which sends a signal to reset PWM timer for board 2)
Please provide the your input.
Best Regards
Abhishek
Dear mariuslucianandrei
It has been some time, but have you found any solution regrading External PWM Sync. We are planning to use this feature but were not able to work it out yet.
Let us know of any solution.
Best Regards,
Abhishek