AnsweredAssumed Answered

MC9S08DZ32 - local variable allocation causing reset problem

Question asked by Szymon Mroczek on Jan 31, 2011
Latest reply on Nov 8, 2011 by Szymon Mroczek

Hi All,


While working with MC9S08DZ32 unit I found some strange issue.


Have a look at the function causing the problem:



U8 eepromSaveAll(EEPROM_DATA_BLOCK * paramBlock,EEPROM_TAddress epp_address){     U8 status;     U8 i = 0;     U8 size = sizeof(EEPROM_DATA_BLOCK);     byte Array[sizeof(EEPROM_DATA_BLOCK)];     (void)memcpy(Array,paramBlock,sizeof(EEPROM_DATA_BLOCK));     while(size)     {         status = EEPROM_SetByte(epp_address++,Array[i]);         size--;         i++;     }     return status;


It is causing heavy instability of the system. Every call or every second call causes device reset.

Interesting thing is that when Array array is declared with static the problem disappears:



static byte Array[sizeof(EEPROM_DATA_BLOCK)];


I have had no time to investigate that more deeply. Problem is solved but curosity remains :smileywink:



Any ideas?