Making an ePWM on a F28379D

Thread Starter

Etne

Joined Apr 5, 2019
3
Hello,

I'm stuck trying to turn a servomotor (SG 90) with a LAUNCHXL-F28379D. I have a PWM signal on my scope but it's way too fast for the servo : I have 6.25 kHz and with an Arduino (using the library Servo.h) I have 49 Hz (something like that). I know why my signal is too fast, but I don't know how to slow it down. This is what I have from the user guide :



For the SG 90, T_ {PWM} needs to be at 20 ms. I know that T_{TBCLK} is 10 ns (and I don't know how I can change it, there is nothing about that in the user guide). So I calculated TBPRD to be 2 000 000 but it is too large for an Uint16 !

I don't what should I do.. Do you have an idea?

Thanks a lot for your time.
 

mvas

Joined Jun 19, 2017
539
Did you see this ....

"...
• Configure the rate of the time-base clock; a prescaled version of the ePWM clock (EPWMCLK). This
allows the time-base counter to increment/decrement at a slower rate.

NOTE: The Type 4 ePWM clocking varies from previous ePWM types. Prior to the Type 4 ePWM,
the time-base submodule was clocked directly by the system clock ( SYSCLKOUT ) . On this
version of the ePWM , there is a divider ( EPWMCLKDIV ) of the system clock which defaults
to EPWMCLK = SYSCLKOUT/2
..."

on Page 1708 ?

Do you have an ePWM that can pre-scale the Clock ?
Look the bottom of figure 15-5 and you will see the "Clock Pre-Scale" divider logic with 2 registers ...
a) TBCTL [ HSPCLKDIV ]
b) TBCTL [ CLKDIV ]

Use the pre-scaler logic to slow down the TBCLK clock pulses
If you increase the Pre-Scale by a factor of 40,
which would be a Pre-Scale = 80,
then your TBPRD = 50,000 ? ( which fits within a Uint16 register )
 
Last edited:
Top