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

PSoC™ 4

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

Hello,

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.

Thanks

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

Hi,

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.

moto

View solution in original post

1 Reply
MotooTanaka
Level 9
First comment on KBA 1000 replies posted 750 replies posted
Level 9

Hi,

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.

moto