AW32 and Unexpected Reset Problem

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

AW32 and Unexpected Reset Problem

1,429 Views
BasePointer
Contributor II
Hi,
 
I have a simple program written in C for AW32. If I allocate 256 bytes for RX and TX buffers, the program reset yourself at the beginning of init_System() function. If I allocate 128 bytes for each, the program works expected. What may cause MCU to reset? I didn't take any warnings or errors when compiling. In the PRM file, I defined STACKSIZE as 0x1FF and using 64bit floating-point support of the compiler. If I remove the line "SOPT = 0;" in init_System() function, it resets a few functions later. I don't use COP, and reset pin of the MCU is stable. I doubt violating some RAM boundary but I don't know how I can check it.
 
Code:
unsigned char RX_Buff[256], TX_Buff[256];void init_System(void){  DisableInterrupts;      SOPT = 0;  // <---------- reset here  // Sets trimming for fbus = 18.432Mhz  ICGTRM = 127;  ...}void main(void){  init_System();  ...  ...}

 
Thanks.
Labels (1)
0 Kudos
3 Replies

294 Views
bigmac
Specialist III
Hello BP,
 
Since the COP is enabled out of reset, it might be possible for the COP to be the cause of your problem, if timeout occurs prior to it being disabled.  Before running the init_System() function, the global variables will normally be initialised.  The time required will depend on the number of bytes to be initialized, and with large arrays for the buffers, it may be possible that the COP timeout period is being exceeded (unless the initialisation code also services the COP timer - I don't know whether it does).
 
You might try with automatic variable initialisation disabled, to see if it makes a difference.  How do you know precisely where, in the code, the reset occurs?  Presumably the reset continuously repeats - what is the period between resets?
 
Regards,
Mac
 
0 Kudos

294 Views
BasePointer
Contributor II
Hi Mac,
 
Thanks for your advices. I looked at SRS register after the reset via BDM and it indicates that the reset was really caused by COP. I added __RESET_WATCHDOG(); immediately main() and the program starts working.
 
Is there any way to tell compiler to reset COP while initializing variables? Or does the initialize routine guarantee that the process always finish within COP period?
 
Thanks,
BP.
0 Kudos

294 Views
Ake
Contributor II
Hello,
The default value of the SOPT register is COPE | COPT| 0x13.
It doesn't say what the 0x13 bits are for, so I would write
SOPT_COPE = 0;
instead of
SOPT = 0;
just to be sure.
 
Then I would use
STACKTOP 0x86f
in the Project.prn instead of
STACKSIZE 0x1ff
to get the largest stack area
 
Well this is just idle thought from an idle mind.
I think that someone else might come with some more clever ideas.
 
Regards,
Ake
 
0 Kudos