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?

  • I am not able to reproduce it here yet, tried on several boards, but no glitch in the PWM.

    Starting the crstyal with sd_clock_hfclk_request() will be the current workaround, there are no drawbacks with doing this other than an increase in current consumption, see here. Running from the crystal will also get higher accuracy (20 ppm crystal on DK vs 1.5% typical for internal oscillator). I will update when I have been able to reproduce this and know more.

    Could you attach a higher resolution picture showing the artifacts more closely so I can see the timing and such (upload the file to the answer)? You are using nRF52 DK? Which version or which version of the chip?

  • 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.

  • Your June 6th update initializes the SoftDevice with the LF RC clock. Have you tried using the 32kHz LF crystal?

Related