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.

MSP430F2618 and NS LM9838 Bluetooth Chip

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.

  • dave said:

    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

    This appears to be okay.

    dave said:

    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?

    Do you really need to configure for 7-bit data?  With the "UCA1CTL0 = 0x18;", you are also configuring for 2 stop bits.

    It seems, based on the divisor being placed in UCA1BRx and the UCA1MCTL registers, you are referencing the third from the last entry in Table 15-4 for typical baud rates that configure BRCLK to be 16MHz.
    The configuration of UCA1CTL1 above selects UCSSELx=00b, which selects UCA1CLK as the clock input into the USCI.  This is found on pin 44 (both QFP packages) of the MSP430F2618 and is muxed with P5.0.
    How do you have that Port configured?

    You could select UCSSELx=10b or 11b, to be SMCLK which is probably 16MHz in your system, but I don't have details of your Basic Clock Module+ registers.

     

    dave said:

    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?

    Regarding this issue, please check the MSP430x2xx Family User's Guide (SLAU144) in Section 15.3.1.  The Note box discusses the initialization steps or re-configuring of the USCI module for UART mode.
    It suggests to clear UCSWRST prior to enabling interrupts via UCAxRXIE and UCAxTXIE.  Perhaps this may explain why th UC1IE register is not responsive.

     

  • Thank you for the response Brandon. I definitely had UCA1CTL0 misconfigured as I did want 7-bit data but only 1 stop bit. And you are correct that I am using the values from table 15-4. I have the UART configured to use ACLK which is sourced from the 16 MHz crystal we have connected to XIN & XOUT. In fact, here's how I configure our clocks:

    // Description:
    //    This function initializes the clock. If the calibration data is available,
    //    then it will make use of it. Otherwise, it is set up manually. It should
    //    be set up so that we have the following:
    //    DCO =    8MHz
    //    ACLK =  16MHz
    //    MCLK =  16MHz
    //    SMCLK =  1MHz
    //=============================================================================
    void init_clock(void)
    {
    #ifndef __DisableCalData
        DCOCTL = CALDCO_8MHZ;                // DCOx=0x04, MODx=0x10
        BCSCTL1 = CALBC1_8MHZ;                // XT2=1 (off), XTS=1 (high frequency mode),
                                            //    ACLK/1, RSEL is calibration value
        BCSCTL1 |= 0x50;                    // XT2=1 (off), XTS=1 (high frequency mode),
    #else
        DCOCTL = 0x90;                        // DCOx=4, MODx=0x10
        BCSCTL1 = 0xCD;                        // XT2=1 (off), XTS=1 (high frequency mode),
                                            //    ACLK/1, RSEL is calibration value
    #endif
        BCSCTL2 = 0xC6;                        // MCLK=3 (LFXT1CLK), MCLK/1 (0), SMCLK=0 (DCOCLK),
                                              //  SMCLK/8 (2), DCO internal resistor (0)
        BCSCTL3 = 0x20;                        // XT2 range=0 (0.4-1MHz), LFXT1 range=0b10 (3-16MHz),
                                            //  XCAPx=0b00 (~1pF, not used)
        IE1 &= ~OFIE;                        // disable oscillator fault interrupt
        IFG1 &= ~OFIFG;                        // clear oscillator fault interrupt flag
        delay_us(50);
        while(BCSCTL3 & 0x02) {
            IFG1 &= ~OFIFG;                    // clear oscillator fault interrupt flag
            delay_us(50);
        }
    }

    So I do want to configure the baud rate based on a 16 MHz clock. Unfortunately, I'm still not sure that the baud rate is correct (although I've done the calculations and looked at the tables way too many times).Just as a point of reference, here is the function header for init_bluetooth from my original posting:

    //=============================================================================
    // Function:        init_bluetooth
    //
    // Input Parameters
    //    none
    //
    // Return Value:    none
    //
    // Description:
    //    This function initializes the bluetooth chip on the board. The pins have
    //     already been set up so just deal with the lines going to the chip. The BT
    //    chip should already be in reset with CTS high from init_pins()
    //    Given that the bluetooth chip is set up to run at 115200, we need to figure
    //    out the appropriate baud rate setting for the UART. The baud rate is
    //    calculated as:
    //    N = Fbrclk / baud rate ==> 16000000 / 115200 = 138.888...
    //    UCBRx = int(N)
    //    UCBRSx = round((N - int(N)) * 8)
    //=============================================================================

    As for port 5, I have it configured thusly:

        // Pin        Pin #    Direction    Connections
        // P5.0         44            ->         ADC nCS
        // P5.1         45            ->         ADC DIN
        // P5.2         46            <-         ADC DOUT
        // P5.3         47            ->         ADC DCLK
        // P5.4         48            <-         ADC BUSY
        // P5.5         49            <-         Acc 0G Det
        // P5.6         50            ->         Acc gSel
        // P5.7         51            ->         Acc Self_Test
        P5DIR  = 0xcb;                        // P5.0-1, P5.3, P5.6-7 output, P5.2, P5.4-5 input
        P5REN  = 0x00;                        // all p/u resistors disabled
        P5SEL  = 0x0e;                        // pins 5.0, 5.4-7 are I/O pins, pins 5.1-3 are SPI

    As you can see, I'm using pin 5.0 for other purposes. I have checked the clocks, ACLK using pin 20 and SMCLK using pin 16. They both appeared to be running at the desired rates (16 MHz & 1 MHz respectively). Of course, even after the updates you suggested, I still can't get any characters from the BT chip [using interrupts or polling].

    Your reference to section 15.3.1 did resolve the issue I was having with enabling the interrupts. That now works but still no characters. Any additional suggestions [from anyone] would be greatly appreciated.

  • One additional data point. When I connect to the bluetooth chip on our board with my laptop, I do get 1 character from the BT chip [out of the 14 it sends when it gets a connection]. The other characters just never seem to make it to me. Would this indicate a baud rate problem or some other problem?

  • Is the one character you do receive an expected value?

    If it is not the value you expect, I might expect a baud rate issue, but the only way to be sure is to use an oscilloscope to verify what is actually being sent and compare to what is being captured by the MSP430.

    What does your software do when the a character is received?  Is it pulling the received character out of the UCAxRXBUF register, resulting in re-arming the UCAxRXIFG flag?

  • It might be one of the characters I expect although it may also be garbage. I say that because there are a number of different characters (around 25 or so) in it initial message that is sent out by the BT chip. For instance, when I first start up the board I expect a message like (this is not the exact message but it's close):

    v2.10 (patch 02.12)

    The characters I am seeing are things like 0x18, 0x0a and 0x7c. None of those are in that message but I do occasionally (rarely) see other characters in other messages.

    As for my polling loop (or interrupt handler when I'm using it), here it is:

    void bluetooth_receiver(void)
    {
        char        rx_char;
        uint8_t*    ptr_rx;
        btHeader*    header;
       
        memset((void*)rx_buffer, 0, BT_MAX_PACKET_SIZE);

        while (1) {
            // wait for initial LMX9838 response
            while (!bt_packet_received) {
                if (UC1IFG & UCA1RXIFG) {            // got a character
                    P4OUT |= BT_CTS_MASK;            // Set nBT_CTS high
                    rx_char = UCA1RXBUF;
                    rx_buffer[rx_count++] = rx_char;
                    if ((rx_char == BT_ETX_CHAR) && (rx_count >= BT_HEADER_SIZE)) {
                        bt_packet_received = true;
                    } else {
                        P4OUT &= ~BT_CTS_MASK;        // Set nBT_CTS low
                    }
                }
                if (UCA1STAT & UCOE) {
                    rx_char = UCA1RXBUF;
                }
            }
            ptr_rx = rx_buffer;
            while (*ptr_rx != BT_STX_CHAR) {
                ptr_rx++;
                if (*ptr_rx == BT_ETX_CHAR)
                    break;
            }
            ptr_rx++;
            header = (btHeader*)ptr_rx;
            switch (header->opCode) {
                case BT_MODULE_READY:
                    break;
                case BT_GAP_REMOTE_DEVICE_NAME:
                    break;
                case BT_SPP_TRANSPARENT_MODE:
                    transparent_mode = false;
                    break;
                case BT_GAP_READ_LOCAL_NAME:
                    break;
                case BT_GAP_SET_SCANMODE:
                    break;
                case BT_GAP_WRITE_LOCAL_NAME:
                    break;
                case BT_SPP_INCOMING_LINK_ESTABLISHED:
                    transparent_mode = true;
                    break;
                case BT_GAP_INQUIRY:
                    break;
                case BT_SPP_LINK_RELEASED:
                    break;
                default:
                    break;
            }
            rx_count = 0;
            bt_packet_received = false;
        }
    }

    As you can see, it's pretty basic. For now, I'm just trying to catch anything the BT chip is sending my way and figure out what kind of message it is. The interrupt handler is similar:

    #pragma vector=USCIAB1RX_VECTOR
    __interrupt void USCI1RX_ISR(void)
    {
        char        data;

        while ((UC1IFG & UCB1RXIFG) || (UC1IFG & UCA1RXIFG)) {
            if (UC1IFG & UCB1RXIFG) {                // got ADC RX interrupt
                UC1IFG &= ~UCB1RXIFG;                // clear interrupt flag
                adc_data = (uint16_t)UCB1RXBUF;        // grab the ADC data
                adc_no_data = false;                // reset data ready flag
            } else {                                // got BT RX interrupt
                P4OUT |= BT_CTS_MASK;                // set CTS high
                while (UC1IFG & UCA1RXIFG) {        // while characters to read
                    data = UCA1RXBUF;
                    rx_buffer[rx_count++] = data;
                    if (bt_got_start_char) {
                        if ((data == BT_ETX_CHAR) && (rx_count >= BT_HEADER_SIZE)) {
                            bt_packet_received = true;
                            bt_got_start_char = false;
                            rx_count = 0;
                        }
                    }
                    if (data == BT_STX_CHAR) {
                        bt_got_start_char = true;
                        bt_packet_received = false;
                    }
                }
                P4OUT &= ~BT_CTS_MASK;                // set CTS low to indicate we're ready
            }
        }
    }

    The interrupt handler has to check to see whether it is a character from the BT chip or a data value from the ADC on the board.

    Do you see any glaring errors in either of those functions? I will use the scope on the TX line of the chip when I'm back in the office on Monday. But if you see anything else that might be obvious, please let me know. And thank you for your help.

  • At this point, I think it is prudent to verify the baud rate before looking at other items.  The USCI interface is going to be driven by the same clock for both the RX and TX operations.  It would be easier to verify the baud rate by using some code to transmit a series of known values that you can then trigger on with an oscilloscope.  Once you have honed in on the appropriate baud rate, then turning our attention to the receive path would be valid.

    By the way, there are some code examples from the MSP430F2618 Product Folder.  These are found in SLAC151.  They are simplistic, but can be used to for initial debug.

    You should probably hold the Bluetooth device in reset when testing this, just to make sure it is not interacting to some non-sensical data being sent to it.

  • I think you're right. I'll break out the scope later today and see what's going on. Thanks for your help on this.

  • Hi Dave,

    Currently I am working with MSP430F149/F249 and Bluetooth LMX9838.  From this forum I came to know that you have worked with the MSP430 and LMX9838.  I am new to Bluetooth LMX9838.  I will highly appreciate if I could contact you if I have questions.  

    If I could have your email address?

    I assure you I will do my best before asking any questions.

    Babu

     

  • Babu,

     

    If I can help I will be happy to do so. Just let me know if you have questions and I'll provide what answers I can. Just post a reply with your email address and I'll contact you via email.

     

    dave

  • Hi Dave,

    I am configuring Naional BTh LMX9838 at power up, so I can send/receive commands/events.  The controller is TI MSP430F149.

    In SbSendCommand() below, if I use usart_tx(), then the runtime gets stuck in setup_clock()/do-while loop. If I comment out the usart_tx(), then runtime does not get stuck. 

    My suspicion is that my baud rate calculation is not right.  I got a baud rate calculator from some web site. Baud rate from this calculator gives the same problem.  Also I got an application note, (Philips, AN10369), the baud rate from it also gives the same problem.

    Note: Most of this code is from National Simply Blue Commander. 

     

    I will highly appreciate your or someone else help to solve this problem.

    My email address is:  BabuddinAhmad@Yahoo.com

    Mobile: 619-315-6885

    Babuddin

     

    SBStatus_T SbSendCommand(uint16 Size)

    {

        uint8  err;

        void   *msg;

        uint16 checksum;

     

        SbCommand[0]    = STX;

        SbCommand[1]    = REQ;

        checksum        = SbCommand[1] + SbCommand[2] + SbCommand[3] + SbCommand[4];

        SbCommand[5]    = checksum % 256;

         

        SbCommand[Size - 1] = ETX;

     

        //if (usart_tx(SB_UART_PORT, SbCommand, Size) == Size) {

        if (usart_tx(Size) == Size) {

            if (SbCommand[2] == SPP_SEND_DATA) {

                return SBSTATUS_OK;

            }

            else {    // BA, 3/25/09

                return      SBSTATUS_ERROR;

            }

        }

          else {

                return SBSTATUS_UART_INCOMPLETE_TRANSFER;

          }

    }

    void setup_clock(void) {                                                                                                     

          unsigned int i;

         

          BCSCTL1 = XT2OFF | XTS | DIVA_0; // XT2 if off, high frequency mode

          do                                                           

          {                                                      

                IFG1 &= ~OFIFG;   // clear OSCfault flag  

                for (i=0xFF; i>0; --i); // time for flag to set                  

          } while ((IFG1 & OFIFG) != 0);  

          BCSCTL2 = (SELM1 | SELM0 | DIVM_0); //                   

    }     // setup_clock()

    uint16 usart_tx(uint16 Size)  // BA, 3/25/09

    {

          int i;

         

          for (i=0; i<Size; ++i) {

                U0TXBUF = SbCommand[i];

                while ((U0TCTL & TXEPT) == 0);      // Tx is busy

          }

         

          if (i==Size) {

                return Size;     

          }

          else {

                return 0;

          }

    }

    SBStatus_T SbSendCommand(uint16 Size)

    {

        uint8  err;

        void   *msg;

        uint16 checksum;

     

        SbCommand[0]    = STX;

        SbCommand[1]    = REQ;

        checksum        = SbCommand[1] + SbCommand[2] + SbCommand[3] + SbCommand[4];

        SbCommand[5]    = checksum % 256;

         

        SbCommand[Size - 1] = ETX;

     

        //if (usart_tx(SB_UART_PORT, SbCommand, Size) == Size) {

        if (usart_tx(Size) == Size) {

            if (SbCommand[2] == SPP_SEND_DATA) {

                return SBSTATUS_OK;

            }

            else {    // BA, 3/25/09

                return      SBSTATUS_ERROR;

            }

        }

          else {

                return SBSTATUS_UART_INCOMPLETE_TRANSFER;

          }

    }

    SBStatus_T SbResetFactorySettings(void)

    {

        uint16 payloadlen;

        //uint8  SbCommand[7]={0, 0, 0, 0, 0, 0, 0};

     

        payloadlen = 0x0000;

     

        SbCommand[2] = RESTORE_FACTORY_SETTINGS;

        SbCommand[3] = (payloadlen & 0x00FF); // payload size is stored

        SbCommand[4] = (payloadlen >> 8);     // in little endian fashion

     

        //return SbSendCommand(SbCommand, 7 + payloadlen);

        return SbSendCommand(7 + payloadlen);

    }

    SBStatus_T SbConfigureLocalDevice(void)

    {

        SBStatus_T status;

     

        status = SbResetFactorySettings();

       

        if (status == SBSTATUS_OK) {

            status = SbDeleteSdpRecords();

            if (status == SBSTATUS_OK) {

                status = SbSetOperationMode(SB_COMMAND_MODE);

                if (status == SBSTATUS_OK) {

                    //status = SbSetNvsDefaultAudioSettings(CodecType, AirFormat);

                    if (status == SBSTATUS_OK) {

                        status = SbResetDevice();

                    }

                }

            }

        }

        return status;

    }

    void main (void) {

     

          SBStatus_T result_config;

         

          /* initialize uController chip (TI MSP430F149) */

          init_system();

          _EINT();

         

          // configure National BTh chip

          result_config = SbConfigureLocalDevice();

     

          do {

     

          } while (1);

         

    }   /* main() */

    void init_system(void) {

          /* stop WD Timer */

          WDTCTL = WDTPW + WDTHOLD;

          setup_clock();

          UART0_Initialize();

          //setup_ints();          

    }     // init_system()

    void UART0_ports_Initialize(void) {

     

          // P1.3 for BTh I/O, RTS: active low made by BTh

          P1SEL &= ~BIT3;   // 0=I/0

          P1DIR &= ~BIT3;   // input

         

          // P1.6 for BTh I/O, CTS: active low made by MSP430

          P1SEL &= ~BIT6;   // 0=I/O

          P1DIR |= BIT6;    // output

          P1OUT &= ~BIT6;   // make CTS low, page 3 of Dave blog

         

          // P6.7:  BT_RESET

          P6SEL &= ~BIT7;   // I/O function

          P6DIR |= BIT7;    // output

          P6OUT |= BIT7;    // take the chip out of reset, page 3 of Dave blog

    }

    void UART0_Initialize(void) {

          // As per page 13-4 of MSP430x1xx User guide

          // 1. set SWRST

                U0CTL = SWRST;

          // 2. initialize all UART registers

                // BRCLK=ACLK=8MHz, BR=115K; UART calculator, values: U0BR0 = 0x45,

                // U0BR1=0x00, U0MCTL=0xAA.

                // SSEL0=ACLK

                U0CTL |= CHAR;    // parity disabled, 1 stop bit, UART mode,

                U0TCTL |= SSEL0;// ACLK is BRCLK source clock

                U0MCTL = 0xAA;    // from calculator

                //U0BR0 = 0x45;   // from calculator

                /* from Philips AN10369

                 * 9600 = 2.5MHz/(16*x), x = 2.5MHz/(16*9600) = 16

                 */

                U0BR0 = 0x4;     

                U0BR1 = 0x00;

          // 3. enable UART module

                ME1 |= UTXE0 | URXE0;  

          // 4. clear SWRST

                U0CTL &= ~SWRST;

          // 5. enable interrupts

                IE1 |= UTXIE0 | URXIE0; // enable UART interrupts

                IFG1 &= ~(UTXIFG0 | URXIFG0);// page 3 of Dave blog

          // init ports

                UART0_ports_Initialize();

    }     // UART0_Initialize()

  • Hi Dave,

    I am configuring Naional BTh LMX9838 at power up, so I can send/receive commands/events.  The controller is TI MSP430F149.

    I made a little change in the code:

    a.  Selected UCLKI as the clock source for BRCLK in UART0_Initialize().

    Now the runtime stucks in the while loop in usart_tx().

     

    I will highly appreciate your or someone else help to solve this problem.

    Babuddin

     

    uint16 usart_tx(uint16 Size)  // BA, 3/25/09

    {

          int i;

         

          for (i=0; i<Size; ++i) {

                U0TXBUF = SbCommand[i];

                while ((U0TCTL & TXEPT) == 0);// Tx is busy << runtime STUCKS

          }

         

          if (i==Size) {

                return Size;     

          }

          else {

                return 0;

          }

    }

    void UART0_Initialize(void) {

          // As per page 13-4 of MSP430x1xx User guide

          // 1. set SWRST

                U0CTL = SWRST;

          // 2. initialize all UART registers

                // BRCLK=ACLK=8MHz, BR=115K; UART calculator, values: U0BR0 = 0x45,

                // U0BR1=0x00, U0MCTL=0xAA.

                // SSEL0=ACLK

                U0CTL |= CHAR;    // parity disabled, 1 stop bit, SYNC=0/UART mode,

                //U0TCTL |= SSEL0;// ACLK is BRCLK source clock

                U0MCTL = 0xAA;    // from calculator

                U0BR0 = 0x45;     // from calculator

                /* from Philips AN10369

                 * 9600 = 2.5MHz/(16*x), x = 2.5MHz/(16*9600) = 16

                 */

                //U0BR0 = 0x4;   

                U0BR1 = 0x00;

          // 3. enable UART module

                ME1 |= UTXE0 | URXE0;  

          // 4. clear SWRST

                U0CTL &= ~SWRST;

          // 5. enable interrupts

                IE1 |= UTXIE0 | URXIE0; // enable UART interrupts

                IFG1 &= ~(UTXIFG0 | URXIFG0);// page 3 of Dave blog

          // init ports

                UART0_ports_Initialize();

    }     // UART0_Initialize()

  • Hi Dave,

    I am configuring Naional BTh LMX9838 at power up, so I can send/receive commands/events.  The controller is TI MSP430F149.

     

    Code does not hang anymore in usart_tx(). Now usart_tx() looks as below.

     

    Babuddin

     

    uint16 usart_tx(uint16 Size)  // BA, 3/25/09

    {

          int i,j;

         

          for (i=0; i<Size; ++i) {

                while (IFG1 & UTXIFG0); // USART0 TX buffer ready?

                U0TXBUF = SbCommand[i];

          }

         

          if (i==Size) {

                return Size;     

          }

          else {

                return 0;

          }

    }

  • Hello All,

    I am working with MSP430 and National LMX9838 Bluetooth chip. 

    At power up:

    Should I send the command to set the baud rate first?

    Note: Baud rate is set up with the OP pins on LMX9838.  But I still have to send 'Change UART Settings' to set parity and stop bit.

    OR

    Should I send the RESET command first?

    Note:  RESET command sends back LMX9838 Ready.  I need to configure baud rate at power up in LMX9838.  The command

    I appreciate your help in this respect.

    Babu

     

  • Babu,

    Sorry for not getting back to you sooner. You should set the baud rate, and the rest of the UART settings, before you take the LMX9838 out of reset. In other words, the sequence is this:

    1. Put the 9838 into reset (set the reset pin low) and set the CTS pin high. If you're using the power down line, make sure to set it high. Newer versions of the 9838 do not have a power down pin so you may not have this.
    2. Configure the UART as necessary (baud rate, interrupts, DMA, etc.).
    3. Take the 9838 out of reset (set the reset pin high).
    4. Set CTS low on the 9838 (this lets it know that you are ready to talk to it).
    5. Wait for the LMX9838 ready message.
    6. Configure the LMX9838 as needed. For instance, I make sure that auto mode is set (I use it as a cable replacement, SPP protocol) and that scan mode is enabled.

    That should be all you need to do to use it. In my case, I initialize all connections to the board from my PC. If you are setting up connections from your board using the 9838, you will have more configuration to do on the 9838.

    Hope this helps.

    dave

  • Hi Dave,

    The code is transmitting the chars, but not receiving chars from LMX9838.  The debug runtime stucks in usart_rx() at the receive interrupt.  So there is no char in the Rx buffer.  I am pasting my code below. I appreciate if you can point out where the problem could be.

    I highly appreciate your help.

    Babu

    void UART0_ports_Initialize(void) {

          // P6.7:  BT_RESET

          P6SEL &= ~BIT7;   // I/O function

          P6DIR |= BIT7;    // output

          P6OUT &= ~BIT7;   // set RESET low

     

          // P1.6 for BTh I/O, CTS: active low made by MSP430

          P1SEL &= ~BIT6;   // 0=I/O

          P1DIR |= BIT6;    // output

          P1OUT |= BIT6;    // set CTS high

     

          // P1.3 for BTh I/O, RTS: active low made by BTh

          P1SEL &= ~BIT3;   // 0=I/0 function

          P1DIR &= ~BIT3;   // input

    }

    void set_RESET_high(void) {

          // P6.7:  BT_RESET

          P6OUT |= BIT7;    // set RESET low

    }

    void set_CTS_low(void) {

          P1OUT &= ~BIT6;   // set CTS low

    }

    void UART0_Initialize(void) {

          // As per page 13-4 of MSP430x1xx User guide

          // 1. set SWRST

                U0CTL = SWRST;

          // 2. initialize all UART registers

                // BRCLK=ACLK=8MHz, BR=115K; UART calculator, values: U0BR0 = 0x45,

                // U0BR1=0x00, U0MCTL=0xAA.

                // SSEL0=ACLK

                U0CTL |= CHAR;    // parity disabled, 1 stop bit, SYNC=0/UART mode,

                U0TCTL |= (SSEL0 | TXEPT | URXSE);// ACLK is BRCLK source clock

                U0MCTL = 0xAA;    // from calculator, BR=115K

                U0BR0 = 0x45;     // from calculator, BR=115K

                U0BR1 = 0x00;

          // 3. enable UART module

                ME1 |= UTXE0 | URXE0;  

          // 4. clear SWRST

                U0CTL &= ~SWRST;

          // 5. enable interrupts

                IE1 |= UTXIE0 | URXIE0; // enable UART interrupts

          // init ports

                UART0_ports_Initialize();

    }     // UART0_Initialize()

     

    void SbProcessFrame(void)

    {

        int    i=0;

        uint16 ServiceResponseStart=0;

        uint32 status;

     

        switch (SbEvent.bOpcode)

        {

            case GAP_DEVICE_FOUND:              break;

            case SPP_LINK_ESTABLISHED:          break;

            case SPP_INCOMING_LINK_ESTABLISHED: break;

                case SPP_LINK_RELEASED:             break;

            case GAP_ESTABLISH_SCO_LINK:        break;

            case GAP_RELEASE_SCO_LINK:          break;

                case SPP_SEND_DATA:                 break;

          case SPP_INCOMING_DATA:             break;

                case SDAP_SERVICE_BROWSE:           break;

                case SDAP_SERVICE_REQUEST:          break;

                case MODULE_READY:

                /* At this point, the device is reset and ready to work */

                ++i;

                break;

            default:

                break;

          }

       

        if (SbEvent.bType == CFM) {

            //signal that sb command is completed

    status = ((!SbEvent.pPayload[0]) ? SBSTATUS_OK :

    SbEvent.pPayload[0]);

        }

    }

    uint16 usart_tx(uint16 Size)  // BA, 3/25/09

    {

          int i;

         

          for (i=0; i<Size; ++i) {

                U0TXBUF = SbCommand[i];

                while (!(IFG1 & UTXIFG0)); // USART0 TX buffer ready?

                //while (!(U0TCTL & TXEPT)); // USART0 TX buffer ready?

          }

          if (i==Size) {

                return Size;     

          } else {

                return 0;

          }

    }

    void usart_rx(uint8 *ch, int numBytes)

    {

          int i;

         

          for (i=0; i<numBytes; ++i) {

                while (!(IFG1 & URXIFG0)); // USART0 RX buffer ready? <<<<<<<<<<<< RUNTIME STUCKS HERE!!!!!!!!!!

                *ch = U0RXBUF;

          }

    }

     

    SBStatus_T SbSendCommand(uint16 Size)

    {

        uint8  err;

        void   *msg;

        uint16 checksum;

     

        SbCommand[0]    = STX;

        SbCommand[1]    = REQ;

        checksum        = SbCommand[1] + SbCommand[2] + SbCommand[3] + SbCommand[4];

        SbCommand[5]    = checksum % 256;

         

        SbCommand[Size - 1] = ETX;

     

        if (usart_tx(Size) == Size) {

                return SBSTATUS_OK;

        }

          else {

                return SBSTATUS_UART_INCOMPLETE_TRANSFER;

    }

    }

    SBStatus_T SbChangeUARTSettings(uint8 parityType, uint8 nStopBits)

    {

        uint16 payloadlen;

     

        payloadlen = 0x0002;      // page 140

     

        SbCommand[2] = CHANGE_UART_SETTINGS;

        SbCommand[3] = (payloadlen & 0x00FF); // payload size is stored

        SbCommand[4] = (payloadlen >> 8);     // in little endian fashion

        SbCommand[6] = 0;

        SbCommand[7] = 0;

       

        return SbSendCommand(7 + payloadlen);

    }

    SBStatus_T SbConfigureLocalDevice_New(void)

    {

          SBStatus_T status;

               

        status = SbChangeUARTSettings((uint8) 0, (uint8) 0);

        if (status == SBSTATUS_OK) {

          set_RESET_high();

          set_CTS_low();

            status = SbSetOperationMode(SB_COMMAND_MODE);

            if (status == SBSTATUS_OK) {

                if (status == SBSTATUS_OK) {

                    status = SbResetDevice();

                }

            }

        }

    }

    void SbTimerTask( void )

    {

        uint16 rxCount=20;

        uint8  in;

        uint16 DataLen;

        uint8  cs;

         

        while (rxCount > 0) {

          if ((P1IN & BIT3) != 1) {     // check RTS for 0

                set_CTS_low();

            switch(SbDevInfo.SbPacketState) {

            case SBPACKET_START:

                usart_rx(&in, 1); // <<<<<<<<<<<<<<<<<<<<<<<<          When called, runtime STUCKS here

                rxCount--;

                if (in == 0x2) {

                    SbDevInfo.SbPacketState = SBPACKET_TYPE;

                }

                else {

                    SbDevInfo.SbPacketState = SBPACKET_ERR;

                }

                break;

            case SBPACKET_TYPE:

                usart_rx(&in, 1);

                rxCount--;

                if (in == CFM || in == IND || in == RES) {

                    SbDevInfo.SbPacketState = SBPACKET_OPCODE;

                    SbEvent.bType   = in;

                }

                else {

                    SbDevInfo.SbPacketState = SBPACKET_ERR;

                }

                break;

            case SBPACKET_OPCODE:

                usart_rx(&in, 1);

                rxCount--;

                SbEvent.bOpcode = in;

                SbDevInfo.SbPacketState = SBPACKET_DATALENGTH;

                break;

            case SBPACKET_DATALENGTH:

                if (rxCount >= 2) {

                    usart_rx((uint8*)&DataLen, 2);

                    rxCount -=2;

                    SbEvent.wPayloadlen = DataLen;

                    SbDevInfo.SbPacketState = SBPACKET_CHECKSUM;

                }

                else {

                    return; //wait for some more bytes to receive

                }

                break;

            case SBPACKET_CHECKSUM:

                usart_rx(&in, 1);

                rxCount--;

                cs = SbEvent.bType + SbEvent.bOpcode +

                     (SbEvent.wPayloadlen >> 8) + (SbEvent.wPayloadlen & 0x00FF);

                if (cs == in) {

                    SbDevInfo.SbPacketState = SBPACKET_DATA;

                }

                else {

                    SbDevInfo.SbPacketState = SBPACKET_ERR;

                }

                break;

            case SBPACKET_DATA:

                if (rxCount >= (SbEvent.wPayloadlen - SbEvent.wPayloadOffset)) {

                    usart_rx(&SbEvent.pPayload[SbEvent.wPayloadOffset],

                             SbEvent.wPayloadlen - SbEvent.wPayloadOffset);

                    rxCount -=(SbEvent.wPayloadlen - SbEvent.wPayloadOffset);                        

                    SbDevInfo.SbPacketState = SBPACKET_END;

                    SbEvent.wPayloadOffset = 0;

                }

                else {

                    usart_rx(&SbEvent.pPayload[SbEvent.wPayloadOffset],

                             rxCount);

                    SbEvent.wPayloadOffset = rxCount;

                    rxCount = 0;

                }

                break;

            case SBPACKET_END:

                usart_rx(&in, 1);

                if (in == ETX) {

                    SbProcessFrame();    /* process the frame once received */

                    SbDevInfo.SbPacketState = SBPACKET_START;

                    //return;

                }

                else {

                    SbDevInfo.SbPacketState = SBPACKET_ERR;

                }

                break;

            default:

                // invalid Packet received from SB usart,skipping of bytes

                // to next valid packet is not incorporated. simply blue assumes

                // error free usart transport. No further processing.

                // apps should call SbGetPacketState() and do proper exit or

                // analyze on error state.

                SbDevInfo.SbPacketState = SBPACKET_ERR;

                return;

            }   // switch{}

          }     // if {}

        } // while ()

    }    

     

     

  • 4/3/09

    I updated some of my routines as below, and now I am getting the MODULE_READY (0x25) message from LMX9838.  I am sorry to say that RTS interrupts are not taking place yet.  If you can throw light as how I can get RTS interrupts (high to low transition).

    Thanks for all of your help.

    Babuddin

    void UART0_ports_Initialize(void) {

          // P6.7:  BT_RESET

          P6SEL &= ~BIT7;   // I/O function

          P6DIR |= BIT7;    // output

          P6OUT &= ~BIT7;   // set RESET low

     

          // P1.6 for BTh I/O, CTS: active low made by MSP430

          P1SEL &= ~BIT6;   // 0=I/O

          P1DIR |= BIT6;    // output

          P1OUT |= BIT6;    // set CTS high

     

          // P1.3 for BTh I/O, RTS: active low made by BTh

          P1SEL &= ~BIT3;   // 0=I/0 function

          P1DIR &= ~BIT3;   // input

          P1IES |= BIT3;    // active low, high to low transition

          P1IFG &= ~BIT3;   // clear the flag

          P1IE  |= BIT3;    // enable interrupts, BA 3/30/09 ????????

    }

    void UART0_Initialize(void) {

          // As per page 13-4 of MSP430x1xx User guide

          // 1. set SWRST

                U0CTL = SWRST;

          // 2. initialize all UART registers

                // P3 bits 4 and 5 are for special function UART0

                P3SEL |= 0x30;

               

                // BRCLK=ACLK=8MHz, BR=115K; UART calculator, values: U0BR0 = 0x45,

                // U0BR1=0x00, U0MCTL=0xAA.

                // SSEL0=ACLK

                U0CTL = CHAR;     // parity disabled, 1 stop bit, SYNC=0/UART mode,

                U0TCTL = (SSEL0); // | TXEPT | URXSE);// ACLK is BRCLK source clock

                U0RCTL = 0;

                U0MCTL = 0xAA;    // from calculator, BR=115K

                U0BR0 = 0x45;     // from calculator, BR=115K

                U0BR1 = 0x00;

          // 3. enable UART module

                ME1 |= UTXE0 | URXE0;  

          // 4. clear SWRST

                U0CTL &= ~SWRST;

          // 5. enable interrupts

                IE1 |= URXIE0; // | UTXIE0;   // enable UART interrupts

          // init ports

                UART0_ports_Initialize();

    }     // UART0_Initialize()

     

  • Babu,

    Sounds like you are making progress. I'll take a look at your code this weekend when I have more time. I'm not really familiar with the code you are using (I wrote all of mine from scratch) so I'll have to compare it to what I have written.

    dave

  • Hi Dave,

    The RTS interrupt (high to low transition) from LMX to MSP is not taking place.  What I see is that at power up, the RTS line is low on the PCB.   

    Should I ask the HW engineer to make the RTS line high at power up? (Does it make sense to you?, It does to me)

    Babuddin

     

  • It all depends on how your hardware is set up. For instance, in my case I just use GPIO lines for my CTS and RTS lines and control them myself in software. For the most part, I don't even look at the RTS line of the 9838. I'm sure you're aware of this but the line you're using for CTS on the CPU goes to the RTS line on the 9838. And the RTS line of the 9838 goes to the pin you're using as RTS on the CPU. For the most part, you really only need 4 lines: Rx, Tx, CTS and RST (reset). With that, you should be able to do everything you need to do between the CPU and the 9838.

    As to your question, you should have the following:

    CPU  9838
    Rx  -> Tx
    Tx  <- Rx
    CTS -> RTS
    RTS <- CTS
    RST -> RST

    That's all you really need. Now I use an interrupt handler for the UART receive (I actually have it set up to use DMA) so that may be worth consideration.

  • Hi Dave,

     

    Below is a routine to establish a link to remote BTh device.  I got it from NSC web site, LMX9838 (file name: sb_custom.c).  I can get local BdAddr by sending a command, GAP_READ_LOCAL_BDA (0x05).

     

    What should be the value for LocalPortNo param?

    What should be the value for RemotePortNo param?

     

    Thanks for all of your help, and waiting for your response.

     

    Babuddin

     

    SBStatus_T SbEstablishLink(BdAddrType BdAddr,

                               uint8 LocalPortNo,

                               uint8 RemotePortNo) 

    {

        uint16 payloadlen;

        uint8  SbCommand[15];

        int    i;

        uint8  err;

        void   *msg;

     

        payloadlen = 0x0008;

     

        SbCommand[2] = SPP_ESTABLISH_LINK;

        SbCommand[3] = (payloadlen & 0x00FF); // payload size is stored

        SbCommand[4] = (payloadlen >> 8);     // in little endian fashion

     

        SbCommand[6] = LocalPortNo;           // Localport

       

        for (i = 0; i < 6; i++) {

            SbCommand[7 + i] = BdAddr[i];     // BDA

        }

       

        SbCommand[7 + i] = RemotePortNo;      // Remoteport

     

        if (SbSendCommand(SbCommand, 7 + payloadlen) == SBSTATUS_OK) {

            //wait till link is established

            msg = OSMboxPend(SbDevInfo.SbCmdMbox, BTCORE_CALLBACK_TIMEOUT, &err);

            if ( err == OS_NO_ERR && ((uint32)(msg) == SBSTATUS_OK)) {

                return SBSTATUS_OK;

            }

        }

     

        return SBSTATUS_ERROR;

    }

     

     

  • Hi Dave,

     

    In the routine SbEstablishLink(), in my previous email, the NSC example is using an OS call OSMboxPend(), to wait until link is established.

     

    In my application, there is no OS, so:

    What should be my mechanism to wait until link has been established?

    Babuddin

  • Babu,

    The first thing you need to do is decide what it is your trying to accomplish. Is your hardware/application a [serial] cable replacement (SPP protocol)? If so, then that's a relatively simple case to handle. Are you going to be attempting to communicate with multiple boards? If so, then you'll have to deal with piconets and who is the master (your PC application most likely). And so forth. Once you have that all ironed out, then you can decide what parts of the Bluetooth protocol you want/need to support.

    My suggestion to you is to write your own application, that's what I did. That will allow you to have complete control over what the 9838 and the 430 are doing. I looked at the same code that you are using and really didn't care for it [which is why I wrote my own].

    Basically, what you need to do is to use an interrupt handler (the UART receive interrupt) to catch the characters (packets) that come in from the 9838.  Watch for the Bluetooth header start character (0x02) and collect the characters until you get the end character (0x03). Then you know that you have a complete packet. You can then look at the packet header and decide what to do with it. Once you have initialized the 9838 and received the welcome message (module ready message), you can then wait for the BT_SPP_INCOMING_LINK_ESTABLISHED message (assuming you are establishing connections from the outside, like your PC or phone or whatever). You can also watch for the BT_SPP_TRANSPARENT_MODE message which means you can then just communicate with your hardware as if it is connected via a serial cable.

    So that's the way I would approach it. Over the course of the last 6 months I have generalized my code quite a bit because some of my devices use USB and some use Bluetooth. So keep your code as generic as possible.

    I know that I haven't addressed your specific question but that's because I'm not really familiar with that code. Like I said, I looked at it and then rejected it in favor of writing my own. Take a step back and decide what it is your trying to accomplish and then go from there. Writing the interrupt handler such that you can collect the bytes coming in from the 9838 is the first step. Once you have that working, then the rest of it should be pretty straight forward.

  • Hi Dave,

    ** Question regarding my code which gets SPP_INCOMING_LINK_ESTABLISHED indication from LMX **

    The operating environment of the two Bluetooth devices in my case is as below:

    1.       PC:  client which initiates communication by clicking on the BTh address of Transmitter

    2.       Transmitter:  an embedded device that I am working on (has National BTh chip LMX9838, and TI MSP430F149 processor)

    In my power up code, I put transmitter in idle automatic, waiting to be connected.  When it gets an incoming link from PC, then it should get connected to PC.

     In the transmitter code, the following is what I do after getting the module ready response from the LMX:

    1.       Send a command to LMX to set the operation mode to AUTOMATIC ON.

    2.       Then as per chapters 1 through 4 of the ‘LMX9838 Software User Guide’, AN1699, I wait for an indication event from the LMX to the MSP, termed as SPP_INCOMING_LINK_ESTABLISHED. 

    Note: First I start a BTh client application on PC, select address of the transmitter and click connect.

    The code for the above two steps are below:

    1.       setOperationMode(AUTOMATIC_ON); // WORKS

    2.  void waitUntilLinkEstablished(void) {     // TO BE TESTED

         

          do {

                SbTimerTask_New();

          } while (rx_buffer[2] != SPP_INCOMING_LINK_ESTABLISHED);

     

    }

    3.       The code for SbTimerTask_New()is below:

    BOOL SbTimerTask_New( void )  // WORKS

    {

          uint8 i=0;

          uint8 j=0;

        uint8 ch=0;

        BOOL status=FALSE;

        BOOL done=FALSE;

        BOOL STX_rcvd=FALSE;

       

        set_CTS_low();

        while (!done) {

          usart_rx(&ch, 1);

          if (ch == STX) {

                rx_buffer[i++] = ch;

                STX_rcvd = TRUE;

          }

          else if (ch == ETX) {

                rx_buffer[i++] = ch;

                done = TRUE;

                status = TRUE;

          }

          else {

                if (STX_rcvd != FALSE) {

                            rx_buffer[i++] = ch;

                }

                else {

                      ++j;

                      if (j > 100) {

                            done = TRUE;

                            status = FALSE;

                      }

                }

          }

        } // while (!done)

        set_CTS_high();

        return status;

    }     // SbTimerTask_New()

     

    Now my questions:

    1.       Is my thought process correct?

    2.       Is my code in step 2 above correct?

    I do not have enough words to thank you.  I look forward for your response.

    Babu

  • Babu,

    I think you basically have it correct. After starting up you board, it should just be waiting for an SPP_INCOMING_LINK_ESTABLISHED notification and then act upon it. In my case, rather than setting the operational mode to AUTOMATIC_ON, I issue an GAP_SET_SCANMODE command and then go into waiting. After the link established command, you may also get an SPP_TRANSPARENT_MODE command as well which you can choose to ignore or act upon. It's really only helpful if transparent mode gets turned off since you then need to either turn it back on or assume that you may have additional handshaking to do. I wouldn't worry about this too much at this point.

    Your code in step 2 is basically correct as well. Until you have a connection established, you just wait. You can try adjusting your different delay values if it seems like you are missing anything. But it looks like you are on the right path at this point.

  • Hi Dave,

    Thanks much for your response.

    Now the question:

    Do you know a Bluetooth chip which supports DMA?

    Note: The National LMX9838 does not support DMA,  and its UART is slow for our purpose.  Although it supports a max UART baud rate of 921.6 Kbps, but my controller is MSP430F2419, which goes only up to 115 Kbps.

    Babu

     

  • I doubt seriously any bluetooth chip supports DMA. The UART or micro-controller would be the thing to support DMA. For instance, I use the MSP430F2618 and it supports DMA. In fact, I use DMA to transmit the data. Since I receive far less data than I transmit, I just use an interrupt handler to deal with receiving data. I generally run my UART at 115K since I have found 921K to not work very well. And the amount of data I am sending doesn't require it so 115k is fine for my purposes.

    Now, on other projects where I use a dsPIC processor (sorry TI), we do run our bluetooth connections at 921K without any problems. So it really does depend on the micro-controller.

  • Hi  Dave,

    First of all, thanks for all of your help.

    Two questions for now:

    1.       When I send SDAP_SERVICE_BROWSE command from controller to LMX9838, I get number of services byte in the CFM message as 0, pages 86 and 87 of LMX SW User guide, AN-1699.  Which indicates LMX9838 does not provide any services.  Why LMX does not provide any services?  How can I make it to provide SPP service?

    2.       What is the importance of ‘class of device’, entry 10 in Table 2 in the SW User guide.  As default it is all 0. Does ‘class of device’ has something to do with number of services provided by LMX?

    I look forward for your response.

    Babu

  • Hi Dave,

    I am ready to test Bluetooth SPP functionality code of my embedded device, which sends bytes to a PC.  But I do not have a Bluetooth SPP application which runs on a PC. 

    Do you know where I can get SPP application that runs on a PC?

    OR:

    There is a Bluetooth icon in system tray. It has a SHARE tab.  This tab allows sharing of files between two Bluetooth paired devices.  How can I make it to provide SPP functionality?

    Babu

  • Babu,

    I'm on vacation until the 10th. The best answer I can provide for you with regards to testing is to write a small application on the PC and use it to test. I wrote mine in python which makes it very quick to write. If you use pyserial (python library) it makes things very easy to connect. But then you'll have to implement something on your board to communicate with the application. Or, go to someplace like softpedia.com and get a trial version of a bluetooth test application. That would be the quickest.

    dave

  • Hi,

    I have interfaced LMX9838 BT device to UART1 of MSP430F1611 device , I need to send SMS from this BT device to any other mobile using BT profile(SPP) .

    I searched for sample code and doc which give some information to implement this but I could not get any information .

    I went through the datasheet of the LMX9838 but did not get required info ..

    Pls help me in finding docs/ code which helps me to start the implementation ..

     

    regards

    chethan 

**Attention** This is a public forum