Hello,
During the integration of our product, using a TMS320F28027 MCU, I encountered a bug, using the TI function _IQdiv.
When loading the program in FLASH and using it without rebooting the MCU, it works fine.
The problem occures when, after loading the program in the MCU FLASH, the device is shut down and restarted. When calling an _IQdiv function, an ILLEGAL_ISR occures during the execution of this function. If the _IQdiv function is called before the initialization of the PIE, the program goes in a trap function.
I have reproduced the problem on a TI experimenter's kit + TMS320F28027 control card, with a simplified program. The program is as follows, and only uses the IQMathLib.h, IQmath.lib, 28027_FLASH_lnk.cmd, DSP2802x_Headers_nonBIOS.cmd files available with controlsuite, and a target configuration file (xds100v1, TMS320F28027)
To reproduce the problem, compile and load the program on a TMS320F28027 target, power it down without terminating the debug session, power it up again, reconnect CCS to the target, reset and restart the program, and run it. The program should end up in a trap.
Hoping someone has a solution to this problem,
Best regards,
Adrien Thurin
The program for the bug reproduction :
#define MATH_TYPE IQ_MATH
#define GLOBAL_Q 17
#include "IQmathLib.h"
void main(void)
{
int i = 0;
_IQdiv(_IQ(.0), _IQ(4096.0));
for(;;)
{
i++;
i &= 127;
}
}