Jump to content

XIN/XOUT as digital outputs

Recommended Posts

  • 1 month later...

Modified the file hardware/msp430/variants/launchpad/pins_energia.h


But when code is verified the following message appears:

Button.cpp:31:23: error: 'XIN' was not declared in this scope

Button.cpp:32:21: error: 'XOUT' was not declared in this scope


I used this as declaration, but using P2_6 and P2_7 gives the same error.

const int buttonPin = XIN;

const int ledPin = XOUT;

Using the actual pin number 18 and 19, no compile error.

But when used as OUTPUT, the output goes High one time, but not Low anymore. *Edit: error in code :lol:


In the file "hardware/msp430/variants/launchpad/pins_energia.h"

Under section "// Pin names based on the silkscreen" XIN and XOUT, or P2_6 and P2_7, are not mentioned as well.


Am i doing something wrong, or is there something else wrong?



Link to post
Share on other sites

You will have to declare the friendly names. Put the following in pins_energia.h under the "Pin names based on silkscreen" section:


static const uint8_t P2_7 = 18;
static const uint8_t P2_6 = 19;

static const uint8_t XIN = 19;
static const uint8_t XOUT = 18; // depends on chip


By default these pins come up as XTAL pins. If you would like to use them as GPIO pins then put the following snip in your setup() routine:


P2SEL &= ~(BIT6|BIT7);

Link to post
Share on other sites


The friendly names work, and also the last code for enabling GPIO to these ports.

I can now use these ports as an Input or Output.


Could you include the mods of the pins_energia.h file in next releases ? ;)

Or does this affect the default/actual operation (XTAL) of these pins?

Link to post
Share on other sites
  • 11 months later...

I am experiencing the same problem, but my version of pins_energia.h seems to be correct based on the above comments.

I have the latest version of Energia, 0101E0010 with MSP430G2553.


The XIN and XOUT pins are not reacting correctly to the digitalWrite commands as the other pins are.  

Watching the pin via LED it pulses while communicating over other pins, like it's "communicating" not acting as the digital on/off I need.


Is anyone else still having this issue?

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.

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...