I have a PSoC3-based project to control two motors via PWM. Currently the PWM block on PSoC Creator is set to work with an input clock of 2MHz, and dividing the period into 100 samples gives a resulting period of 50us and therefore 20kHz.
Wanting to increase the resolution of the PWM to have greater linearity on the movement of the motors, I changed the value of the input clock of the PWM block to 48MHz, dividing the period into 2400 samples to still have a resulting period of 50us and therefore a PWM with a frequency of 20kHz.
After this modification, however, giving the same inputs the motors do not move.
Do you have any suggestions please? Thank you very much
Does motor move when you set PWM duty cycle to 50% (compare = 1200)? If so, I suspect that the motor driver is bandpass-limited, and does not pass short pulses from the PWM, when they are too short. Typically, the motor drivers are limited to 200kHz max, which is ~5usec minimum pulse length.
odissey1 is correct. In fact, the larger the motor (more inductance) the longer the minimum pulse must be.
When a motor is OFF, the motor is in effect "stalled". When you apply power to it, the motor starts at stall torque value (see the motor curve) with the RPM at 0. As current flows through the motor coils, the motor starts to move (RPM increases) and the motor torque decreases.
The minimum pulse for a stopped (or stalled) motor must be enough to overcome brush and bearing friction and eventually something called "cogging" torque.
In your specific case, when the input clock to the PWM was 2MHz with a period of 100, the single pulse with a <= compare of 0 had a width of 500ns. Apparently your motors must be small to allow only 500ns to turn the armatures.
When you changed to a 48MHz clock with a period of 2400, the single pulse with a <= compare of 0 had a width of 21ns. This is not enough energy to the motors to overcome the brush and bearing friction to attempt to start spinning.
Suggestion: With the 48MHz input clock, use 24 as the compare value. This will have the PWM output 500ns which should be equivalent to when you had the input clock at 2MHz.
Note: It is very likely that you can use low PWM values with the 48MHz input clock. The trick is that you have to apply a wider PWM width first. Once the motor is spinning, you can lower the PWM width. This is because because when the motor is already spinning, the brush and bearing frictions go from static to dynamic which are always smaller and you have momentum of the armature on your side.
Len "Engineering is an Art. The Art of Compromise."