Skip to content

Commit

Permalink
Add distinction on SARA-R5 module tested (#91)
Browse files Browse the repository at this point in the history
  • Loading branch information
rebatoma committed Nov 5, 2024
1 parent 17e42c5 commit 9158ce5
Show file tree
Hide file tree
Showing 15 changed files with 336 additions and 167 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,12 @@
*
******************************************************************************
* Modules: All Products
* Tested on: LARA-R2, SARA-R5, SARA-R42, LARA-R6, LENA-R8
* Tested on: LARA-R2, SARA-R50_R51, SARA-R52, SARA-R42, LARA-R6, LENA-R8
******************************************************************************/

// Configurable parameters

string productInUse = "lenaR8"; // Possible options are "saraR5" , "saraR42" , "laraR2", "laraR6", "lenaR8"
string productInUse = "saraR52"; // Possible options are "saraR50_R51", "saraR52", "saraR42", "laraR2", "laraR6", "lenaR8"
string CID = "1"; // default CID
string PDPtype = "IP"; // IP, NONIP, IPV6, IPV4V6
string APN = "internet";
Expand Down Expand Up @@ -76,7 +76,7 @@ void main()

SENDAT("AT+CGDCONT?",10000,"");

if(productInUse == "laraR2" || productInUse == "saraR5" || productInUse == "saraR42")
if(productInUse == "laraR2" || productInUse == "saraR50_R51" || productInUse == "saraR42")
{
if (SENDAT("AT+UPSD=0,0," + IPV,1000,"OK") != "OK")
{
Expand All @@ -89,7 +89,7 @@ void main()
}
}

if(productInUse == "laraR2" || productInUse == "saraR5")
if(productInUse == "laraR2" || productInUse == "saraR50_R51")
{
if(SENDAT("AT+UPSDA=0,3",150000,"OK") != "OK")
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
* must be activated.
******************************************************************************
* Modules: All products
* Tested on: LARA-R2, SARA-R42, LENA-R8, LEXI-R10
* Tested on: LARA-R2, SARA-R42, LENA-R8, LEXI-R10, LARA-R6, SARA-R5
******************************************************************************/

// Configurable parameters
Expand Down
32 changes: 20 additions & 12 deletions at_scripts/internet_applications/ipApp_all_tcpUdpDataTest_basic.atl
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,12 @@
* This script has the purpose to test TCP and UDP data connections.
******************************************************************************
* Modules: All Products
* Tested on: LARA-R6, LARA-R2, SARA-R5, SARA-R42
* Tested on: LARA-R6, LARA-R2, SARA-R50_R51, SARA-R52, SARA-R42
******************************************************************************/

// configuration
// configure the product/module in use
string productInUse = "laraR6"; // Possible options are "saraR5" , "saraR42" , "laraR2", "laraR6"
string productInUse = "saraR52"; // Possible options are "saraR50_R51", "saraR52", "saraR42", "laraR2", "laraR6"
string IPV = 0; //0: IPV4, 1: IPV6
string rat;
string resp;
Expand All @@ -46,27 +46,35 @@ void main()
SENDAT("ATI9",genericTimeDelay,"OK");
SENDAT("AT+UGPIOC=16,2",genericTimeDelay,"OK");
SENDAT("AT+URAT?",genericTimeDelay,"OK");
SENDAT("AT+ULWM2M?",genericTimeDelay,"OK"); // command not supported by all modules
SENDAT("AT+UMNOPROF?",genericTimeDelay,"OK"); // command not supported by all modules
SENDAT("AT+USVCDOMAIN?",genericTimeDelay,"OK"); // command not supported by all modules
SENDAT("AT+CPSMS?",genericTimeDelay,"OK"); // command not supported by all modules
SENDAT("AT+UPSV?",genericTimeDelay,"OK");
SENDAT("AT+UBANDMASK?",genericTimeDelay,"OK"); // command not supported by all modules

if(productInUse != "laraR2")
{
SENDAT("AT+ULWM2M?",genericTimeDelay,"OK"); // command not supported by all modules
SENDAT("AT+UMNOPROF?",genericTimeDelay,"OK"); // command not supported by all modules
SENDAT("AT+USVCDOMAIN?",genericTimeDelay,"OK"); // command not supported by all modules
SENDAT("AT+CPSMS?",genericTimeDelay,"OK"); // command not supported by all modules
SENDAT("AT+UBANDMASK?",genericTimeDelay,"OK"); // command not supported by all modules
}
ECHO("******************** End INIT ********************");
if(productInUse != "saraR5")
if(productInUse == "laraR2" || productInUse == "laraR6" || productInUse == "saraR42")
{
SENDAT("AT+CFUN=15",genericTimeDelay,"OK");
}
else
else if(productInUse == "saraR50_R51" || productInUse == "saraR52")
{
SENDAT("AT+CFUN=16",genericTimeDelay,"OK");
}
else
{
STOP("ERROR: productInUse is not existing");
}

SENDAT("AT+CFUN=1",genericTimeDelay,"OK");
for(int i=1; i<maxCnt+1; i++)
{
ECHO("");
ECHO("******************** Start Loop #"+i+" ********************");
SENDAT("AT+CFUN=1",genericTimeDelay,"OK");
SENDAT("ATE0",genericTimeDelay,"OK");
SENDAT("AT+CREG=2",genericTimeDelay,"OK");
SENDAT("AT+CGREG=2",genericTimeDelay,"OK");
Expand All @@ -80,7 +88,7 @@ void main()
SENDAT("AT+CREG?",genericTimeDelay,"OK");
SENDAT("AT+CEREG?",genericTimeDelay,"OK");

if(productInUse == "laraR2" || productInUse == "saraR5" || productInUse == "saraR42")
if(productInUse == "laraR2" || productInUse == "saraR50_R51" || productInUse == "saraR42")
{
if (SENDAT("AT+UPSD=0,0," + IPV,1000,"OK") != "OK")
{
Expand All @@ -93,7 +101,7 @@ void main()
}
}

if(productInUse == "laraR2" || productInUse == "saraR5")
if(productInUse == "laraR2" || productInUse == "saraR50_R51")
{
if(SENDAT("AT+UPSDA=0,3",150000,"OK") != "OK")
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ void enable_IP_stack_data_handling()
}


void modem_initialization (void)
void modem_initialization(void)
{
// in case of R8 autobauding. If baudrate is enabled, "AT" will not be replied
SENDAT("AT", 200, "OK");
Expand Down Expand Up @@ -253,18 +253,19 @@ string return_latitude_longitude_from_nmea()
ECHO("*************************************************************************************************************");
ECHO("BROKEN NMEA UGRMC response.");
ECHO("*************************************************************************************************************");
restart_script_initialization();
script_initialization();
return "BROKEN NMEA UGRMC";
}
}


void restart_script_initialization()
void script_initialization()
{
modem_initialization();
wait_for_registration_polling();
start_gnss();
obtain_first_fix();
configure_secure_http();
}


Expand Down Expand Up @@ -551,7 +552,6 @@ string http_post()

void get_info()
{
configure_secure_http();
for (int i = 0; i < iteration_number; i++) {
string all_local_cells = get_neighbor_cells();
string final_result, pos, cesq;
Expand Down Expand Up @@ -639,10 +639,7 @@ void main()
ECHO("REMEMBER TO CONFIGURE: the correct APN address to be used for this execution.");
ECHO("*************************************************************************************************************");

modem_initialization();
wait_for_registration_polling();
start_gnss();
obtain_first_fix();
script_initialization();

handle_file_to_send();
get_info();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,15 +26,15 @@
* https://www.u-blox.com/en/product/iot-sim-card
******************************************************************************
* Modules: SARA-R5, SARA-R42
* Tested on: SARA-R5, SARA-R42
* Tested on: SARA-R50_R51, SARA-R42, SARA-R52
******************************************************************************/

// Variables
string command, resp, identity, product_in_use;

// Configurable parameters
identity = "identity:xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx";
product_in_use = "saraR5"; // Possible options are "saraR5" or "saraR42"
product_in_use = "saraR52"; // Possible options are "saraR50_R51", "saraR52" or "saraR42"

// Initialization
ECHO("*************************************************************************************************************");
Expand Down Expand Up @@ -63,22 +63,25 @@ ECHO("Registering to the network.");
AT+CFUN=1
PAUSE 10000

AT+UPSD=0,0,0
AT+UPSD=0,100,1
if(product_in_use == "saraR5"){
resp = SENDAT("AT+UPSDA=0,3",10000,"OK");
if (FIND(resp,"ERROR") != -1){
STOP("Error in the context activation.");
if(product_in_use != "saraR52")
{
AT+UPSD=0,0,0
AT+UPSD=0,100,1
if(product_in_use == "saraR50_R51"){
resp = SENDAT("AT+UPSDA=0,3",10000,"OK");
if (FIND(resp,"ERROR") != -1){
STOP("Error in the context activation.");
}
}
}
else if (product_in_use == "saraR42"){
resp = SENDAT("AT+CGACT=1,1",10000,"OK");
if (FIND(resp,"ERROR") != -1){
STOP("Error in the context activation.");
else if (product_in_use == "saraR42"){
resp = SENDAT("AT+CGACT=1,1",10000,"OK");
if (FIND(resp,"ERROR") != -1){
STOP("Error in the context activation.");
}
}
else{
STOP("Wrong product configured.");
}
}
else{
STOP("Wrong product configured.");
}

// Collect module status
Expand All @@ -101,7 +104,7 @@ AT+UMQTTSN=10,1
ECHO("Connecting...");
command = "AT+UMQTTSNC=1";
resp = SENDAT(command,300000,"+UUMQTTSNC:");
resp=resp.split(':')[1];
resp=resp.split("+UUMQTTSNC:")[1];

if (FIND(resp,"1,1") == -1){
STOP("Unable to connect");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@
* See the License for the specific language governing permissions and
* limitations under the License.
******************************************************************************
* Synopsis: location_saraR5_saraR42_cellLocateFixOverTcp_basic.atl
* Synopsis: location_all_cellLocateFixOverTcp_basic.atl
* Topic: location_features
* Version: 1.0
* Version: 1.2
* Author: dtro
* Description:
* This script has the purpose to demonstrate the use of CellLocate and
Expand All @@ -26,7 +26,7 @@
* Also a erver_ip address is needed.
******************************************************************************
* Modules: All products
* Tested on: LARA-R6, LARA-L6, SARA-R5, SARA-R42
* Tested on: LARA-R6, LARA-L6, SARA-R5, SARA-R42, LEXI-R10
******************************************************************************/

// defined global variable
Expand All @@ -37,9 +37,10 @@ int socket_timeout = 180000;

string first_aiding_server = "cell-live1.services.u-blox.com";
string second_aiding_server = "cell-live2.services.u-blox.com";
string lena_r8_aiding_server = "lscellapi.services.u-blox.com";
string token = "<cellLocate_token>";

string cellLocate_command = "AT+ULOC=2,2,2," + timeout_CellLocate + ",2"; //script created for mode and response_type 2
string cellLocate_command = "AT+ULOC=2,2,1," + timeout_CellLocate + ",2"; //script created for mode and response_type 2

string server_ip = "<ip_server>";
int server_port = 7;
Expand All @@ -56,9 +57,16 @@ resp = SENDAT(command, generic_timeout, "OK");
command = "AT+CEREG=2;+CREG=2;+CGREG=2;+CSCON=1;+CGEREP=2,1;+CMEE=2";
resp = SENDAT(command, generic_timeout, "OK");

// check module type (speical server address must be used for LENA-R8)
command = "AT+CGMM";
string module_type = SENDAT(command, 200, "OK");

// set the aiding servers
command = "AT+UGSRV=\""+ first_aiding_server + "\",\""+ second_aiding_server + "\",\"" + token + "\",14,4,1,1,0,15";
SENDAT(command, 200, "OK");
if (FIND(module_type, "LENA-R8") != -1){
command = "AT+UGSRV=\""+ lena_r8_aiding_server + "\",\"\",\"" + token + "\",14,4,1,65,0,15";
}
SENDAT(command, 1000, "OK");

command = cellLocate_command;
resp = SENDAT(command, generic_timeout, "OK");
Expand All @@ -68,14 +76,19 @@ int counter = 0;
// worst case scenario
while (!uuloc_found && counter < 10) {
resp = WAIT("+UULOC", timeout_CellLocate * 1000);
if (FIND(resp, "+UULOC: ") != -1) {
if (FIND(resp, "+UULOC:") != -1) {
uuloc_found = true;
}
counter++;
}

string valid_point = resp.split(",")[2];
string CellLocate_response = resp.split(" ")[1];
string valid_point = resp.split(",")[9];
string CellLocate_response;
if (FIND(module_type, "LENA-R8") != -1){
CellLocate_response = resp.split("+UULOC:")[1];
} else {
CellLocate_response = resp.split(" ")[1];
}

if (FIND(valid_point, "2") != -1) {
command = "AT+USOCR=6";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@
* greeting text can be activated using the command AT+CSGT=1,"Start!"
* and using a fixed baud rate.
******************************************************************************
* Modules: SARA-R510M8S, SARA-R422M8S
* Tested on: SARA-R510M8S, SARA-R422M8S
* Modules: SARA-R510M8S, SARA-R422M8S, SARA-R520M10
* Tested on: SARA-R510M8S, SARA-R422M8S, SARA-R520M10
******************************************************************************/

// iteration cycles
Expand All @@ -34,8 +34,9 @@ int max_iteration = 200;
// modem type
// 0 - SARA-R510M8S
// 1 - SARA-R422M8S
// 2 - SARA-R520M10S

int modem_type = 0;
int modem_type = 2;

// aiding type to be configured, values allowed are:
// • 0 (default value): no aiding
Expand Down Expand Up @@ -147,16 +148,27 @@ void wait_for_registration()
}
}

command = "AT+CGACT=1,1";
resp = SENDAT(command, 10000, "OK");
if (modem_type == 0)
if (modem_type != 2)
{
command = "AT+UPSD=0,0,0";
resp = SENDAT(command, 10000, "OK");
command = "AT+UPSD=0,100,1";
resp = SENDAT(command, 10000, "OK");
command = "AT+UPSDA=0,3";
resp = SENDAT(command, 10000, "OK");

if (0 == modem_type)
{
command = "AT+UPSDA=0,3";
resp = SENDAT(command, 10000, "OK");
}
else if (1 == modem_type)
{
command = "AT+CGACT=1,1";
resp = SENDAT(command, 10000, "OK");
}
else
{
STOP("ERROR: modem_type is not existing");
}
}
}

Expand All @@ -168,6 +180,7 @@ void main()
ECHO("*************************************************************************************************************");
ECHO("This script needs 'Start!' greeting message active on boot");
ECHO("The greeting text can be actived using the command +CSGT=1,\"Start!\" and using a fixed baud rate (+IPR)");
ECHO("On SARA-R5 you need also to store the data on the active profile (AT&W)");
ECHO("");
ECHO("");
ECHO("*************************************************************************************************************");
Expand Down
Loading

0 comments on commit 9158ce5

Please sign in to comment.