ransher 0 Posted February 9, 2017 Share Posted February 9, 2017 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 Quote Link to post Share on other sites
KeithB 0 Posted February 9, 2017 Share Posted February 9, 2017 Have you installed the 432 board support yet? A lot of these libraries are supplied with Energia, and arduino code should run with no issues. Quote Link to post Share on other sites
ransher 0 Posted February 9, 2017 Author Share Posted February 9, 2017 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); } } Quote Link to post Share on other sites
ransher 0 Posted February 9, 2017 Author Share Posted February 9, 2017 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). Quote Link to post Share on other sites
KeithB 0 Posted February 9, 2017 Share Posted February 9, 2017 You need to use the library manager: http://energia.nu/guide/library-manager/ Quote Link to post Share on other sites
ransher 0 Posted February 10, 2017 Author Share Posted February 10, 2017 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). Quote Link to post Share on other sites
KeithB 0 Posted February 10, 2017 Share Posted February 10, 2017 Did you bother to read my post? Use the library manager and use the provided version for Energia. Quote Link to post Share on other sites
energia 484 Posted February 10, 2017 Share Posted February 10, 2017 @@KeithB, there is no SoftwareSerial support for the MSP432. You can however use Serial1.xyz() just as you do with Serial. Serial1's TX is located on pin 4 and RX on pin3. Please see the pinmap posted here: http://energia.nu/pin-maps/guide_msp432p401r/ Note that baudrates lower than 9600 are currently not supported for the MSP432. ransher 1 Quote Link to post Share on other sites
KeithB 0 Posted February 10, 2017 Share Posted February 10, 2017 @@KeithB, there is no SoftwareSerial support for the MSP432... From the docs (http://energia.nu/reference/libraries/) These libraries are included in the official release of Energia. Learn how to manage and import your libraries with this tutorial. .... SoftwareSerial Quote Link to post Share on other sites
ransher 0 Posted February 12, 2017 Author Share Posted February 12, 2017 @@KeithB msp432 (48mhz) does not support softwareserial library softwareserial.h only supports 8mhz and 20mhz processor Quote Link to post Share on other sites
ransher 0 Posted February 12, 2017 Author Share Posted February 12, 2017 @@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"); } } } Quote Link to post Share on other sites
KeithB 0 Posted February 13, 2017 Share Posted February 13, 2017 Ah, I see. Sorry to be obtuse. Though a warning in the 432 boards setup page about which libraries don't work would be nice. Quote Link to post Share on other sites
KeithB 0 Posted February 13, 2017 Share Posted February 13, 2017 ransher: define "not working" Quote Link to post Share on other sites
ransher 0 Posted February 13, 2017 Author Share Posted February 13, 2017 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; } } } Quote Link to post Share on other sites
KeithB 0 Posted February 13, 2017 Share Posted February 13, 2017 You probably need to strip control characters. Do a strlen() or whatever the equivalent on a String is. Quote Link to post Share on other sites
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.