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.

MSP430FR4133: Program stopping in fs_add.asm or fs_div.asm

Part Number: MSP430FR4133
Other Parts Discussed in Thread: MSP430FR6877

Greetings,
I am trying to work with MSP4133 in LPM4 mode for a power conscious operation, for this I am using an external crystal oscillator of 32.768khz.
The required functionality is as follows.
There are two microcontrollers in my module, connected by UART.
When a button is pressed on another microcontroller (MSP430fr6877) , it sends a certain symbol/character over uart to 4133 module. The 4133 module has 2 screens, 1 - total liters 2 - flowrate,
On receiving this character, the 4133 module should display the second screen for some time and then jump back to the default screen i.e., screen 1. However, when the character is received the 2nd screen is coming up blank, and after the time elapses it goes back to the default screen. When i tried pausing the program after pressing button on the other controller,the program stops into fs_add.asm or fs_div.asm.
i changed all the float variables to Integer still the issue persists.

here is the related code

//UART Interrupt

#if defined(__TI_COMPILER_VERSION__) || defined(__IAR_SYSTEMS_ICC__)
#pragma vector=USCI_A0_VECTOR
__interrupt void USCI_A0_ISR(void)
#elif defined(__GNUC__)
void __attribute__ ((interrupt(USCI_A1_VECTOR))) USCI_A1_ISR (void)
#else
#error Compiler not supported!
#endif
{
__bic_SR_register_on_exit(LPM4_bits);
switch(__even_in_range(UCA0IV, USCI_UART_UCTXCPTIFG))
{
case USCI_NONE: break;
case USCI_UART_UCRXIFG:
while(!(UCA0IFG&UCTXIFG));
gucrcvChar = UCA0RXBUF;
gucRxBuffer[guiRXIndex] = gucrcvChar;
if(gucrcvChar=='*')                                              //Loop for switching between flowrate and current litres.
{
displayflowrateflag^=1;
if(displayflowrateflag==0)
{
flowrateDisplay_Count=0;
LCDM7 |= 0x00;
LCDM13 = 0x00;
LCDM10 |= 0x00;

}
//clear_data();
count=1;
}
// guiRXIndex++;

break;
case USCI_UART_UCTXIFG: break;
case USCI_UART_UCSTTIFG: break;
case USCI_UART_UCTXCPTIFG: break;
}
}


// display loop.

while(1)
{

if ((gulPulseTimeCount > (RefPulseTimeCount * 2)) && ((RampFlag==1) || (RPMRampFlag==1)))
{
tempFloat = 0;
PtoPFlowrate=0;
RPM_flowrate=0;
tempIndex = 0;
RPM_tempindex=0;
start_timer=0;
PtoPstart_timer_flag=0;
avgarr[0] = 0;
avgarr[1] = 0;
avgarr[2] = 0;
avgarr[3] = 0;
avgarr[4] = 0;

RPMavgarr[0] = 0;
RPMavgarr[1] = 0;
RPMavgarr[2] = 0;
RPMavgarr[3] = 0;
RPMavgarr[4] = 0;

gulPulseTimeCount = 0;
//pulseofftime = 0;
// RampFlag = 0;
// RPMRampFlag=0;
}


if(guc_SetupMode)
{
setup_Mode(); //setup mode to edit the scale factor
}

if(gucReset_TT_Flag)
{
gucReset_TT_Flag = 0;
SYSCFG0 &= ~PFWP; // Program FRAM write enable
FRAM_gud_TT_LTR = 0;
SYSCFG0 |= PFWP; // Program FRAM write protected (not writable)
wait();
}
if((gui_dispParameter==1) && (guc_SetupMode==0) && (displayflowrateflag==1) && (flowrateDisplay_Count<=25000))
{
if((PtoPFlowrate > Min_flowrate) && (start_timer >= 200))
{
tempFloat=RPM_flowrate;
_nop();

}
else
{
tempFloat= PtoPFlowrate;
}
if(count)
{
clear_data();
count=0;
}
display_flow(tempFloat);
}

if((gui_dispParameter==1) && (guc_SetupMode==0) && (displayflowrateflag==0))
{

display_Total((unsigned long int)FRAM_gud_TT_LTR);
}
__bis_SR_register(LPM4_bits | GIE); 
__no_operation(); // For debugger
}
}

I would highly appreciate your input.
Regards
Pratik.

  • Hi Pratik,

    What is the fs_add and fs_div, it seems to be math operation code, is it defined by you or the library? 

    It will take me some time to go through the case and code, and I will update feedback this week.

    I suggest you do some tests firstly:

    1. Does the 2nd screen can display normally? you can directly display it and check the result.

    2. Does your code work normal when use other LP mode, like LPM0.

    B.R.

    Sal

  • Hi Sal,
    Thanks for the reply
    1. yes if I make the second screen as default it displays correctly
    2. will do this..
    One thing i have observed that if i am giving pulses to the module via a pulse generator (its a flowmeter operation so pulses are to simulate the liquid flow)
    then the screens can switch. the problem is only coming when the module is idle. (the flow calculation logic is contained in the timer interrupts )
    Here is a snippet of the timer interrupt code.

    void __attribute__ ((interrupt(TIMER1_A1_VECTOR))) TIMER1_A1_ISR (void)
    {

    //1 ms timer

    switch(__even_in_range(TA1IV, TA1IV_TAIFG))
    {
    case TA1IV_NONE: break; // No interrupt
    case TA1IV_TACCR1: break; // CCR1 not used
    case TA1IV_TACCR2: break; // CCR2 not used
    case TA1IV_3: break; // reserved
    case TA1IV_4: break; // reserved
    case TA1IV_5: break; // reserved
    case TA1IV_6: break; // reserved
    case TA1IV_TAIFG: // overflow
    guiKeyDebounce++;

    {
    gulPulseTimeCount++;
    RPM_pulsetime_count++;


    if(displayflowrateflag)
    {
    flowrateDisplay_Count++;
    }
    if(flowrateDisplay_Count>15000)
    {
    flowrateDisplay_Count = 0;
    displayflowrateflag = 0;
    clear_data();
    __bic_SR_register_on_exit(LPM4_bits);
    count=1;
    }

    Regards 
    Pratik

  • fs_xxx appear to be part of the floating point library.

    Execution is not going to stop within those bits of code because there is nothing there to halt execution. It will stop at the points where a low power mode is set. Then wait for an interrupt to occur. The ISR may or may not cause a return to normal operation when it exits.

  • Pasting your code into the message removes formatting. Without the white space, your code is difficult to follow so I tend to give up.

    The Insert: code feature of the editor creates a scrollable window and doesn't delete white space.

  • Pratik,

    i changed all the float variables to Integer still the issue persists.

    Where is currently the code stuck when the second screen not display, when not use float libarary?

    then the screens can switch. the problem is only coming when the module is idle.

    Any difference between with pulse and without pulse to the device? Maybe you can check the recieved data in the two conditions.

    B.R.

    Sal

**Attention** This is a public forum