Sparkfun LTE Shield troubles

All about boards manufactured by ST
Post Reply
Max44
Posts: 3
Joined: Tue Jun 16, 2020 8:29 pm

Sparkfun LTE Shield troubles

Post by Max44 »

I'm planning to use the Sparkfun LTE Shield on a Nucleo 64 board (Nucleo F401RE). I've installed the Sparkfun library and I am attempting to compile their SMS_Send example. This compiles fine for an Arduino Uno. When I try to compile for the Nucleo board, I'm getting an undefined reference during the linker stage. The Sparkfun library .cpp file seemed to compile OK and an object file was created. See code snippets below. I suspect the pointer to the SoftwareSerial definition is the problem, but I don't know how to work around it. I'm hoping someone might have some similar experience and can provide guidance or can tell me if this is a problem with SoftwareSerial.

Thanks, Max

This is the error message:

Code: Select all

01_SMS_Send.ino.cpp:(.text.setup+0x16): undefined reference to `LTE_Shield::begin(SoftwareSerial&, unsigned long)'

collect2.exe: error: ld returned 1 exit status
Using library SparkFun_LTE_Shield_Arduino_Library at version 1.2.0 in folder: E:\Affinity\Water Device\libraries\SparkFun_LTE_Shield_Arduino_Library 
Using library SoftwareSerial at version 1.0 in folder: E:\Documents\ArduinoData\packages\STM32\hardware\stm32\1.9.0\libraries\SoftwareSerial 
Using library SrcWrapper at version 1.0.1 in folder: E:\Documents\ArduinoData\packages\STM32\hardware\stm32\1.9.0\libraries\SrcWrapper 
exit status 1
Error compiling for board Nucleo-64.
The relevant sample sketch section:

Code: Select all

#define LTE_SHIELD_SOFTWARE_SERIAL_ENABLED

//Click here to get the library: http://librarymanager/All#SparkFun_LTE_Shield_Arduino_Library
#include <SparkFun_LTE_Shield_Arduino_Library.h>

// Create a SoftwareSerial object to pass to the LTE_Shield library
SoftwareSerial lteSerial(8, 9);
// Create a LTE_Shield object to use throughout the sketch
LTE_Shield lte;

// Set the cell phone number to be texted
String DESTINATION_NUMBER = "11234567890";

void setup() {
  Serial.begin(9600);

  if ( lte.begin(lteSerial, 9600) ) {
    Serial.println(F("LTE Shield connected!"));
  }
  Serial.println(F("Type a message. Send a Newline (\\n) to send it..."));
}
And the definition of the begin function in the library .cpp file:

Code: Select all

#ifdef LTE_SHIELD_SOFTWARE_SERIAL_ENABLED
boolean LTE_Shield::begin(SoftwareSerial &softSerial, unsigned long baud)
{
    LTE_Shield_error_t err;

    _softSerial = &softSerial;

    err = init(baud);
    if (err == LTE_SHIELD_ERROR_SUCCESS)
    {
        return true;
    }
    return false;
}
#endif
by fpiSTM » Thu Jun 18, 2020 8:14 am
Hi @Max44
Max44 wrote:
Wed Jun 17, 2020 7:16 pm
Yes, LTE_SHIELD_SOFTWARE_SERIAL_ENABLED was defined. I added that to make sure as seen 1st line in 2nd code snippet.
No it is not properly defined. As it is only defined in the sketch but when the library build then it is not defined.

I've made a PR to add the STM32 core support.
https://github.com/sparkfun/SparkFun_LT ... ary/pull/9

If you can test and give your feedback.

Thanks in advance.
Go to full post

User avatar
fpiSTM
Posts: 851
Joined: Wed Dec 11, 2019 7:11 pm
Answers: 33
Location: Le Mans
Contact:

Re: Sparkfun LTE Shield troubles

Post by fpiSTM »

Is LTE_SHIELD_SOFTWARE_SERIAL_ENABLED defined?
Probably the lib does not handle this core and need some additions. If the lib handle a HardwareSerial, I advise to use it.

Ex: https://github.com/sparkfun/SparkFun_LT ... y/issues/6

Max44
Posts: 3
Joined: Tue Jun 16, 2020 8:29 pm

Re: Sparkfun LTE Shield troubles

Post by Max44 »

Thanks for the reply.

Yes, LTE_SHIELD_SOFTWARE_SERIAL_ENABLED was defined. I added that to make sure as seen 1st line in 2nd code snippet.

Thanks for the link. I will give HardwareSerial a try. The problem there is I will have to jumper into the shield versus plugging it into the Arduino connectors as pins 8 and 9 on the shield do not match the hardware USART pin assignments. That's OK with me to do this if the code compiles.

I want to use a STM32 as the MCU driving a ublox SARA-R4 module and was hoping the Sparkfun library would save some work. If HardwareSerial doesn't build, I'll head back over to STM32CubeIDE.

Max

Max44
Posts: 3
Joined: Tue Jun 16, 2020 8:29 pm

Re: Sparkfun LTE Shield troubles

Post by Max44 »

Following the HardwareSerial example on the Wiki, I commented out SoftwareSerial and added:

Code: Select all

HardwareSerial Serial1(PA10, PA9);
And changed lteSerial to:

Code: Select all

  if ( lte.begin(Serial1, 9600) ) {
    Serial.println(F("LTE Shield connected!"));
  }
  Serial.println(F("Type a message. Send a Newline (\\n) to send it..."));
}
This compiles!

I don't have the LTE Shield in yet, so we'll see if the code loads and runs later.

Cheers! Max

User avatar
fpiSTM
Posts: 851
Joined: Wed Dec 11, 2019 7:11 pm
Answers: 33
Location: Le Mans
Contact:

Re: Sparkfun LTE Shield troubles

Post by fpiSTM »

Hi @Max44
Max44 wrote:
Wed Jun 17, 2020 7:16 pm
Yes, LTE_SHIELD_SOFTWARE_SERIAL_ENABLED was defined. I added that to make sure as seen 1st line in 2nd code snippet.
No it is not properly defined. As it is only defined in the sketch but when the library build then it is not defined.

I've made a PR to add the STM32 core support.
https://github.com/sparkfun/SparkFun_LT ... ary/pull/9

If you can test and give your feedback.

Thanks in advance.

Post Reply

Return to “STM boards (Discovery, Eval, Nucleo, ...)”