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.

LAUNCHXL-CC1352R1: IEEE foreground and background commands in CSMA

Part Number: LAUNCHXL-CC1352R1

Using:
CC1352R1F3 Rev E
SDk 3.30.00.03

Hi.

I'm implementing my own RF communication with IEEE commands and I can't figure out how to use CSMA/CA mechanism.

I'm trying to use commands chain: EdScan -> CSMA/CA -> FS -> TX, but all the time it's hanging at CSMA command. One thing is when csma.condition.rule is set to COND_NEVER then command run and give csma.status equals 0x2400 (IEEE_DONE_OK), but if condition is different (e.g. COND_ALWAYS or COND_STOP_ON_FALSE) then status is 0x0806 (wrong background/foreground operations).

I'm using RF_scheduleCmd to fire RF commands. At this moment I tried to use one schedule with chain: EdScan -> CSMA/CA -> FS -> TX, and also two schedules when first was only EdScan and second with rest of chain. Also I tried different startTriggers, times and conditions but nothing works for me.

In CC13x2 manual is list with compatible background/foreground commands and all should be okay, but I can't make it works. 

  • Please provide us with the setup of all the commands you are using and how you have set up the chain, so that we can take a look at it.

    BR

    Siri

  • Commands (skipped 0 or null fields):

    cmdRadioSetup.commandNo = CMD_RADIO_SETUP;
    cmdRadioSetup.startTrigger.triggerType = TRIG_NOW;
    cmdRadioSetup.condition.rule = COND_NEVER;
    cmdRadioSetup.mode = 1; // IEEE 802.15.4 mode
    cmdRadioSetup.txPower = 0x4E63;
    cmdRadioSetup.pRegOverride = pOverrides;
    
    
    cmdFs.commandNo = CMD_FS;
    cmdFs.startTrigger.triggerType = TRIG_NOW;
    cmdFs.frequency = 0x096F;
    cmdFs.fractFreq = 0x0000;
    cmdFs.synthConf.bTxMode = 0x1;
    
    
    cmdIeeeTx.commandNo = CMD_IEEE_TX;
    cmdIeeeTx.status = IDLE;
    cmdIeeeTx.startTrigger.triggerType = TRIG_NOW;
    cmdIeeeTx.startTrigger.pastTrig = 1;
    cmdIeeeTx.payloadLen = packetLength;
    cmdIeeeTx.pPayload = packet; // (address of array)
    
    
    cmdIeeeEdScan.commandNo = 0x2802;
    cmdIeeeEdScan.channel = 13;
    cmdIeeeEdScan.startTrigger.triggerType = TRIG_ABSTIME;
    cmdIeeeEdScan.endTrigger.triggerType = TRIG_ABSTIME;
    cmdIeeeEdScan.startTime = currentTime;
    cmdIeeeEdScan.endTime = cmdIeeeEdScan + 10000;
    
    
    cmdIeeeCsma.commandNo = 0x2C02;
    cmdIeeeCsma.startTime = currentTime + 400;
    cmdIeeeCsma.endTime = cmdIeeeCsma + 2000;
    cmdIeeeCsma.startTrigger.triggerType = TRIG_ABSTIME;
    cmdIeeeCsma.endTrigger.triggerType = TRIG_ABSTIME;
    
    cmdIeeeCsma.randomState = rand();
    cmdIeeeCsma.csmaConfig.initCW = 1;
    cmdIeeeCsma.csmaConfig.bSlotted = 0;
    cmdIeeeCsma.NB = 0;
    cmdIeeeCsma.BE = 3;
    cmdIeeeCsma.remainPeriods = 0;
    cmdIeeeCsma.macMaxBE = 4;
    cmdIeeeCsma.macMaxCSMABackoffs = 4;
    
    
    
    

    CurrentTime is uint32_t variable set by RF_gerCurrentTime and incremented by 100000 at beginning of every sequence, so it's always in future.
    I tried two versions of chaining, first:

    // EdScan -> Csma -> Fs -> Tx
    cmdIeeeEdScan.pNextOp = (RF_Op*)&cmdIeeeCsma;
    cmdIeeeCsma.pNextOp = (RF_Op*)&cmdFs;
    cmdFs.pNextOp = (RF_Op*)&cmdIeeeTx;
    
    // schedule command
    RF_scheduleCmd(rfHandle, (RF_Op*)&cmdIeeeEdScan, &edParams, &callback, 0xFFFFFFFF);

    second:

    // EdScan
    // Csma -> Fs -> Tx
    cmdIeeeEdScan.pNextOp = NULL;
    cmdIeeeCsma.pNextOp = (RF_Op*)&cmdFs;
    cmdFs.pNextOp = (RF_Op*)&cmdIeeeTx;
    
    // schedule commands
    RF_scheduleCmd(rfHandle, (RF_Op*)&cmdIeeeEdScan, &edParams, &callback, 0xFFFFFFFF);
    RF_scheduleCmd(rfHandle, (RF_Op*)&cmdIeeeCsma, &csmaParams, &csmaCallback, 0xFFFFFFFF);

    Both RF_schedulerCmdParams were only initialized without any changed fields. I'm using commands generated in SmartRF Studio, values for csma are from CC13x2 manual.

  • Unfortunately I have so far not been able to find any example code for you, but I have some comment.

    the first chain will not work, as the edScan and Scma commands must run at the same time.

    The second approach is more correct, but I think you need to remove the CMD_FS.

    Also, I am not sure about all your timing/triggers. As a starting point, try to get it to work without using any end triggers on your commands.

    BR

    Siri

  • I made it works without cmdFs and commands changes:

    cmdIeeeEdScan.startTime = time;
    cmdIeeeEdScan.startTrigger.triggerType = TRIG_ABSTIME;
    cmdIeeeEdScan.endTrigger.triggerType = TRIG_NEVER;
    cmdIeeeCsma.startTime = time;
    cmdIeeeCsma.startTrigger.triggerType = TRIG_ABSTIME;
    cmdIeeeCsma.startTrigger.pastTrig = 1;

    Now I'll try test it with SmartRF Studio transmit, I'll write if encounter a problem. Thank you for help! 

  • Glad you were able to get it up and running :-)

    BR

    Siri