Part Number: CC1310
Tool/software: Code Composer Studio
HI,
I am working with two CC1310 sub 1 GHz board. Programmed such a way that,
- The master waits for data infinite time in a frequency.
- When the slave sends data to the master, the master switches to transmit mode in another frequency.
- After transmitting data to the master, slave switches to receive mode and receives data from the master.
- Again slave switches to transmit mode and master switches to receive mode and cycle continues.
- Receive and transmit works in different frequency for a single CC1310.
Everything works fine when both master and slave are in debug mode( no stepping, no breakpoints).
But anyone side is not in debug mode, its receive does not work properly, it's unstable, most of the times it doesn't work.
My code for receive in the master with infinite waiting is,
int receive()
{
int status = 0;
RF_Params rfParams;
RF_Handle rfHandle;
RF_Object rfObject;
RF_Params_init(&rfParams);
if (RFQueue_defineQueue(&dataQueue, rxDataEntryBuffer, sizeof(rxDataEntryBuffer), NUM_DATA_ENTRIES, MAX_LENGTH + NUM_APPENDED_BYTES)) {
/* Failed to allocate space for all data entries */
while (1);
}
RF_cmdPropRadioDivSetup.centerFreq = 0x0YYY;
RF_cmdPropRx.pQueue = &dataQueue; /* Set the Data Entity queue for received data */
RF_cmdPropRx.rxConf.bAutoFlushIgnored = 1; /* Discard ignored packets from Rx queue */
RF_cmdPropRx.rxConf.bAutoFlushCrcErr = 1; /* Discard packets with CRC error from Rx queue */
RF_cmdPropRx.maxPktLen = PAYLOAD_SIZE; /* Implement packet length filtering to avoid PROP_ERROR_RXBUF */
RF_cmdPropRx.pktConf.bRepeatOk = 0;
RF_cmdPropRx.pktConf.bRepeatNok = 0;
RF_cmdPropRx.syncWord = 0xXXXXXXXX;
RF_cmdFs.frequency = 0x0YYY;
rfHandle = RF_open(&rfObject, &RF_prop, (RF_RadioSetup*) &RF_cmdPropRadioDivSetup, &rfParams);
RF_CmdHandle rx_cmd_handle = RF_runCmd(rfHandle, (RF_Op*) &RF_cmdFs, RF_PriorityNormal, NULL, 0);
RF_EventMask result = RF_runCmd(rfHandle, (RF_Op*) &RF_cmdPropRx, RF_PriorityNormal, NULL, IRQ_RX_ENTRY_DONE);
if((result == RF_EventLastCmdDone) && (RF_cmdPropRx.status == PROP_DONE_OK))
status = 1;
RF_close(rfHandle);
return status;
}
Code for receive in slave side(with a 10 sec timeout) is
uint64_t Receive()
{
uint64_t status = 0;
RF_Handle rxrfHandle;
RF_Params rfParams;
RF_Object rfObject;
RF_Params_init(&rfParams);
if (RFQueue_defineQueue(&dataQueue, rxDataEntryBuffer, sizeof(rxDataEntryBuffer), NUM_DATA_ENTRIES, MAX_LENGTH + NUM_APPENDED_BYTES))
{
while (1);
}
/* Modify CMD_PROP_RX command for application needs */
RF_cmdPropRx.pQueue = &dataQueue; /* Set the Data Entity queue for received data */
RF_cmdPropRx.rxConf.bAutoFlushIgnored = 1; /* Discard ignored packets from Rx queue */
RF_cmdPropRx.rxConf.bAutoFlushCrcErr = 1; /* Discard packets with CRC error from Rx queue */
RF_cmdPropRx.maxPktLen = PAYLOAD_SIZE; /* Implement packet length filtering to avoid PROP_ERROR_RXBUF */
RF_cmdPropRx.pktConf.bRepeatOk = 0;
RF_cmdPropRx.pktConf.bRepeatNok = 0;
RF_cmdPropRx.endTrigger.triggerType = TRIG_REL_START;
RF_cmdPropRx.endTrigger.pastTrig = 1;
RF_cmdPropRx.endTime = (uint32_t)(4*10000000);
RF_cmdPropRx.syncWord = 0xXXXXXXXX;
RF_cmdFs.frequency = 0x0YYY;
RF_cmdPropRadioDivSetup.centerFreq = 0x0YYY;
rxrfHandle = RF_open(&rfObject, &RF_prop, (RF_RadioSetup*) &RF_cmdPropRadioDivSetup, &rfParams);
RF_CmdHandle rx_cmd_handle = RF_runCmd(rxrfHandle, (RF_Op*) &RF_cmdFs, RF_PriorityNormal, NULL, 0);
RF_EventMask result = RF_runCmd(rxrfHandle, (RF_Op*) &RF_cmdPropRx, RF_PriorityNormal, NULL/*&callback*/, IRQ_RX_ENTRY_DONE);
// RF_Stat stat = RF_cancelCmd(rxrfHandle, RF_CMDHANDLE_FLUSH_ALL, 0);
// if (!(stat & RF_StatSuccess))
// {
// while(1);
// }
RF_close(rxrfHandle);
RF_yield(rxrfHandle);
return status;
}