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

Clock config of the MESH sdk 1.0

Hi,

IC : nrf52832 SDK : Mesh_v1.0.0

I am testing the light_switch demo of the Mesh_v1.0.0.

I don't have 32kHz osc on my server board, so I have to change the clk config. I config the clock in server project like this:

config_params.lf_clk_cfg.source    = NRF_CLOCK_LF_SRC_RC;
config_params.lf_clk_cfg.accuracy = NRF_CLOCK_LF_ACCURACY_20_PPM;

By the j-link RTT viwer i can find the problem has failed at the sd_softdevice_enable() function. And the J-link RTT viewer showing this:

 0> <t:          0>, main.c,  119, ----- BLE Mesh Light Switch Server Demo -----
 0> <t:          0>, nrf_mesh_sdk.c,   72, APP_ERROR: G:\ES_project\nrf5_SDK_for_Mesh_v1.0.0_src\examples\light_switch\server\src\main.c:141 code 7

I think it is because of the clk config. But I config the clock in client project like this:

    nrf_clock_lf_cfg_t lfc_cfg = {NRF_CLOCK_LF_SRC_RC, 16, 2, NRF_CLOCK_LF_ACCURACY_20_PPM};

By the J-link RTT viwer I can find the program is running as expected, like this:

 0> <t:          0>, main.c,  431, ----- BLE Mesh Light Switch Client Demo -----
 0> <t:          0>, nrf_mesh_sdk.c,  187, Initializing softdevice
 0> <t:          0>, nrf_mesh_sdk.c,  122, Initializing SoftDevice...
 0> <t:          0>, nrf_mesh_sdk.c,  131, Ram base: 0x200031B0
 0> <t:         15>, nrf_mesh_sdk.c,  197, Initializing mesh stack
 0> <t:        558>, nrf_mesh_sdk.c,  205, Enabling mesh stack
 0> <t:        564>, main.c,  183, Setting up access layer and models
 < 1
 0> <t:     487100>, main.c,  314, Button 1 pressed
 0> <t:     487102>, main.c,  317, No devices provisioned

So how should I config the clk in the server project if I don't have the LF CLK on my board, please?

Parents
  • I has solved this problem.

    I find this in the server project:

     * @param p_clock_lf_cfg Low frequency clock source and accuracy.
       If NULL the clock will be configured as an RC source with rc_ctiv = 16 and .rc_temp_ctiv = 2
       In the case of XTAL source, the PPM accuracy of the chosen clock source must be greater than 
       or equal to the actual characteristics of your XTAL clock.
     * @param fault_handler Callback to be invoked in case of fault, cannot be NULL.
    

    so I do this changes in this fountion:

    uint32_t softdevice_setup(nrf_clock_lf_cfg_t lfc_cfg, nrf_fault_handler_t assertion_handler)
    {
        #if !defined(HOST)
        if (assertion_handler == NULL)
        {
            assertion_handler = default_softdevice_assertion_handler;
        }
    
        #if defined(S110)
            RETURN_ON_ERROR(sd_softdevice_enable(lfc_cfg, assertion_handler));
        #else
        // RETURN_ON_ERROR(sd_softdevice_enable(&lfc_cfg, assertion_handler));
            RETURN_ON_ERROR(sd_softdevice_enable(NULL, assertion_handler));
        #endif
            RETURN_ON_ERROR(sd_nvic_EnableIRQ(SD_EVT_IRQn));
        #endif
    
        return NRF_SUCCESS;
    }
    

    so, this project has run as respected.

  • According to this case, you should stil be able to configure with RC oscillator without using NULL as the lfc_cfg. Make sure you also configure the rc_ctiv and rc_temp_ctiv.

Reply Children
No Data
Related