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

How to configure a secondary clock crystal in Zephyr for NRF52833dk?

Hi all,

I am trying to interface a BLE mikrobus module onto a Yocto based Linux SBC. I need to use Zephyr's hci_uart example to flash it onto the module, the mikrobus BLE module is based on nrf52833dk. But it doesn't have a primary 32.678KHz crystal, so I need to use a secondary crystal. If anyone knows how to configure a secondary crystal in Zephyr for the hci_uart example and flash it onto the module, please help me out on this.

The code works fine when I use the EVK and fails to run on the Module. If anyone can help me on how to configure a second crystal it'll really be helpful to me.

Thanks in advance.

Parents
  • Hi,

    You need to configure it to use the internal 32.768 kHz RC oscillator (LFRC).

    Set these configs:

    Fullscreen
    1
    2
    3
    # 32kHz clock source
    CONFIG_CLOCK_CONTROL_NRF_K32SRC_RC=y
    CONFIG_CLOCK_CONTROL_NRF_K32SRC_500PPM=y
    XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

  • Hi Sigurd,

    May I know on which file do I set this?

  • Maneesh N said:
    I tried it on the Hello world example to see if the module is able to print anything onto the console, nothing comes up on the console.

     Do you know what pins the module uses for printing? Is there some UART-USB-bridge / virtual COM port via UART on the module?

  • It is a virtual COM port via UART.

    On the Nordic SDK, making the changes mentioned above and flashing this ble_app_uart example is working fine on the module. And

    Fullscreen
    1
    2
    3
    4
    5
    6
    7
    8
    #ifndef NRF_SDH_CLOCK_LF_SRC
    #define NRF_SDH_CLOCK_LF_SRC 0
    #endif
    #ifndef NRF_SDH_CLOCK_LF_ACCURACY
    #define NRF_SDH_CLOCK_LF_ACCURACY 1
    #endif
    XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

    These 2 macro definitions give me the same meaning as you had sent me before. i.e,

    Fullscreen
    1
    2
    3
    # 32kHz clock source
    CONFIG_CLOCK_CONTROL_NRF_K32SRC_RC=y
    CONFIG_CLOCK_CONTROL_NRF_K32SRC_500PPM=y
    XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

    but the others I'm not quite sure.

  • 1) This is the sample you used? https://github.com/nrfconnect/sdk-zephyr/tree/master/samples/hello_world

    2) What board did you build for ? nrf52833dk_nrf52833 ?

    3) Are you using command-line/ west to build and flash, or SES ?

  • 1. Yes, that's the example I'm trying

    2. Yes!

    3. Command-Line, I'm using west.

  • Could it be an issue with flow-control?

    Try this overlay to turn flow-control on:

    Fullscreen
    1
    2
    3
    &uart0 {
    hw-flow-control;
    };
    XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

    alternatively, to turn it off, try this:

    Fullscreen
    XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

    7206.nrf52833dk_nrf52833.overlay

Reply
  • Could it be an issue with flow-control?

    Try this overlay to turn flow-control on:

    Fullscreen
    XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

    alternatively, to turn it off, try this:

    Fullscreen
    XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

    7206.nrf52833dk_nrf52833.overlay

Children