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

I am using nRF52832 board to un provision the device using the button from the hardware.how to configure this

I am using nRF52832 board to un provision the device using the button from the hardware.how to configure this

Parents Reply Children
  • In sample example of nrf52 for light switch server handled for RTT pressing button4 from serial terminal it is getting unprovisioned.I need to unprovision by pressing the button on the hardware manually.How to give input via button instead of RTT.plz suggest your answer

  • Hi,

    Please don't click Verify Answer if it's not a solution for your problem. 

    If you have a look at the code inside app_rtt_input_handler() to handle RTT input, you can find that it in turn will call button_event_handler(). So in the light switch or light_lc example if you press button 4 on the board, it's the same as when you input '4' in RTT. Both of them will end up executing this code:

            case 4:
            {
                /* Clear all the states to reset the node. */
                if (mesh_stack_is_device_provisioned())
                {
    #if MESH_FEATURE_GATT_PROXY_ENABLED
                    (void) proxy_stop();
    #endif
                    mesh_stack_config_clear();
                    node_reset();
                }
                else
                {
                    __LOG(LOG_SRC_APP, LOG_LEVEL_INFO, "The device is unprovisioned. Resetting has no effect.\n");
                }
                break;
            }

    So I'm not sure why you don't get the same effect when you press button 4 on your board, what's the issue here ? 

  • Hi,

    yes i found this,my issue is how to call the button event handler inorder to give input from the board

  • Ok, so you based your application on  light_lc example. And in that example the buttons are not handled.

    You would need to have a look into the light switch server example. In that example we include the simple_hal.c module to handle the buttons. Note that we don't use nrfx_gpio in that example but use simple_hal.c instead. 
    You need to include simple_hal.c to your project just like in the light switch example. 
    Then you need to call ERROR_CHECK(hal_buttons_init(button_event_handler)); inside intialize() function. 
    Please refer to the code inside light switch server example. 

  • In samplehal.c they handled it only for rtt not for the button from the board.

Related