Skip to content

Add SARA network examples #17

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
sfe-SparkFro opened this issue Dec 13, 2023 · 9 comments
Open

Add SARA network examples #17

sfe-SparkFro opened this issue Dec 13, 2023 · 9 comments

Comments

@sfe-SparkFro
Copy link
Collaborator

From @PaulZC in #13:

The SARA-R5 does need the PDP / PSD stuff to set up its data connection... I'm fine with you creating a SARA-specific examples folder and copying in a subset of the examples from the SARA-R5 library. I will help you refactor them and test them when I get some spare time.

@PaulZC
Copy link
Contributor

PaulZC commented Jan 8, 2024

Here are my notes as I test the Cellular Library examples on the SARA-R510M8S. Separate Pull Requests will follow as I add SARA-specific examples (with the extra PDP commands needed by the SARA).

Hardware:

SparkFun MicroMod Asset Tracker Carrier Board DEV-17272
SparkFun MicroMod Artemis Processor DEV-16401
SparkFun Apollo3 Boards v2.2.1

Example1_DeviceIdentification:

SparkFun_ublox_SARA_R510M8S_61B myModule;
Uncomment myModule.invertPowerPin(true);

First time, the example runs correctly. I see Manu ID, Model ID, IMEI, IMSI etc.
But if I upload and run it again, it fails. The Artemis is sending AT commands, but the SARA is not replying.
I suspect it has something to do with the power pin, or the way the Artemis is reset when (re)uploading the example?
Investigating...

@PaulZC
Copy link
Contributor

PaulZC commented Jan 8, 2024

I'm trying to define the power pin - Artemis MicroMod PB pin G2:

This compiles OK:
SparkFun_ublox_Cellular myModule(G2);

But this fails:
SparkFun_ublox_SARA_R510M8S_61B myModule(G2);

Example1_DeviceIdentification:14:44: error: no matching function for call to 'SparkFun_ublox_SARA_R510M8S_61B::SparkFun_ublox_SARA_R510M8S_61B(PinName)'
 SparkFun_ublox_SARA_R510M8S_61B myModule(G2);
                                            ^
In file included from C:\Users\pc235\Documents\Arduino\libraries\SparkFun_u-blox_AT_Commands_Arduino_Library\src/SparkFun_u-blox_Cellular_Arduino_Library.h:2,
                 from C:\Users\pc235\AppData\Local\Temp\arduino_modified_sketch_873765\Example1_DeviceIdentification.ino:1:
C:\Users\pc235\Documents\Arduino\libraries\SparkFun_u-blox_AT_Commands_Arduino_Library\src/sfe_sara_r5.h:65:7: note: candidate: 'SparkFun_ublox_SARA_R510M8S_61B::SparkFun_ublox_SARA_R510M8S_61B()'
 class SparkFun_ublox_SARA_R510M8S_61B : public SparkFun_ublox_SARA_R5
       ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
C:\Users\pc235\Documents\Arduino\libraries\SparkFun_u-blox_AT_Commands_Arduino_Library\src/sfe_sara_r5.h:65:7: note:   candidate expects 0 arguments, 1 provided
C:\Users\pc235\Documents\Arduino\libraries\SparkFun_u-blox_AT_Commands_Arduino_Library\src/sfe_sara_r5.h:65:7: note: candidate: 'SparkFun_ublox_SARA_R510M8S_61B::SparkFun_ublox_SARA_R510M8S_61B(const SparkFun_ublox_SARA_R510M8S_61B&)'
C:\Users\pc235\Documents\Arduino\libraries\SparkFun_u-blox_AT_Commands_Arduino_Library\src/sfe_sara_r5.h:65:7: note:   no known conversion for argument 1 from 'PinName' to 'const SparkFun_ublox_SARA_R510M8S_61B&'
C:\Users\pc235\Documents\Arduino\libraries\SparkFun_u-blox_AT_Commands_Arduino_Library\src/sfe_sara_r5.h:65:7: note: candidate: 'SparkFun_ublox_SARA_R510M8S_61B::SparkFun_ublox_SARA_R510M8S_61B(SparkFun_ublox_SARA_R510M8S_61B&&)'
C:\Users\pc235\Documents\Arduino\libraries\SparkFun_u-blox_AT_Commands_Arduino_Library\src/sfe_sara_r5.h:65:7: note:   no known conversion for argument 1 from 'PinName' to 'SparkFun_ublox_SARA_R510M8S_61B&&'

@sfe-SparkFro : how do I define the power pin on the SARA-R510M8S? Thanks!

@sfe-SparkFro
Copy link
Collaborator Author

Ah, looks like the problem is that you can only use the default constructor for all the inherited classes. @gigapod any suggestions on how to best fix this? Would prefer to not have to define the same constructor for each class if possible.

@gigapod
Copy link
Member

gigapod commented Jan 10, 2024

You need to bring up the superclasses constructors using a using statement.

From something I did in Flux:

// use superclasses other constructors (besides default)
       using flxStorageJSONPref::flxStorageJSONPref;

Here in context
https://github.com/sparkfun/SparkFun_Flux/blob/981a4b6ec2080532b6405beff6390049e8a481b1/src/Flux/flxStorageJSONPref.h#L187

sfe-SparkFro added a commit that referenced this issue Jan 11, 2024
Discussed in #17, couldn't set pins with constructors of child classes
@sfe-SparkFro
Copy link
Collaborator Author

See #23, should be working there!

@gigapod
Copy link
Member

gigapod commented Jan 11, 2024

Looks good, merged in the branch!

@gigapod
Copy link
Member

gigapod commented Jan 11, 2024

The use of using is discussed in detail in a section on this page: https://en.cppreference.com/w/cpp/language/using_declaration

@PaulZC
Copy link
Contributor

PaulZC commented Feb 27, 2024

My RTK EVK examples (currently private):

  • 8_4_GNSS_NTRIP_Caster
    • Uses sockets to transfer the NTRIP data
  • 8_5_PointPerfect_MQTT
    • A stripped-down version of Michael's HPG Solution
    • Uses the LARA's built-in MQTT commands
    • Automatically subscribes to / unsubscribes from topics as needed
    • Subscribes to the closest u-blox PointPerfect Localized Distribution topic - minimizing the amount of data needed
    • Works very well!

Note: both examples need a GNSS, so they're not great 'generic' examples. Maybe we could adapt 8_5 so it transfers data to / from ThingSpeak using MQTT?

@PaulZC
Copy link
Contributor

PaulZC commented Feb 27, 2024

Hah! Except you almost did that already!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants