AnsweredAssumed Answered

why MCU reset after execute the code?

Question asked by Allen Huang on Sep 21, 2017
Latest reply on Sep 25, 2017 by Mark Butcher

Dear Sir,

I have simulated the below code in IAR.

And it worked!

But I run this code in real KE02.

this code will cause KE02 reset.

could you help find out root cause?

 

I have changed the macro as below. this macro worked normally.

#define Set16Int(p,d)        *(p)=d&0xff; *(p+1)=d>>8

 

====================================================

#define Get16Int(p) *((uint16*)(p))
#define Set16Int(p,d) *((uint16*)(p)) = d

uint16 u16gT=0;

uint8 u8gRxBuff[16];

 

u8gRxBuff[0]=0x12;

u8gRxBuff[1]=0x34;

u16gT = Get16Int(u8gRxBuff);

 

u16gT=0x1234;

Set16Int(u8gRxBuff,u16gT);

 

 

 

 

 

Outcomes