Page 1 of 1

Use pwm_init experiencing some problems

Posted: Thu Mar 26, 2015 4:35 pm
by huafan
I use SDK V1.0.0
GPIO0
pwm_init freq range 1 - 500
freq eq 500 it is OK,
freq eq 100 it is OK,
but freq eq 50 and 10 ,It is a problem.

attachment
code: freq = 10HZ
Oscilloscope picture: freq = 10HZ
code: freq = 50HZ
Oscilloscope picture: freq = 50HZ
code: freq = 100HZ
Oscilloscope picture: freq = 100HZ

Re: Use pwm_init experiencing some problems

Posted: Tue Mar 31, 2015 6:10 pm
by costaud
将pwm.h中pwm_single_param 和pwm_param 结构体参数类型做以下修改即可解决问题:

uint16 h_time; 改为 uint32 h_time;

uint16 period; 改为 uint32 period;

修改后为:

struct pwm_single_param {
uint16 gpio_set;
uint16 gpio_clear;
uint32 h_time;
};

struct pwm_param {
uint32 period;
uint16 freq;
uint8 duty[PWM_CHANNEL];
};