SWRA571B August 2017 – August 2020 CC1310 , CC1310 , CC1312PSIP , CC1312PSIP , CC1312R , CC1312R , CC1314R10 , CC1314R10 , CC1350 , CC1350 , CC1352P , CC1352P , CC1352P7 , CC1352P7 , CC1352R , CC1352R
To test that the data entries are set up correctly and that the patch is working you can enable the built-in test pattern (see Table 2-2) and declare two arrays (iSamples and qSamples) that can hold the “received” I and Q samples.
#define NUMBER_OF_BUFFERS 5
static uint16_t iSamples[NUMBER_OF_SAMPLE_PAIRS*NUMBER_OF_BUFFERS];
static uint16_t qSamples[NUMBER_OF_SAMPLE_PAIRS*NUMBER_OF_BUFFERS];
For test purposes, set NUMBER_OF_SAMPLE_PAIRS to a low number(2) to easier be able to go through the array to see that everything is OK.
#define NUMBER_OF_SAMPLE_PAIRS 8
In the callback, where code for handling the samples should be implemented, the following code was added:
static uint16_t index = 0;
void callback(RF_Handle h, RF_CmdHandle ch, RF_EventMask e)
{
if (e & RF_EventRxEntryDone)
{
// Toggle pin to indicate RX
PIN_setOutputValue(ledPinHandle,
Board_PIN_LED2,!PIN_getOutputValue(Board_PIN_LED2));
// Get a pointer to the first IQ sample byte
packetDataPointer = ¤tReadEntry->rxData;
//---------------------------------------------------------------------------
// Implement code for handling the IQ data
// In this example, I and Q data are simply copied into two separate array
{
uint16_t i;
// IQ Sample Handling
for (i = index; i < (NUMBER_OF_SAMPLE_PAIRS + index); i++)
{
iSamples[i] = (((*(packetDataPointer + 1)) << 8) |
(*packetDataPointer)) & 0x0FFF;
qSamples[i] = (((*(packetDataPointer + 2)) << 8) |
(*(packetDataPointer + 1))) >> 4;
packetDataPointer += 3;
}
}
index += NUMBER_OF_SAMPLE_PAIRS;
if (index == (NUMBER_OF_SAMPLE_PAIRS*NUMBER_OF_BUFFERS))
{
index = 0;
}
//---------------------------------------------------------------------------
currentReadEntry->status = DATA_ENTRY_PENDING;
currentReadEntry = (rfc_dataEntryPartial_t*)currentReadEntry->pNextEntry;
}
}
Figure 4-1 shows the five buffers with eight IQ sample pairs in each stored in an iSamples and qSamples array, each holding 40 samples (NUMBER_OF_BUFFERS · NUMBER_OF_SAMPLE_PAIRS).