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.

RTOS/CC1310: 1310 transceiver

Part Number: CC1310

Tool/software: TI-RTOS

Hi,

I am working on 1310 based concentrator,which will always in receiver mode to collect data from its nodes.When the concentrator receives a specific packet from the serial port it has to send to the  specific node.

For that I made two threads

1. For packet receive(from radio) 

2. For packet receive from UART.

Both threads working independantly

But when tried to close the receiver handle before initializing for transmit the system is not returning from the RF_close(rfHandle) function.

Note: RF_close(rfHandle) function has been called from the UART thread.since the packet receiver thread stay for ever.

/* Enter RX mode and stay forever in RX */
RF_runCmd(rfHandle, (RF_Op*) &RF_cmdPropRx, RF_PriorityNormal, &callback,
IRQ_RX_ENTRY_DONE);

 

Please suggest me some solutions.Do we have any sample code with transceiver functionality for CC1310?

Regards

Zee 

 

  • Hi
    If you are using repeat mode= 1 so that the radio is in RX state you need to cancel the RX command (RF_cancelCmd()) before doing the RF_close. If you have submitted commands other than the RF_cmdPropRX, you can do a RF_flushCmd() to abort previously submitted command.
    BR
    Siri
  • Thank you Siri...
    I am not able to figure the mode= 1(which fr structure this refers to?)
    I tried out the way you mentioned above but RF_cancelCmd() is getting failed with an error code 0x84(RF_StatInvalidParamsError).
    Please see my code snippet below

    //Receiver thread
    /* 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_LENGTH; /* Implement packet length filtering to avoid PROP_ERROR_RXBUF */
    RF_cmdPropRx.pktConf.bRepeatOk = 1;
    RF_cmdPropRx.pktConf.bRepeatNok = 1;


    /* Request access to the radio */
    rfHandle = RF_open(&rfObject, &RF_prop,
    (RF_RadioSetup*) &RF_cmdPropRadioDivSetup, &rfParams);

    /* Set the frequency */
    rfCmdHandle = RF_postCmd(rfHandle, (RF_Op*) &RF_cmdFs, RF_PriorityNormal, NULL, 0);

    /* Enter RX mode and stay forever in RX */
    RF_runCmd(rfHandle, (RF_Op*) &RF_cmdPropRx, RF_PriorityNormal, &callback,
    IRQ_RX_ENTRY_DONE);
    while(1)
    {
    }



    //In UART thread
    /* stop reception */
    stat = RF_cancelCmd(rfHandle, rfCmdHandle, 1 /* Stop gracefully */ ); // Tried with 0 also same result
    if(stat != 0)
    {
    while(1); // control always here.
    }
    Task_sleep(1000);
    RF_close(rfHandle);
  • In my application, I have Rx and Tx RF commands in a loop (each pNextOp points at the other), and I use end trigger on Rx to flip into Tx mode when I want to transmit. This allows all the RF handling to happen in a single thread, and other threads can simply pass it things to transmit with standard threadsafe locking and buffer ownership management techniques.

    This works vastly better than calling RF_flush since if the receiver is in the process of receiving a packet, it won't go into transmit mode until the packet has finished being received, rather than aborting packet reception then trying to transmit over the top of another node which causes data corruption for anyone trying to receive the packet.
  • Thank you Michel.
    How we can flip from Rx to Tx ?
    Could you please share some code snippets ?
  • Something like this perhaps:

    	void Setup() {
    		RF_cmdPropRx.pNextOp = (rfc_radioOp_t*) &RF_cmdPropTx; // after RX is finished, go to TX
    
    		RF_cmdPropRx.pktConf.bRepeatOk = 1;   // Go back to RX after receiving a good packet
    		RF_cmdPropRx.pktConf.bRepeatNok = 1;  // Go back to RX after receiving a bad packet
    		RF_cmdPropRx.pktConf.endType = 0;     // Finish receiving packet when end trigger occurs during RX
    		RF_cmdPropRx.endTrigger.triggerType = TRIG_NEVER; // RX will never automatically finish
    		RF_cmdPropRx.endTrigger.bEnaCmd = 1;  // CMD_TRIGGER used for end trigger
    		RF_cmdPropRx.endTrigger.pastTrig = 1; // past triggers are honoured
    
    		RF_cmdPropTx.pNextOp = (rfc_radioOp_t*) &RF_cmdPropRx; // after TX is finished, go to RX
    	}
    
    	// call this after your RF_cmdPropTx is set up and ready to transmit
    	void IssueTrigger() {
    		rfc_CMD_TRIGGER_t trigCmd = {
    			CMD_TRIGGER,
    			0
    		};
    
    		RF_runImmediateCmd(handle, (uint32_t*) &trigCmd); // Ask RX to finish and go to TX. If it's currently receiving, it'll wait until the packet is received before going to TX since endType=0
    	}
    

  • Thank you Michel for sharing the awesome code..
    But my RF_runImmediateCmd(handle, (uint32_t*) &trigCmd) is returned with RF_StatCmdDoneError(0x83).Also Tx after Rx is not happened,I verified with a sniffer.After the RF_runImmediateCmd(),Rx is working fine like previous.I doubt the trigger is been properly registered .Is there any mechanism to know RF_cmdPropTx is been executed and trigger is properly executing ?
  • Sure, check event flags and command status in your callback.