Switching RATs, operators and activating PDP contexts with TRM240

We are currently doing a project with the TRM240 and TRM250 where we do iperf3 tests, FTP operations etc. and we want to use the modems in different RATs. This is done using Windows 10, Python 3 and AT commands. Below are some questions I had for the setup and switching between RATs, and my setup so far is shown below the questions:

  • What are the AT command steps to switch between operators and switch between RATs? Do I have to switch operators to switch RATs?
  • Should I define multiple PDP contexts or should I just overwrite the current one each time? We have our own private APNs; one for 2G and 3G and another one for 4G.
  • Do I need to have chosen an operator to activate the PDP context to get an IP address?
  • Since I have multiple APNs, but Windows only uses one at a time and it seems to override the PDP context that I activated on the modem using the AT commands?

Setup:

from AT import AT
from ftplib import FTP
import time
import subprocess
import iperf3

port = ‘COM15’

modem1 = AT(port)

def run_iperf_test(rat, options):

#print(modem1.send_AT_command("AT+CFUN=0"))
#print(modem1.send_AT_command("AT+CFUN=1"))
print(modem1.send_AT_command("AT+COPS=2"))
print(modem1.send_AT_command("AT+QIDEACT=1"))

if rat == "2G":
    print(modem1.send_AT_command("AT+COPS=0,,,0"))
    print(modem1.send_AT_command("AT+CREG?"))
    print(modem1.send_AT_command("AT+COPS?"))
    print(modem1.send_AT_command('AT+QCFG="nwscanmode",1,1'))
    print(modem1.send_AT_command('AT+CGDCONT=1,"IP","ruskoap1"'))
    print(modem1.send_AT_command("AT+QIACT=1"))
    print(modem1.send_AT_command("AT+QIACT?"))

elif rat == "3G":
    print(modem1.send_AT_command("AT+COPS=0,,,2"))
    print(modem1.send_AT_command("AT+CREG?"))
    print(modem1.send_AT_command("AT+COPS?"))
    print(modem1.send_AT_command('AT+QCFG="nwscanmode",2,1'))
    print(modem1.send_AT_command('AT+CGDCONT=1,"IP","ruskoap1"'))
    print(modem1.send_AT_command("AT+QIACT=1"))
    print(modem1.send_AT_command("AT+QIACT?"))
    
elif rat == "4G":
    print(modem1.send_AT_command("AT+COPS=0,,,7"))
    print(modem1.send_AT_command("AT+CREG?"))
    print(modem1.send_AT_command("AT+COPS?"))
    print(modem1.send_AT_command('AT+QCFG="nwscanmode",3,1'))
    print(modem1.send_AT_command('AT+CGDCONT=1,"IP","5gapn1"'))
    print(modem1.send_AT_command("AT+QIACT=1"))
    print(modem1.send_AT_command("AT+QIACT?"))
    
    

ip_address = modem1.get_ip_address()
print(ip_address)

command = f'iperf3 {options} -B {ip_address}'
print(command)
result = subprocess.run(command, shell=True,capture_output=True, text=True)
print("Output:", result.stdout)
print("Error:", result.stderr)

test changing RATs

run_iperf_test(‘2G’, ‘-c 10.33.92.47’)
#run_iperf_test(‘3G’, ‘-c 10.33.92.47’)
#run_iperf_test(‘4G’, ‘-c 10.33.92.47’)

modem1.close()

This topic was automatically closed after 15 days. New replies are no longer allowed.