Part Number: TMS320F280049
Hi,
We observed a strange behavior in the execution of the below code during casting from 16 bit to 32 bit, the code is snippet from a larger project, we were able to emulate the issue on a evaluation board
The ADC results are subtracted to remove the DC offset. As the ADC registers are unsigned integer (16bit) if we use all 16 bit variables including the result being store in 16 bit signed variable the code is executing fine. When we cast the result from 16bit to 32bit signed (i32Present ), we see strange behavior where the result shows as -6553x or 6553x, we were unable to put a watchpoint or breakpoint as it is randomly shown in the watch window, nor we could put a condition in the code to capture it. We are assuming the behavior is purely due to the JTAG and IDE interface. We could share the eval code for testing the same. The code is tested on LaunchXl-F2800049C
We did look at the assembly level code, it looks fine. As it is random for some values
int16_t i16Present;
int16_t i16Prev;
int16_t gi16ADC_temp;
int32_t i16Present;
gi16ADC_temp = (AdccResultRegs.ADCRESULT0); // storing the result from ADC 0 -- Sine Wave
i16Prev = (AdccResultRegs.ADCRESULT1); // Storing the result from ADC 1 -- DC Offset
i16Present = (gi16ADC_temp - i16Prev); // REmoving the Offset, expected negative value
i32Present = (int32_t)i16Present; // Type casting to 32 bit integer
Regards,
Murugavelu
