nRF5340 HFCLKAUDIO clock settings

I've been experimenting with the nRF5340's HFCLKAUDIO clock, and have discovered a discrepancy that I cannot reconcile.

Table 23 in the datasheet details the peripheral's frequency ranges, along with the Min/Center/Max register values required to create a given clock output.

nRF5340 Datasheet Table 23

nRF5340 Datasheet Figure 20

But according to the equation provided in Figure 20 which dictates the relationship between register value and output frequency, the center value of 39854 (0x9BAE) does NOT result in a 12,288,000Hz clock, rather it produces 12,288,300Hz.

Even accounting for a minimum resolution of 40.7Hz, this seems markedly inaccurate. By my calculations, the closest frequency attainable is 12,288,004Hz which requires a register value of 39846 (0x9BA6).

reg_value 39854 = f_out 12,288,300.08

reg_value 39846 = f_out 12,288,004.56

I understand that clock circuits and locked loops are designed to accommodate slight timing variances, but can anyone from Nordic explain this apparent lack of precision in the datasheet? Is it a typo, or is there some other hidden aspect of the setting that I'm simply unaware of?

Any additional info appreciated.

Parents
No Data
Reply
  • One last question regarding the HFCLKAUDIO clock configuration before I admit defeat.

    The target frequency of 12.288MHz is an exact multiple (256x) of 48KHz, which simplifies I2S BCLK and LRCLK generation, but neither Nordic's documentation nor the nrf5340_audio example application seem to set this frequency correctly.

    When using the default register value of 0x9BAE, which is listed in the product specification and also defined in audio_i2s.c, the output frequency is noticeably elevated at 12,288,330Hz.

    When instead using the devicetree to set hfclkaudio-frequency=<12288000> exactly, and then using nrfx_clock_hfclkaudio_config_get() to read the register, the resulting value is 0x9BA5, which correctly matches the above frequency equation.

    Why then does Nordic document 0x9BAE as the register default and center frequency setting when that value clearly does not match the given equation? Or is 0x9BAE the center value used when calibrating the chip, and so is in fact more accurate?

    The only explanation I can fathom is that 0x9BAE=39854, and 0x9BA5=39845, and at some point someone accidentally transposed the last two decimal numerals as a typo, and it went unnoticed before being converted to hex.

    What am I failing to understand? Which is the correct register value for a precise HFCLKAUDIO output of 12,288,000Hz, and why would I want to use the default of 12,288,330Hz instead?

Children
Related