Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

Msp430 UART Communication

Status
Not open for further replies.

Elderflower14

Junior Member level 3
Joined
Aug 18, 2011
Messages
26
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,486
Hello,

I am working on MSP430F5438A and have done a simple UART program to echo back the transmitted character to the receiver buffer. The code worked fine. ButI had connected the UART to a bluetooth chip. I am able to transmit characters to the UART unable to receive any. So I took a step backwards, put an extra UART in MSP430 as it has 4 pairs of UART lines. Tried the simple UART code for loop back but it is not working now. I am highly concerned and any help will be highly appreciated. I am pasting the code below

#include "msp430x54x.h"

char buf[10];
int i=0;

void main(void)
{
WDTCTL = WDTPW + WDTHOLD; // Stop WDT
P3SEL = 0x30; // P3.4,5 = USCI_A0 TXD/RXD

UCA0CTL1 |= UCSWRST; // **Put state machine in reset**
UCA0CTL1 |= UCSSEL_1; // CLK = ACLK
UCA0BR0 = 0x20; //
UCA0BR1 = 0x00; //
//Not required right now.
//UCA0MCTL |= UCBRS_6+UCBRF_0; // Modulation UCBRSx=6, UCBRFx=0
UCA0CTL1 &= ~UCSWRST; // **Initialize USCI state machine**
UCA0IE |= UCRXIE; // Enable USCI_A1 RX interrupt

P1DIR |= BIT0;
UCA0TXBUF=0x61;
while(!(UCA0IFG&UCTXIFG));

__bis_SR_register(LPM3_bits + GIE); // Enter LPM3, interrupts enabled
__no_operation(); // For debugger

}

// Echo back RXed character, confirm TX buffer is ready first
#pragma vector=USCI_A0_VECTOR
__interrupt void USCI_A0_ISR(void)
{
buf= UCA0RXBUF;
if(buf==0x61)
{
P1OUT ^= BIT0;
__delay_cycles(100000);
}
}


Kind Regards
Elderflower
 

Most Bluetooth modules use hardware flow control due to their high BAUD rates. Have you check to see if this is the case with your Bluetooth module?

If hardware flow control is active by default you may need to turn it off or implement it on the MSP430 side.

BigDog
 

Hi Bigdog,

Right now I am just checking the UART simple loopback code for MSP430. Although I have connected the bluetooth module to Pin 39 and 40 (UCSI_A0 TX and RX), I am not using it at present. I have enabled the second pair of UART lines PIN 53 and 54 and want to check the loopback code with just MSP430 on. So the above code which worked before is not working now.

Thanks.
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top