Jump to content
Sign in to follow this  
KeithB

MSP 432 pins file

Recommended Posts

I got blinky to work just fine with the RGB LED's on the MSP432P401R, but I could not get the single LED to flash. The Pin drawing implies it should be LED1, but that just gets me a not defined error. I also tried P1_0, but that did not work, either.

 

So, In the interest of giving me a fish:

What is the pin name of the single Red LED on the MSP432 board?

 

In the interest of teaching me to fish:

Where is the pins file for the 432 Launchpad on a Mac? I rooted around in the app bundle - spotlight was no help - but could not find it.

 

Also, I could not get serial to work. I tried Serial and Serial1 and 9600 and 115200 baud, but nothing appeared in the monitor window. All the jumpers are set to default.

Share this post


Link to post
Share on other sites

I am going to teach you how to fish with the first fish on me for wanting to learn the details.

 

The framework is located at:

  1. On GNU/Linuxes: ~/.energia15/packages/energia/hardware/msp432/x.y.z/
  2. On Windows: %LOCALAPPDATA%\Energia15\packages\hardware\msp432\x.y.z\
  3. On MacOSXes: ~/Library/Energia15/packages/hardware/msp432/x.y.z/
Search for pins_energia.h in that directory. You will find it in the variants directory. The RED LED is mapped to YELLOW_LED and is on pin 78. I know, makes sense right. I will change this in a future release to map to LED1 and RED_LED1.
 
You can also use the pin numbers rather than the friendly names. The naming Px_y is obsoleted and should not be used anymore.
 
Robert

Share this post


Link to post
Share on other sites
/* Blink without Delay

  Turns on and off a light emitting diode(LED) connected to a digital  
  pin, without using the delay() function.  This means that other code
  can run at the same time without being interrupted by the LED code.

  In MSP430 Launchpad, there is already an LED on the board that's 
  attached to pin 14, so no hardware is needed for this example. 

  created 2005
  by David A. Mellis
  modified 8 Feb 2010
  by Paul Stoffregen
  modified 27 Apr 2012
  by Robert Wessels
*/

// Pin 14 has an LED connected on MSP430 boards, has a name 'GREEN_LED' in the code.

// constants won't change. Used here to 
// set pin numbers:
const int ledPin =  GREEN_LED;      // the number of the LED pin

// Variables will change:
int ledState = LOW;             // ledState used to set the LED
long previousMillis = 0;        // will store last time LED was updated

// the follow variables is a long because the time, measured in miliseconds, will quickly become a bigger 
// number than can be stored in an int.
long interval = 1000;           // interval at which to blink (milliseconds)

void setup() {
  // set the digital pin as output:
  pinMode(ledPin, OUTPUT);      
}

void loop()
{
  // here is where you'd put code that needs to be running all the time.
 // check to see if it's time to blink the LED; that is, if the 
  // difference between the current time and last time you blinked 
  // the LED is bigger than the interval at which you want to 
  // blink the LED.
  unsigned long currentMillis = millis();

  if(currentMillis - previousMillis > interval) {
    // save the last time you blinked the LED 
    previousMillis = currentMillis;   

    // if the LED is off turn it on and vice-versa:
    if (ledState == LOW)
      ledState = HIGH;
    else
      ledState = LOW;

    // set the LED with the ledState of the variable:
    digitalWrite(ledPin, ledState);
  }
}

Here you go. RED1 caused an error. I guess I needed to use YELLOW_LED.

Share this post


Link to post
Share on other sites

Have you tried using the pin number instead of P1_0? LED1 is pin number 78 according to the pinout sheet.

 

 

Here is a link to the MSP432 pinout:

 

http://energia.nu/wordpress/wp-content/uploads/2015/03/2016-06-09-LaunchPads-MSP432-2.0-%E2%80%94-Pins-Maps.jpg

 

 

I think it would be helpful if you posted your code.

 

That pinout is obsolete. That is what I took LED1 from. It appears that "P1_0" is wrong, too. I thought 78 was a pin number on the board, not the chip.

Share this post


Link to post
Share on other sites

I just verified this code working on my msp432 using the following code:

/*
  Blink
  The basic Energia example.
  Turns on an LED on for one second, then off for one second, repeatedly.
  Change the LED define to blink other LEDs.
  
  Hardware Required:
  * LaunchPad with an LED
  
  This example code is in the public domain.
*/

// most launchpads have a red LED
const int led = 78;

//see pins_energia.h for more LED definitions
//#define LED GREEN_LED
  
// the setup routine runs once when you press reset:
void setup() {                
  // initialize the digital pin as an output.
  pinMode(led, OUTPUT);     
}

// the loop routine runs over and over again forever:
void loop() {
  digitalWrite(led, HIGH);   // turn the LED on (HIGH is the voltage level)
  delay(1000);               // wait for a second
  digitalWrite(led, LOW);    // turn the LED off by making the voltage LOW
  delay(1000);               // wait for a second
}

Share this post


Link to post
Share on other sites

I modified your code to blink the red led and to print some stuff out on the serial monitor. I hope this helps.

/* Blink without Delay

  Turns on and off a light emitting diode(LED) connected to a digital  
  pin, without using the delay() function.  This means that other code
  can run at the same time without being interrupted by the LED code.

  In MSP430 Launchpad, there is already an LED on the board that's 
  attached to pin 14, so no hardware is needed for this example. 

  created 2005
  by David A. Mellis
  modified 8 Feb 2010
  by Paul Stoffregen
  modified 27 Apr 2012
  by Robert Wessels
*/

// Pin 14 has an LED connected on MSP430 boards, has a name 'GREEN_LED' in the code.

// constants won't change. Used here to 
// set pin numbers:
const int ledPin =  78;      // the number of the LED pin

// Variables will change:
int ledState = LOW;             // ledState used to set the LED
long previousMillis = 0;        // will store last time LED was updated

// the follow variables is a long because the time, measured in miliseconds, will quickly become a bigger 
// number than can be stored in an int.
long interval = 1000;           // interval at which to blink (milliseconds)

void setup() {
  Serial.begin(9600); //initializes the serial monitor
  
  // set the digital pin as output:
  pinMode(ledPin, OUTPUT);      
}

void loop()
{
  // here is where you'd put code that needs to be running all the time.
 // check to see if it's time to blink the LED; that is, if the 
  // difference between the current time and last time you blinked 
  // the LED is bigger than the interval at which you want to 
  // blink the LED.
  unsigned long currentMillis = millis();

  if(currentMillis - previousMillis > interval) {
    // save the last time you blinked the LED 
    previousMillis = currentMillis;
    Serial.print("CurrentMillis = ");
     Serial.println(currentMillis);

    // if the LED is off turn it on and vice-versa:
    if (ledState == LOW){
      ledState = HIGH;
      Serial.println("LED is on");
  }
    else
      ledState = LOW;
      Serial.println("LED is off");

    // set the LED with the ledState of the variable:
    digitalWrite(ledPin, ledState);
  }
}

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this  

×