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 Children
  • 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

  • Hello,

    Since this is not the same topic as your original question, I suggest that you create a new ticket. I will try to help you in this answer, but if you are still stuck, then post your issue in a new ticket.

    This is the assertion handler. 

    Can you check the status value of your different calls? E.g. status = generic_onoff_client_set(). What is status after this line is executed?

    It may also be your ERROR_CHECK(app_timer_create()) or ERROR_CHECK(app_timer_start()). Try to do:

    ret_code_t err_code;

    err_code = app_timer_create();

    ERROR_CHECK(err_code);

    err_code = app_timer_start());

    APP_ERROR_CHECK(err_code); 

    and check the err_code after the application calls, and before the APP_ERROR_CHECK();

    Try to debug, and figure out what you are adding that causes the problem to crash. You say that it is when you try to "send command" I am not sure how you do this, but it is probably related to this.

Related