This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

TMS320F280039C: variable unexpected changed issue

Part Number: TMS320F280039C

Tool/software:

We find one union variable be unexpected changed when software running.

Phenomenon

tPFC_Ctrl.Bit.OnOff is defined in CpuToCla1MsgRAM and will be unexpected changed.The code do not assignment 0 to tPFC_Ctrl.Bit.OnOff but it will be changed high speed to 0 and then recover to 1.

We use GPIO to observe tPFC_Ctrl.Bit.OnOff, it will changed irregular and every time it will recover in 20us.

The question

For this issue ,we find two way to solve.

1.close the compiler optimization(from 3 -> off).

2.use volatile keyword to define tPFC_Ctrl.

So the question are

1.why compiler optimization will let this issue happen?

2.How to use compiler optimization level to avoid this kind problem.

The other try

1.we try to redefine  tPFC_Ctrl in Cla1ToCpuMsgRAM, the issue disappear. It means only CPU will let the issue happen not CLA.

2.we use const keyword to define tPFC_Ctrl, can only use pointer to access  tPFC_Ctrl, the issue still exist.