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.

MSP430FR4133: How to use HC-05 bluetooth module to toggle LED

Part Number: MSP430FR4133
Other Parts Discussed in Thread: ENERGIA

Firstly, I am a complete newcomer to this hence my lack of knowledge on the subject so I do apologise.

I have a MSP430FR4133 launch pad Rev 1.0 and a HC-05 bluetooth module I picked up off the Pi Hut : https://thepihut.com/products/hc-05-bluetooth-module

The bluetooth module has the following pins Vcc, Ground , RXD TXD En and State - I know En and State are not required to be connected to the board

I have tried for many hours to communicate by connecting RXD and TXD to P1.1 and P1.0 and many iterations of code in Energia (as yet again I am new to this)

I can power on the HC-05 module via the MSP and even connect via my computers bluetooth. In energia I can even select the HC-05 port for serial monitor.

Effectively what I want to do is connect the HC-05 so that I can sent over the serial monitor a 1 which will turn on the RED LED and a 0 that will turn it off.

If my connections are connecting the same pins to what the HC-05 how would I code this in energia to work. Any help is massively appreciated as Energia code is close to Arduino which I understand

  • Are you communicating with the Module? If you send the command to get its status does it answer back?

    What pins do you have connected to the module? You want the TXD of the MSP to go the the RXD of the HC05 and vice-versa. Make sure you have the correct initial baud rate

  • I have tried communicating with the module over Energia with the port on the HC-05 and I get no response. I can access some info about it via command line like MAC address and last access date but not sure how to get its status.

    Connections are as follows:

    Bluetooth Module - MSP430FR4133:

    Vcc - 3V3 

    GND - GND

    RXD - TXD

    TXD - RXD

    And here is the code I have compiled to the MSP:

    #define LED RED_LED

    #include <SoftwareSerial.h>

    SoftwareSerial BTserial(3,4);

    void setup() {
    Serial.begin(9600);
    BTserial.begin(9600);
    }

    void loop() {
    if (BTserial.available())
    {
    byte x = BTserial.read();
    if(x == '1'){
    digitalWrite(LED, HIGH);
    }
    Serial.write(x);
    BTserial.write(x);
    }

    if (Serial.available())
    {
    byte y = Serial.read();
    if(y == '2'){
    digitalWrite(LED, LOW);
    }
    BTserial.write(y);
    Serial.write(y);
    }
    }

  • Walk before you run. Look at the HC-05 data sheet. Find the command to have the unit send some info back. Use BTSerial.Write to send that command. Once serial available shows that data has arrived, copy that data to Serial.

    If this works, you know you have established communication.

  • Thanks again for the help keith. So I tried communicating as you said with the bluetooth commands, just sending a simple AT was the goal with the response OK expected. This response was never received.

    I found this good video on youtube of how to communicate with commands on the HC-05 https://youtu.be/BXXAcFOTnBo

    It made me realise that my Energia (non windows) doesnt have the COM serial ports that windows versions do and this could be my issue.

    I am going to get a hold of a windows version and try this communication and will let you know how it goes

  • IF you are on a Mac, you just need to find what serial port is being used. It should list them for you, and you usually have 2 choices. I always guess the wrong one first.

  • The command that should return an OK is AT. I have two bluetooth ports to choose from and two USB ones. The ports are

    HC-05 - you would suspect it is this one, but alas nothing is returned when AT is sent

    Bluetooth Incoming Port - same as above 

    USBModem 12401 - this one does return something when at is said but its a bunch of []? symbols - I have tried all baud rates and none of it changed this.

    USBModem 12403 - nothing returned.

    I have connected the RX and TX as said to pins 1.1 and 1.0 hence have tried changing my definition of BTSerial to pins 3,4 or 1.0,1.1 or 23,24 or 7,8 none of them work.

    The only promising sign is that I have visual confirmation when I connect my device to the HC-05 as the light switches from rapid blinking to longer gaps.

    Wondering if i have bit off more than I can chew here as I don't know how to communicate with it.

  • Again, lets step back here. Forget about the bluetooth for a second. We just want to get the MCU communicating.

    First remove the HC-05, run the arduino hello world program:

    https://arduinogetstarted.com/tutorials/arduino-hello-world

    Next, hook up the HC-05 and get the AT command working printing "OK" to your console.

    Now worry about bluetooth.

  • Ok thanks again - I got hello world outputting to the console. 

    I have connected the HC-05. 

    I try sending the command AT over the code e.g BTSerial.println("AT");

    I try sending the command using the Serial monitors input box - no response.

    I suspect I haven't set up the HC-05 SoftwareSerial correctly or something. 

    I have it connected as said with RX/TX pins - Am I selecting the wrong pins when making SoftwareSerial?

  • I don't know, I dropped Energia ages ago. And I was unable to find board info for your board.

  • Ah okay - thanks again appreciate the help.

  • Do you have a scope available?

    Do you have a link to the board parameters?

  • I don't have access to a scope unfortunately.

    Not entirely sure what board parameters are sorry - I have this board specific file called pins in energia if this is what you mean

    /*
      ************************************************************************
      *	pins_energia.h
      *
      *	Pin definition functions for LaunchPad w/ msp430fr4133
      *		Copyright (c) 2015 Robert Wessels. All right reserved.
      *
      *     Contribution: Stefan Sch
      *
      ***********************************************************************
      Derived from:
      pins_arduino.h - Pin definition functions for Arduino
      Part of Arduino - http://www.arduino.cc/
    
      Copyright (c) 2007 David A. Mellis
    
      This library is free software; you can redistribute it and/or
      modify it under the terms of the GNU Lesser General Public
      License as published by the Free Software Foundation; either
      version 2.1 of the License, or (at your option) any later version.
    
      This library is distributed in the hope that it will be useful,
      but WITHOUT ANY WARRANTY; without even the implied warranty of
      MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
      Lesser General Public License for more details.
    
      You should have received a copy of the GNU Lesser General
      Public License along with this library; if not, write to the
      Free Software Foundation, Inc., 59 Temple Place, Suite 330,
      Boston, MA  02111-1307  USA
    */
    
    
    #ifndef Pins_Energia_h
    #define Pins_Energia_h
    #ifndef BV
    #define BV(x) (1 << (x))
    #endif
    
    #include <msp430fr2xx_4xxgeneric.h>
    
    // Attribute for placing R/W variables in FRAM
    // Example
    //      uint8_t DisplayBuffer[LCD_MAXIMUM_Y][LCD_MAXIMUM_X] PLACE_IN_FRAM;
    #define PLACE_IN_FRAM __attribute__((section(".text;")))
    
    
    #if defined(__MSP430_HAS_EUSCI_B0__)
    static const uint8_t SS      = 8;   /* P2.5 */
    static const uint8_t SCK     = 7;   /* P5.1 */
    static const uint8_t MOSI    = 15;  /* P5.2 aka SIMO */
    static const uint8_t MISO    = 14;  /* P5.3 aka SOMI */
    static const uint8_t TWISCL1  = 9;   /* P8.2 SW I2C */
    static const uint8_t TWISDA1  = 10;  /* P8.3 SW I2C */
    static const uint8_t TWISDA0  = 15;  /* P5.2 UCB0 */
    static const uint8_t TWISCL0  = 14;  /* P5.3 UCB0 */
    #define TWISDA0_SET_MODE  (PORT_SELECTION0 | INPUT_PULLUP)
    #define TWISCL0_SET_MODE  (PORT_SELECTION0 | INPUT_PULLUP)
    #define TWISDA1_SET_MODE  (INPUT_PULLUP)
    #define TWISCL1_SET_MODE  (INPUT_PULLUP)
    #define SPISCK_SET_MODE  (PORT_SELECTION0)
    #define SPIMOSI_SET_MODE (PORT_SELECTION0)
    #define SPIMISO_SET_MODE (PORT_SELECTION0)
    /* Define the default I2C settings */
    #define DEFAULT_I2C -1 /* indicates SW I2C on pseudo module 1 */
    #define TWISDA TWISDA1
    #define TWISCL TWISCL1
    #define TWISDA_SET_MODE  TWISDA1_SET_MODE
    #define TWISCL_SET_MODE  TWISCL1_SET_MODE
    #endif
    
    #if defined(__MSP430_HAS_EUSCI_A0__) || defined(__MSP430_HAS_EUSCI_A1__)
    static const uint8_t DEBUG_UARTRXD = 3;  /* Receive  Data (RXD) at P1.1 */
    static const uint8_t DEBUG_UARTTXD = 4;  /* Transmit Data (TXD) at P1.0 */
    #define DEBUG_UARTRXD_SET_MODE (PORT_SELECTION0 | INPUT)
    #define DEBUG_UARTTXD_SET_MODE (PORT_SELECTION0 | OUTPUT)
    #define DEBUG_UART_MODULE_OFFSET 0x00
    #endif
    
    /* Enable P4.1/2 as XTAL pins = FR4133 */
    #define INIT_LFXTAL_PINS 	P4SEL0 = BIT1 | BIT2
    #define F_CPU  16000000L
    
    
    /* Analog pins */
    static const uint8_t A0  = 4;
    static const uint8_t A1  = 3;
    static const uint8_t A2  = 128 + 2;  // Not available on BoosterPack header
    static const uint8_t A3  = 13;
    static const uint8_t A4  = 12;
    static const uint8_t A5  = 11;
    static const uint8_t A6  = 18;
    static const uint8_t A7  = 19;
    static const uint8_t A8  = 6;
    static const uint8_t A9  = 2;
    static const uint8_t A10 = 128 + 10; // Not available on BoosterPack header
    static const uint8_t A11 = 128 + 11; // Not available on BoosterPack header
    static const uint8_t A12 = 128 + 12; // Not available on BoosterPack header
    static const uint8_t A13 = 128 + 13; // Not available on BoosterPack header
    static const uint8_t A14 = 128 + 14; // Not available on BoosterPack header
    static const uint8_t A15 = 128 + 15; // Not available on BoosterPack header
    
    //-------------------------------------------
    
    /* Layout of the 2 - 10 pin headers.
    
       All pins support digitalWrite() and attachInterrupt()
       Pins marked with PWM support anaglogWrite()
       Pins marked with Ax support analogRead()
    
                                              +---\/---+
                                       VCC0  1|        |20  GND
                                (A9)   P8.1  2|        |19  P1.7            (A7) (PWM)
          (UCA0RXD -> Serial0)  (A1)   P1.1  3|        |18  P1.6            (A6) (PWM)
          (UCA0TXD -> Serial0)  (A0)   P1.0  4|        |17  P5.0
                                       P2.7  5|        |16  RST
                                (A8)   P8.0  6|        |15  P5.2 (SDA) (MOSI)
                        (SCK)          P5.1  7|        |14  P5.3 (SCL) (MISO)
                                       P2.5  8|        |13  P1.3            (A3) 
                                       P8.2  9|        |12  P1.4            (A4) 
                        (PWM)          P8.3 10|        |11  P1.5            (A5) 
                                              +--------+
    
    
                                                   ----+
                                                       |4   DebugUART TX  (P1.0) (A0)
                         J13 eZ-FET Connector          |3   DebugUART RX  (P1.1) (A1)
                                                       |21  DebugUART CTS (P2.4)
                                                       |22  DebugUART RTS (P2.3)
                                                   ----+
                                                   ----+
                                                       |4   LED1       (P1.0)    (A0)
                         Extra LED's and Switches      |23  LED2       (P4.0)   (PWM)
                                                       |24  PUSH1      (P1.2)    (A2)
                                                       |25  PUSH2      (P2.6)
                                                   ----+
    */
    
    // Pin names based on the silkscreen
    //
    
    static const uint8_t P1_0 = 4;
    static const uint8_t P1_1 = 3;
    static const uint8_t P1_2 = 24;
    static const uint8_t P1_3 = 13;
    static const uint8_t P1_4 = 12;
    static const uint8_t P1_5 = 11;
    static const uint8_t P1_6 = 18;
    static const uint8_t P1_7 = 19;
    
    //static const uint8_t P2_0 = ;
    //static const uint8_t P2_1 = ;
    //static const uint8_t P2_2 = ;
    static const uint8_t P2_3 = 22;
    static const uint8_t P2_4 = 21;
    static const uint8_t P2_5 = 8;
    static const uint8_t P2_6 = 25;
    static const uint8_t P2_7 = 5;
    
    //static const uint8_t P3_0 = ;
    //static const uint8_t P3_1 = ;
    //static const uint8_t P3_2 = ;
    //static const uint8_t P3_3 = ;
    //static const uint8_t P3_4 = ;
    //static const uint8_t P3_5 = ;
    //static const uint8_t P3_6 = ;
    //static const uint8_t P3_7 = ;
    
    static const uint8_t P4_0 = 23;
    //static const uint8_t P4_1 = ;
    //static const uint8_t P4_2 = ;
    //static const uint8_t P4_3 = ;
    //static const uint8_t P4_4 = ;
    //static const uint8_t P4_5 = ;
    //static const uint8_t P4_6 = ;
    //static const uint8_t P4_7 = ;
    
    static const uint8_t P5_0 = 17;
    static const uint8_t P5_1 = 7;
    static const uint8_t P5_2 = 15;
    static const uint8_t P5_3 = 14;
    //static const uint8_t P5_4 = ;
    //static const uint8_t P5_5 = ;
    //static const uint8_t P5_6 = ;
    //static const uint8_t P5_7 = ;
    
    static const uint8_t P8_0 = 6;
    static const uint8_t P8_1 = 2;
    static const uint8_t P8_2 = 9;
    static const uint8_t P8_3 = 10;
    //static const uint8_t P8_4 = ;
    //static const uint8_t P8_5 = ;
    //static const uint8_t P8_6 = ;
    //static const uint8_t P8_7 = ;
    
    //static const uint8_t PJ_0 = ;
    //static const uint8_t PJ_1 = ;
    //static const uint8_t PJ_2 = ;
    //static const uint8_t PJ_3 = ;
    //static const uint8_t PJ_4 = ;
    //static const uint8_t PJ_5 = ;
    //static const uint8_t PJ_6 = ;
    //static const uint8_t PJ_7 = ;
    
    
    static const uint8_t LED1 = 4;
    static const uint8_t LED2 = 23;
    /* For LaunchPad compatability */
    static const uint8_t RED_LED = 4;
    static const uint8_t GREEN_LED = 23;
    
    static const uint8_t PUSH1 = 24;
    static const uint8_t PUSH2 = 25;
    static const uint8_t TEMPSENSOR = 128 + 12; // depends on chip
    
    #ifdef ARDUINO_MAIN
    const uint16_t port_to_input[] = {
       NOT_A_PORT,
       (uint16_t) (P1_BASE+OFS_P1IN),
       (uint16_t) (P2_BASE+OFS_P2IN),
    #ifdef __MSP430_HAS_PORT3_R__
       (uint16_t) (P3_BASE+OFS_P3IN),
    #endif
    #ifdef __MSP430_HAS_PORT4_R__
       (uint16_t) (P4_BASE+OFS_P4IN),
    #endif
    #ifdef __MSP430_HAS_PORT5_R__
       (uint16_t) (P5_BASE+OFS_P5IN),
    #endif
    #ifdef __MSP430_HAS_PORT6_R__
       (uint16_t) (P6_BASE+OFS_P6IN),
    #endif
    #ifdef __MSP430_HAS_PORT7_R__
       (uint16_t) (P7_BASE+OFS_P7IN),
    #endif
    #ifdef __MSP430_HAS_PORT8_R__
       (uint16_t) (P8_BASE+OFS_P8IN),
    #endif
    #ifdef __MSP430_HAS_PORT9_R__
       (uint16_t) (P9_BASE+OFS_P9IN),
    #endif
    #ifdef __MSP430_HAS_PORT10_R__
       (uint16_t) (P10_BASE+OFS_P10IN),
    #endif
    #ifdef __MSP430_HAS_PORTJ_R__
       (uint16_t) (PJ_BASE+OFS_PJIN),
    #endif
    };
    
    const uint16_t port_to_output[] = {
       NOT_A_PORT,
       (uint16_t) (P1_BASE+OFS_P1OUT),
       (uint16_t) (P2_BASE+OFS_P2OUT),
    #ifdef __MSP430_HAS_PORT3_R__
       (uint16_t) (P3_BASE+OFS_P3OUT),
    #endif
    #ifdef __MSP430_HAS_PORT4_R__
       (uint16_t) (P4_BASE+OFS_P4OUT),
    #endif
    #ifdef __MSP430_HAS_PORT5_R__
       (uint16_t) (P5_BASE+OFS_P5OUT),
    #endif
    #ifdef __MSP430_HAS_PORT6_R__
       (uint16_t) (P6_BASE+OFS_P6OUT),
    #endif
    #ifdef __MSP430_HAS_PORT7_R__
       (uint16_t) (P7_BASE+OFS_P7OUT),
    #endif
    #ifdef __MSP430_HAS_PORT8_R__
       (uint16_t) (P8_BASE+OFS_P8OUT),
    #endif
    #ifdef __MSP430_HAS_PORT9_R__
       (uint16_t) (P9_BASE+OFS_P9OUT),
    #endif
    #ifdef __MSP430_HAS_PORT10_R__
       (uint16_t) (P10_BASE+OFS_P10OUT),
    #endif
    #ifdef __MSP430_HAS_PORTJ_R__
       (uint16_t) (PJ_BASE+OFS_PJOUT),
    #endif
    };
    
    const uint16_t port_to_dir[] = {
       NOT_A_PORT,
       (uint16_t) (P1_BASE+OFS_P1DIR),
       (uint16_t) (P2_BASE+OFS_P2DIR),
    #ifdef __MSP430_HAS_PORT3_R__
       (uint16_t) (P3_BASE+OFS_P3DIR),
    #endif
    #ifdef __MSP430_HAS_PORT4_R__
       (uint16_t) (P4_BASE+OFS_P4DIR),
    #endif
    #ifdef __MSP430_HAS_PORT5_R__
       (uint16_t) (P5_BASE+OFS_P5DIR),
    #endif
    #ifdef __MSP430_HAS_PORT6_R__
       (uint16_t) (P6_BASE+OFS_P6DIR),
    #endif
    #ifdef __MSP430_HAS_PORT7_R__
       (uint16_t) (P7_BASE+OFS_P7DIR),
    #endif
    #ifdef __MSP430_HAS_PORT8_R__
       (uint16_t) (P8_BASE+OFS_P8DIR),
    #endif
    #ifdef __MSP430_HAS_PORT9_R__
       (uint16_t) (P9_BASE+OFS_P9DIR),
    #endif
    #ifdef __MSP430_HAS_PORT10_R__
       (uint16_t) (P10_BASE+OFS_P10DIR),
    #endif
    #ifdef __MSP430_HAS_PORTJ_R__
       (uint16_t) (PJ_BASE+OFS_PJDIR),
    #endif
    };
    
    const uint16_t port_to_ren[] = {
    	   NOT_A_PORT,
    	   (uint16_t) (P1_BASE+OFS_P1REN),
    	   (uint16_t) (P2_BASE+OFS_P2REN),
    	#ifdef __MSP430_HAS_PORT3_R__
    	   (uint16_t) (P3_BASE+OFS_P3REN),
    	#endif
    	#ifdef __MSP430_HAS_PORT4_R__
    	   (uint16_t) (P4_BASE+OFS_P4REN),
    	#endif
    	#ifdef __MSP430_HAS_PORT5_R__
    	   (uint16_t) (P5_BASE+OFS_P5REN),
    	#endif
    	#ifdef __MSP430_HAS_PORT6_R__
    	   (uint16_t) (P6_BASE+OFS_P6REN),
    	#endif
    	#ifdef __MSP430_HAS_PORT7_R__
    	   (uint16_t) (P7_BASE+OFS_P7REN),
    	#endif
    	#ifdef __MSP430_HAS_PORT8_R__
    	   (uint16_t) (P8_BASE+OFS_P8REN),
    	#endif
    	#ifdef __MSP430_HAS_PORT9_R__
    	   (uint16_t) (P9_BASE+OFS_P9REN),
    	#endif
    	#ifdef __MSP430_HAS_PORT10_R__
    	   (uint16_t) (P10_BASE+OFS_P10REN),
    	#endif
    	#ifdef __MSP430_HAS_PORTJ_R__
    	   (uint16_t) (PJ_BASE+OFS_PJREN),
    	#endif
    };
    
    const uint16_t port_to_sel0[] = {  /* put this PxSEL register under the group of PxSEL0 */
    	   NOT_A_PORT,
    	   (uint16_t) (P1_BASE+OFS_P1SEL0),
    	   (uint16_t) (P2_BASE+OFS_P2SEL0),
    	#ifdef __MSP430_HAS_PORT3_R__
    	   (uint16_t) (P3_BASE+OFS_P3SEL0),
    	#endif
    	#ifdef __MSP430_HAS_PORT4_R__
    	   (uint16_t) (P4_BASE+OFS_P4SEL0),
    	#endif
    	#ifdef __MSP430_HAS_PORT5_R__
    	   (uint16_t) (P5_BASE+OFS_P5SEL0),
    	#endif
    	#ifdef __MSP430_HAS_PORT6_R__
    	   (uint16_t) (P6_BASE+OFS_P6SEL0),
    	#endif
    	#ifdef __MSP430_HAS_PORT7_R__
    	   (uint16_t) (P7_BASE+OFS_P7SEL0),
    	#endif
    	#ifdef __MSP430_HAS_PORT8_R__
    	   (uint16_t) (P8_BASE+OFS_P8SEL0),
    	#endif
    	#ifdef __MSP430_HAS_PORT9_R__
    	   (uint16_t) (P9_BASE+OFS_P9SEL0),
    	#endif
    	#ifdef __MSP430_HAS_PORT10_R__
    	   (uint16_t) (P10_BASE+OFS_P10SEL0),
    	#endif
    	#ifdef __MSP430_HAS_PORTJ_R__
    	   (uint16_t) (PJ_BASE+OFS_PJSEL0),
    	#endif
    };
    
    const uint16_t port_to_sel1[] = {
    	   NOT_A_PORT,
    	   (uint16_t) (P1_BASE+OFS_P1SEL1),
    	   (uint16_t) (P2_BASE+OFS_P2SEL1),
    	#ifdef __MSP430_HAS_PORT3_R__
    	   (uint16_t) (P3_BASE+OFS_P3SEL1),
    	#endif
    	#ifdef __MSP430_HAS_PORT4_R__
    	   (uint16_t) (P4_BASE+OFS_P4SEL1),
    	#endif
    	#ifdef __MSP430_HAS_PORT5_R__
    	   (uint16_t) (P5_BASE+OFS_P5SEL1),
    	#endif
    	#ifdef __MSP430_HAS_PORT6_R__
    	   (uint16_t) (P6_BASE+OFS_P6SEL1),
    	#endif
    	#ifdef __MSP430_HAS_PORT7_R__
    	   (uint16_t) (P7_BASE+OFS_P7SEL1),
    	#endif
    	#ifdef __MSP430_HAS_PORT8_R__
    	   (uint16_t) (P8_BASE+OFS_P8SEL1),
    	#endif
    	#ifdef __MSP430_HAS_PORT9_R__
    	   (uint16_t) (P9_BASE+OFS_P9SEL1),
    	#endif
    	#ifdef __MSP430_HAS_PORT10_R__
    	   (uint16_t) (P10_BASE+OFS_P10SEL1),
    	#endif
    	#ifdef __MSP430_HAS_PORTJ_R__
    	   (uint16_t) (PJ_BASE+OFS_PJSEL1),
    	#endif
    };
    
    const uint8_t digital_pin_to_timer[] = {
    	NOT_ON_TIMER,  /*  0 - pin count starts at 1 */
    	NOT_ON_TIMER,  /*  1 - Vcc */
    	NOT_ON_TIMER,  /*  2 - P8.1 */
    	NOT_ON_TIMER,  /*  3 - P1.1 */
    	NOT_ON_TIMER,  /*  4 - P1.0 */
    	NOT_ON_TIMER,  /*  5 - P2.7 */
    	NOT_ON_TIMER,  /*  6 - P8.0 */
    	NOT_ON_TIMER,  /*  7 - P5.1 */
    	NOT_ON_TIMER,  /*  8 - P2.5 */
    	NOT_ON_TIMER,  /*  9 - P8.2 */
    	T1A2,          /* 10 - P8.3 */
    	NOT_ON_TIMER,  /* 11 - P1.5 */
    	NOT_ON_TIMER,  /* 12 - P1.4 */
    	NOT_ON_TIMER,  /* 13 - P1.3 */
    	NOT_ON_TIMER,  /* 14 - P5.3 */
    	NOT_ON_TIMER,  /* 15 - P5.2 */
    	NOT_ON_TIMER,  /* 16 - RST */
    	NOT_ON_TIMER,  /* 17 - P5.0 */
    	T0A2,          /* 18 - P1.6 */
    	T0A1,          /* 19 - P1.7 */
    	NOT_ON_TIMER,  /* 20 - GND */
    	
    	NOT_ON_TIMER,  /* 21 - P2.4 */
    	NOT_ON_TIMER,  /* 22 - P2.3 */
    	T1A1,          /* 23 - P4.0 */
    	NOT_ON_TIMER,  /* 24 - P1.2 */
    	NOT_ON_TIMER,  /* 25 - P2.6 */
    };
    
    const uint8_t digital_pin_to_port[] = {
    	NOT_A_PIN,   /*  0 - pin count starts at 1 */
    	NOT_A_PIN,   /*  1 - Vcc */
    	P8,          /*  2 - P8.1 */
    	P1,          /*  3 - P1.1 */
    	P1,          /*  4 - P1.0 */
    	P2,          /*  5 - P2.7 */
    	P8,          /*  6 - P8.0 */
    	P5,          /*  7 - P5.1 */
    	P2,          /*  8 - P2.5 */
    	P8,          /*  9 - P8.2 */
    	P8,          /* 10 - P8.3 */
    	P1,          /* 11 - P1.5 */
    	P1,          /* 12 - P1.4 */
    	P1,          /* 13 - P1.3 */
    	P5,          /* 14 - P5.3 */
    	P5,          /* 15 - P5.2 */
    	NOT_A_PIN,   /* 16 - RST */
    	P5,          /* 17 - P5.0 */
    	P1,          /* 18 - P1.6 */
    	P1,          /* 19 - P1.7 */
    	NOT_A_PIN,   /* 20 - GND */
    
    	P2,          /* 21 - P2.4 */
    	P2,          /* 22 - P2.3 */
    	P4,          /* 23 - P4.0 */
    	P1,          /* 24 - P1.2 */
    	P2,          /* 25 - P2.6 */
    };
    
    const uint8_t digital_pin_to_bit_mask[] = {
    	NOT_A_PIN,   /*  0 - pin count starts at 1 */
    	NOT_A_PIN,   /*  1 - Vcc */
    	BV(1),       /*  2 - P8.1 */
    	BV(1),       /*  3 - P1.1 */
    	BV(0),       /*  4 - P1.0 */
    	BV(7),       /*  5 - P2.7 */
    	BV(0),       /*  6 - P8.0 */
    	BV(1),       /*  7 - P5.1 */
    	BV(5),       /*  8 - P2.5 */
    	BV(2),       /*  9 - P8.2 */
    	BV(3),       /* 10 - P8.3 */
    	BV(5),       /* 11 - P1.5 */
    	BV(4),       /* 12 - P1.4 */
    	BV(3),       /* 13 - P1.3 */
    	BV(3),       /* 14 - P5.3 */
    	BV(2),       /* 15 - P5.2 */
    	NOT_A_PIN,   /* 16 - RST */
    	BV(0),       /* 17 - P5.0 */
    	BV(6),       /* 18 - P1.6 */
    	BV(7),       /* 19 - P1.7 */
    	NOT_A_PIN,   /* 20 - GND */
    
    	BV(4),       /* 21 - P2.4 */
    	BV(3),       /* 22 - P2.3 */
    	BV(0),       /* 23 - P4.0 */
    	BV(2),       /* 24 - P1.2 */
    	BV(6),       /* 25 - P2.6 */
    };
    
    const uint32_t digital_pin_to_analog_in[] = {
            NOT_ON_ADC,     /*  0 - pin count starts at 1 */
            NOT_ON_ADC,     /*  1 - Vcc */
            9,              /*  2 - P8.1 */
            1,              /*  3 - P1.1 */
            0, 	        /*  4 - P1.0 */
            NOT_ON_ADC,     /*  5 - P2.7 */
            8,   	        /*  6 - P8.0 */
            NOT_ON_ADC,   	/*  7 - P5.1 */
            NOT_ON_ADC, 	/*  8 - P2.5 */
            NOT_ON_ADC, 	/*  9 - P8.2 */
            NOT_ON_ADC, 	/* 10 - P8.3 */
            5,              /* 11 - P1.5 */
            4,              /* 12 - P1.4 */
            3,              /* 13 - P1.3 */
            NOT_ON_ADC,     /* 14 - P5.3 */
            NOT_ON_ADC,     /* 15 - P5.2 */
            NOT_ON_ADC, 	/* 16 - RST */
            NOT_ON_ADC,     /* 17 - P5.0 */
            6,		/* 18 - P1.6 */
            7,     		/* 19 - P1.7 */
            NOT_ON_ADC, 	/* 20 - GND */
    		                
            NOT_ON_ADC, 	/* 21 - P2.4 */
            NOT_ON_ADC, 	/* 22 - P2.3 */
            NOT_ON_ADC,	/* 23 - P4.0 */
            2,    		/* 24 - P1.2 */
            NOT_ON_ADC,    	/* 25 - P2.6 */
    };
    #endif // #ifdef ARDUINO_MAIN
    #endif // #ifndef Pins_Energia_h
    

  • I was thinking of one of these:

    https://energia.nu/pinmaps/msp-exp430fr2311/

    AFAICT, You can't use 3 and 4 for software serial since they are being used for Serial.

  • Could I use another pair of input/output pins e.g. 13/14?

  • I assume so.

  • Thanks again Keith for your help. What this has made me realises is that what I wanted isn't possible in this way on the board. I am probably better to communicate with the module off chip and pass control signals over to the MSP430 instead. The  HC-05 can be controlled by alot of Bluetooth serial terminal apps out there with nice GUI's too

  • I am pretty sure you are wrong, it should be no problem communicating with the HC05 and the PC.

  • Also, the 43oh board is a much better place to ask Energia questions.

  • Found the main problem. I consulted the HC-05 manual and effectively I was in the wrong modes at times. Thought I would post the steps to fix this.

    The key was the red LED on the HC-05: it has three states.

    Rapid Flashing - Looking to pair but unpaired

    Slow flashing - Paired

    Slow double flashes - in AT command mode.

    I should not have been using Software serial - it wasn't compatible with my board (something to do with a 16MHz CPU issue - not entirely sure). 

    Using the RX/TX pins and communicating over the Serial() was the way to go as the HC-05 sends data across this.

    The other issue was that using all apple devices meant I couldn't interact serially with the HC-05 to send data over a bluetooth terminal once a connection was established. The ideal way to do this is with an android phone and the bluetooth serial app.

    Really good article for this here : https://circuitdigest.com/microcontroller-projects/interfacing-hc-05-bluetooth-module-with-msp430-launchpad-to-control-an-led

    Thanks for your help - glad I managed to get this sorted and can now scale this up to the purpose I need to use it for

**Attention** This is a public forum