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.

CCS/MSP430F6638: CCS/MSP430F6638

Part Number: MSP430F6638

Tool/software: Code Composer Studio

Hello;

I try to use uart with UCA0 at port 3 and 4, my rx code is working bu tx part is not working. I don't understand what's the problem.

My main function is 

int main(void)
{
WDTCTL = WDTPW | WDTHOLD; // Stop watchdog timer

Port_Mapping();
set_pin();


uart_init();

enable_periodic_wake_up(); //RTC 
initial_message_send(); // Uart send

__bis_SR_register(LPM1_bits + GIE);

...... }

my port mapping function is

void Port_Mapping(void)
{
// Disable Interrupts before altering Port Mapping registers
__disable_interrupt();
// Enable Write-access to modify port mapping registers
PMAPPWD = 0x02D52;

#ifdef PORT_MAP_RECFG
// Allow reconfiguration during runtime
PMAPCTL = PMAPRECFG;
#endif

P2MAP4 = PM_UCA0TXD;
P2MAP5 = PM_UCA0RXD;

// Disable Write-Access to modify port mapping registers
PMAPPWD = 0;
#ifdef PORT_MAP_EINT
__enable_interrupt(); // Re-enable all interrupts
#endif
}

my uart init function is

void uart_init(void){

P2SEL = 0x30; // P2.4,5 = USCI_A0 TXD/RXD
P2DIR |= 0x30;

UCA0CTL1 = UCSSEL_2 | UCSWRST; // **Put state machine in reset**
UCA0CTL1 |= UCSSEL_2; // SMCLK
UCA0BR0 = 6; // 1MHz 9600 (see User's Guide)
UCA0BR1 = 0; // 1MHz 9600
UCA0MCTL = UCBRS_0 + UCBRF_13 + UCOS16; // Modln UCBRSx=0, UCBRFx=0,
// over sampling
UCA0CTL1 &= ~UCSWRST; // **Initialize USCI state machine**
UCA0IE |= UCRXIE; // Enable USCI_A0 RX interrupt


}

my uart send function is 

void uart_puts( char* buffer)
{
while(*buffer)
{
while (!(UCTXIFG &UCA0IFG)) ; // USCI_A0 TX buffer ready?
UCA0TXBUF = (*buffer++);
}
}

**Attention** This is a public forum