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.

MSP430F5438A: UART flag error in low-power mode

Part Number: MSP430F5438A

Hi,

I am trying to read UART RX Buffer after UCRXIFG triggered USCI_A0_VECTOR interruption. When I don't enter LPM4 or if I exist LPMx at the end of my interruption I am able to retrieve the whole buffer without error. But If I am in LPM4 I have UCA0STAT = 0x6C (Framing Error, OverRun Error, Break Error) and I receive 3 incorrect bytes if UCRXEIE = 1. 

Data that I want to retrieve are acknowledgement of a TX message. When I have the error, I retry sending this message and I have a correct ACK without any error.

In my main continous loop, I manage the enter in LPM like this :

// Low power mode when done
if(sync_OperationState.Probes || sync_OperationState.TM)
{
    TIMERB0_EN;
    __bis_SR_register(LPM0_bits + GIE); 
            
}
else
{
    TIMERB0_DIS;
    __bis_SR_register(LPM4_bits + GIE); 
}

My timerB0 is here to trigger an interrupt every 10ms when I am frequently using my MCU. Otherwise I have a timerA0 which trigger an interrupt every seconds.
And here is how I manage my UCA interruption. If I uncomment the last line "// __low_power_mode_off_on_exit();" it works everytime.


#pragma vector=USCI_A0_VECTOR __interrupt void USCI_A0_ISR(void) { uca0_Stat_Before = UCA0STAT; switch(__even_in_range(UCA0IV,4)) { case 0: // Vector 0 - no interrupt break; case 2: // Vector 2 - RXIFG // Update of the receive buffer uca0_NbreReceivedValue++; *WritePointer[RXBUFFER]++ = UCA0RXBUF; if(WritePointer[RXBUFFER] == &RXBuffer[UCA0_RXBUFFERSIZE]) WritePointer[RXBUFFER] = RXBuffer; break; case 4: // Vector 4 - TXIFG // Send a byte if necessary and update of the transmission buffer SendingInProgress = FALSE; if(ReadPointer[TXBUFFER] != WritePointer[TXBUFFER]) { SendingInProgress = TRUE; UCA0TXBUF = *ReadPointer[TXBUFFER]++; if(ReadPointer[TXBUFFER] == &TXBuffer[UCA0_TXBUFFERSIZE]) ReadPointer[TXBUFFER] = TXBuffer; } break; default: break; } uca0_Stat_After = UCA0STAT; // __low_power_mode_off_on_exit(); }

This issue seems to be highly related to the fact that I am in LPM but I can't explain why I have this behavior.

  • Hi Clement18,

    I believe the issue is when exiting from LPM3 or LPM4, the clock system needs about 10usec to come and start working.  During that 10usec, it is possible to miss 1 or more bits being clocked into the receiver.  Maybe not at 9600, but at higher baud rates this can be an issue.  So if you use LPM0 you don't see this issue?

  • Hi Clement18,

    I haven’t heard from you for a couple of days now, so I’m assuming you were able to resolve your issue.
    If this isn’t the case, please click the "This did NOT resolve my issue" button and reply to this thread with more information.
    If this thread locks, please click the "Ask a related question" button and in the new thread describe the current status of your issue and any additional details you may have to assist us in helping to solve your issues.

**Attention** This is a public forum