strange problem in global variable on atsamg53

Go To Last Post
2 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hi

Today I encountered a very strange problem. Define a global variable array data [4] = {4, 4, 4, 4}, and then read and write the array in the program. If you write the global variable with data [i] = Val, and then read the global variable TMP = data [i], it is found that the value of the global variable does change after executing the data [i] = Val statement. If you keep reading TMP = data [i], the value of TMP starts to be Val, but in a few seconds, the value of TMP becomes the initial value 4 of data [i], These seconds are sometimes as short as 1 second and as long as 10 seconds. This program is a bare metal program. There is no other place to modify this variable. Trying to add stack can't solve it. Any guy has encountered the same problem?

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

What else is the program doing?

Show a minimal example program that exhibits this problem...

David