Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob

TRAVEO™ T2G cluster MCU: Synchronization of PWM channels - KBA235698

TRAVEO™ T2G cluster MCU: Synchronization of PWM channels - KBA235698

IFX_Publisher2
Community Manager
Community Manager
Community Manager
1000 replies posted First like given 750 replies posted

Version:  **

Some applications require multiple PWM channels. Each PWM channel may need to be synchronized by software to allow coordinated timing such as in motor control and color sensing.

To control PWM counters simultaneously without delay in T2G devices, consider the following approach.

The same trigger signal can control different TCPWM counters. The trigger source can be either a hardware or software trigger (see the the Trigger Multiplexer chapter in related T2G Architecture TRM for the list of hardware triggers).
The following solution describes the PWM synchronization by a software trigger, but in principle, the same trigger event can be done based on hardware triggers.

The trigger signal can be used for different events (for example, START, STOP, RELOAD, CAPTURE/SWITCH). Connecting the same trigger signal on other counters can control them at the same time, without any delay.

For example, the following figure shows the setup for a center-aligned PWM signal for a TRAVEO™ T2G  CYT2B7 device.

BinduPriya_G_4-1656048190500.pngBased on this example, do the following to synchronize the PWM channels:
  1. Use the startInput value for the start event trigger. All counters must have the same value. Depending on the device, the value might differ.

There is an ordering for input trigger signals for TCPWM counters:

  • 0: Const 0
  • 1: Const 1
  • 2: One-to-one trigger 0
  • 3: One-to-one trigger 1
  • 4: One-to-one trigger 2
  • 5: General-purpose trigger TR_ALL_IN0
  • 6: General-purpose trigger TR_ALL_IN1
  • 31: General-purpose trigger TR_ALL_IN26

Check the datasheet of the corresponding device in chapter “Miscellaneous configuration” to find the maximum number of one-to-one trigger signals to calculate the required general-purpose trigger signal.

BinduPriya_G_3-1656048055082.png
  1. Assign all counters to the same clock source by using the Cy_SysClk_PeriphAssignDivider function.
BinduPriya_G_2-1656048001422.png
  1. After initializing the PWM, start the counters by calling the Cy_TrigMux_SwTrigger function. It generates a rising edge (TR_CMD_ACTIVATE) on the general-purpose trigger signal TR_ALL_IN0 which starts all connected counters synchronously without any delay.
BinduPriya_G_0-1656047418346.png

 


Note:      For different events, use different general-purpose trigger signals.
0 Likes
234 Views