embassy-rs / nrf-softdevice

Apache License 2.0
256 stars 76 forks source link

Fix nRF clock accuracy setting in examples #165

Closed lonesometraveler closed 1 year ago

lonesometraveler commented 1 year ago

The original value of 7 sets the accuracy to 20 ppm (NRF_CLOCK_LF_ACCURACY_20_PPM). However, the chip's internal RC oscillator has an accuracy of 500 ppm. I think this should be NRF_CLOCK_LF_ACCURACY_500_PPM (= 1).

alexmoon commented 1 year ago

Thanks, I think you are correct. Reviewing the documentation, I believe the ctiv field should also be set to 16 instead of 4. Can you update the PR with that change as well?

lonesometraveler commented 1 year ago

You are right. The recommended configuration for NRF_CLOCK_LF_SRC_RC on nRF52 is rc_ctiv=16 and rc_temp_ctiv=2. I made the changes.

alexmoon commented 1 year ago

Thanks!