This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

High frequency PWM shifts phase when radio is active

image description

When setting up a 1Mhz square wave using NRF_PWM on the NRF52 or GPIOTE on the NRF51 while BLE is advertising, the PWM stops when the radio is active. The problem doesn't happen when the frequency is below 6khz. No PWM interrupt is enabled. Is this an unavoidable limitation with high PWM frequencies?

Parents
  • image description image description

    I'm also experiencing this on my nrf52. I can see the advertising events causing the artifacts in the pwm output.

    1. Advertising interval = 125x 0.625 ms = 78 ms
    2. Advertising interval = 250 x 0.625 ms = 156 ms

    This might be caused by the BLE-event requesting a clock change from RC to XTAL.

    sd_clock_hfclk_request() did the trick in my case.

  • sd_clock_hfclk_request didn't do anything for me. Looks like the clock can be configured once during startup, using SOFTDEVICE_HANDLER_INIT to use the hfclk to synthesize the 32khz clock, but any attempt to change the clock later does nothing or crashes it. This eliminates the clock instability, but uses 1mA which is too high without a way to disable it at runtime.

    Visualizing the artifact requires an oscilloscope sampling below 100 ksamples/sec & an 800khz square wave synthesized by PWM. There hasn't been a directly observable change in frequency, only a DC alias. The workaround has been only doing time sensitive operations when the radio is inactive, but this makes it really slow.

Reply
  • sd_clock_hfclk_request didn't do anything for me. Looks like the clock can be configured once during startup, using SOFTDEVICE_HANDLER_INIT to use the hfclk to synthesize the 32khz clock, but any attempt to change the clock later does nothing or crashes it. This eliminates the clock instability, but uses 1mA which is too high without a way to disable it at runtime.

    Visualizing the artifact requires an oscilloscope sampling below 100 ksamples/sec & an 800khz square wave synthesized by PWM. There hasn't been a directly observable change in frequency, only a DC alias. The workaround has been only doing time sensitive operations when the radio is inactive, but this makes it really slow.

Children
No Data
Related