Other Parts Discussed in Thread: MSP430F2618, MSP430F149, MSP430F2419, MSP430F1611
I am new to the forums here but hopefully someone can help me out. I am trying to get a new board that we have designed to work. It incorporates an MSP430F2618 and a National Semi LM9838 bluetooth chip for communication. I cannot get these 2 to work together after many hours of trying. Has anyone gotten them to work together? If so, could you give me some pointers? I am using CCE v3 for my development.
I wanted to include a couple of examples from my code to make it easier to understand what I am doing. First, here is the section of code that sets the GPIO pin directions and functions:
// Pin Pin # Direction Connections
// P3.0 28 -> Flash CS
// P3.1 29 <- Flash SDI
// P3.2 30 -> Flash SDO
// P3.3 31 -> Flash SCK
// P3.4 32 -> Flash WP
// P3.5 33 -> Flash HD
// P3.6 34 -> BT RXD
// P3.7 35 <- BT TXD
P3DIR = 0x7d; // P3.0, P3.2-5, P3.6 output, P3.1, P3.7 input
P3REN = 0x00; // all p/u resistors disabled
P3SEL = 0xce; // P3.0, P34-5 are I/O pins, pins 3.1-3 are SPI,
// P3.6-7 are UART
// Pin Pin # Direction Connections
// P4.0 36 -> BT CTS
// P4.1 37 <- BT RTS
// P4.2 38 -> BT RST
// P4.3 39 -- n/c
// P4.4 40 -- n/c
// P4.5 41 -- n/c
// P4.6 42 -- n/c
// P4.7 43 -- n/c
P4DIR = 0xfd; // P4.0, P4.2-7 output, P4.1 input
P4REN = 0x00; // all p/u resistors disabled
P4SEL = 0x00; // all pins are I/O pins
P4OUT = BT_CTS_MASK; // set CTS high & RST low
And here is the initialization code for the UART and BT chip:
void init_bluetooth(void)
{
UCA1CTL1 |= UCSWRST; // put the UART in reset
UCA1CTL0 = 0x18; // parity disabled, LSB first, 7-bit data,
// 1 stop bit, UART mode, async mode for UART
UCA1CTL1 |= 0x40; // ACLK, don't receive erronious chars or
// break chars, not dormant, transmit data,
// no transmit break
UCA1BR0 = 0x8A; // UCBRx = int(N)
UCA1BR1 = 0x00; // no oversampling
UCA1MCTL = 0x0E; // UCBRSx = round((N - int(N)) * 8)
UCA1STAT = 0x00; // clear the status register
UC1IFG &= 0xFC; // clear interrupt flags
UC1IE |= UCA1RXIE + UCA1TXIE; // enable receive and transmit interrupts
UCA1CTL1 &= ~UCSWRST; // take the UART out of reset
P4OUT |= 0x04; // take the chip out of reset
P4OUT &= ~BT_CTS_MASK; // set CTS low
}
I have the BT chip set up to run at a baud rate of 115200. When the BT chip starts up, it sends out a message letting the microcontroller know that it is 'alive'. I get nothing at all from the chip. Does anyone see anything obvious that I am doing wrong here?
On a related note, notice the following line in my initialization function:
UC1IE |= UCA1RXIE + UCA1TXIE; // enable receive and transmit interrupts
When this line of code is executed, and I check the UC1IE register right after executing that line of code, the bits in the register are still set to 0. Even if I try setting the bits in the register directly in the debugger, it still doesn't take them! Can anyone give me any insight into why that might be happening?
Thank you in advance for any help on this matter. It is quickly getting critical for my project so any help is greatly appreciated.