This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

TM4C129 erroneous data on beginning of large array

Other Parts Discussed in Thread: TM4C129ENCZAD

I need to flash external memory chip via I2C with TM4C129ENCZAD MCU but there seem to be some really weird behavior while working with large arrays. I have a separate file which contains the firmware as an array which have circa 30500 unsigned char (or uint8_t) elements. However when I read this variable I get 0x87, 0xD5, 0x00, 0x00 over and over again in a loop. After 243 elements I finally get what I have on my array, but the beginning of the firmware is corrupted (or what should I call this behavior) and therefore my external chip cannot work properly.


What is even more strange is that if I change my datatype to unsigned short (or uint16_t) only 122 first element is garbage and the rest of the file is fine. Again if I change datatype to unsigned int (or uint32_t) only 61 elements are corrupted. Finally with unsigned long long (uint64_t) datatype only 30 elements from the beginning is nonsense data. I can't understand why it is like that.

I have "fixed" this by adding myself some garbage at the beginning of the file and then I just start to read that file with an offset, thus skipping the problematic data at the beginning. However, when I read the data from memory to verify it, I get again about 260 elements of garbage and after that I start to get correct data. I can't figure it out where that garbage comes from because I have verified with debugger that it writes correct data with my "offset hack" in place. Any thoughts what could cause this?