Jump to content
JasonP

Software Serial library use

Recommended Posts

Hello,

 

I am having problems compiling a sketch that utilizes Software Serial.   I'm sure I am simply missing a library somewhere, just not sure what it is.  I have attached an image of the errors I am seeing from the compiler window. 

#include <SoftwareSerial.h>

void setup()
{
  // put your setup code here, to run once:
  
}

void loop()
{
  // put your main code here, to run repeatedly:
  
}

Can someone verify that Software Serial is working in Energia and perhaps tell me what I am doing wrong?  Thanks!

 

-Jason

post-48521-0-68582500-1466633455_thumb.png

Share this post


Link to post
Share on other sites

Hello,

 

I am having problems compiling a sketch that utilizes Software Serial.   I'm sure I am simply missing a library somewhere, just not sure what it is.  I have attached an image of the errors I am seeing from the compiler window. 

#include <SoftwareSerial.h>

void setup()
{
  // put your setup code here, to run once:
  
}

void loop()
{
  // put your main code here, to run repeatedly:
  
}

Can someone verify that Software Serial is working in Energia and perhaps tell me what I am doing wrong?  Thanks!

 

-Jason

It seems like you are trying to use this AVR only version

 

...

 

https://github.com/battosai30/Energia/blob/c4df0d2b7974540b39bb61d4a90ba5d0add8194b/libraries/SoftwareSerial/SoftwareSerial.cpp#L181

 

This isn't going to work for any TI chip.

Share this post


Link to post
Share on other sites

I'm using Energia V17 and will be compiling for an MSP-432 launchpad.  @@Rickta59, Is there a version of Software Serial that will work for me? I guess I'm confused why the AVR only version is in the Energia Repository?

 

Thanks guys.

Share this post


Link to post
Share on other sites

@@JasonP

 

I just ran your sketch above in Energia v17 with MSP-432 and get the following at the bottom of the compilation output

 

sketch_jun23a.ino:5:28: fatal error: SoftwareSerial.h: No such file or directory
compilation terminated.
make: *** [sketch_jun23a.obj] Error 1
C:\energia-0101E0017\energia-0101E0017\tools\common\bin\make returned 2
 

In other words, SoftwareSerial.h was not included with Energia for the MSP432.

 

Further, the other Serial hardware pins don't show on the Energia pin map so perhaps additional hardware access (i.e. use of Serial1) is not included for the MSP432 either.  The thing to do might be to access the serial hardware directly but I realize that isn't particularly satisfying for an Energia user.

Share this post


Link to post
Share on other sites

Seems like it supports at least Serial and Serial1. This compiles:

/*
  Multple serial test
 
  Receives from the main serial port, sends to the others. 
  Receives from serial port 1, sends to the main serial (Serial 0).
 
  The circuit: 
  * Any serial device attached to Serial port 1
  * Serial monitor open on Serial port 0:
 
  created 30 Dec. 2008
  by Tom Igoe
 
  This example code is in the public domain.
 
*/
 

void setup() {
  // initialize both serial ports:
  Serial.begin(9600);
  Serial1.begin(9600);
}

void loop() {
  // read from port 1, send to port 0:
  if (Serial1.available()) {
    int inByte = Serial1.read();
    Serial.write(inByte); 
  }
}

Share this post


Link to post
Share on other sites

It looks like all that stuff is now hidden in a binary blob that doesn't come with source code.

$ arm-none-eabi-nm -C hardware/emt/ti/runtime/wiring/msp432/lib/wiring_msp432.m4fg.lib  | grep Serial
HardwareSerial.om4fg:
00000000 t _GLOBAL__sub_I__ZN14HardwareSerialC2Ev
00000000 B Serial
00000000 B Serial1
00000000 T HardwareSerial::readCallback(UART_Config*, void*, unsigned int)
00000000 T HardwareSerial::end()
00000000 T HardwareSerial::init(unsigned long)
00000000 T HardwareSerial::peek()
00000000 T HardwareSerial::read()
00000000 T HardwareSerial::begin(unsigned long)
00000000 T HardwareSerial::flush()
00000000 T HardwareSerial::write(unsigned char)
00000000 T HardwareSerial::write(unsigned char const*, unsigned int)
00000000 T HardwareSerial::acquire()
00000000 T HardwareSerial::release()
00000000 T HardwareSerial::setPins(unsigned long)
00000000 T HardwareSerial::flushAll()
00000000 T HardwareSerial::available()
00000000 T HardwareSerial::setModule(unsigned long)
00000000 T HardwareSerial::HardwareSerial(unsigned long)
00000000 T HardwareSerial::HardwareSerial()
00000000 T HardwareSerial::HardwareSerial(unsigned long)
00000000 T HardwareSerial::HardwareSerial()
00000000 T HardwareSerial::operator bool()
00000000 R vtable for HardwareSerial

It appears that only Serial and Serial1 are implemented.

 

This is a question for @@energia

 

-rick

Share this post


Link to post
Share on other sites

Really I only need two serial ports for this project.  I can use the hardware defined serial ports.  However, I only see one UART port on the pin map for the MSP-432.  @@Rickta59, do you know which pins Serial1 would be on?  Thanks guys!

Share this post


Link to post
Share on other sites

@@Fmilburn,  Yeah I saw that initially so I went out to Energia's github page and grabbed the SoftwareSerial library.  (Which is apparently not the correct library for MSP - boards).  Makes sense now that I see the AVR libraries included in the SoftwareSerial.cpp file.  Thanks.

Share this post


Link to post
Share on other sites

Really I only need two serial ports for this project.  I can use the hardware defined serial ports.  However, I only see one UART port on the pin map for the MSP-432.  @@Rickta59, do you know which pins Serial1 would be on?  Thanks guys!

It doesn't appear on the pin map so you will have to dig around yourself.

 

http://energia.nu/wordpress/wp-content/uploads/2015/03/MSP432-LaunchPad-%E2%80%94-Pins-Maps.jpg

 

Maybe @@Rei Vilo knows

Share this post


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