C2000 Synchronization of ePWM modules with external signal

Hello everyone, I am trying to use an external signal to synchronize 4 ePWM (ePWM1, ePWM2, ePWM3 and ePWM4) modules together, however I have not been able to make it work. Modules ePWM1, ePWM2 and ePWM3 are configured as UP/DOWN with TBPRD = 5000 (achieving 20 kHz period) and ePWM4 is also configured in UP/DOWN mode, however TBPRD = 50000 (achieving 2 kHz). I would like to use a signal connected to GPIO40 as an external SYNC to the ePWM modules. The signal is 2 kHz. How am I supposed to configure the ePWM Blocks in Simulink??? BTW: I have configured GPIO40 als SYNCI inthe Hardware settings tab.
I have also noticed that Simulink is not setting the EPWMSYNCINSEL register in the generated code.....
I am using a TMS320F28388D ControlCard
Thanks!

Answers (2)

Hi Roberto
Did you fix this problem? How to cope it?
Hi @Roberto,
To configure ePWM1, ePWM2, ePWM3, and ePWM4 for synchronization using an external signal connected to GPIO40, you can follow these steps:
  • In Simulink, go to Hardware Settings and configure GPIO40 as the SYNCI signal.
  • Set ePWM1, ePWM2, and ePWM3 to Up/Down Mode with TBPRD = 5000 (20 kHz).
  • Set ePWM4 to Up/Down Mode with TBPRD = 50000 (2 kHz).
  • Enable Synchronization (TBCTL[SYNCOSEL]) for each ePWM module to allow synchronization via the external input.
  • If Simulink does not set EPWMSYNCINSEL = 0x18 (Input X-BAR) in the generated code: Use a custom code block in Simulink to set the register manually in the initialization phase.
EPwmXbarRegs.EPWMSYNCINSEL.bit.SYNCIN = 0x18; // Map Input X-BAR to SYNCI
You can refer to the below example which demonstrates synchronization of ePWM modules and includes configuration steps which is relevant to your requirements.

Products

Release

R2020b

Asked:

on 25 May 2021

Answered:

on 6 Dec 2024

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!