Hello,
I want to learn how we generate the frequency on nrf52832. I simply take a Blinky led example and on that blinking the led. i want 1MHZ frequency . so how should i proceed for???
Hello,
I want to learn how we generate the frequency on nrf52832. I simply take a Blinky led example and on that blinking the led. i want 1MHZ frequency . so how should i proceed for???
Hi Sunil,
There are at least three ways to satisfy your need. I assume that you need a 1MHZ 50%duty PWM wave.
1. GPIO toggle + 0.5us dealy, basically like the blinky led example, but the delay function is not accurate, it is hard to achieve 1MHz accurately.
2. GPIOE + PPI + Timer, nrf52DK examples\peripheral\gpiote shows exactly how to do this. Just modify the following lines.
... nrf_drv_timer_extended_compare(&timer, (nrf_timer_cc_channel_t)0, 1, NRF_TIMER_SHORT_COMPARE0_CLEAR_MASK, false); ... nrf_drv_timer_config_t timer_cfg = NRF_DRV_TIMER_DEFAULT_CONFIG; timer_cfg.frequency = NRF_TIMER_FREQ_2MHz; ...
3. using PWM peripheral. See the example examples\peripheral\pwm_driver.
Best regards,
Charlie
Hi Sunil,
There are at least three ways to satisfy your need. I assume that you need a 1MHZ 50%duty PWM wave.
1. GPIO toggle + 0.5us dealy, basically like the blinky led example, but the delay function is not accurate, it is hard to achieve 1MHz accurately.
2. GPIOE + PPI + Timer, nrf52DK examples\peripheral\gpiote shows exactly how to do this. Just modify the following lines.
... nrf_drv_timer_extended_compare(&timer, (nrf_timer_cc_channel_t)0, 1, NRF_TIMER_SHORT_COMPARE0_CLEAR_MASK, false); ... nrf_drv_timer_config_t timer_cfg = NRF_DRV_TIMER_DEFAULT_CONFIG; timer_cfg.frequency = NRF_TIMER_FREQ_2MHz; ...
3. using PWM peripheral. See the example examples\peripheral\pwm_driver.
Best regards,
Charlie