Jump to content
43oh

msp432p401r launchpad library for using with energia


Recommended Posts

hello,

i have a new msp432p401r launchpad and i am new to use energia and TI microcontroller.i need the help regarding the library for serial communication with bluetooth hc-05 and pc and coding information for energia setup.Before this i used to code on arduino microcontroller and i am bit confused with this new stuff and some questions are in my mind that can we use arduino library and codes for msp432p401r microcontroller via energia ??

 

 

regards,

Ransher

Link to post
Share on other sites

i have installed the driver for 432.whatelse i need ?

i try to upload a code which i used to run on arduino microcontroller for serial communication using SoftwareSerial.h library which found error while uploading to msp432p401r microcontroller.

Error-Softwareserial.h not found

 

code 

 

#include <SoftwareSerial.h>
#define rxPin 10
#define txPin 11
SoftwareSerial mySerial(rxPin, txPin); // RX, TX
char myChar ;
void setup() {
  Serial.begin(9600);   
  Serial.println("AT");
  mySerial.begin(9600);
  mySerial.println("AT");
}
void loop() {
  while (mySerial.available()) {
    myChar = mySerial.read();
    Serial.print(myChar);
  }
 while (Serial.available()) {
    myChar = Serial.read();
    Serial.print(myChar); //echo
    mySerial.print(myChar);
  }
}
Link to post
Share on other sites

error i recieved

 

C:\Users\Hp\AppData\Local\Temp\arduino_modified_sketch_95419\sketch_feb10a.ino:1:28: fatal error: SoftwareSerial.h: No such file or directory
 
 #include <SoftwareSerial.h>
 
                            ^
 
compilation terminated.
 
exit status 1
Error compiling for board LaunchPad w/ msp432 EMT (48MHz).
Link to post
Share on other sites

installed softwareserial.zip file now shows this error.

 

 
 
 
 
 
 
 
 
 
 
C:\Users\Hp\Documents\Energia\libraries\SoftwareSerial\SoftwareSerial.cpp:125:2: error: #error This version of SoftwareSerial supports only 20, 16 and 8MHz processors
 
 #error This version of SoftwareSerial supports only 20, 16 and 8MHz processors
 
  ^
 
C:\Users\Hp\Documents\Energia\libraries\SoftwareSerial\SoftwareSerial.cpp: In member function 'bool SoftwareSerial::listen()':
 
C:\Users\Hp\Documents\Energia\libraries\SoftwareSerial\SoftwareSerial.cpp:181:23: error: 'SREG' was not declared in this scope
 
     uint8_t oldSREG = SREG;
 
                       ^
 
C:\Users\Hp\Documents\Energia\libraries\SoftwareSerial\SoftwareSerial.cpp:182:9: error: 'cli' was not declared in this scope
 
     cli();
 
         ^
 
C:\Users\Hp\Documents\Energia\libraries\SoftwareSerial\SoftwareSerial.cpp: In member function 'void SoftwareSerial::setTX(uint8_t)':
 
C:\Users\Hp\Documents\Energia\libraries\SoftwareSerial\SoftwareSerial.cpp:356:44: error: 'digitalPinToBitMask' was not declared in this scope
 
   _transmitBitMask = digitalPinToBitMask(tx);
 
                                            ^
 
C:\Users\Hp\Documents\Energia\libraries\SoftwareSerial\SoftwareSerial.cpp:357:37: error: 'digitalPinToPort' was not declared in this scope
 
   uint8_t port = digitalPinToPort(tx);
 
                                     ^
 
C:\Users\Hp\Documents\Energia\libraries\SoftwareSerial\SoftwareSerial.cpp:358:50: error: 'portOutputRegister' was not declared in this scope
 
   _transmitPortRegister = portOutputRegister(port);
 
                                                  ^
 
C:\Users\Hp\Documents\Energia\libraries\SoftwareSerial\SoftwareSerial.cpp: In member function 'void SoftwareSerial::setRX(uint8_t)':
 
C:\Users\Hp\Documents\Energia\libraries\SoftwareSerial\SoftwareSerial.cpp:367:43: error: 'digitalPinToBitMask' was not declared in this scope
 
   _receiveBitMask = digitalPinToBitMask(rx);
 
                                           ^
 
C:\Users\Hp\Documents\Energia\libraries\SoftwareSerial\SoftwareSerial.cpp:368:37: error: 'digitalPinToPort' was not declared in this scope
 
   uint8_t port = digitalPinToPort(rx);
 
                                     ^
 
C:\Users\Hp\Documents\Energia\libraries\SoftwareSerial\SoftwareSerial.cpp:369:48: error: 'portInputRegister' was not declared in this scope
 
   _receivePortRegister = portInputRegister(port);
 
                                                ^
 
C:\Users\Hp\Documents\Energia\libraries\SoftwareSerial\SoftwareSerial.cpp: In member function 'void SoftwareSerial::begin(long int)':
 
C:\Users\Hp\Documents\Energia\libraries\SoftwareSerial\SoftwareSerial.cpp:380:31: error: 'table' was not declared in this scope
 
   for (unsigned i=0; i<sizeof(table)/sizeof(table[0]); ++i)
 
                               ^
 
C:\Users\Hp\Documents\Energia\libraries\SoftwareSerial\SoftwareSerial.cpp:396:38: error: 'digitalPinToPCICR' was not declared in this scope
 
     if (digitalPinToPCICR(_receivePin))
 
                                      ^
 
C:\Users\Hp\Documents\Energia\libraries\SoftwareSerial\SoftwareSerial.cpp:398:78: error: 'digitalPinToPCICRbit' was not declared in this scope
 
       *digitalPinToPCICR(_receivePin) |= _BV(digitalPinToPCICRbit(_receivePin));
 
                                                                              ^
 
C:\Users\Hp\Documents\Energia\libraries\SoftwareSerial\SoftwareSerial.cpp:398:79: error: '_BV' was not declared in this scope
 
       *digitalPinToPCICR(_receivePin) |= _BV(digitalPinToPCICRbit(_receivePin));
 
                                                                               ^
 
C:\Users\Hp\Documents\Energia\libraries\SoftwareSerial\SoftwareSerial.cpp:399:37: error: 'digitalPinToPCMSK' was not declared in this scope
 
       *digitalPinToPCMSK(_receivePin) |= _BV(digitalPinToPCMSKbit(_receivePin));
 
                                     ^
 
C:\Users\Hp\Documents\Energia\libraries\SoftwareSerial\SoftwareSerial.cpp:399:78: error: 'digitalPinToPCMSKbit' was not declared in this scope
 
       *digitalPinToPCMSK(_receivePin) |= _BV(digitalPinToPCMSKbit(_receivePin));
 
                                                                              ^
 
C:\Users\Hp\Documents\Energia\libraries\SoftwareSerial\SoftwareSerial.cpp: In member function 'void SoftwareSerial::end()':
 
C:\Users\Hp\Documents\Energia\libraries\SoftwareSerial\SoftwareSerial.cpp:414:36: error: 'digitalPinToPCMSK' was not declared in this scope
 
   if (digitalPinToPCMSK(_receivePin))
 
                                    ^
 
C:\Users\Hp\Documents\Energia\libraries\SoftwareSerial\SoftwareSerial.cpp:415:77: error: 'digitalPinToPCMSKbit' was not declared in this scope
 
     *digitalPinToPCMSK(_receivePin) &= ~_BV(digitalPinToPCMSKbit(_receivePin));
 
                                                                             ^
 
C:\Users\Hp\Documents\Energia\libraries\SoftwareSerial\SoftwareSerial.cpp:415:78: error: '_BV' was not declared in this scope
 
     *digitalPinToPCMSK(_receivePin) &= ~_BV(digitalPinToPCMSKbit(_receivePin));
 
                                                                              ^
 
C:\Users\Hp\Documents\Energia\libraries\SoftwareSerial\SoftwareSerial.cpp: In member function 'virtual size_t SoftwareSerial::write(uint8_t)':
 
C:\Users\Hp\Documents\Energia\libraries\SoftwareSerial\SoftwareSerial.cpp:450:21: error: 'SREG' was not declared in this scope
 
   uint8_t oldSREG = SREG;
 
                     ^
 
C:\Users\Hp\Documents\Energia\libraries\SoftwareSerial\SoftwareSerial.cpp:451:7: error: 'cli' was not declared in this scope
 
   cli();  // turn off interrupts for a clean txmit
 
       ^
 
C:\Users\Hp\Documents\Energia\libraries\SoftwareSerial\SoftwareSerial.cpp:455:26: error: 'XMIT_START_ADJUSTMENT' was not declared in this scope
 
   tunedDelay(_tx_delay + XMIT_START_ADJUSTMENT);
 
                          ^
 
C:\Users\Hp\Documents\Energia\libraries\SoftwareSerial\SoftwareSerial.cpp: In member function 'virtual void SoftwareSerial::flush()':
 
C:\Users\Hp\Documents\Energia\libraries\SoftwareSerial\SoftwareSerial.cpp:498:21: error: 'SREG' was not declared in this scope
 
   uint8_t oldSREG = SREG;
 
                     ^
 
C:\Users\Hp\Documents\Energia\libraries\SoftwareSerial\SoftwareSerial.cpp:499:7: error: 'cli' was not declared in this scope
 
   cli();
 
       ^
 
exit status 1
Error compiling for board LaunchPad w/ msp432 EMT (48MHz).
Link to post
Share on other sites

@@energia,thanks for helping 

 

now i have new problem, the code i am running perfect with no issue compiled and working as per written on arduino microcontroller- works perfectly

 

but when implemented same code on msp432 with modification as you have notified  me above,the code compiles perfectly but don't works as defined in energia though its working on arduino mega 2560 with no issue 

 

code

 

 

 
#define rxPin 3
#define txPin 4
 
char myChar ;
void setup() {
  Serial.begin(9600);   
  Serial.println("AT");
  Serial1.begin(9600);
  Serial1.println("AT");
}
void loop() {
  if (Serial1.available() > 0) {
    String  s = Serial1.readString();
    if ( s == "hello") {                           // if the bluetooth read string is hello serially print hi
      Serial.println("hi");
    }
    else if ( s == "hey") {                     // if bluetooth read string is hey serially print yeah
      Serial.println("yeah");
    }
    else                                              // if (s != "hello" && s != "hey")
    {
      Serial.println("invalid"); 
     
    }
  }
}
Link to post
Share on other sites

the same code i have uploaded above is not working in msp432 its just showing "invalid" whenever hello &hey  is typed which it should not and should print corresponding strings "hi" &"yeah"

 

further modification i have done in code but the problem still exist

 

 

code

 
//#define rxPin 3
//#define txPin 4
 
void setup()
{
  Serial.begin(9600);
  Serial.write("Arduino is ready");
  Serial1.begin(9600);
  Serial1.write("Bluetooth is ready");
}
void loop()
{
jump:
  if (Serial1.available() > 0) {
    String  s = Serial1.readString();
    if ( s == "hello") {                                         // if the bluetooth read string is hello serially print hi
      Serial.write("hi");
    }
    else if ( s == "hey") {                                    // if bluetooth read string is hey serially print yeah
      Serial.write("yeah");
    }
    else                                                             // if (s != "hello" && s != "hey")
    {
      Serial.write("invalid");
      goto jump;
    }
  }
}
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...