Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

PSoC™ 4

Level 2
25 sign-ins 10 sign-ins 5 replies posted
Level 2


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.


1 Solution
Level 9
First comment on KBA 1000 replies posted 750 replies posted
Level 9


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.


View solution in original post

1 Reply