This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts
This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Equation result is not as expected

Hello,

there is an equation in the code where I see that variable: deviceid is: 229 and var_temp is also: 229.

But the debugging shows that the Mikrocontroller is going into this if-case. I cant understand why. Both variables are uint8_t and have the same value.

  • I am using Segger-Embedded-Studio V3.30.
  • I am using SEGGER EDU
  • I am using NRF52832

I have downloaded the code into Mikrocontroller several times. So I am shure that the code in the mikrocontroller is the same code as I see in the Embedded-Studio IDE.

if (deviceid != var_temp)
{
  ret_eok |= ERROR_BIT_0;
}

Do you have any ideas what is going wrong?

Parents
  • fairly obvious guess is that you've enabled the TWIM in non-blocking mode giving it a callback however you're using it as if it were in blocking mode in that code expecting the data to be available as soon as the twim rx call completes.

    That also explains why the debugger shows the values equal because, by the time you get to look at them in the debugger, the data has been transferred.

    If you want blocking mode then use that, if you want callback mode, put your code in the callback.

  • please go and read the documentation on the twi handler you're using, it's very comprehensive and will tell you all about how to initialize the driver in blocking as opposed to non-blocking mode.

Reply Children
No Data
Related