Hi @jwjung
I have reviewed your code and noticed that the value sent via CAN is derived from a series of operations based on the value received from the IOR_CalcTemp() function. Could you please verify if the value obtained seems to fluctuate since its calculation?
Additionally, fluctuations in values during a debug session can often be caused by several factors related to the debugging process itself. Some common causes include:
1. Debugger Interference: During debugging, the debugger interacts with the system in real-time, which may alter the normal execution of code, especially if breakpoints, stepping, or real-time monitoring is being used.
2. Debugger-induced Delays: The debugging process introduces delays as the code is paused and controlled by the debugger. These delays can affect the timing of variable updates, leading to fluctuations in their values.
3. Un-synchronized Memory Access: The debugger might access memory or variables while the code is running, which can lead to unpredictable changes in their values during the session.
4. Compiler Optimizations: The compiler may apply optimizations in debugging mode that alter the normal behavior of the system. This can result in discrepancies in the way variables are calculated or updated.
5. Clock or Timing Issues: The clock behavior or timing in the system could be impacted by the debugger, which can affect the consistency of values, especially if the system depends on precise timing or real-time operations.
6. Modification of Control Registers: Debuggers can modify microcontroller registers, potentially altering the normal flow of operations and causing fluctuations in values.
To identify the exact cause, I recommend checking whether the value from IOR_CalcTemp() itself fluctuates when running without the debugger. This will help determine if the issue is related to the debugging environment or the calculation process itself.