This is a Python library to control the RWC5020x LoRa Tester remotely through either the serial port (RS232) or the Ethernet port.
-
Supported analyzers (current generation):
RWC5020B RWC5020M 

-
Supported analyzer (previous generation):
RWC5020A 
- To access RWC5020x tester using Python Library, please follow the setup shown in the diagram.
-
Clone the repository from github
-
Open a terminal window and change directory to
{path_to_repository}/rwc-python-api. -
To install the library in your local Python setup, enter the command
python setup.py install
Create a Python file and import the class library from package:
from rwclib.cRWC5020x import RWCTesterApiCreate a class object and pass serial port or ethernet port & ip address as constructor parameter
# ---Serial Communication---
rwc = RWCTesterApi('COM5') #windows
(or)
rwc = RWCTesterApi('/dev/ttyUSB0') #Linux
# ---Ethernet Communication---
rwc = RWCTesterApi('5001', '192.168.0.33')Access the class methods using instantiated object
rwc.query_identification()To know more about class methods, please see the code documentation in the following location in this repository: ./doc/build/html/index.html
Example scripts showing how to use the library can be found in the examples directory.
The Python library supports RWC5020x firmware from v1.150 on. v1.0.5 to v1.1.0 were tested with an RWC5020B running firmware v1.500; v1.2.0 was tested with firmware v1.500 and v1.604. There is no manual for firmware later than v1.500; commands for later firmware come from the firmware release notes and from tests on the tester.
The library logs each command and response through Python's logging module, under the logger rwclib.cRWCSerialSetup. To see them, configure logging in your script, for example logging.basicConfig(level=logging.INFO).
-
v1.2.0 has the following changes:
- Part of #18: firmware v1.604.
- Firmware v1.520 separated LoRa CRC from the coding rate. New
nst_tx/rx/mfg_set/getcrc()andnst_rx_set/getimplicitcrc(). On v1.520 and later,nst_tx_setcr(),nst_mfg_setcr()andnst_rx_setimplicitcr()raise forNO_CRC, andnst_rx_setcr()raises for any coding rate: on v1.604,CONF:NST:RX:CRtakes ON or OFF and sets the RX CRC. - SF5 and SF6 for NST TX, RX and MFG on v1.520 and later;
16-CHforrf_setedtmultichannel()on v1.510 and later (it needs the tester's 16-channel option);protocol_set/getrelaymode()on v1.600 and later;query_incertoptinfo(). link_set/getadrchmask_optdr()andquery_ilcertoptinfo()raise on v1.604, which answers NAK; the release notes don't say when or why these went.link_setfopts()raises unless the value's length matchesFOPTS_SIZE. The tester accepts a shorter value and keeps the old bytes after it; a hex string passed without0xis read as decimal and is usually shorter.
-
v1.1.0 has the following changes:
- Part of #18: methods for commands in the v1.500 manual that the library lacked: EDT channel plan, RX AGC, NST implicit header, coding rate and payload size, NST frame-count averaging, FOpts user payload and its size, uplink and downlink dwell time, general application key, sensitivity PER result by index, and the 64-channel and AU, RU, IL and EU433 certification option queries.
- On firmware v1.500,
link_getfoptspayload()gets NAK even afterlink_setfoptspayload()has set a payload. The dwell-time getters return1for 400ms and0for NO_LIMIT.
-
v1.0.9 has the following changes:
- Part of #18:
sensitivity_setrx2frequency()works (it was a stub); uplink and downlink channel methods take an optional channel number; firmware version checks use numeric ranges instead of lists, and fail with a clear error if the tester doesn't report its version.
- Part of #18:
-
v1.0.8 has the following changes:
- Part of #18: region names AU_915, KR_920 and IN_865 (old names still accepted); ICA operator; ranges for target PER, power Y-axis minimum, fragment padding, MFG packet interval and TX power; payload setters take bytes or hex strings starting with
0x, and keep leading zero bytes; per-channel power for channels above 7. - Payload and sync-word setters read a plain string as decimal, as v1.0.4 did. v1.0.5 to v1.0.7 read a plain string passed to
nst_tx_setpayload()or a sync-word setter as hex; write hex as'0x...'or pass bytes.
- Part of #18: region names AU_915, KR_920 and IN_865 (old names still accepted); ICA operator; ranges for target PER, power Y-axis minimum, fragment padding, MFG packet interval and TX power; payload setters take bytes or hex strings starting with
-
v1.0.7 has the following changes:
- Part of #18:
link_getmacsendresult()sendsMAC_SEND_RESULT;link_set/getadrchmask_optdr()sendADR_CH_MASK_OPT <MAC_NUM>on firmware v1.200 and later;nst_rx_settxpolarity()sendsRX_POLARITY;nst_tx_getmode()readsMODULATION. Methods for commands deleted in firmware v1.32 and v1.33 raise on that firmware and later. - Offline tests in
tests/test_commands.py.
- Part of #18:
-
v1.0.6 has the following changes:
- All six RF frequency setters send the frequency to 1 Hz. v1.0.5 kept only 6 significant digits in
rf_setfrequency()andrf_settxfrequency()(865.0625 MHz went out as 865.062), and the other four truncated to whole MHz. - Over Ethernet,
transceive()discards replies that arrive after a timeout, so they no longer shift every later reply by one. The timeout is 15 s;CONF:RF:RX_FREQtakes about 5.5 s.
- All six RF frequency setters send the frequency to 1 Hz. v1.0.5 kept only 6 significant digits in
-
v1.0.5 has the following changes:
- Fix #14: commands that failed on firmware v1.500. Data-rate setters accept any firmware from v1.170 on; frequency setters accept fractional MHz;
nst_tx_setpayloadsize()sends the NST command;nst_tx_setpayload()and the sync-word setters take bytes or hex strings; NST getters useREAD:queries. - Fix #13: the library no longer configures logging or writes
../logs/rwcapi.log;setup.pyrequires pyserial.
- Fix #14: commands that failed on firmware v1.500. Data-rate setters accept any firmware from v1.170 on; frequency setters accept fractional MHz;
-
v1.0.4 has the following changes:
- Fix #6: Added new remote commands for the latest firmware v1.310
-
v1.0.3.10 includes the following changes:
- Fix #2: Updated latest remote commands and added backward compatibility to python library for support of RWC5020x firmware from v1.150 to v1.305.
