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

Add Timer Schedule in Mesh Main

Hi 

I am doing a mesh application with :

      --SOC:52832;

      --with an AT Command Module connected  UART;

      --Mesh SDK :3.2;

      --SDK 15.3;

in order to manage call backs from AT Command Module, I add Schedule in mesh, to protect a timer watching  UART;

Simple codes here :

BEFORE MAIN:

     #define SCHED_MAX_EVENT_DATA_SIZE       APP_TIMER_SCHED_EVENT_DATA_SIZE    //define two parameters for schedule

    void one_net_timer_init(void);  //declare timer 

static void scheduler_init(void)
{
APP_SCHED_INIT(SCHED_MAX_EVENT_DATA_SIZE, SCHED_QUEUE_SIZE);
}

static void idle_state_handle(void)
{
app_sched_execute();
}

IN MAIN:

one_net_timer_init();   //initiate the timer watching UART
scheduler_init();

for (;;)
{
   idle_state_handle();     //take care timer event;
  (void)sd_app_evt_wait();
}

 IN APPLICATION FILE:

APP_TIMER_DEF(one_net_timer);    //define timer

void one_net_timer_handler(void * p_context)     //timer handle
{
UNUSED_PARAMETER(p_context);
if(m_onenet_initiated){
at_uart_handle_URL(uart_rx_data);   //this is the function to checke UART call backs
}
}
void one_net_timer_init(void)       //Initiate timer
{
ret_code_t err_code;
err_code = app_timer_create(&one_net_timer,APP_TIMER_MODE_REPEATED, one_net_timer_handler);
APP_ERROR_CHECK(err_code);
err_code = app_timer_start(one_net_timer, APP_TIMER_TICKS(5000), NULL);
APP_ERROR_CHECK(err_code);
}

  PROBLEM:

  Operation went well, but after a while, when program is waiting call backs,  came out an error: Mesh Error 1, or Mesh Error 4, at 0x000000000;

 I am sure it is not with : at_uart_handle_URL(uart_rx_data);  in first two or three minutes, call backs handled properly. Error came in waiting period.

 Does mesh exist with Schedule in SDK 15.3 ?

Thanks

Brent

  

Parents Reply Children
No Data
Related