SCPI interface to SX1272 and SX1276
Dependencies: SX127x lib_gps lib_mma8451q lib_mpl3115a2 lib_sx9500 libscpi mbed
Description
This program implements a SCPI command parser. When connected via the debug virtual comm port, you can command the radio and peripherals to perform specific tasks or to set specific parameters. The serial port defaults to 9600bps N-8-1.
Example
The following exampling causes the NA Mote to transmit a continuous LoRa signal.
Example SCPI Commands
*IDN? RA:MOD LORA RA:FREQ 903 RA:PAS PA_BOOST RA:OCP 170 RA:BGR 7 RA:POW 15 RA:LORA:TXContinuous ON RA:FI "test"
Commands
SCPI is case-insensitive. Commands can be entered lower case.
RAdio
:FIfo "text"
write to fifo, and transmit packet:FIfo?
read from fifo (last received packet):REGister { address }, {value}
write radio register (SCPI takes #H for hex prefix):REGister? { address }
read radio register (SCPI takes #H for hex prefix):MODulation { FSK | OOK | LORa }
set modem type:MODulation?
get modem type:OPmode { SLE | STB | FST | TX | FSR | RXC | RXS | CAD }
set mode:OPmode?
get mode:DIOMap { 0 - 5 }, { 0 - 3 }
set DIO pin function {pin number}, {map value}:DIOMap? { 0 - 5 }
get DIO pin function {pin number}:DIO? { 0 - 5 }
read DIO pin level:RSSI?
read received signal strength (if in RXC mode):PASelect { RFO | PA_BOOST }
set RF output pin:PASelect?
get RF output pin selected:OCP {mA}
set over current protection:OCP?
read current limit:POWer {0 to 15}
set OutputPower:POWer?
get OutputPower:BGR { 0 - 7 }
set PA ref current:BGR?
get PA ref current:FREQuency {MHz}
set FRF:FREQuency?
get FRF:LNABoost { OFF | ON }
set LNA boost:LNABoost?
get LNA boost:LORa
:BW {KHz}
set lora bandwidth:BW?
get lora bandwidth (in KHz):SF {7 to 12}
set spreading factor:SF?
get spreading factor:TXContinuous { OFF | ON }
set continuous TX (end transmit by turning off):TXContinuous?
get continuous TX:PRELen {n-symbols}
set preamble length:PRELen?
get preamble length:CR {0-4}
set coding rate:CR?
get coding rate:LDRO { OFF | ON }
set LowDataRateOptimize bit:LDRO?
get LowDataRateOptimize bit:CRC { OFF | ON}
enable CRC in transmitted packet:CRC?
read CRC enabled state:INVRx { OFF | ON }
enable receiver spectral invert:INVRx?
get receiver inversion state:INVTx { OFF | ON }
enable transmitter spectral invert:INVTx?
get transmitter inversion state:FEI?
get frequency error of last received packet:PKTSnr?
get S/N (dB) of last received packet
:FSK
:DATAMode { CONT | PKT }
select continuous/packet mode:DATAMode?
get packet mode / continuous:FDev {Hz}
set TX frequency deviation:FDev?
get TX frequency deviation:BITRate {bps}
set bit rate:BITRate?
get bit rate:BT { 1.0 | 0.5 | 0.3 | 0.0 }
set transmit shaping:BT?
get transmit shaping:PRELen {n}
set preamble size:PRELen?
get preamble size:RXBW {Hz}
set receive bandwidth:RXBW?
set receive bandwidth:AFCBW {Hz}
set receive bandwidth (during preamble):AFCBW?
set receive bandwidth (during preamble):DCFree { OFF | MAN | WHIT }
set DC-free encoding:DCFree?
get DC-free encoding:RXTrigger { OFF | RSSI | PRE | BOTH }
set RX trigger mode:RXTrigger?
get RX trigger selection
radio events
Radio events are reported into the Questionable Data Status Event Register, which is summarized in Bit 3 (QSB) of Status Byte Register.
enabling event and reading event
RA:MOD? "LORa" RA:OP? "RXC" STAT:QUES:ENAB 512 *STB? 8 STAT:QUES:EVEN? 512 RA:FI? "4747474747474747" *STB? 0
Bit 9 of QUEStionable event register indicates DIO0 event occurred upon radio packet reception.
NA Mote-72 specific commands
PD2 { OFF | ON }
set power amplifier voltage statePD2?
get power amplifier voltage stateVBAT?
read battery voltageGPS
:EN { OFF | ON }
enable GPS:EN?
get GPS enabled state:NUMCoords {n}
set count of coordinates received (use to clear count):NUMCoords?
get count of coordinates received:LOngitude {n}
set longitude:LOngitude?
get longitude:LAtitude {n}
set latitude:LAtitude?
get latitude
MMA
MMA8451Q:ID?
read ID register (WHO_AM_I == 0x1a)
MPL
MPL3115A2:ID?
read ID register (WHO_AM_I == 0xc4)
SX9500
:RST
reset SX9500:REGister {addr}, {value}
write SX9500 register:REGister? {addr}
read SX9500 register
History
update to latest libraries
2018-05-29, by Wayne Roberts [Tue, 29 May 2018 12:45:54 -0700] rev 12
update to latest libraries
LEDs in test_interactive.cpp only for TARGET_MOTE_L152RC
2017-11-01, by dudmuck [Wed, 01 Nov 2017 22:54:05 +0000] rev 11
LEDs in test_interactive.cpp only for TARGET_MOTE_L152RC
update to current libraries
2017-10-30, by dudmuck [Mon, 30 Oct 2017 20:59:21 +0000] rev 10
update to current libraries
Blink LED when a command is issued over Serial Port
2016-07-05, by ubhat [Tue, 05 Jul 2016 20:54:43 +0000] rev 9
Blink LED when a command is issued over Serial Port
VBAT? command read fix
2016-01-19, by ubhat [Tue, 19 Jan 2016 21:34:03 +0000] rev 8
VBAT? command read fix
use released mbed library
2016-01-15, by dudmuck [Fri, 15 Jan 2016 18:33:50 +0000] rev 7
use released mbed library
added hardware version detection
2015-09-30, by dudmuck [Wed, 30 Sep 2015 19:34:50 +0000] rev 6
added hardware version detection
added peripherals for mote
2015-08-20, by dudmuck [Thu, 20 Aug 2015 02:01:45 +0000] rev 5
added peripherals for mote
handle PaSelect/rfsw correctly for mote
2015-08-18, by dudmuck [Tue, 18 Aug 2015 17:12:26 +0000] rev 4
handle PaSelect/rfsw correctly for mote
clear tx_busy upon *RST
2015-08-18, by dudmuck [Tue, 18 Aug 2015 15:58:03 +0000] rev 3
clear tx_busy upon *RST