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.

Reset USCI UART MODE

Hi,

I have a problem when i try to reset my uscia. I am doing this between sent packages but the last byte is sent is modified...

I am doing the following in my isr:

#pragma vector = USCIAB0TX_VECTOR
__interrupt void USCIAB0TX_ISR(void)
{

if((IFG2&UCA0TXIFG)&&(IE2&UCA0TXIE)) //INTERRUPCION SERIAL
{

if ( contador_bytes_out != total_bytes_out)
{
UCA0TXBUF = mensaje_out[contador_bytes_out]; // TX next character
contador_bytes_out++;
}
else
{

contador_bytes_out = 0;

IE2 &= ~UCA0TXIE;

__bic_SR_register_on_exit(LPM3_bits); // Exit LPM0


}

}

}

When i get out of the ISR i turn off the USCIA: 

UCA0CTL1 |= UCSWRST;

What do you suggest?

I need this to reduce my power consumption on idle state...

  • When you get out of the ISR, the last byte isn't sent. It's just being sent. TXIFG being set measn that the TXBUF regiseter is empty. The output shift register isn't (double buffering).
    You'll need to check UCBUSY bit before resettign the USCI.

**Attention** This is a public forum