How to set the ctu?

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

How to set the ctu?

945 Views
hongjinzeng
Contributor IV

Hi everybody,

  Now I use Motor Control Toolbox for MPC5643L.In the CTU,I do not know how to set the Counter Stop Delay(mks) and the Trigger x Delay(mks).Can you help me?

pastedImage_1.png

pastedImage_2.png

                                                                                                                                     Best Regards,

                                                                                                                                     Hongjin Zeng.

0 Kudos
3 Replies

671 Views
dumitru-daniel_
NXP Employee
NXP Employee

Hi Hongjin Zeng,

As you know the Cross-Triggering Unit is used to offload the CPU involvement in the acquisitions of different signals (i.e. motor currents, voltages, etc) that can be linked against a predefined sequences of events. i.e. you can only measure the motor phase currents with a shunt resistor only when lower transistors are in conduction. Therefore you need to sync the ADC acquisition with the PWM pulses on the lower transistors.

 

The CTU can receive signals (to start counting events) from various peripherals: PWM, Timers, GPIO, External and can start counting event based on various states of such signals: i.e.: rising/falling or combination.

Coming back to your question:

Counter Stop Delay - defines the period when TGS Counter loaded with TGS Counter Reload Value reaches TSG Counter Compare Value while Trigger n Delay defines period when TGS Counter loaded with TGS Counter Reload Value reaches Trigger n Compare Value, in other words the Trigger n Delay is a subset of Counter Stop Delay. And because a picture worth a 1000 words:

TGS.JPG

Counter Stop Delays  may refers to the red arrow time interval if you count for the whole time interval between events (or might be lower than than)

Trigger n Delay refers to the time interval between red (when event has occurs) and black arrows (when you take the action).

Let's come back to the initial example with current measurements: Basically you want to set up the Counter Stop Delay to PWM period in order to measure the current each time the PWM gets updated. Then you will have to set up the Trigger n Delay to a certain time in order to sample and measure the current via ADC only when the current is reaching the steady state flow thru the shunt.

So, playing with the value of Trigger n Delay you control the moment when the ADC will actually read the value after the lower transistor is in conduction.

FYI, there are a few examples about usage of CTU in the Example Folder of the toolbox you have installed.

Hope this helps!

Daniel

0 Kudos

671 Views
hongjinzeng
Contributor IV

Hi Daniel,

   In the flexpwm_ctu_adc_center.mdl,I find the pwm is 10000Hz,but the Counter Stop Delay is 1000,and the Trigger 0 Delay is 0.Does this mean in one pwm period the ADC measure 10 times?

pastedImage_1.png

Best Regards,

Hongjin Zeng.

0 Kudos

671 Views
dumitru-daniel_
NXP Employee
NXP Employee

Hi Hongjin Zeng,

Because the Trigger 0 Delay is 0 it means the ADC will start to measure immediately after the PWM update interrupt occurs (but only once per PWM period). In this case the value of Counter Stop Delay is not too important. Usually you can setup this timer to expire in order to make sure to perform the ADC measurement in a window of time.

0 Kudos