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

nRF5 SDK for Mesh v3.0.0 PERSISTENT_STORAGE Macro Enable Create issue.

Hii,

I'm using Nordic nRF5 SDK for Mesh v3.0.0 Example Code in LIGHT SW Provisioner Example i got Error code please healp me how to solve.

In Case Of

 #define PERSISTENT_STORAGE 1

if  #define PERSISTENT_STORAGE 0 then works well. i want to store server and client data in stack so please help me out of it.

Regards,

-Nikunj

Parents Reply
  • Ok. Can you try to download the mesh SDK (3.0.0) and the normal SDK (15.2.0), unzip them in the same folder, and compile it without any changes (PERSISTENT_STORAGE = 1). Can you also make sure that you erase the entire chip before programming it? It may be some leftover data stored in flash from another application.

    use "nrfjprog -e" in a cmd terminal window (PS: you need to install Nordic Command Line Tools first).

    Best regards,

    Edvin

Children
  • Thanks its work well ..

    i want to send string like 10 byte using ble mesh is it possible..?

  • Edvin

    Thanks .but i have one  query , I'm using LIGHT SWITCH Example code.i want to send LIGHT ON/OFF Command Every 5 Second base on timer interpret instead of button pressed. In this scenario code stuck.

    Best Regards,

    Nikunj

  • Hello Nikunj,

    Have you tried to set up the timer? Does it trigger? I am not sure where the code is stuck without some more details.

  • void msg_send_to_server()
    {
         uint8_t Data_Buff[50] ="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwx";
    
        uint32_t status = NRF_SUCCESS;
        generic_onoff_set_params_t set_params;
        model_transition_t transition_params;
        static uint8_t tid = 0;
    
        memcpy(set_params.on_off,Data_Buff,sizeof(Data_Buff));
     
        set_params.tid = tid++;
        transition_params.delay_ms = APP_CONFIG_ONOFF_DELAY_MS;//50MS
        transition_params.transition_time_ms = APP_CONFIG_ONOFF_TRANSITION_TIME_MS;//100MS
       
    
    
        status = generic_onoff_client_set(&m_clients[0], &set_params, &transition_params);
        if(status==0)
        {
          __LOG(LOG_SRC_APP, LOG_LEVEL_INFO,"\nClient Send:%s  LEN:%d\r\n",set_params.on_off,sizeof(Data_Buff));
        }
       
    //    status = generic_onoff_client_set_unack(&m_clients[0], &set_params,&transition_params, 0);//APP_UNACK_MSG_REPEAT_COUNT
    //    if(status==0)
    //    {
    //      __LOG(LOG_SRC_APP, LOG_LEVEL_INFO,"\nClient Send:%s  LEN:%d\r\n",set_params.on_off,sizeof(Data_Buff));
    //    }
    
    
        switch (status)
        {
            case NRF_SUCCESS:
                break;
    
            case NRF_ERROR_NO_MEM:
            case NRF_ERROR_BUSY:
            case NRF_ERROR_INVALID_STATE:
                __LOG(LOG_SRC_APP, LOG_LEVEL_INFO, "\nClient %u cannot send\r\n");
                hal_led_blink_ms(LEDS_MASK, LED_BLINK_SHORT_INTERVAL_MS, LED_BLINK_CNT_NO_REPLY);
                break;
    
            case NRF_ERROR_INVALID_PARAM:
                /* Publication not enabled for this client. One (or more) of the following is wrong:
                 * - An application key is missing, or there is no application key bound to the model
                 * - The client does not have its publication state set
                 *
                 * It is the provisioner that adds an application key, binds it to the model and sets
                 * the model's publication state.
                 */
                __LOG(LOG_SRC_APP, LOG_LEVEL_INFO, "\n Publication not configured for client %u\r\n");
                break;
    
            default:
                ERROR_CHECK(status);
                break;
        }
    
       //hal_led_blink_ms(1 << BSP_LED_3, LED_BLINK_INTERVAL_MS, 1);
    
    }
    
    
    
    
    APP_TIMER_DEF(m_temp_timer);
    uint8_t sec_2 =0;
    static void temp_handler(void * p_context)
    {
      UNUSED_VARIABLE(p_context);
      sec_2=1;
    }
    
    static void initialize(void)
    {
    
          uart_init();
    
        __LOG_INIT(LOG_SRC_APP | LOG_SRC_ACCESS | LOG_SRC_BEARER, LOG_LEVEL_INFO, LOG_CALLBACK_DEFAULT);
        __LOG(LOG_SRC_APP, LOG_LEVEL_INFO,"\n----- BLE Mesh Light Switch Client Demo -----\r\n");
    
      
    
        ERROR_CHECK(app_timer_init());
        hal_leds_init();
    
    #if BUTTON_BOARD
        ERROR_CHECK(hal_buttons_init(button_event_handler));
    #endif
    
        ble_stack_init();
    
    #if MESH_FEATURE_GATT_ENABLED
        gap_params_init();
        conn_params_init();
    #endif
        mesh_init();
        
    
       ERROR_CHECK(app_timer_create(&m_temp_timer, APP_TIMER_MODE_REPEATED, temp_handler));
       ERROR_CHECK(app_timer_start(m_temp_timer, MAX(APP_TIMER_MIN_TIMEOUT_TICKS, HAL_MS_TO_RTC_TICKS(2000)), NULL));
    
    }
    
    
    int main(void)
    
    {
      
       initialize();
        start();
    
        for (;;)
        {
    
           if(sec_2)
           {
             msg_send_to_server();
             //__LOG(LOG_SRC_APP, LOG_LEVEL_INFO,"\n----- 2Second Timer Run-----\r\n");
             sec_2=0;
           }
    
    
        
            (void)sd_app_evt_wait();
        }
    
    
    
    }
     
    
    

    Got an Error below

    If i send command on Button press and only print timer line every 2 sec working ok but when i send command every 2 sec (single Byte oR bool data ) code is stuck.

    Thanks,

    Nikunj

Related