RadioTestLibrary  1.33.0
Macros | Functions
main.cpp File Reference
#include <iostream>
#include <memory>
#include <QtCore>
#include <QCoreApplication>
#include "rtl_device.h"
#include "rtl_device_26_13xx.h"
Include dependency graph for main.cpp:

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...
 

Macro Definition Documentation

§ ACTION_QUIT

#define ACTION_QUIT   "qt"

Referenced by selectEb().

§ ACTION_LINK_TEST

#define ACTION_LINK_TEST   "lt"

§ ACTION_LINK_TEST_E

#define ACTION_LINK_TEST_E   "le"

§ ACTION_START_PACKET_TX

#define ACTION_START_PACKET_TX   "pt"

§ ACTION_START_PACKET_RX

#define ACTION_START_PACKET_RX   "pr"

§ ACTION_START_CONT_TX

#define ACTION_START_CONT_TX   "ct"

§ ACTION_START_CONT_RX

#define ACTION_START_CONT_RX   "cr"

§ ACTION_FREQ_OFFSET

#define ACTION_FREQ_OFFSET   "fo"

§ ACTION_RSSI

#define ACTION_RSSI   "rs"

§ ACTION_IDLE

#define ACTION_IDLE   "id"

§ ACTION_PROGRAM_FLASH_FROM_FILE

#define ACTION_PROGRAM_FLASH_FROM_FILE   "pf"

§ ACTION_PROGRAM_FLASH

#define ACTION_PROGRAM_FLASH   "pb"

§ ACTION_READ_MEMORY

#define ACTION_READ_MEMORY   "rm"

§ ACTION_WRITE_MEMORY

#define ACTION_WRITE_MEMORY   "wm"

§ ACTION_PROGRAM_AND_RUN_CPU

#define ACTION_PROGRAM_AND_RUN_CPU   "pc"

§ ACTION_HELP

#define ACTION_HELP   "hp"

§ RFREG_DEMFIFE0_CHA

#define RFREG_DEMFIFE0_CHA   0x400450EC

§ RFREG_DEMFIFE0_AGA

#define RFREG_DEMFIFE0_AGA   0x400450FC

§ MCUREG_IOCFG7

#define MCUREG_IOCFG7   0x4008101C

§ MCUREG_IOCFG13

#define MCUREG_IOCFG13   0x40081034

§ MCUREG_IOCFG14

#define MCUREG_IOCFG14   0x40081038

§ MCUREG_IOCFG25

#define MCUREG_IOCFG25   0x40081064

§ MCUREG_DOE31_0

#define MCUREG_DOE31_0   0x400220D0

§ MCUREG_DOUT15_12

#define MCUREG_DOUT15_12   0x4002200C

§ MCUREG_DOUT27_24

#define MCUREG_DOUT27_24   0x40022018

§ MCUREG_PDCTL0PERIPH

#define MCUREG_PDCTL0PERIPH   0x40082138

§ RANGE_EXTENDER

#define RANGE_EXTENDER   "Range_extender"

§ MAX_PKT_LENGTH

#define MAX_PKT_LENGTH   255

Referenced by startPacketRx().

§ INCLUDE_TRANSMITTER

#define INCLUDE_TRANSMITTER

Function Documentation

§ printHeader()

void printHeader ( void  )

Prints application header to console.

§ printMenu()

void printMenu ( void  )

Prints the user menu.

§ printPrompt()

void printPrompt ( void  )

Prints command prompt character.

Referenced by selectEb().

§ printLine()

void printLine ( void  )

Prints a line to console.

§ printError()

void printError ( QString &  message)

Prints an error message to the screen.

Parameters
[in]messageThe message to be printed.

Referenced by printLastError().

§ printErrorList()

void printErrorList ( void  )

§ printEbInfo()

void printEbInfo ( QStringList &  ebList)

Prints information about connected devices.

Parameters
[in]ebListA list of connected devices

§ getInputChar()

char getInputChar ( void  )

Get an input character from console.

Returns
char

§ getMenuOption()

std::string getMenuOption ( void  )

Get the menu option.

Returns
string

§ doAction()

void doAction ( const std::string &  action)

Execute selected action.

Parameters
[in]actionaction to execute

§ doLinkTest()

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.

Parameters
[in]rangeExtenderThe name of a range extender. The default value is "None"

§ selectEb()

QString selectEb ( void  )

Select Eb.

Returns
QString Selected EB identifier

References ACTION_QUIT, and printPrompt().

§ selectDeviceName()

QString selectDeviceName ( void  )

Select device name.

Returns
QString Selected device name

§ progressFunc()

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()

Parameters
[in]percentageThe percentage of the progress

§ startPacketTx()

void startPacketTx ( void  )

Start Packet TX.

This function shows how to send 100 packets for selected device.

§ startPacketRx()

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.

§ startContinuousTx()

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.

§ startContinuousRx()

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.

§ frequencyOffset()

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.

§ rssi()

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().

§ idle()

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.

§ askForFileName()

QString askForFileName ( )

Ask for file name.

This function asks the user to specify a file name, and returns it.

§ programFlashFromFile()

void programFlashFromFile ( const QString &  fileName)

Program flash.

This function show how to erase, program and verify flash with input from file.

Referenced by programAndRunImage().

§ programFlash()

void programFlash ( void  )

Program flash.

This function show how to program flash from a given data buffer.

§ readMemory()

void readMemory ( void  )

Read memory.

This function show how to read memory from the target device.

§ writeMemory()

void writeMemory ( void  )

Write memory.

This function shows how to write memory on the target device.

§ programAndRunImage()

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().

§ getCategoryAndSetting()

void getCategoryAndSetting ( const QString &  devId,
QString &  category,
QString &  setting 
)

Get category and setting based on selected device name.

Parameters
[in]devIdUSB Device ID. E.g.: "XDS-06EB12100472A"
[out]categoryThe category name. The same name as used in SmartRF Studio under typical settings.
[out]settingName 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().

§ getTargetName()

void getTargetName ( const QString &  devId,
QString &  targetName 
)

Get target name based on selected device name.

Parameters
[out]targetNameName of the target. Same name as used in SmartRF Studio under Target Configuration.

Referenced by rssiTest().

§ configureIOPinsForRangeExtender()

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

Parameters
[in]devIdUSB Device ID. E.g.: "XDS-06EB12100472A"
[in]rangeExtenderName 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().

§ delay()

void delay ( const int &  millisecondsToWait)

Delay in given milliseconds.

Parameters
[in]millisecondsToWaitNumber of milliseconds to wait

§ rssiTest()

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.

Parameters
[in]devIdUSB Device ID. E.g.: "XDS-06EB12100472A"

References getCategoryAndSetting(), getTargetName(), RTLDevice::readCmdSettingsFromFile(), RTLDevice::setParameter(), RTLDevice::TM_CONT_RX, and RTLDevice::TST_OK.

§ isBleDevice()

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.

Returns
Returns true if BLE device, false otherwise.

§ isBleR2Device()

bool isBleR2Device ( void  )

Checks if the selected device a BLE device with ROM version 2.

Returns
Returns true if BLE R2 device, false otherwise.

Referenced by createPacketData().

§ isBleCC13x2CC26x2Device()

bool isBleCC13x2CC26x2Device ( void  )

Checks if the selected device a BLE device.

Returns
Returns true if BLE CC13x2 or CC26x2 device, false otherwise.

Referenced by createPacketData().

§ isBleCC13x4CC26x4Device()

bool isBleCC13x4CC26x4Device ( void  )

Checks if the selected device a BLE device.

Returns
Returns true if BLE CC1354 or CC26x4 device, false otherwise.

Referenced by createPacketData().

§ isIeeeDevice()

bool isIeeeDevice ( )

Checks if the selected device an IEEE device.

This function is used for checking if the selected device is an IEEE device.

Returns
Returns true if IEEE device, false otherwise.

§ setTargetBoardAndGetTxPowerValue()

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.

Parameters
[in]devIdDevice ID
[out]pTxPowerValuePointer to the TX Power value to return.
Returns
int RTLDevice::TST_OK or RTLDevice::TST_FAILED

§ setMaxOutputPower()

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.

Parameters
[in]devIdUSB Device ID. E.g.: "XDS-06EB12100472A"

References RTLDevice::TST_OK.

§ setCapArrayTuning()

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.

Parameters
[out]targetNameName of the target. Same name as used in SmartRF Studio under Target Configuration.

References RTLDevice::setCapArrayDelta().

§ createPacketData()

void createPacketData ( char **  pData,
int *  length 
)

Create Packet Data.

This function return a pointer to packet data depending on the device under test.

Parameters
[out]*pDataPointer address to the packet data
[out]lengthLength of the data.

References isBleCC13x2CC26x2Device(), isBleCC13x4CC26x4Device(), and isBleR2Device().

§ main()

int main ( int  argc,
char *  argv[] 
)

Main function.

§ printLastError()

void printLastError ( RTLDevice pTestDevice)

Prints last error message from RTLDevice class.

Parameters
[in]pTestDevicepointer to RTLDevice object

References RTLDevice::getLastError(), and printError().

© Copyright 1995-2024, Texas Instruments Incorporated. All rights reserved.
Trademarks | Privacy policy | Terms of use | Terms of sale