Jump to content
43oh

MSP430FR4133 - Can LCD pins be configured as GPIO


Recommended Posts

Hi ,

  I am using MSP430FR4133LP , in energia the GPIO pins are predefined in the pins_energia.h for MSP430FR4133 LP based on the silkscreen on the board. I using this MSP430FR4133 chip for another project and in that i am not using a LCD so i thought that i can also use LCD pins as GPIO. For this purpose i need to add the pins in the pins_energia.h  but i am not able to crack it. Can anyone help me with this ....?

if i try to use any other pins other than the defined ones (say P2_2) ... it throws an error as " P2_2 not defined in the scope"

// 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 = ;                         <------ What should i do in order to add this pin 
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 = ;

These are the pin definitions that are already in the pins_energia.h based on the silkscreen. If i want to use a pin (say P2.2) what must i do in order to define that pin in the pins_energia.h file ??

thank you in advance.....

Link to post
Share on other sites

Not that P2_2, etc are "friendly" names only that map to a pin number and point into the arrays digital_pin_to_port[], digital_pin_to_bit_mask[], etc.

On a side note, It is discouraged to use these friendly names since they are not portable between all launchpads. Instead use pin numbers.

With that said, in order to use the pins currently exclusive to the LCD, you need to add them to the following arrays in pins_energia.h:

digital_pin_to_port[]
digital_pin_to_bit_mask[]

Add them to the end of the arrays. You will have to choose which pin goes at which position in the array. The position in the array determines the pin number you use in your Sketches for a particular pin.

e.g. if you were to add P2.2 to the end of the arrays it would look something like this:

const uint8_t digital_pin_to_port[] = {
        NOT_A_PIN,   /*  0 - pin count starts at 1 */
        .....
        P2,          /* 21 - P2.4 */
        P2,          /* 22 - P2.3 */
        P4,          /* 23 - P4.0 */
        P1,          /* 24 - P1.2 */
        P2,          /* 25 - P2.6 */
        P2,          /* 26 - P2.2 */
};

const uint8_t digital_pin_to_bit_mask[] = {
        NOT_A_PIN,   /*  0 - pin count starts at 1 */
        ......
        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 */
        BV(2),       /* 26 - P2.2 */
};

With this addition you can use P2.2 as pin 26 in your Sketch as GPIO.

void setup()
{
  pinMode(26, OUTPUT);
  digitalWrite(26, HIGH);
}

Be careful with modifying the core since it is controlled by Energia. An update to the core will undo all the changes.

Robert

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...