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.

Compiler/TMS320F28062: Toggleing Pins is not working

Part Number: TMS320F28062


Tool/software: TI C/C++ Compiler

Hello,

Again I have a really weird behavior of the f28062. When I have the following while loop 

while(1){

GpioDataRegs.GPADAT.bit.GPIO6 = 1; GpioDataRegs.GPADAT.bit.GPIO7 = 0;

GpioDataRegs.GPADAT.bit.GPIO6 = 0; GpioDataRegs.GPADAT.bit.GPIO7 = 1;

GpioDataRegs.GPADAT.bit.GPIO6 = 0; GpioDataRegs.GPADAT.bit.GPIO7 = 0;

}

at the end of the loop I would expect GPIO7 to be LOW, but it isn`t. At the end it is still HIGH (No I didn`t set the Breakpoint to the wrong location, the breakpoint is in the first line)

So the code stops at the first line, I hit the "Run" button, the debugger stops at the first line again and GPIO7 is still HIGH. I ca see it in the registers and also on the oscilloscope.

BUT if I step through the code line by line it is working fine.. Why?

It is not only this, if I don`t set any breakpoints and let the code run, I can see that while GPIO6 is toggleing like 1000000 Times, GPIO7 is always HIGH and only goes LOW once in a while.

When I write this code

while(1){

GpioDataRegs.GPADAT.bit.GPIO7 = 1;

GpioDataRegs.GPADAT.bit.GPIO7 = 0;

}

GPIO7 toggles like it should.

So I thought, ok then I will try a different way by using GPATOGGLE. Here is the code:


while(1){ GpioDataRegs.GPATOGGLE.all = 6; }

Here I would expect GPIO6 to toggle between HIGH an LOW but it is doing nothing. The toggle register is 0 and the corresponding bit in GPADAT also stays on 0.


What am I doing wrong?

EDIT

Optimizations are turned off completely