Other Parts Discussed in Thread: FLOWESI-GUI,
Hi everyone,
I am suffering a lot of bugs and problems with the code generated by FLOWESI-GUI.
I have just notice that my MSP430FR5989 fails when I increase the temperature from 25ºC to 48-53ºC. The ESI stops counting correctly. If I down the temperature to around 45 ºC the ESI starts working again.
My suspicious are that the auto calibration is not working properly due to the fact I am printing the registers: ESIDAC1R0-ESIDAC1R1 and ESIDAC1R2-ESIDAC1R3, and they have never changed during the process of increasing the temperature from 25ºC to 48-53ºC. Therefore, I was reviewing the code and I have realized that the code in charge of updating these registers is not working.
This is the part of the flowchart I am talking about:
In the file: esiCalibration.c I have found the part of the code is in charge of calculating the drift. This function ReCalScanIF() in the line 639:
...
void ReCalScanIF(void){ int16_t newLevel, delta; uint16_t loopCounter = 0; ... if (gRecalFlag&VALID_RECALIBRATION) { if(gRecalFlag&PERIODIC_AFE2_RECALIBRATION) { afe2MaxDACCH0 /= 4; afe2MinDACCH0 /= 4;
But this function ReCalScanIF() is executed in the main.c in the line 330:
...
void serviceInterrupts(void){
TARGET_COMM_checkForReceivedPacket();
if(gCommFlags & START_CONFIG_ESI_MODULE){
esiConfig();
startTimer();
}
if(gCommFlags & COMM_CAL_DONE){
if(gCommFlags & FLUSH_COUNTER_REGISTERS){
TARGET_COMM_sendSensorData();
gCommFlags &= ~FLUSH_COUNTER_REGISTERS;
}
if(gCommFlags & FLUSH_DEBUG_REGISTERS){
TARGET_COMM_sendDebugData();
gCommFlags &= ~FLUSH_DEBUG_REGISTERS;
}
if(gRecalFlag&PERIODIC_AFE2_RECALIBRATION){
GPIO_setOutputLowOnPin(RECAL_LED_PORT, RECAL_LED_PIN);
TARGET_COMM_sendRecalStartCmd();
gRecalFlag &= ~PERIODIC_AFE2_RECALIBRATION;
Timer_A_setCompareValue(TIMER_RECALIBRATION_SELECTION,
TIMER_A_CAPTURECOMPARE_REGISTER_0,
RECAL_TIME_OUT);
Timer_A_startCounter(TIMER_RECALIBRATION_SELECTION,TIMER_A_UP_MODE);
ReCalScanIF();
gRecalCounter = TIME_TO_RECAL_REPEAT;
Timer_A_initUpModeParam upParams =
{
...
And as you can see, the bit PERIODIC_AFE2_RECALIBRATION is cleared before entering the function ReCalScanIF(), therefore is impossible that the values of the registers were updated.
Does anyone any advice to fix this bug properly?
Best regards.