Does QN9021 support 120khz pwm frequency?
If yes, what is the duty cycle resolution for 120khz.
If no, what is the minimum fwm frequency and what is the resolution for this frequency?
Thank you!
Zevi
Got it mario. thank you!
zevi
Hi Zevi,
Please take as reference the pwm driver, you can find it following the next path.
C:\QBlue\QN9020\QBlue-1.3.9\Projects\Driver\pwm
pwm_example.c
Period = 1/120 kHz = 8.333us
int main (void)
{
SystemInit();
pwm_init(PWM_CH0);
pwm_io_config();
//P2.7 will output pwm wave with period for 1000us and pulse for 400us
pwm_enable(PWM_CH0, MASK_ENABLE);
pwm_config(PWM_CH0, PWM_PSCAL_DIV, PWM_COUNT_US(8.333, PWM_PSCAL_DIV), PWM_COUNT_US(1, PWM_PSCAL_DIV));
}
pwm.h
PWM_PSCAL_DIV = 0 +1
/// Set PWM divider
#define PWM_DIV(n) ((n) + 1)
/// Set PWM clock
#define PWM_CLK(x, n) (TIMER_CLK(x) / (PWM_DIV(n)))
#define PWM_PSCAL_DIV 0 // timer divider bypass
#define PWM_COUNT_US(us, pscl_div) ((us) * PWM_CLK(TIMER_DIV, pscl_div) / 1000000)
The Resolution that you will have is the 1/Frequency in, it is the minimum value that you will have
Hope it helps,
Best Regards,
Mario