SCPI interface to SX1272 and SX1276

Dependencies:   SX127x lib_gps lib_mma8451q lib_mpl3115a2 lib_sx9500 libscpi mbed

Issue: RAdio:FIfo? query returns unknown strings or bitstreams

Since there is no complete tutorial for SCPI RXD in LoRa mode. I tried the following step to test RXC mode. However at last step, the FIFO reading return UNKNOWN bitstream. Since the returned strings will corrupt my TeraTerm session, so I wrote a Python script to fetch the returned values from FIFO.

test_fifo_read_scpi.py

#!/usr/bin/env python

import serial
import time
import binascii
import listport

ports = listport.serial_ports()
if len(ports):
    print "{0} ports are available".format(len(ports))
    port = ports[0]
    print "port {0} is selected".format(port)
    
ser = serial.Serial(port, 9600, timeout = 0.5)

print("Port is opened\r\n")

setup_rxc_queries = [
    "RA:MOD LORa",
    "RA:FREQ 434",
    "RA:PAS PA_BOOST",
    "RA:OCP 170",
    "RA:POW 15",
    "RA:OP RXC",
]

for q in setup_rxc_queries:
    ser.write(q+'\r')
    time.sleep(0.1)
    print(ser.readline().strip())
    
print "******"
ser.write("RA:FI?\r")
print(ser.readline().strip())
time.sleep(0.1)
r = ser.readline().strip()
print "******"

print "LEN: {0}".format(len(r))
print "HEX: {0}".format(binascii.b2a_hex(r))
print "TXT: {0}".format(r)

ser.write("RA:OP?\r")
ser.readline().strip()
print(ser.readline().strip())
print(ser.readline().strip())
ser.write("RA:OP STB\r")

ser.close()

result

1 ports are available
port COM5 is selected
Port is opened

RA:MOD LORa
RA:FREQ 434
RA:PAS PA_BOOST
RA:OCP 170
RA:POW 15
RA:OP RXC
******
RA:FI?
******
LEN: 232
HEX: 22393064363564323865376564366363386138326631323164336330643362663765313661366533656233633461383233376630336538396538383933663835326561353736663138656234363935306363653565373864383361343931663932356565393336643630656162303336313161646236653630323664363632633366633666383662313061663161346539623964303330386231343562326663303939326339333935356332383337373366363037323866663766646362376364333833306531316131366535306562613766343436386165313361643761653235613130653622
TXT: "90d65d28e7ed6cc8a82f121d3c0d3bf7e16a6e3eb3c4a8237f03e89e8893f852ea576f18eb46950cce5e78d83a491f925ee936d60eab03611adb6e6026d662c3fc6f86b10af1a4e9b9d0308b145b2fc0992c93955c283773f60728ff7fdcb7cd3830e11a16e50eba7f4468ae13ad7ae25a10e6"
"RXC"

Since there is no LoRa beacon or transmitter nearby, it is abnormal to return such a long bitstream at all. I am not sure if my setup is correct or firmware has a bug.