I'm trying to fill an array in xdata with zeros as follows:
unsigned char n; //Index to scan the array unsigned char xdata bt[100]; //The array to fill
for(n=0;n<100;n++){ bt[n]=0; }
But when the array size is bigger than 38 elements the MCU hangs. Does anybody know the reason why this happens?
look in the .map file, how much xdata?
Hi Erik! thanks for your reply. Below the Memory map: TYPE BASE LENGTH RELOCATION SEGMENT NAME ----------------------------------------------------- * * * * * * * D A T A M E M O R Y * * * * * * * REG 0000H 0008H ABSOLUTE "REG BANK 0" REG 0008H 0008H ABSOLUTE "REG BANK 1" DATA 0010H 0002H UNIT ?DT?_WAIT?SMARTNODE 0012H 000EH *** GAP *** BIT 0020H.0 0002H.4 UNIT ?BI?SMARTNODE BIT 0022H.4 0001H.1 UNIT _BIT_GROUP_ BIT 0023H.5 0000H.1 UNIT ?BI?_UART_SEND_COMMAND?SMARTNODE 0023H.6 0000H.2 *** GAP *** DATA 0024H 001DH UNIT ?DT?SMARTNODE DATA 0041H 0015H UNIT _DATA_GROUP_ IDATA 0056H 0001H UNIT ?STACK * * * * * * * X D A T A M E M O R Y * * * * * * * XDATA 0000H 03F0H UNIT ?XD?SMARTNODE XDATA 03F0H 0065H UNIT _XDATA_GROUP_ As I was wondering if the problem was caused by WDT I also disabled the WDT at the very beginning of the main with PCA0MD &= ~0x40; but it doesn't help
XDATA 0000H 03F0H UNIT ?XD?SMARTNODE
you have used the XDATA up
Yeah, you're right but this was not the problem, or was not the root cause.
When the MCU start I create the variables in xdata memory, well.
I'm not able to write in this blog messages thatb are bigger than 1 row. Incredible I I do I get Error 500 (Internal Server Error), So I will post several messages.
I'm unable to post any further message...
When I create such a big arrays into xdata the system takes to long and WDT expires causing a CPU reset. Obviously the first thing I do in main() is to disable the WDT but it's too late. So it looks like despite I've got 2k of RAM I cannot use this memory for global arrays that are bigger than 20bytes, as I I do that the WDT will reset the MCU. Does anybody know how can I avoid WDT operation to take place before I got the control into the main()? Is it possible that Silab made such a beautiful memory bank but it's impossible to use for such a thing?
It is possible to create longer messages on this forum - and notice it's a forum and not a blog.
The issue is that there have been lots of spam issues. And for some reason, the word w_a_t_c_h_d_o_g just happens to trig their spam filter, giving you the error messages you are seeing. Or you might have accidentally found some other trigger word.
I think this was one of several threads where I did try to warn about the w-dog issues but wasn't allowed to post.
View all questions in Keil forum