This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

TM4C123GH6ZXR: PWM Frequency control and LOAD register

Part Number: TM4C123GH6ZXR


We're currently using the TM4C123GH6ZXR microcontroller to regulate stepper motors' movements through PWM signals, which control the timing and duration of motor steps. However, when we attempt to tweak the timing to adjust one motor's speed, we encounter a challenge. Altering the PWM signal's timing to slow down one motor inadvertently disrupts its movement precision. For instance, if we aim to reduce the speed by shortening the duration of the signals 'on' state, the motor may skip steps or overshoot its target due to the abrupt change in timing. We are using PWM0 based Gen1 and their two channels M0PWM2 and M0PWM3, so load register is common 'Load1'. We have requirement that we need to change the load register value as to control the total time of stepper motor. We have to use pwm in up/down count mode because the stepper driver is detecting the rising edges for inching movement of stepper motor. So is there any way to generate separate to load separate value for load register as to have separate timings for stepper motors. Our problem is related to Load register of generator which is present in PWM. For example, PWM0 Gen0 has LOAD0 register and this Gen0 has two channels OUT0 and OUT1, so in datasheet mentioned that we cannot change or timing output for channel. Let say I have loaded 800 value to LOAD0 register so value will apply to both channels. Is it true that we cannot control the LOAD0 register for each channel on same generator.

  • if we aim to reduce the speed by shortening the duration of the signals 'on' state, the motor may skip steps or overshoot its target due to the abrupt change in timing

    Hi,

      I suppose you are changing the comparator value of the PWM to control the duty cycle of the PWM, correct?

    We are using PWM0 based Gen1 and their two channels M0PWM2 and M0PWM3, so load register is common 'Load1'. We have requirement that we need to change the load register value as to control the total time of stepper motor.

    I'm a bit confused. Here you said you are changing the LOAD value. LOAD value controls the period of the PWM, not the duty cycle. Do you want to change the duty cycle or the period or both for the PWM?

    Let say I have loaded 800 value to LOAD0 register so value will apply to both channels. Is it true that we cannot control the LOAD0 register for each channel on same generator.

    That is correct. The LOAD register is common to to both channel. If you look at the block diagram for each generator, there is only one LOAD register and two CMPx registers. 

    Altering the PWM signal's timing to slow down one motor inadvertently disrupts its movement precision.

    Whether you are changing the duty cycle or the period dynamically, you should apply the sync (either locally sync or globally sync depending if you are using one PWM generator or multiple generators) so that the update to the LOAD or CMPx registers do not take effect until the PWM period is complete.