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.

CC1350: Implementing CSMA/CA network

Part Number: CC1350

hi,

i am working on sensor node. with No-rtos mode . here in my application there is multiple sensor node and one gateway. and i want to build the CSMA/CA algorithm for my application. i understand the concept of the CSMA/CA algorithm. but how to implement it by software that i don't get the idea of it. 

Is there any reference code of it. so it can help to implement of my application algorithm. and i actually wanted it in NO-RTOS mode.

so please provide details of it. waiting of your reply 

  • The Listen Before Talk example implements the feature you are looking for. There is a No-RTOS driver example that can be found from the link below.
    dev.ti.com/.../

    Here is a link to the details of the example.
    dev.ti.com/.../
  • Thanks for the helpful reply. i will check it . and revert you back
  • i have checked it. here they have mentioned the Rssi threshold . i know it is a receiver signal strength. they mentioned -80 db.
    sensitivity. can i increase this sensitivity.

    is there any limitation on the receiver sensitivity?
  • You can increase the sensitivity. The resolution is specified in the datasheet (I have attached a link below). Increasing the sensitivity too much may increase the number of packets lost - I would suggest getting a reading of the background noise in your environment and setting the filter to above the noise floor.

    www.ti.com/.../cc1350.pdf
  • Thanks for the reply.

    one question i would like to ask, what is command chaining. In The listen before talk example they doing the operation with command chaining .
    so what is command chaining and what it will do exactly. should i use number of nodes with refer of command chaining.

    means i want to build the CSMA/CA algorithm . can i implement this using command chaining.
  • Command chaining allows multiple RF commands to follow one after another. For example, if a node wants to transmit an ACK as soon as a packet was received the project can be designed in two different ways. 

    1. RX command submitted to RF core. Once packet is received, TX (ACK) is submitted to RF core. 

    2. TX command is chained to the RX command. RX-TX chain submitted to RF core and ACK is sent after packet is received. 

    See the technical reference manual for more information (Section 23.3.2.5 on Command Scheduling): 

    You could use command chaining for the CSMA/CA algorithm if you choose. There are a specific set of conditions that either continue or halt command chain execution. See section 23.3.2.5.2 of the above link for specific conditions. 

  • hi sir,

    from this at least i get the idea to implement the CSMA/CA network. Thank you for this .
    just want ask one question is in Rf command structure they have taken 'start time ', 'end time ' variable. in the example code they also mentioned it. but i want to know that this time is in usecond, milisecond , or second that is question?


    means for assigning time to any time related variable . what unit we need to consider?
  • The time is in RAT ticks. There is a series of macros from the RF driver that can be used to convert to us or ms (e.g. RF_convertUsToRatTicks). How the start and end time is related to the command is determined by the trigger type. For example a start trigger type trigger now will execute the command immediately regardless of the start time, where as trigger rel to submit will wait for the number of RAT ticks specified in the start time before executing.

    See the following link for trigger types and time conversion:
    dev.ti.com/.../triggers.html
  • Hello sir

    By using the example code. i have made the command chaining for my application.

    i am mentioning my logic below.

    -----> first sense the carrier  is busy or not.

    -----> if the carrier is busy, wait for the some time. retries count are 10

    ----->   if the carrier is free then execute the Tx command .

    ------>  check transmission Done or Not

    ------> if Transmission Done , then execute the RX command and wait for the Receiver .

    ------> if RX Event Done then check the status of the event then blink the LED

    ------> again check the Carrier sense .. ans so on.

    this is the flow of the RF command according to my application.

    i am attaching my code here for the RF configuration command.

    please verify  it is correct or not.

    void DT_RF_Configuration(void)
    {

    if (RFQueue_defineQueue(&dataQueue, rxDataEntryBuffer,
    sizeof(rxDataEntryBuffer), NUM_DATA_ENTRIES,
    PAYLOAD_LENGTH + NUM_APPENDED_BYTES))
    {
    /* Failed to allocate space for all data entries */
    PIN_setOutputValue(ledPinHandle, Board_PIN_LED1, 1);
    PIN_setOutputValue(ledPinHandle, Board_PIN_LED2, 1);
    while (1);
    }

    /* Settings for the No operation commands i.e RF_cmdNop*/
    RF_cmdNop.pNextOp = (rfc_radioOp_t*) &RF_cmdPropCs;
    RF_cmdNop.startTrigger.triggerType = TRIG_ABSTIME;
    RF_cmdNop.startTrigger.pastTrig = 1;
    RF_cmdNop.condition.rule = COND_STOP_ON_FALSE;

    /* Modify the settings for the carrier settings set the receiver sensitivity threshold level and command end time*/
    RF_cmdPropCs.pNextOp = (rfc_radioOp_t*) &RF_cmdCountBranch;
    RF_cmdPropCs.rssiThr = RSSI_THRESHOLD_DBM;
    RF_cmdPropCs.csEndTime = (IDLE_TIME_US + 200) * 7; /* Add some margin */

    /* settings for the count branch command i.e RF_cmdCountbranch */
    RF_cmdCountBranch.counter = CS_RETRIES_WHEN_BUSY;
    RF_cmdCountBranch.pNextOp = (rfc_radioOp_t*) &RF_cmdPropTx;
    RF_cmdCountBranch.pNextOpIfOk = (rfc_radioOp_t*) &RF_cmdPropCs;

    /* Modify the Transmitter command settings i.e CMD_PROP_TX */
    RF_cmdPropTx.pktLen = PAYLOAD_LENGTH;
    RF_cmdPropTx.pPkt = txPacket;
    RF_cmdPropTx.startTrigger.triggerType = TRIG_ABSTIME;
    RF_cmdPropTx.startTrigger.pastTrig = 1;
    RF_cmdPropTx.pNextOp = (rfc_radioOp_t *) &RF_cmdPropRx;

    /* Only run the RX command if TX is successful */
    RF_cmdPropTx.condition.rule = COND_STOP_ON_FALSE;

    /* Modify the settings for the receiver command i.e CMD_PROP_RX */

    RF_cmdPropRx.pQueue = &dataQueue; // Set the Data Entity queue for received data
    RF_cmdPropRx.rxConf.bAutoFlushIgnored = 1; // it will discard ignored packet from the received queue
    /* Discard packets with CRC error from Rx queue */
    RF_cmdPropRx.rxConf.bAutoFlushCrcErr = 1;
    /* Implement packet length filtering to avoid PROP_ERROR_RXBUF */
    RF_cmdPropRx.maxPktLen = PAYLOAD_LENGTH;
    RF_cmdPropRx.pktConf.bRepeatOk = 0;
    RF_cmdPropRx.pktConf.bRepeatNok = 0;
    RF_cmdPropRx.pOutput = (uint8_t *) &rxStatistics;
    /* Receive operation will end RX_TIMEOUT ms after command starts */
    RF_cmdPropRx.endTrigger.triggerType = TRIG_REL_PREVEND;
    RF_cmdPropRx.endTime = RX_TIMEOUT;

    }

    DT_RF_Configuration ();// called before Main

    main()

    {  

    while (1)
    {

    /* Set absolute TX time to utilize automatic power management */
    curtime += (PACKET_INTERVAL );
    RF_cmdNop.startTime = curtime;

    /* Send packet */
    RF_EventMask terminationReason = RF_runCmd(rfHandle, (RF_Op*) &RF_cmdNop, RF_PriorityNormal, callback,
    (RF_EventCmdDone | RF_EventRxEntryDone |
    RF_EventLastCmdDone));


    RF_cmdNop.status = IDLE;
    RF_cmdPropCs.status = IDLE;
    RF_cmdCountBranch.status = IDLE;
    RF_cmdPropTx.status = IDLE;
    RF_cmdPropRx.status = IDLE;
    RF_cmdCountBranch.counter = CS_RETRIES_WHEN_BUSY;

    }

    }

    After  doing this my code working some time interval means I have received what i was transmitted (sending a string) . but after that my code has been crashed somewhere . that i don't understand .

    please tell where i am doing mistake?

    waiting of your reply.

  • From my understanding you are trying to transmit an acknowledgement packet after you receive the string. What is the status of the RX and TX commands when the string is received (this can be found in the debugger by adding the command to the watch expressions)?