Topic

FAQ
Login Register
Zigbee BLE concurent SDK - gateway restart
Jan 03, 2023 12:18

/

A

/A

I have noticed that from time to time my gateway restarts (I guess after a crash/exception).

Is there a way to find out what causes the restart? Where the exception occurs?


5 replies
TL_Soyo Jan 05, 2023 14:05
0
/A

Hi,

  The reboot casuse reason may you Called SYSTEM_RESET() or PC point run to wrong place,you can try search SYSTEM_RESET in SDK and add some logs.

wes58 [Author] Jan 06, 2023 06:17
0
/A

Thanks Soyo,

There is not a lot of information in the SDK documentation.

What I found is, that I can use T_evtExcept[]:

Volatile u16 T_debug_except_code = 0;


static void sampleLightSysException(void){
   T_debug_except_code = T_evtExcept[1];
   while(1)//or SYSTEM_RESET();
}


In the ev.c file I found:

volatile u16 T_evtExcept[4] = {0};
u8 sys_exceptionPost(u16 line, u8 evt)
{
   T_evtExcept[0] = line;
   T_evtExcept[1] = evt;
   /* TODO: some information stored in NV */
   if(g_sysExceptCallbak){
     g_sysExceptCallbak();
   }
   return 0;
}


1. As you can see in this function: /* TODO: some information stored in NV */ - will this TODO be ever done?


2. What is line in T_evtExcept[0] = line?


If I do something like this:

_attribute_data_retention_ u16 T_debug_except_code;

_attribute_data_retention_ u16 T_debug_except_line;


static void PowerBrdtSysException(void){
   T_debug_except_code = T_evtExcept[1];

   T_debug_except_line = T_evtExcept[0];
   SYSTEM_RESET();

//  while(1)
}


3. Will the values in  T_debug_except_line and  T_debug_except_code be saved or will they be cleared after SYSTEM_RESET()?

wes58 [Author] Jan 06, 2023 13:43
0
/A

As I wrote above, in the SDK documentation there is:

Volatile u16 T_debug_except_code = 0;

static void sampleLightSysException(void){

 T_debug_except_code = T_evtExcept[1];

 while(1)//or SYSTEM_RESET();

}


But this doesn t compile because T_evtExcept is not defined - it is a local variable in function u8 sys_exceptionPost(u16 line, u8 evt) (in ev.c).

In this function, it calls g_sysExceptCallbak(); which doesn t have any parameters. So how is the T_evtExcept[] transfered in the g_sysExceptCallbak()?


TL_Soyo Jan 06, 2023 14:08
0
/A

1、the TODO need you to implement.

2、the line is the location of the exception code

3、if call SYSTEM_RESET() ,the information will lose,so modify SYSTEM_RESET() to while(1) or some else.
4、use extern or you can modify the call back structuer of typedef void (*sys_exception_cb_t)(void);


wes58 [Author] Jan 06, 2023 15:06
0
/A

1. This is in the file that is part of the SDK. If I modify it, I will have to remember when the SDK is updated - like I did in many other files. It is hard to keep track of the changes!

4. That's what I did before I saw your post. But it is the same as point #1 - I modify the SDK file for one project, so it will affect all other examples in the app folder - callback function in other examples won't have extra parameters.