QN9021 120khz PWM

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 

QN9021 120khz PWM

1,510 次查看
zevikramer
Contributor I

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

标记 (1)
0 项奖励
回复
2 回复数

1,433 次查看
zevikramer
Contributor I

Got it mario. thank you!

zevi

0 项奖励
回复

1,433 次查看
mario_castaneda
NXP TechSupport
NXP TechSupport

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

pastedImage_1.png

Hope it helps,

Best Regards,

Mario

0 项奖励
回复