Part Number: TMS320F28235
Tool/software: TI C/C++ Compiler
Hi,
In customer's code, they faced one issue on a global parameter, which is used by both main loop and ISR, but not volatile.
They found that, very few times, the parameter value couldn't be changed by ISR successfully. The value may be covered by main loop instruction.
They did a test. The details are:
1) In the main loop, the code continuesly writing the parameter with a value: gMainStatus.ErrorCode &= ~ERR_24VVTG_LOW (macro defined).
2) In the ISR, gMainStatus.ErrorCode |= ERR_24VVTG_LOW.
ISR is triggered frequently. Few times, after ISR (gMainStatus.ErrorCode |= ERR_24VVTG_LOW), before a new assignment in main loop (gMainStatus.ErrorCode &= ~ERR_24VVTG_LOW), gMainStatus.ErrorCode was still the value from mian loop (gMainStatus.ErrorCode &= ~ERR_24VVTG_LOW), but not the one from ISR.
From disassembly side, we'd like to know if it's possible.
Here's the disassembly. 0xbd50 is the address of the struct. #8 is the offset of ErrorCode.
We don't understand the code in 00a7fc. If it's just one cycle instruction, that ussue may not happen. As, if during main loop instruction gMainStatus.ErrorCode &= ~ERR_24VVTG_LOW, ISR happens, gMainStatus.ErrorCode's values is changed. If there's no restore after ISR, the issue may not happen.
Thanks a lot.
Br, Jordan