How to use internal capacitors on nrf5340?

Hi, 

I wonder how to use the internal capacitor of the nrf5340.

The nRF5340-DK operates at 32M=8pf 32.768k=9pf without any special settings.

If i use 10pf products for both crystals,

How can I set it up in NCS 1.9.1?

I added it to prj.conf as below, but it seems not to be applied.

CONFIG_SOC_ENABLE_LFXO=y
CONFIG_SOC_LFXO_CAP_INT_7PF=y
CONFIG_SOC_HFXO_CAP_INTERNAL=y
CONFIG_SOC_HFXO_CAP_INT_VALUE_X2=20
thank you

Parents
  • I did some testing.

    • I programmed the hello world sample (NCS v1.9.1) to the nRF5340 DK using the board name nrf5340dk_nrf5340_cpuapp with the following prj.conf

    CONFIG_SOC_ENABLE_LFXO=y
    CONFIG_SOC_LFXO_CAP_INT_7PF=y
    CONFIG_SOC_HFXO_CAP_INTERNAL=y
    CONFIG_SOC_HFXO_CAP_INT_VALUE_X2=20

    @$ nrfjprog --memrd 0x500046D0
    0x500046D0: 00000002 |....|

    According to the documentation, it is correct. A value of 2 means the 7 pF internal load capacitance is selected

    • Then I put a break point in the function nordicsemi_nrf53_init() to see what the calculated cap value was, which was 7
      • I don't have much knowledge about this topic, so I'm not sure if a value of 7 makes sense. If it doesn't please let me know and I will take a closer look at it/ask internally
    • Then I read the XOSC32MCAPS register:

    @$ nrfjprog --memrd 0x500045C4
    0x500045C4: 00000107 |....|

    As you can see, this will enable the capacitor and set the cap value to 7

    Best regards,

    Simon

  • Hi. 

    I used the board name nrf5340dk_nrf5340_cpuapp_ns.
    Was it a problem to use it as nonsecure?
    Cannot read as nrfjprog --memrd.

    The reason for 7 is that I checked the link below to add 3pf.

    link

    Thank you.

  • Try adding these Kconfigs to the prj.conf:

    CONFIG_SOC_ENABLE_LFXO=y
    CONFIG_SOC_LFXO_CAP_INT_7PF=y
    CONFIG_SOC_HFXO_CAP_INTERNAL=y
    CONFIG_SOC_HFXO_CAP_INT_VALUE_X2=20
    CONFIG_BUILD_WITH_TFM=y
    

    Then build and program you application, and read the registers in the following manner:

    @$ nrfjprog --memrd 0x400046D0
    0x400046D0: 00000002 |....|

    @$ nrfjprog --memrd 0x400045C4
    0x400045C4: 00000107 |....|


    Explanations:

    noseed said:
    I used the board name nrf5340dk_nrf5340_cpuapp_ns.
    Was it a problem to use it as nonsecure?

    You need to add CONFIG_BUILD_WITH_TFM due to the following: https://github.com/nrfconnect/sdk-zephyr/blob/v2.7.99-ncs1-1/soc/arm/nordic_nrf/nrf53/Kconfig.soc#L149 

    noseed said:
    Cannot read as nrfjprog --memrd.

    Be aware that the nonsecure oscillator offset is 0x40004000, not 0x50004000. This is probably why you couldn't read the registers

    Best regards,

    Simon

Reply
  • Try adding these Kconfigs to the prj.conf:

    CONFIG_SOC_ENABLE_LFXO=y
    CONFIG_SOC_LFXO_CAP_INT_7PF=y
    CONFIG_SOC_HFXO_CAP_INTERNAL=y
    CONFIG_SOC_HFXO_CAP_INT_VALUE_X2=20
    CONFIG_BUILD_WITH_TFM=y
    

    Then build and program you application, and read the registers in the following manner:

    @$ nrfjprog --memrd 0x400046D0
    0x400046D0: 00000002 |....|

    @$ nrfjprog --memrd 0x400045C4
    0x400045C4: 00000107 |....|


    Explanations:

    noseed said:
    I used the board name nrf5340dk_nrf5340_cpuapp_ns.
    Was it a problem to use it as nonsecure?

    You need to add CONFIG_BUILD_WITH_TFM due to the following: https://github.com/nrfconnect/sdk-zephyr/blob/v2.7.99-ncs1-1/soc/arm/nordic_nrf/nrf53/Kconfig.soc#L149 

    noseed said:
    Cannot read as nrfjprog --memrd.

    Be aware that the nonsecure oscillator offset is 0x40004000, not 0x50004000. This is probably why you couldn't read the registers

    Best regards,

    Simon

Children
No Data
Related