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

ble mesh trasmission

hi guys, I'm looking for understand how to send a simple signal using ble mesh between two nrf52840 boards.

The  available example aren't so usefull in order to have the input signal to trasmitt but I need to have a pin interrupt on a gpio port that start trasmission in tx-board ,so in the rx one riceve only the pin-interrupt.

In which way can I set this using the given examples???

some advices?

Thanks a lot for your answers!!!!

I tried to do something like that..using the example on light switch,but obviusly it didn't work..moreover in no way does the board recognize the interrupt input on port 28!!!

 
Parents
  • Hi. 

     

    The  available example aren't so usefull in order to have the input signal to trasmitt but I need to have a pin interrupt on a gpio port that start trasmission in tx-board ,so in the rx one riceve only the pin-interrupt.

     Not sure what you want to do exactly. 

    The examples in the nRF5 SDK for Mesh (Light switch examples) will be in RX-mode for the most of the time, as you might already know. This is because the nodes will be listening for packets from the other mesh nodes. 

    The light swtich example wil, on button press, send an on/off command to turn on/off the light on the server. Is this something that you can re-use for your application?

    If not, I suggest that you take a look at the GPIO and GPIOTE chapter in the product specification. 
    We also have a GPIOTE example in our SDK that you can use as guidance. 

    Best regards, 
    Joakim Jakobsen

  • HI Joakim ,thanks a lot for your answer....but, the problem isn't about the gpio...i used it in other wifi protocol and it was fine. The problem concern the sending of a message with ble mesh. Reading the examples about ble mesh i didin't find the line code i have to use in orther to do : ''ok,now send a message to the other node''!!

    For example , In the case  of light switch example i tried and if i press the button 0 the led 0 turn on...but in case 0 in the code there is a white space..so which is the code that make that possible????

    static void button_event_handler(uint32_t button_number)
    {
    
        __LOG(LOG_SRC_APP, LOG_LEVEL_INFO, "Button %u pressed\n", button_number);
      
        ret_code_t err_code;
        uint32_t status = NRF_SUCCESS;
        generic_onoff_set_params_t set_params;
        model_transition_t transition_params;
        static uint8_t tid = 0;
    
        /* Button 1: On, Button 2: Off, Client[0]
         * Button 2: On, Button 3: Off, Client[1]
         */
    
        switch(button_number)
        {
           ret_code_t err_code;
            case 0:
     
            case 2:
                set_params.on_off = APP_STATE_ON;
                break;
    
            case 1:
            case 3:
                set_params.on_off = APP_STATE_OFF;
                break;
        }
    
        set_params.tid = tid++;
        transition_params.delay_ms = APP_CONFIG_ONOFF_DELAY_MS;
        transition_params.transition_time_ms = APP_CONFIG_ONOFF_TRANSITION_TIME_MS;
        __LOG(LOG_SRC_APP, LOG_LEVEL_INFO, "Sending msg: ONOFF SET %d\n", set_params.on_off);
    
        switch (button_number)
        {
            case 0:
    
    
            case 1:
                /* Demonstrate acknowledged transaction, using 1st client model instance */
                /* In this examples, users will not be blocked if the model is busy */
                (void)access_model_reliable_cancel(m_clients[0].model_handle);
                status = generic_onoff_client_set(&m_clients[0], &set_params, &transition_params);
                hal_led_pin_set(BSP_LED_0, set_params.on_off);
                break;
    
            case 2:
            case 3:
                /* Demonstrate un-acknowledged transaction, using 2nd client model instance */
                status = generic_onoff_client_set_unack(&m_clients[1], &set_params,
                                                        &transition_params, APP_UNACK_MSG_REPEAT_COUNT);
                hal_led_pin_set(BSP_LED_1, set_params.on_off);
                break;
        }
    
        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, "Client %u cannot send\n", button_number);
                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, "Publication not configured for client %u\n", button_number);
                break;
    
            default:
                ERROR_CHECK(status);
                break;
        }
    }

Reply
  • HI Joakim ,thanks a lot for your answer....but, the problem isn't about the gpio...i used it in other wifi protocol and it was fine. The problem concern the sending of a message with ble mesh. Reading the examples about ble mesh i didin't find the line code i have to use in orther to do : ''ok,now send a message to the other node''!!

    For example , In the case  of light switch example i tried and if i press the button 0 the led 0 turn on...but in case 0 in the code there is a white space..so which is the code that make that possible????

    static void button_event_handler(uint32_t button_number)
    {
    
        __LOG(LOG_SRC_APP, LOG_LEVEL_INFO, "Button %u pressed\n", button_number);
      
        ret_code_t err_code;
        uint32_t status = NRF_SUCCESS;
        generic_onoff_set_params_t set_params;
        model_transition_t transition_params;
        static uint8_t tid = 0;
    
        /* Button 1: On, Button 2: Off, Client[0]
         * Button 2: On, Button 3: Off, Client[1]
         */
    
        switch(button_number)
        {
           ret_code_t err_code;
            case 0:
     
            case 2:
                set_params.on_off = APP_STATE_ON;
                break;
    
            case 1:
            case 3:
                set_params.on_off = APP_STATE_OFF;
                break;
        }
    
        set_params.tid = tid++;
        transition_params.delay_ms = APP_CONFIG_ONOFF_DELAY_MS;
        transition_params.transition_time_ms = APP_CONFIG_ONOFF_TRANSITION_TIME_MS;
        __LOG(LOG_SRC_APP, LOG_LEVEL_INFO, "Sending msg: ONOFF SET %d\n", set_params.on_off);
    
        switch (button_number)
        {
            case 0:
    
    
            case 1:
                /* Demonstrate acknowledged transaction, using 1st client model instance */
                /* In this examples, users will not be blocked if the model is busy */
                (void)access_model_reliable_cancel(m_clients[0].model_handle);
                status = generic_onoff_client_set(&m_clients[0], &set_params, &transition_params);
                hal_led_pin_set(BSP_LED_0, set_params.on_off);
                break;
    
            case 2:
            case 3:
                /* Demonstrate un-acknowledged transaction, using 2nd client model instance */
                status = generic_onoff_client_set_unack(&m_clients[1], &set_params,
                                                        &transition_params, APP_UNACK_MSG_REPEAT_COUNT);
                hal_led_pin_set(BSP_LED_1, set_params.on_off);
                break;
        }
    
        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, "Client %u cannot send\n", button_number);
                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, "Publication not configured for client %u\n", button_number);
                break;
    
            default:
                ERROR_CHECK(status);
                break;
        }
    }

Children
Related