RadioTestLibrary
1.34.0
|
#include <iostream>
#include <memory>
#include <QtCore>
#include <QCoreApplication>
#include "rtl_device.h"
#include "rtl_device_26_13xx.h"
Macros | |
#define | ACTION_QUIT "qt" |
#define | ACTION_LINK_TEST "lt" |
#define | ACTION_LINK_TEST_E "le" |
#define | ACTION_START_PACKET_TX "pt" |
#define | ACTION_START_PACKET_RX "pr" |
#define | ACTION_START_CONT_TX "ct" |
#define | ACTION_START_CONT_RX "cr" |
#define | ACTION_FREQ_OFFSET "fo" |
#define | ACTION_RSSI "rs" |
#define | ACTION_IDLE "id" |
#define | ACTION_PROGRAM_FLASH_FROM_FILE "pf" |
#define | ACTION_PROGRAM_FLASH "pb" |
#define | ACTION_READ_MEMORY "rm" |
#define | ACTION_WRITE_MEMORY "wm" |
#define | ACTION_PROGRAM_AND_RUN_CPU "pc" |
#define | ACTION_HELP "hp" |
#define | RFREG_DEMFIFE0_CHA 0x400450EC |
#define | RFREG_DEMFIFE0_AGA 0x400450FC |
#define | MCUREG_IOCFG7 0x4008101C |
#define | MCUREG_IOCFG13 0x40081034 |
#define | MCUREG_IOCFG14 0x40081038 |
#define | MCUREG_IOCFG25 0x40081064 |
#define | MCUREG_DOE31_0 0x400220D0 |
#define | MCUREG_DOUT15_12 0x4002200C |
#define | MCUREG_DOUT27_24 0x40022018 |
#define | MCUREG_PDCTL0PERIPH 0x40082138 |
#define | RANGE_EXTENDER "Range_extender" |
#define | MAX_PKT_LENGTH 255 |
#define | INCLUDE_TRANSMITTER |
Functions | |
void | printHeader (void) |
Prints application header to console. More... | |
void | printMenu (void) |
Prints the user menu. More... | |
void | printPrompt (void) |
Prints command prompt character. More... | |
void | printLine (void) |
Prints a line to console. More... | |
void | printError (QString &message) |
Prints an error message to the screen. More... | |
void | printErrorList (void) |
void | printEbInfo (QStringList &ebList) |
Prints information about connected devices. More... | |
char | getInputChar (void) |
Get an input character from console. More... | |
std::string | getMenuOption (void) |
Get the menu option. More... | |
void | doAction (const std::string &action) |
Execute selected action. More... | |
void | doLinkTest (const QString &rangeExtender) |
Execute link test. More... | |
QString | selectEb (void) |
Select Eb. More... | |
QString | selectDeviceName (void) |
Select device name. More... | |
void | progressFunc (int percentage) |
Progress function. More... | |
void | startPacketTx (void) |
Start Packet TX. More... | |
void | startPacketRx (void) |
Start Packet RX. More... | |
void | startContinuousTx (void) |
Start Continuous Tx. More... | |
void | startContinuousRx (void) |
Start Continuous Rx. More... | |
void | frequencyOffset (void) |
Frequency Offset. More... | |
void | rssi (void) |
RSSI measurements. More... | |
void | idle (void) |
Idle and disconnected from connected devices. More... | |
QString | askForFileName () |
Ask for file name. More... | |
void | programFlashFromFile (const QString &fileName) |
Program flash. More... | |
void | programFlash (void) |
Program flash. More... | |
void | readMemory (void) |
Read memory. More... | |
void | writeMemory (void) |
Write memory. More... | |
void | programAndRunImage (void) |
Program and run CPU. More... | |
void | getCategoryAndSetting (const QString &devId, QString &category, QString &setting) |
Get category and setting based on selected device name. More... | |
void | getTargetName (const QString &devId, QString &targetName) |
Get target name based on selected device name. More... | |
void | configureIOPinsForRangeExtender (const QString &devId, const QString &rangeExtender) |
Configure IO pins to control range extender. More... | |
void | delay (const int &millisecondsToWait) |
Delay in given milliseconds. More... | |
void | rssiTest (const QString &devId) |
RSSI test. More... | |
bool | isBleDevice (void) |
Checks if the selected device a BLE device. More... | |
bool | isBleR2Device (void) |
Checks if the selected device a BLE device with ROM version 2. More... | |
bool | isBleCC13x2CC26x2Device (void) |
Checks if the selected device a BLE device. More... | |
bool | isBleCC13x4CC26x4Device (void) |
Checks if the selected device a BLE device. More... | |
bool | isIeeeDevice () |
Checks if the selected device an IEEE device. More... | |
int | setTargetBoardAndGetTxPowerValue (const QString &devId, QString *pTxPowerValue) |
Set Target board and Get The TX Power value. More... | |
void | setMaxOutputPower (const QString &devId) |
Set max output power for the selected device. More... | |
void | setCapArrayTuning (const QString &devId, const QString &targetName) |
Set the internal Cap-array tuning. More... | |
void | createPacketData (char **pData, int *length) |
Create Packet Data. More... | |
int | main (int argc, char *argv[]) |
Main function. More... | |
void | printLastError (RTLDevice *pTestDevice) |
Prints last error message from RTLDevice class. More... | |
#define ACTION_QUIT "qt" |
Referenced by selectEb().
#define ACTION_LINK_TEST "lt" |
#define ACTION_LINK_TEST_E "le" |
#define ACTION_START_PACKET_TX "pt" |
#define ACTION_START_PACKET_RX "pr" |
#define ACTION_START_CONT_TX "ct" |
#define ACTION_START_CONT_RX "cr" |
#define ACTION_FREQ_OFFSET "fo" |
#define ACTION_RSSI "rs" |
#define ACTION_IDLE "id" |
#define ACTION_PROGRAM_FLASH_FROM_FILE "pf" |
#define ACTION_PROGRAM_FLASH "pb" |
#define ACTION_READ_MEMORY "rm" |
#define ACTION_WRITE_MEMORY "wm" |
#define ACTION_PROGRAM_AND_RUN_CPU "pc" |
#define ACTION_HELP "hp" |
#define RFREG_DEMFIFE0_CHA 0x400450EC |
#define RFREG_DEMFIFE0_AGA 0x400450FC |
#define MCUREG_IOCFG7 0x4008101C |
Referenced by configureIOPinsForRangeExtender().
#define MCUREG_IOCFG13 0x40081034 |
Referenced by configureIOPinsForRangeExtender().
#define MCUREG_IOCFG14 0x40081038 |
Referenced by configureIOPinsForRangeExtender().
#define MCUREG_IOCFG25 0x40081064 |
#define MCUREG_DOE31_0 0x400220D0 |
Referenced by configureIOPinsForRangeExtender().
#define MCUREG_DOUT15_12 0x4002200C |
Referenced by configureIOPinsForRangeExtender().
#define MCUREG_DOUT27_24 0x40022018 |
#define MCUREG_PDCTL0PERIPH 0x40082138 |
Referenced by configureIOPinsForRangeExtender().
#define RANGE_EXTENDER "Range_extender" |
Referenced by configureIOPinsForRangeExtender().
#define MAX_PKT_LENGTH 255 |
Referenced by startPacketRx().
#define INCLUDE_TRANSMITTER |
void printHeader | ( | void | ) |
Prints application header to console.
void printMenu | ( | void | ) |
Prints the user menu.
void printPrompt | ( | void | ) |
Prints command prompt character.
Referenced by selectEb().
void printLine | ( | void | ) |
Prints a line to console.
void printError | ( | QString & | message | ) |
Prints an error message to the screen.
[in] | message | The message to be printed. |
Referenced by printLastError().
void printErrorList | ( | void | ) |
void printEbInfo | ( | QStringList & | ebList | ) |
Prints information about connected devices.
[in] | ebList | A list of connected devices |
char getInputChar | ( | void | ) |
Get an input character from console.
std::string getMenuOption | ( | void | ) |
Get the menu option.
void doAction | ( | const std::string & | action | ) |
Execute selected action.
[in] | action | action to execute |
void doLinkTest | ( | const QString & | rangeExtender | ) |
Execute link test.
This function lets the user select one of the enumerated devices for RX and another device for TX. It then connects to the devices and configures for link test. It starts the link and reports the results when it is finished. Finally it disconnects from the devices.
[in] | rangeExtender | The name of a range extender. The default value is "None" |
QString selectEb | ( | void | ) |
QString selectDeviceName | ( | void | ) |
Select device name.
void progressFunc | ( | int | percentage | ) |
Progress function.
This function is a callback function from the Radio Test Library to track progress during link test. It must be registered with the function RTLDevice::setCallBackProgressFunction()
[in] | percentage | The percentage of the progress |
void startPacketTx | ( | void | ) |
Start Packet TX.
This function shows how to send 100 packets for selected device.
void startPacketRx | ( | void | ) |
Start Packet RX.
This function shows how to receive packets.
References MAX_PKT_LENGTH, RTLDevice::PacketData_t::maxLength, and RTLDevice::PacketData_t::pData.
void startContinuousTx | ( | void | ) |
Start Continuous Tx.
This function lets the user select one of the enumerated devices. It then connects to the device, configures for continuous TX and starts it.
void startContinuousRx | ( | void | ) |
Start Continuous Rx.
This function lets the user select one of the enumerated devices. It then connects to the device, configures for continuous RX and starts it.
void frequencyOffset | ( | void | ) |
Frequency Offset.
This function will setup one device in continuous TX and start a second device in continuous RX to read out the frequency offset value.
Note CC2650_BLE: To achieve better accuracy of the estimated frequency offset value, the RF register DEMFIFE0 is updated. This must be done after the Radio setup command. That is why the commands are executed one by one to start Continuous RX.
The command names can be found from the command view in SmartRF Studio.
void rssi | ( | void | ) |
RSSI measurements.
This function will setup one device in continuous TX and start a second device in continuous RX to read out RSSI value.
Referenced by RTLDevice26_13xx::doLinkTest(), and RTLDevice::readPacket().
void idle | ( | void | ) |
Idle and disconnected from connected devices.
This function go through the list of all enumerated devices. For each device that is connected it will be set to idle state and disconnected.
QString askForFileName | ( | ) |
Ask for file name.
This function asks the user to specify a file name, and returns it.
void programFlashFromFile | ( | const QString & | fileName | ) |
Program flash.
This function show how to erase, program and verify flash with input from file.
Referenced by programAndRunImage().
void programFlash | ( | void | ) |
Program flash.
This function show how to program flash from a given data buffer.
void readMemory | ( | void | ) |
Read memory.
This function show how to read memory from the target device.
void writeMemory | ( | void | ) |
Write memory.
This function shows how to write memory on the target device.
void programAndRunImage | ( | void | ) |
Program and run CPU.
This function shows how to program a FW image and run from the debug interface. For this example it is assumed that the stack pointer address is given in the first 32 bit word of the programmed flash and that the Program counter is given by the second 32 bit word of the programmed flash.
References programFlashFromFile().
void getCategoryAndSetting | ( | const QString & | devId, |
QString & | category, | ||
QString & | setting | ||
) |
Get category and setting based on selected device name.
[in] | devId | USB Device ID. E.g.: "XDS-06EB12100472A" |
[out] | category | The category name. The same name as used in SmartRF Studio under typical settings. |
[out] | setting | Name of the file with typical settings. The file can be found under cmd_settings folder as part of the configuration for each device. |
Referenced by rssiTest().
void getTargetName | ( | const QString & | devId, |
QString & | targetName | ||
) |
Get target name based on selected device name.
[out] | targetName | Name of the target. Same name as used in SmartRF Studio under Target Configuration. |
Referenced by rssiTest().
void configureIOPinsForRangeExtender | ( | const QString & | devId, |
const QString & | rangeExtender | ||
) |
Configure IO pins to control range extender.
This function just show an example of connections that is used by one of our boards with range extender. The following IO pins on CC26xx/CC13xx are used as control signal for the range extender: DIO7: PA enable DIO13: LNA enable DIO14: HGM In this example the HGM is set high by default.
Examples of a range extender could be CC2592 or CC1190
For other designs where the control signal of the range extender are connected to different IO pins, the configuration must be changed accordingly.
See the Technical Reference Manual (Chapter 11 I/O Control) for further details about the IO configuration. https://www.ti.com/lit/pdf/swcu117
[in] | devId | USB Device ID. E.g.: "XDS-06EB12100472A" |
[in] | rangeExtender | Name of the Range Extender. |
References MCUREG_DOE31_0, MCUREG_DOUT15_12, MCUREG_IOCFG13, MCUREG_IOCFG14, MCUREG_IOCFG7, MCUREG_PDCTL0PERIPH, RANGE_EXTENDER, RTLDevice::readMcuReg(), and RTLDevice::writeMcuReg().
void delay | ( | const int & | millisecondsToWait | ) |
Delay in given milliseconds.
[in] | millisecondsToWait | Number of milliseconds to wait |
void rssiTest | ( | const QString & | devId | ) |
RSSI test.
This function is only used for testing and does not contain a complete setup to do RSSI measurement.
[in] | devId | USB Device ID. E.g.: "XDS-06EB12100472A" |
References getCategoryAndSetting(), getTargetName(), RTLDevice::readCmdSettingsFromFile(), RTLDevice::setParameter(), RTLDevice::TM_CONT_RX, and RTLDevice::TST_OK.
bool isBleDevice | ( | void | ) |
Checks if the selected device a BLE device.
This function is used for checking if the selected device is a BLE device.
bool isBleR2Device | ( | void | ) |
Checks if the selected device a BLE device with ROM version 2.
Referenced by createPacketData().
bool isBleCC13x2CC26x2Device | ( | void | ) |
Checks if the selected device a BLE device.
Referenced by createPacketData().
bool isBleCC13x4CC26x4Device | ( | void | ) |
Checks if the selected device a BLE device.
Referenced by createPacketData().
bool isIeeeDevice | ( | ) |
Checks if the selected device an IEEE device.
This function is used for checking if the selected device is an IEEE device.
int setTargetBoardAndGetTxPowerValue | ( | const QString & | devId, |
QString * | pTxPowerValue | ||
) |
Set Target board and Get The TX Power value.
This is used for the LAUNCHXL-CC1352Px. The variants can be recognized by their device ID.
[in] | devId | Device ID |
[out] | pTxPowerValue | Pointer to the TX Power value to return. |
void setMaxOutputPower | ( | const QString & | devId | ) |
Set max output power for the selected device.
This function sets the max known output power for the selected device.
[in] | devId | USB Device ID. E.g.: "XDS-06EB12100472A" |
References RTLDevice::TST_OK.
void setCapArrayTuning | ( | const QString & | devId, |
const QString & | targetName | ||
) |
Set the internal Cap-array tuning.
The internal load capacitor array for the HF Crystal can be modified to tune the frequency offset for the RF Design.
[out] | targetName | Name of the target. Same name as used in SmartRF Studio under Target Configuration. |
References RTLDevice::setCapArrayDelta().
void createPacketData | ( | char ** | pData, |
int * | length | ||
) |
Create Packet Data.
This function return a pointer to packet data depending on the device under test.
[out] | *pData | Pointer address to the packet data |
[out] | length | Length of the data. |
References isBleCC13x2CC26x2Device(), isBleCC13x4CC26x4Device(), and isBleR2Device().
int main | ( | int | argc, |
char * | argv[] | ||
) |
Main function.
void printLastError | ( | RTLDevice * | pTestDevice | ) |
Prints last error message from RTLDevice class.
[in] | pTestDevice | pointer to RTLDevice object |
References RTLDevice::getLastError(), and printError().