Part Number: TM4C123GH6PM
Other Parts Discussed in Thread: TM4C123GH6PM
Tool/software: TI-RTOS
Hello, I am using TI-RTOS PWM.C and PWMTiva.C to set up some PWM outputs.
I need 20khz and then 200hz frequencies.
It seems like when I initiate one the other frequency gets shifted up and the range of frequencies i have is about 2khz to 20khz or 200 to 2khz
I need 200hz for some servos and 20khz for a motor and I am wondering how I can achieve this with the TI-RTOS api.
PWM_Params params1;
uint16_t pwmPeriod = 5000; // Period and duty in microseconds
PWM_Params_init(¶ms1);
params1.period = pwmPeriod;
params1.dutyMode = PWM_DUTY_SCALAR;
pwm_distance_level = PWM_open(2, ¶ms1);
if (pwm_distance_level == NULL) {
System_abort("Board_PWM0 did not open");
}
pwm_top_pitch = PWM_open(3, ¶ms1);
if (pwm_top_pitch == NULL) {
System_abort("Board_PWM0 did not open");
}
pwm_top_yaw = PWM_open(4, ¶ms1);
if (pwm_top_yaw == NULL) {
System_abort("Board_PWM0 did not open");
}
PWM_setDuty(pwm_distance_level, DISTANCE_LEVEL_HOME);
PWM_setDuty(pwm_top_pitch, CAMERA_TILT_HOME);
PWM_setDuty(pwm_top_yaw, CAMERA_TURN_HOME);
PWM_Handle pwm1;
PWM_Handle pwm2;
PWM_Params params;
uint16_t pwmPeriod = 50; // Period and duty in microseconds
uint16_t duty = 0;
PWM_Params_init(¶ms);
params.period = pwmPeriod;
params.dutyMode = PWM_DUTY_SCALAR;
pwm1 = PWM_open(Board_PWM0, ¶ms);
if (pwm1 == NULL) {
System_abort("Board_PWM0 did not open");
}
if (Board_PWM1 != Board_PWM0) {
pwm2 = PWM_open(Board_PWM1, ¶ms);
if (pwm2 == NULL) {
System_abort("Board_PWM1 did not open");
}
}
Any help would be appreciated thanks.