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

UART implementation in light_switch_server and sending uart data over mesh

Hi I am using BLE Mesh V4.0 and Stack V 16.0.0

I have included UART functionality in light switch server code to interface a sensor.Now upon receiving 5 bytes from UART I want to publish that data over mesh to client node.

But as soon as I send 5 bytes from UART I receive below error in attachment.Please help.

Note : Where as if I call app_onoff_status_publish2(&m_onoff_server_0)  from button_event_handler it does work.But I don't want dependency of button.

void uart_event_handle(app_uart_evt_t * p_event)
{
  static uint8_t data_array[244];
  static uint8_t index = 0;
  uint32_t       err_code;
  
    switch (p_event->evt_type)
    {
        case APP_UART_DATA_READY:
            UNUSED_VARIABLE(app_uart_get(&data_array[index]));
            index++; 
            __LOG(LOG_SRC_APP, LOG_LEVEL_INFO, "--index=%d-----\n",index);
            break;
    }
    if(index==5)
     {
     app_onoff_status_publish(&m_onoff_server_0);
     index=0;
     }
}

Parents
  • Hi,

    app_onoff_status_publish2(&m_onoff_server_0)

    Is this a custom function (if so what does it look like), or is the "2" in the function name a spelling error? Are you using the unchanged app_onoff_status_publish() from examples/common/src/app_onoff.c, or have you changed it? (If changed, what does it look like?)

    I suspect this may have to do with what interrupt priority level the code is running from, when you call app_onoff_status_publish(). From what interrupt priority level does the uart event handler run? See more here: Setting interrupt priority levels.

    Regards,
    Terje

Reply
  • Hi,

    app_onoff_status_publish2(&m_onoff_server_0)

    Is this a custom function (if so what does it look like), or is the "2" in the function name a spelling error? Are you using the unchanged app_onoff_status_publish() from examples/common/src/app_onoff.c, or have you changed it? (If changed, what does it look like?)

    I suspect this may have to do with what interrupt priority level the code is running from, when you call app_onoff_status_publish(). From what interrupt priority level does the uart event handler run? See more here: Setting interrupt priority levels.

    Regards,
    Terje

Children
No Data
Related