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

mesk SDK 2.2.0 example light_switch_proxy_server publish issue

HI, team.

I use two nrf52840 PDK run the example light switch, light switch proxy server and client.

for the light witch proxy client, when press button 0 it will call app_onoff_status_publish() to send msg to server board and set or clear the LED of server board.

but what can I do if I want send message to server board? Could I just call the function app_onoff_status_publish ()?

I try to call app_onoff_status_publish() at main() like:

while(1)
{
    nrf_delay_ms(5000);
    button_event_handler(0);
}
 provisioned and set publish address,  after reset ,5 seconds later the Error occurred.

app_error_weak.c,   95, Mesh assert at 0x0002AD0A (:0)

it seem that NRF_MESH_ASSERT_DEBUG(bearer_event_in_correct_irq_priority()) at timer_scheduler.c line 213.

But if I press the button 0 before 5 seconds , without reset , there is not error occurred .

I still can not figure it out.

Parents
  • Hi Enzo,

    To send a message from the server board to the client board you need to implement both the client and server model. We have an example on Github which sets a light switch client server proxy here https://github.com/NordicPlayground/nrf52-mesh-light-switch-client-server-proxy

    Follow the step by step guide in the Mesh Hands-on pdf and see if that works for you.

    Best Regards,

    Marjeris

  • Hi msromero,

    Thanks for your reply.

    I've already run this example and it works fine.

    I made some changes.

    To implement UART model I add uart_init() and uart_event_handle() to project.

    static void uart_init(void)
    {
        uint32_t                     err_code;
        app_uart_comm_params_t const comm_params =
        {
            .rx_pin_no    = RX_PIN_NUMBER,
            .tx_pin_no    = TX_PIN_NUMBER,
            .rts_pin_no   = RTS_PIN_NUMBER,
            .cts_pin_no   = CTS_PIN_NUMBER,
            .flow_control = APP_UART_FLOW_CONTROL_DISABLED,
            .use_parity   = false,
    #if defined (UART_PRESENT)
            .baud_rate    = NRF_UART_BAUDRATE_115200
    #else
            .baud_rate    = NRF_UARTE_BAUDRATE_115200
    #endif
        };
    
        APP_UART_FIFO_INIT(&comm_params,
                           UART_RX_BUF_SIZE,
                           UART_TX_BUF_SIZE,
                           uart_event_handle,
                         APP_IRQ_PRIORITY_HIGH,//  APP_IRQ_PRIORITY_LOWEST,
                           err_code);
        APP_ERROR_CHECK(err_code);
    }

    void uart_event_handle(app_uart_evt_t * p_event)
    {
        static uint8_t data_array[UART_DATA_LEN_MAX];
        static uint8_t index = 0;
        uint32_t       err_code;
    
        switch (p_event->evt_type)
        {
            case APP_UART_DATA_READY:
    
                ........
    
                      user_readyToPublishTag=1;
        
                ........
    
                break;
    
            case APP_UART_COMMUNICATION_ERROR:
                APP_ERROR_HANDLER(p_event->data.error_communication);
                break;
    
            case APP_UART_FIFO_ERROR:
                APP_ERROR_HANDLER(p_event->data.error_code);
                break;
    
            default:
                break;
        }
    }

    Then add uart_init() to mian(),When the program is running the UART works fine.

    My purpose is when I get UART data I can call generic_on_off_client_set_unreliable() to set or reset LED.

    Then I add this code to mian()

    if(user_readyToPublishTag==1)
    {
      m_on_off_button_flag=!m_on_off_button_flag; 
      generic_on_off_client_set_unreliable(&m_client,
                                                 m_on_off_button_flag,
                                                GROUP_MSG_REPEAT_COUNT);
      user_readyToPublishTag=0;
    }

    So here's the process when I get UART data the value user_readyToPublishTag will be set and then in the main() the function generic_on_off_client_set_unreliable() will be called.

    But I found the same errror with this question I post.

    after every thing is configured.

    I power off the PDK board.Then power it on.If I get UART data first and call generic_on_off_client_set_unreliable(). Then I get this error. But if I press button 0 first ,generic_on_off_client_set_unreliable() will be called at button_event_handler(). there is no error. And then whenever I get UART data there's no error.

    My English is not good, I hope you can understand me

Reply Children
No Data
Related