I currently observed a phenomenon which I could I observe several times before and I would like to know the reason for this.
I have a function that returns a byte value which was read from SPI interface.
When I debug, inside of the function the return value is what I would expect it to be (in this case 0x25) but when I step further and exit the function, the value that was assigned to the external variable is different (0x09).
How is this possible? What can I do to prevent this from happening? Is this a debug only problem or will this also happen during in runtime?
I will run some more tests to gather some more info, but maybe someone can already tell what the cause for this behaviour is.
Solved! Go to Solution.
Without seeing a project which can reproduce the problem, we can only guess.
Currently, my best bet is
defining the external variable which receives the return value as "volatile" may fix the problem.