This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

CC1310: Sub-1 GHz forum

Part Number: CC1310

Hi, in our application we use cc1310 and tirtos_cc13xx_cc26xx_2_21_01_08;
Here the code:

1. Prepare  sniff command .
         RF_cmdPropRxSniff.commandNo = CMD_PROP_RX_SNIFF;

RF_cmdPropRxSniff.startTrigger.pastTrig = 1;

Start time equal to current time plus some seconds.
RF_cmdPropRxSniff.startTime = Current time + delta T

 Start trigger is TRIG_ABSTIME

RF_cmdPropRxSniff.startTrigger.triggerType = TRIG_ABSTIME;

End Trigger is TRIG_REL_START.
RF_cmdPropRxSniff.endTime = time;
RF_cmdPropRxSniff.endTrigger.triggerType = TRIG_REL_START;


RF_EventMask bmEvent = RF_EventRxEntryDone | RF_EventLastCmdDone | RF_EventCmdAborted | RF_EventCmdStopped | RF_EventCmdCancelled;

Send command:
RF_postCmd(RfHandle, (RF_Op*)&RF_cmdPropRxSniff,RF_PriorityNormal, Callback, bmEvent);

2. After some timeout about 10-20 msec) I try to abort current command as following:
RF_Stat res = RF_flushCmd(RfHandle, RF_CMDHANDLE_FLUSH_ALL, 0);

Sometimes the result is    RF_StatInvalidParamsError  (Invalid API parameters)

In this case the next command started only after finishing previous command (RF_cmdPropRxSniff)

and RF_cmdPropRxSniff.status is IDLE (Operation not started).


Q1: what goes wrong?

Q2: what I can do fix the problem(add retries...0?

BR

Leonid

  • Hi Leonid, 

    To answer your questions, I need some more information on which project you are using and what you are trying to do with your application. Can you share more details on the expected behavior for the application, which example you have used and from which SDK, etc?

    Thanks, 
    Elin

  • To answer your questions, I need some more information on which project you are using and what you are trying to do with your application. Can you share more details on the expected behavior for the application, which example you have used and from which SDK, etc?

    Thanks, 
    Elin

    Hi, Elin,

    Elin:

    To answer your questions, I need some more information on which project you are using and what you are trying to do with your application

    Answer:

    Our applicxation is of Security type and we implement wireless commjunication between sensors and Network Coordinator.

    Elin:

    Can you share more details on the expected behavior for the application, which example you have used and from which SDK

    Answer:

    Expected behavior:

    Adter abort the actual Rf Command RF_cmdPropRxSniff is aborted.

    SDK:

    tirtos_cc13xx_cc26xx_2_21_01_08

    BR

    Leonid

  • Hi Leonid, 

    The version you are referring to is the TI-RTOS version, not the SDK. The latest version for the CC13x0 SDK is v4.10, is that the version you are using? 

    Which project are you basing your application on? 

    What kind of technology are you using? BLE, TI15.4, prop?

    Thanks, 
    Elin

  • Hi Elin,

    "Elin W" :The version you are referring to is the TI-RTOS version, not the SDK[/quote]

    Yes, it's right.

    "Elin W" : Which project are you basing your application on? 

    We started from simple send/receive packet projects.

    "Elin W" :What kind of technology are you using? BLE, TI15.4, prop?

    Proprietary.

    BR Leonid 

  • Hi Leonid

    I am not sure I understand what the problem is.

    The sniff command is only active for a short period of time, especially if there are no signal on the air.

    If you try to cancel the command when it is not running, it will return RF_StatInvalidParamsError, and the status of the command will still be IDLE.

    If the command is running when you cancel it, the function will return RF_StatSuccess and the status of the sniff command will be PROP_DONE_ABORT.

    BR

    Siri

  • Hi Siri,

    to ensure Rx sniff on exact times we send sniff command with absolute trigger and start time. The Start time of command can be some seconds after current time.

    Here the code:

    1. Send to Rf sniff command with start time equal to current time plus some seconds.
    Start trigger is TRIG_ABSTIME
    End Trigger is TRIG_REL_START.
    RF_cmdPropRxSniff.commandNo = CMD_PROP_RX_SNIFF;

    RF_cmdPropRxSniff.startTrigger.pastTrig = 1;

    delta T is equal to some second.
    RF_cmdPropRxSniff.startTime = Current time + delta T
    RF_cmdPropRxSniff.startTrigger.triggerType = TRIG_ABSTIME;

    RF_cmdPropRxSniff.endTime = time;
    RF_cmdPropRxSniff.endTrigger.triggerType = TRIG_REL_START;

    RF_cmdPropRxSniff.startTrigger.pastTrig = 1;

    RF_EventMask bmEvent = RF_EventRxEntryDone | RF_EventLastCmdDone | RF_EventCmdAborted | RF_EventCmdStopped | RF_EventCmdCancelled;

    RF_postCmd(RfHandle, (RF_Op*)&RF_cmdPropRxSniff,RF_PriorityNormal, Callback, bmEvent);

    We see that command started exactly in time.

    2. If we must to transmit data immediately before start of current sniff command, we try to abort current sniff command with  RF_flushCmd(RfHandle,RF_CMDHANDLE_FLUSH_ALL, 0);

    3. After that  always send Tx command with start trigger in some msec from current time : 

    RF_EventMask result = RF_runCmd(m_rfHandle, (RF_Op*)&RF_cmdPropTx,RF_PriorityNormal, NULL, 0);

    4. We see that sometimes  RF_cmdPropTx started exactly after end of RF_cmdPropRxSniff, i.e.  with delay of some seconds.

    It looks like RF_cmdPropRxSniff command was NOT aborted.

    I hope that explanation will help to solve the problem.

    BR

    Leonid

  • Hi Leonid

    To be able to figure out what is going on, I would need to know more about when/where you are calling the different functions you are listing. For example, I do not know from where you are calling your cancel command.

    Please note that If RF_flushCmd is called from a Swi context with same or higher priority than RF Driver Swi, when the RF core is powered OFF -> the cancel callback will be delayed  until the next power-up cycle.

    To dig more into this, I would appreciate if you can send me a very simply code example that I can run on my LP to reproduce what you are seeing.

    You do not need to send me your complete application. Just a simple demo that calls the sniff command at a certain interval, and where you show where/hos you call the flush command.

    When you are debugging this, I recommend that you output the LNA and PA signals so that you can monitor when the radio go in and out of RX and TX state.

    BR

    Siri

  • Hi Siri, thanks for answer.
    Here the psewdo code: 
    
    This function runs in the task context.
    
    TGenErr   receiveDataHandler (void* a_pParam)
    {
    	bool RestartRxSniffCommand(true);
    
    	while(1)
    	{
    		if(RestartRxSniffCommand)
    		{
    			//start sniff command with start trigger TRIG_ABSTIME and start time equal to wakeUpTime4nextSniff.
    			//wakeUpTime4nextSniff can be some seconds from current time
    			
    			m_rRf.sniff(Frequency,DataRate,CarrierSenseMode::CarrierSenseMode_RSSIandPQT,wakeUpTime4nextSniff, sniffCommandParametersSet,diagnosticCode);
    
    			if(m_diagnosticCode != TDiagnosticCode::noError)
    			{
    				//send diagnostic message and exit
    				return;
    			} 
    		}
    		else
    		{
    			RestartRxSniffCommand = true;
    		}
    		
    		//now  wait for  events
    		ReadyEvents = EventObject.wait(Timeout,Events2Wait);
            
    		//event from Sniff command callback
    		if(ReadyEvents.isContain(RxReady))
    		{
    			//get data if any from sniff command
    			res = getData(Data);
    
    			if(GEN_ERR_OK == res)
    			{
    				//handle received data:send ack if needed, 
    				//calculate next sniff time and parameters
    			}
    			else
    			{
    				//received data is not valid
    				//calculate next sniff time and parameters
    			}
    		}
            
    		//event from Sniff command callback
    		if(ReadyEvents.isContain(Waiting4responseSniffTimeout))
    		{
    			//no data received during sniff
    			//handle timeout /error: calculate next sniff time and parameters
    		}
            
    		//event from application task: send data via radio
    		if(ReadyEvents.isContain(Buffer2send))
    		{
    			//Rx Sniff still active, so not restart sniff command
    			RestartRxSniffCommand = false;
    			
                //calculate time for start sending data, 
    			//start timer  for wake up the task for starting transmit
    		}
            
    		// event from timer: start transmit data
    		if(ReadyEvents.isContain(StartTx))
    		{
    			//it's time to send data			
    			//abort current command (sniff command)
    			TGenErr res = abort();
    			//we do not test result... 	
    			
    			//send data	
    			//data send via RF_runCmd with start trigger equal to current time   2 msec  
    			tx(m_msg);
    		}
    	}
    
    	return GEN_ERR_OK;
    }
    
    //here abort function
    TGenErr abort()
    {
    	TGenErr err = GEN_ERR_NULL_POINTER;
    	
    	if(!m_configured)
    	{
    		return GEN_ERR_NOT_INITIALIZED;
    	}
    	
    	if(m_rfHandle != NULL)
    	{
    		flushResult = RF_flushCmd(m_rfHandle, RF_CMDHANDLE_FLUSH_ALL, 0);
    		//I try  RF_cancelCmd too 
    		//m_rfAbortInfo.m_flushResult = RF_cancelCmd(m_rfHandle, m_asyncCmdHndl, 0);
    		
    		if(RF_StatSuccess == flushResult)
    		{
    			/* Wait for Command to complete */
    			//may be it's redundant for flust.
    			//in easyLink package TI use  RF_cancelCmd and RF_pendCmd
    			
    			RF_EventMask result = RF_pendCmd(m_rfHandle, m_asyncCmdHndl, (RF_EventLastCmdDone | RF_EventCmdError |
    																		  RF_EventCmdAborted | RF_EventCmdCancelled | RF_EventCmdStopped));
    			if (result & RF_EventLastCmdDone)
    			{
    				err = GEN_ERR_OK;
    				
    			}
    			else
    			{
    				err = GEN_ERR_TIMEOUT;
    				
    			}
    		}
    		else
    		{
    			err = GEN_ERR_OPERATION_FAILED;
    		}
    	}
    	return err;
    }
    
    //here sniff 
    TGenErr sniff(TFrequency::Values a_freq,TDataRate::Values a_dataRate,TCarrierSenseMode::Values a_carrierSenseMode,TTime a_startTs, int a_sniffCommandParametersSet,TDiagnosticCode::Values& a_diagnosticCode)
    {
    	a_diagnosticCode = TDiagnosticCode::noError;
    	TGenErr res      = GEN_ERR_OUT_OF_RANGE;
    
    	TTime TsStart = getCurrTime();
    	//a_startTs - absolute time for start sniff command
    	UInt32   Delta  = calculateInterval(a_startTs,TsStart);
    
    	//sniff started after TBD sec maximum
    	if(Delta>a_diagnosticThresholdOrCurrentTime)
    	{
    		a_diagnosticCode = TDiagnosticCode::error;
    	}
    	//....
    }
     
    Here another short explanation:
    
    1. Time Stamp TS1 -   start sniff command with start absolute trigger.
    2 wait for event StartTx from timer for start sending data(StartTx event) 3 Time Stamp TS3 - StartTx event received - abort (flush or cancel) current commands (sniff only) 
    4. Time Stamp TS4 - transmit data
    5. Time Stamp TS5 - restart sniff command
    We see that abort duration TS4 - TS3 is about 100 - 200 mcs but TS5 - TS4 can be equal to some seconds. 
    We see that TS5 equal to calculated start of sniff command plus sniff duration plus transmit duration.
    Our packet is 30 bytes , so transmit duration should be about 5 msec.
    It looks like sniff command is not aborted, and tx starts only after finishing of sniff command.
    In this case abort command returns GEN_ERR_OPERATION_FAILED and flushResult = RF_StatInvalidParamsError

    If all that is not enough I will send more detailed code.
    BR Leonid

  • Hi Leonid

    Thanks for sharing

    Unfortunately I am not sure I will be able to make any progress without some complete code that I can actually run on my LP to see the problem.

    Kan you please provide me with such an example? Make it as simple as possible. You can use the rfPacketRX examples for one of our LPs as a starting point, and then modify it to use sniff mode (with your sniff settings, and implement the flushing. That way I can re-create the problem and hopefully figure out what is going on.

    Have you monitored the LNA and PA signals as I suggested? Doing this, together with for example toggle a pin before and after you do the send the sniff command and the flush command will give you useful timing information that will help us debugging this.

    I am really sorry for the inconvenience.

  • Hi Siri,

    during debugging the issue I used RAT time stamp, and not  LNA/PA signals.

    I will try to prepare some simple code.

    But generally speaking the only thing we do is sending sniff command with absolute start trigger  and flushing the command after that.

    We always appreciate your support activity. You helped us a lot in the past.

    BR 

    Leonid

  • I will do my best to help, but I am suspecting that the issue is related to how/when things are done, so I think it is essential that I run the same code.

    Also, I notice that you run a VERY old TI RTOS version.

    Once you have your test up and running it might be a good idea to do the test with the newest SDK as well, to see if your problem is related to issues with the old drivers etc.

    If you get problems with sharing your test project here, please send me a friend request and you can send the code directly to me.

    BR

    Siri