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/CC2640: CC2640 Proprietary Application

Part Number: CC2640
Other Parts Discussed in Thread: CC2650, SMARTRFTM-STUDIO,

Tool/software: TI-RTOS

Hi,

I have to build a proprietary application on CC2640. 

Does the following RF example of CC2650 work on CC2640?

Thank you.

dev.ti.com/.../

  • If you look at the TRM you will see that some of the PROP API commands are supported by the CC26x0. However, we do not have characterized settings for anything other than BLE on this device. You can off course test the rfPacketRX and rfPacket TX examples as all the commands used there are supported by the device, but I do not know what RF performance you can expect.

    Siri
  • Hi,

    Yes the CC2640 support BLE and Proprietary RF.
  • Hi Siri,

    Thank you for your reply. 

    Our customer request a demo to evaluate the 40 RF frequency channels CH0~CH39) transmission quality without frequency hopping.

    During the test, the Tx and Rx devices will be set to the same frequency channel.

    The Rx device will send the RSSI and received packet count to PC using UART.

    I think the  rfPacketRX and rfPacketTX example would be a good start to implement this.

  • Hi,

    If they are going to use the BLE PHY, the quickest would probably be to use SmartRF Studio for testing (www.ti.com/tool/SMARTRFTM-STUDIO )
  • Thank you for your information.

    I would like to know if I can set the CRC of CC2640 proprietary RF packet to 24 bits.
    In TRM it seems it's either 0 or 16 bits option.
    As the CRC BLE advertising packet format is 3 byte-sized, does it means that the RF hardware can support 24 bits CRC?
  • The CC2640 supports 3 bytes CRC but there are no simple API to configure this. If you want another CRC than what is default in the PROP API, we need to get the details of the CRC and we will try to help you with the necessary overrides.

    Siri
  • Thank you for your information.
    I am recently testing on SmartRF.

    Is the source code of the firmware download from SmartRF to CC2640R2 LaunchPad is open?
    If we like to development our custom PC software with similar feature of SmartRF, what is the quickest way?
  • Regarding the question from the link below, is the support of 'AUX_ADV_IND' is now available in the latest protocol stack?

    e2e.ti.com/.../621447
  • From SmartRF Studio you can find the following:

    Siri

  • Hi Siri,

    In order to use 3-byte CRC on CC2640 proprietary mode, I need your help to to provide the details of the necessary overrides.

    Thank you.

  • I need to get information regarding what crc polynomial you want to use, what the init value should be etc.

    Siri
  • Thank you for your reply.
    Let me confirm what kind of crc polynomial I need.

    Please kindly answer my question below.

    I am now trying to run the rfPacketErrorRate demo (under 'driver' folder) on CC2640R2 LaunchPad. The CCS project can be compiled normally. The BLE test option works fine that the Rx side device receive packets normally. But if I switch the test option to 'custom', the frequency option always shows 'custom' and cannot be changed. And then if I start to transmit packet, the software hang after display of 'Pkts send: 0'. Even I press the buttons again there is no any response.

    For the BLE test option, if I set the advertising length larger than 31 the demo didn't works anymore. Is it possible to send and receive advertising packets with PDU size larger than 37 bytes? For bluetooth 5.0 standard this is possible. Am I correct?
  • I must admit that I am not sure I understand exactly what devices you are testing and what software you are running.
    You are referring to the PER test for the CC2640R2 LP, but there are no PER test in the simplelink_cc2640r2_sdk_1_50_00_58.
    The Per test is a great example if you want to just run it as it is, but is not a good example if you are trying to do modifications to Packet format, PHY etc. I would therefore strongly recommend to look at the rfPacketRX and rfPacketTx examples instead.
    I am not familiar with BLE and need to get someone else comment on the packet length.
    What I know is that when running Smart Studio on CC2640R2, you are not allowed to set the packet length greater than 37.

    Siri
  • Hello user,
    Regarding the question of PDU larger than 37 Bytes:
    Yes, but you must use one of our parts that will support BLE5 (CC26x2 or CC2640R2F).
    Please refer to this thread post:
    e2e.ti.com/.../2576625
  • Sorry that I didn't provide more information about the test.
    SDK: simplelink_cc2640r2_sdk_1_40_00_45
    PCB: LAUNCHXL-CC2604R2 Rev: 1.0

    Actually I start to test the PER test on CC2604 because the rfPacketRX and rfPacketTx code didn't works. It didn't return from the RF_runcmd() function. The PER test demo works for BLE option but not for custom.
  • Hi Eirik, thank you for your advise. Is there any example available of using this scannable advertising setting with extended PDU data? As I’m now using the PER test code, it would be very helpful if you can provide the setting of smartrf files.
  • Hello User,
    This video explains advertising extensions on Bluetooth 5:
    training.ti.com/what-bluetooth-5-and-when-do-i-use-it

    This is supported and will be supported in our upcoming SDK release for CC2640R2F and CC26x2 in early July. The simple_peripheral example code use this. No need for smartRFStudio export.
  • Thank you for the useful information. We look forward to evaluate the new SDK release.

    But before that we are now working on the other project.

    The requirement is to evaluation the 40 BLE channel (one by one) packet transmission quality.

    We are considering the following method:

    1. rfPacketErrorRate BLE option:

        Something like SmartRF would be satisfied but now the maximum PDU size is limited to 37 bytes. Is there any easy way to switch the the advertising type and send larger packets?

    2. rfPacketErrorRate custom option:

       We are also considering to use proprietary RF on CC2640R2F. Unfortunately, the rfPacketErrorRate(custom) project and also rfPacketTX, rfPacketRX project doesn't seem to work on the CC2640R2 LaunchPad.

    We still keep trying on both method but any suggestion or help would be really appreciated.

    Project path: C:\ti\simplelink_cc2640r2_sdk_1_40_00_45\examples\rtos\CC2640R2_LAUNCHXL\drivers\rfPacketErrorRate

  • Hi Siri,

    Regarding to the crc polynomial and init value requirement, we would like to follow the setting of Bluetooth standard.
    Would you please let me know the setting and help to implement it?

    By the way, I'm still working on the rfPacketErrorRate project on CC2640R2F with custom option.
    Following the information from the below link, it seems I can send and receive packet already.
    Stay tuned.
    e2e.ti.com/.../611730
  • I also had a problem with rfPacketRX and rfPacket TX and found hte same post as you did. I got it up and running (the setup commando got stuck with the settings from the PER test). However, I do not know anything about the performance when using these settings. I know that it is possible to use the characterized BLE PHY with the prop API. You can then run 1 Mbps. I guess that since you are using the BLE PHY, the CRC will be accordingly.

    I have attached my code and settings.

    /*
     * Copyright (c) 2017, Texas Instruments Incorporated
     * All rights reserved.
     *
     * Redistribution and use in source and binary forms, with or without
     * modification, are permitted provided that the following conditions
     * are met:
     *
     * *  Redistributions of source code must retain the above copyright
     *    notice, this list of conditions and the following disclaimer.
     *
     * *  Redistributions in binary form must reproduce the above copyright
     *    notice, this list of conditions and the following disclaimer in the
     *    documentation and/or other materials provided with the distribution.
     *
     * *  Neither the name of Texas Instruments Incorporated nor the names of
     *    its contributors may be used to endorse or promote products derived
     *    from this software without specific prior written permission.
     *
     * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
     * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
     * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
     * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
     * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
     * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
     * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
     * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
     * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
     * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
     * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
     */
    
    /***** Includes *****/
    /* Standard C Libraries */
    #include <stdlib.h>
    
    /* TI Drivers */
    #include <ti/drivers/rf/RF.h>
    #include <ti/drivers/PIN.h>
    
    
    /* Driverlib Header files */
    #include DeviceFamily_constructPath(driverlib/rf_prop_mailbox.h)
    
    /* Board Header files */
    #include "Board.h"
    
    /* Application Header files */
    #include "RFQueue.h"
    #include "smartrf_settings/smartrf_settings.h"
    
    /***** Defines *****/
    
    /* Packet RX Configuration */
    #define DATA_ENTRY_HEADER_SIZE 8  /* Constant header size of a Generic Data Entry */
    #define MAX_LENGTH             30 /* Max length byte the radio will accept */
    #define NUM_DATA_ENTRIES       2  /* NOTE: Only two data entries supported at the moment */
    #define NUM_APPENDED_BYTES     1  /* The Data Entries data field will contain:
                                       * 1 Header byte (RF_cmdPropRx.rxConf.bIncludeHdr = 0x1)
                                       * Max 30 payload bytes */
    
    
    
    /***** Prototypes *****/
    static void callback(RF_Handle h, RF_CmdHandle ch, RF_EventMask e);
    
    /***** Variable declarations *****/
    static RF_Object rfObject;
    static RF_Handle rfHandle;
    
    /* Pin driver handle */
    static PIN_Handle ledPinHandle;
    static PIN_State ledPinState;
    
    /* Buffer which contains all Data Entries for receiving data.
     * Pragmas are needed to make sure this buffer is 4 byte aligned (requirement from the RF Core) */
    #if defined(__TI_COMPILER_VERSION__)
    #pragma DATA_ALIGN (rxDataEntryBuffer, 4);
    static uint8_t 
    rxDataEntryBuffer[RF_QUEUE_DATA_ENTRY_BUFFER_SIZE(NUM_DATA_ENTRIES,
                                                      MAX_LENGTH,
                                                      NUM_APPENDED_BYTES)];
    #elif defined(__IAR_SYSTEMS_ICC__)
    #pragma data_alignment = 4
    static uint8_t 
    rxDataEntryBuffer[RF_QUEUE_DATA_ENTRY_BUFFER_SIZE(NUM_DATA_ENTRIES,
                                                      MAX_LENGTH,
                                                      NUM_APPENDED_BYTES)];
    #elif defined(__GNUC__)
    static uint8_t 
    rxDataEntryBuffer[RF_QUEUE_DATA_ENTRY_BUFFER_SIZE(NUM_DATA_ENTRIES,
                                                      MAX_LENGTH, 
                                                      NUM_APPENDED_BYTES)] 
                                                      __attribute__((aligned(4)));
    #else
    #error This compiler is not supported.
    #endif
    
    /* Receive dataQueue for RF Core to fill in data */
    static dataQueue_t dataQueue;
    static rfc_dataEntryGeneral_t* currentDataEntry;
    static uint8_t packetLength;
    static uint8_t* packetDataPointer;
    static rfc_propRxOutput_t rxStatistics;
    
    static uint8_t packet[MAX_LENGTH + NUM_APPENDED_BYTES - 1]; /* The length byte is stored in a separate variable */
    
    /*
     * Application LED pin configuration table:
     *   - All LEDs board LEDs are off.
     */
    PIN_Config pinTable[] =
    {
        Board_PIN_LED2 | PIN_GPIO_OUTPUT_EN | PIN_GPIO_LOW | PIN_PUSHPULL | PIN_DRVSTR_MAX,
        PIN_TERMINATE
    };
    
    /***** Function definitions *****/
    
    void *mainThread(void *arg0)
    {
        RF_Params rfParams;
        RF_Params_init(&rfParams);
    
        /* Open LED pins */
        ledPinHandle = PIN_open(&ledPinState, pinTable);
        if (ledPinHandle == NULL)
        {
            while(1);
        }
    
        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);
        }
    
        /* Modify CMD_PROP_RX command for application needs */
        /* Set the Data Entity queue for received data */
        RF_cmdPropRx.pQueue = &dataQueue;           
        /* Discard ignored packets from Rx queue */
        RF_cmdPropRx.rxConf.bAutoFlushIgnored = 1;  
        /* 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 = MAX_LENGTH;        
        RF_cmdPropRx.pktConf.bRepeatOk = 1;
        RF_cmdPropRx.pktConf.bRepeatNok = 1;
        RF_cmdPropRx.rxConf.bAppendStatus = 0x0;
        RF_cmdPropRx.pktConf.bUseCrc = 0x1;
        RF_cmdPropRx.pOutput = (uint8_t*)&rxStatistics;
    
        /* Request access to the radio */
        rfHandle = RF_open(&rfObject, &RF_ble, 
                           (RF_RadioSetup*)&RF_cmdBle5RadioSetup, &rfParams);
    
        /* Set the frequency */
        RF_postCmd(rfHandle, (RF_Op*)&RF_cmdFs, RF_PriorityNormal, NULL, 0);
    
        /* Enter RX mode and stay forever in RX */
        RF_EventMask terminationReason = RF_runCmd(rfHandle, (RF_Op*)&RF_cmdPropRx,
                                                   RF_PriorityNormal, &callback,
                                                   RF_EventRxEntryDone);
    
        switch(terminationReason)
        {
            case RF_EventCmdDone:
                // A radio operation command in a chain finished
                break;
            case RF_EventLastCmdDone:
                // A stand-alone radio operation command or the last radio
                // operation command in a chain finished.
                break;
            case RF_EventCmdCancelled:
                // Command cancelled before it was started; it can be caused
                // by RF_cancelCmd() or RF_flushCmd().
                break;
            case RF_EventCmdAborted:
                // Abrupt command termination caused by RF_cancelCmd() or
                // RF_flushCmd().
                break;
            case RF_EventCmdStopped:
                // Graceful command termination caused by RF_cancelCmd() or
                // RF_flushCmd().
                break;
            default:
                // Uncaught error event
                while(1);
        }
    
        uint32_t cmdStatus = ((volatile RF_Op*)&RF_cmdPropRx)->status;
        switch(cmdStatus)
        {
            case PROP_DONE_OK:
                // Packet received with CRC OK
                break;
            case PROP_DONE_RXERR:
                // Packet received with CRC error
                break;
            case PROP_DONE_RXTIMEOUT:
                // Observed end trigger while in sync search
                break;
            case PROP_DONE_BREAK:
                // Observed end trigger while receiving packet when the command is
                // configured with endType set to 1
                break;
            case PROP_DONE_ENDED:
                // Received packet after having observed the end trigger; if the
                // command is configured with endType set to 0, the end trigger
                // will not terminate an ongoing reception
                break;
            case PROP_DONE_STOPPED:
                // received CMD_STOP after command started and, if sync found,
                // packet is received
                break;
            case PROP_DONE_ABORT:
                // Received CMD_ABORT after command started
                break;
            case PROP_ERROR_RXBUF:
                // No RX buffer large enough for the received data available at
                // the start of a packet
                break;
            case PROP_ERROR_RXFULL:
                // Out of RX buffer space during reception in a partial read
                break;
            case PROP_ERROR_PAR:
                // Observed illegal parameter
                break;
            case PROP_ERROR_NO_SETUP:
                // Command sent without setting up the radio in a supported
                // mode using CMD_PROP_RADIO_SETUP or CMD_RADIO_SETUP
                break;
            case PROP_ERROR_NO_FS:
                // Command sent without the synthesizer being programmed
                break;
            case PROP_ERROR_RXOVF:
                // RX overflow observed during operation
                break;
            default:
                // Uncaught error event - these could come from the
                // pool of states defined in rf_mailbox.h
                while(1);
        }
    
        while(1);
    }
    
    void callback(RF_Handle h, RF_CmdHandle ch, RF_EventMask e)
    {
        if (e & RF_EventRxEntryDone)
        {
            /* Toggle pin to indicate RX */
            PIN_setOutputValue(ledPinHandle, Board_PIN_LED2,
                               !PIN_getOutputValue(Board_PIN_LED2));
    
            /* Get current unhandled data entry */
            currentDataEntry = RFQueue_getDataEntry();
    
            /* Handle the packet data, located at &currentDataEntry->data:
             * - Length is the first byte with the current configuration
             * - Data starts from the second byte */
            packetLength      = *(uint8_t*)(&currentDataEntry->data);
            packetDataPointer = (uint8_t*)(&currentDataEntry->data + 1);
    
            /* Copy the payload + the status byte to the packet variable */
            memcpy(packet, packetDataPointer, (packetLength + 1));
    
            RFQueue_nextEntry();
        }
    }
    

    /*
     * Copyright (c) 2017, Texas Instruments Incorporated
     * All rights reserved.
     *
     * Redistribution and use in source and binary forms, with or without
     * modification, are permitted provided that the following conditions
     * are met:
     *
     * *  Redistributions of source code must retain the above copyright
     *    notice, this list of conditions and the following disclaimer.
     *
     * *  Redistributions in binary form must reproduce the above copyright
     *    notice, this list of conditions and the following disclaimer in the
     *    documentation and/or other materials provided with the distribution.
     *
     * *  Neither the name of Texas Instruments Incorporated nor the names of
     *    its contributors may be used to endorse or promote products derived
     *    from this software without specific prior written permission.
     *
     * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
     * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
     * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
     * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
     * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
     * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
     * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
     * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
     * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
     * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
     * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
     */
    
    /***** Includes *****/
    /* Standard C Libraries */
    #include <stdlib.h>
    
    /* TI Drivers */
    #include <ti/drivers/rf/RF.h>
    #include <ti/drivers/PIN.h>
    #include <ti/drivers/pin/PINCC26XX.h>
    
    /* Driverlib Header files */
    #include DeviceFamily_constructPath(driverlib/rf_prop_mailbox.h)
    
    /* Board Header files */
    #include "Board.h"
    #include "smartrf_settings/smartrf_settings.h"
    
    /***** Defines *****/
    
    /* Packet TX Configuration */
    #define PAYLOAD_LENGTH      30
    #define PACKET_INTERVAL     (uint32_t)(4000000*0.01f) /* Set packet interval to 10 ms */
    #define PACKET_COUNT        2500
    
    /***** Prototypes *****/
    
    /***** Variable declarations *****/
    static RF_Object rfObject;
    static RF_Handle rfHandle;
    
    /* Pin driver handle */
    static PIN_Handle ledPinHandle;
    static PIN_State ledPinState;
    
    static uint8_t packet[PAYLOAD_LENGTH];
    static uint16_t seqNumber;
    
    /*
     * Application LED pin configuration table:
     *   - All LEDs board LEDs are off.
     */
    PIN_Config pinTable[] =
    {
        Board_PIN_LED0 | PIN_GPIO_OUTPUT_EN | PIN_GPIO_LOW | PIN_PUSHPULL | PIN_DRVSTR_MAX,
        Board_PIN_LED1 | PIN_GPIO_OUTPUT_EN | PIN_GPIO_LOW | PIN_PUSHPULL | PIN_DRVSTR_MAX,
        PIN_TERMINATE
    };
    
    /***** Function definitions *****/
    
    void *mainThread(void *arg0)
    {
        uint32_t curtime;
        uint16_t count = 0;
        RF_Params rfParams;
        RF_Params_init(&rfParams);
    
        /* Open LED pins */
        ledPinHandle = PIN_open(&ledPinState, pinTable);
        if (ledPinHandle == NULL)
        {
            while(1);
        }
    
        RF_cmdPropTx.pktLen = PAYLOAD_LENGTH;
        RF_cmdPropTx.pPkt = packet;
        RF_cmdPropTx.startTrigger.triggerType = TRIG_ABSTIME;
        RF_cmdPropTx.startTrigger.pastTrig = 1;
        RF_cmdPropTx.startTime = 0;
    
        /* Request access to the radio */
        rfHandle = RF_open(&rfObject, &RF_ble, (RF_RadioSetup*)&RF_cmdBle5RadioSetup, &rfParams);
    
        /* Set the frequency */
        RF_postCmd(rfHandle, (RF_Op*)&RF_cmdFs, RF_PriorityNormal, NULL, 0);
    
        /* Get current time */
        curtime = RF_getCurrentTime();
        
        while(count++ < PACKET_COUNT)
        {
            /* Create packet with incrementing sequence number and random payload */
            packet[0] = (uint8_t)(seqNumber >> 8);
            packet[1] = (uint8_t)(seqNumber++);
            uint8_t i;
            for (i = 2; i < PAYLOAD_LENGTH; i++)
            {
                packet[i] = i - 1;
            }
    
            /* Set absolute TX time to utilize automatic power management */
            curtime += PACKET_INTERVAL;
            RF_cmdPropTx.startTime = curtime;
    
            /* Send packet */
            RF_EventMask terminationReason = RF_runCmd(rfHandle, (RF_Op*)&RF_cmdPropTx,
                                                       RF_PriorityNormal, NULL, 0);
    
            switch(terminationReason)
            {
                case RF_EventCmdDone:
                    // A radio operation command in a chain finished
                    break;
                case RF_EventLastCmdDone:
                    // A stand-alone radio operation command or the last radio
                    // operation command in a chain finished.
                    break;
                case RF_EventCmdCancelled:
                    // Command cancelled before it was started; it can be caused
                // by RF_cancelCmd() or RF_flushCmd().
                    break;
                case RF_EventCmdAborted:
                    // Abrupt command termination caused by RF_cancelCmd() or
                    // RF_flushCmd().
                    break;
                case RF_EventCmdStopped:
                    // Graceful command termination caused by RF_cancelCmd() or
                    // RF_flushCmd().
                    break;
                default:
                    // Uncaught error event
                    while(1);
            }
    
            uint32_t cmdStatus = ((volatile RF_Op*)&RF_cmdPropTx)->status;
            switch(cmdStatus)
            {
                case PROP_DONE_OK:
                    // Packet transmitted successfully
                    break;
                case PROP_DONE_STOPPED:
                    // received CMD_STOP while transmitting packet and finished
                    // transmitting packet
                    break;
                case PROP_DONE_ABORT:
                    // Received CMD_ABORT while transmitting packet
                    break;
                case PROP_ERROR_PAR:
                    // Observed illegal parameter
                    break;
                case PROP_ERROR_NO_SETUP:
                    // Command sent without setting up the radio in a supported
                    // mode using CMD_PROP_RADIO_SETUP or CMD_RADIO_SETUP
                    break;
                case PROP_ERROR_NO_FS:
                    // Command sent without the synthesizer being programmed
                    break;
                case PROP_ERROR_TXUNF:
                    // TX underflow observed during operation
                    break;
                default:
                    // Uncaught error event - these could come from the
                    // pool of states defined in rf_mailbox.h
                    while(1);
            }
            PIN_setOutputValue(ledPinHandle, Board_PIN_LED1,!PIN_getOutputValue(Board_PIN_LED1));
        }
        RF_yield(rfHandle);
        while(1);
    }
    
    

    //*********************************************************************************
    // Generated by SmartRF Studio version 2.9.0 (build #163)
    // Compatible with SimpleLink SDK version: CC2640R2 SDK 1.50.xx.xx
    // Device: CC2640R2F Rev. 1.0
    // 
    //*********************************************************************************
    
    
    //*********************************************************************************
    // Parameter summary
    // Adv. Address: 010203040506 
    // BLE Channel: 0 
    // Extended Header: 09 09 010203040506 babe 
    // Frequency: 2404 MHz
    // PDU Payload length: 30 
    // TX Power: 5 dBm 
    // Whitening: TRUE 
    
    #include <ti/devices/DeviceFamily.h>
    #include DeviceFamily_constructPath(driverlib/rf_mailbox.h)
    #include DeviceFamily_constructPath(driverlib/rf_common_cmd.h)
    #include DeviceFamily_constructPath(driverlib/rf_ble_cmd.h)
    #include DeviceFamily_constructPath(driverlib/rf_prop_cmd.h)
    #include <ti/drivers/rf/RF.h>
    #include DeviceFamily_constructPath(rf_patches/rf_patch_cpe_bt5.h)
    #include "smartrf_settings.h"
    
    // TI-RTOS RF Mode Object
    RF_Mode RF_ble =
    {
        .rfMode = RF_MODE_PROPRIETARY_2_4,
        .cpePatchFxn = &rf_patch_cpe_bt5,
        .mcePatchFxn = 0,
        .rfePatchFxn = 0,
    };
    
    // Overrides for CMD_BLE5_RADIO_SETUP
    static uint32_t pOverrides1Mbps[] =
    {  
        // Change Sync word
        (uint32_t)0xC0040241,
        (uint32_t)0x930B51DE,
        // Rx: Configure AGC to use gain table for improved performance
        HW_REG_OVERRIDE(0x6084, 0x05F8),
        (uint32_t)0xFFFFFFFF,
    };
    
    // CMD_BLE5_RADIO_SETUP
    // BLE Radio Setup Command for all v5.0 PHYs
    rfc_CMD_BLE5_RADIO_SETUP_t RF_cmdBle5RadioSetup =
    {
        .commandNo = 0x1820,
        .status = 0x0000,
        .pNextOp = 0, // INSERT APPLICABLE POINTER: (uint8_t*)&xxx
        .startTime = 0x00000000,
        .startTrigger.triggerType = 0x0,
        .startTrigger.bEnaCmd = 0x0,
        .startTrigger.triggerNo = 0x0,
        .startTrigger.pastTrig = 0x0,
        .condition.rule = 0x1,
        .condition.nSkip = 0x0,
        .defaultPhy.mainMode = 0x0,
        .defaultPhy.coding = 0x0,
        .__dummy0 = 0x00,
        .config.frontEndMode = 0x0,
        .config.biasMode = 0x0,
        .config.analogCfgMode = 0x0,
        .config.bNoFsPowerUp = 0x0,
        .txPower = 0x9330,
        .pRegOverrideCommon = 0x0,
        .pRegOverride1Mbps = pOverrides1Mbps,
        .pRegOverride2Mbps = 0x0,
        .pRegOverrideCoded = 0x0,
    };
    
    // CMD_FS
    // Frequency Synthesizer Programming Command
    rfc_CMD_FS_t RF_cmdFs =
    {
        .commandNo = 0x0803,
        .status = 0x0000,
        .pNextOp = 0, // INSERT APPLICABLE POINTER: (uint8_t*)&xxx
        .startTime = 0x00000000,
        .startTrigger.triggerType = 0x0,
        .startTrigger.bEnaCmd = 0x0,
        .startTrigger.triggerNo = 0x0,
        .startTrigger.pastTrig = 0x0,
        .condition.rule = 0x1,
        .condition.nSkip = 0x0,
        .frequency = 0x0964,
        .fractFreq = 0x0000,
        .synthConf.bTxMode = 0x0,
        .synthConf.refFreq = 0x0,
        .__dummy0 = 0x00,
        .__dummy1 = 0x00,
        .__dummy2 = 0x00,
        .__dummy3 = 0x0000,
    };
    
    // CMD_PROP_TX
    // Proprietary Mode Transmit Command
    rfc_CMD_PROP_TX_t RF_cmdPropTx =
    {
        .commandNo = 0x3801,
        .status = 0x0000,
        .pNextOp = 0, // INSERT APPLICABLE POINTER: (uint8_t*)&xxx
        .startTime = 0x00000000,
        .startTrigger.triggerType = 0x0,
        .startTrigger.bEnaCmd = 0x0,
        .startTrigger.triggerNo = 0x0,
        .startTrigger.pastTrig = 0x0,
        .condition.rule = 0x1,
        .condition.nSkip = 0x0,
        .pktConf.bFsOff = 0x0,
        .pktConf.bUseCrc = 0x1,
        .pktConf.bVarLen = 0x1,
        .pktLen = 0x1E, // SET APPLICATION PAYLOAD LENGTH
        .syncWord = 0x930B51DE,
        .pPkt = 0, // INSERT APPLICABLE POINTER: (uint8_t*)&xxx
    };
    
    // CMD_PROP_RX
    // Proprietary Mode Receive Command
    rfc_CMD_PROP_RX_t RF_cmdPropRx =
    {
        .commandNo = 0x3802,
        .status = 0x0000,
        .pNextOp = 0, // INSERT APPLICABLE POINTER: (uint8_t*)&xxx
        .startTime = 0x00000000,
        .startTrigger.triggerType = 0x0,
        .startTrigger.bEnaCmd = 0x0,
        .startTrigger.triggerNo = 0x0,
        .startTrigger.pastTrig = 0x0,
        .condition.rule = 0x1,
        .condition.nSkip = 0x0,
        .pktConf.bFsOff = 0x0,
        .pktConf.bRepeatOk = 0x0,
        .pktConf.bRepeatNok = 0x0,
        .pktConf.bUseCrc = 0x1,
        .pktConf.bVarLen = 0x1,
        .pktConf.bChkAddress = 0x0,
        .pktConf.endType = 0x0,
        .pktConf.filterOp = 0x0,
        .rxConf.bAutoFlushIgnored = 0x0,
        .rxConf.bAutoFlushCrcErr = 0x0,
        .rxConf.bIncludeHdr = 0x1,
        .rxConf.bIncludeCrc = 0x0,
        .rxConf.bAppendRssi = 0x0,
        .rxConf.bAppendTimestamp = 0x0,
        .rxConf.bAppendStatus = 0x1,
        .syncWord = 0x930B51DE,
        .maxPktLen = 0xFF, // MAKE SURE DATA ENTRY IS LARGE ENOUGH
        .address0 = 0xAA,
        .address1 = 0xBB,
        .endTrigger.triggerType = 0x1,
        .endTrigger.bEnaCmd = 0x0,
        .endTrigger.triggerNo = 0x0,
        .endTrigger.pastTrig = 0x0,
        .endTime = 0x00000000,
        .pQueue = 0, // INSERT APPLICABLE POINTER: (dataQueue_t*)&xxx
        .pOutput = 0, // INSERT APPLICABLE POINTER: (uint8_t*)&xxx
    };
    
    
    
    

    BR

    Siri

  • Thank you very much for your confirmation.

    Please kindly advice for the following questions.

    If I use these code with BLE PHY configuration to send packets, I should be able to see the received packets by SmartRF Studio with the 4-byte ‘address setting’ same as the TX syncword and ‘whitening’ uncheck.

    What is the maximum payload size I can set? It would be the maximum size that the BLE PHY can support.

    Is my understanding written above is correct?

  • Thank you very much for your confirmation and providing the test code.

    With these configuration, I can send and receive packets up to payload sizes 255 bytes successfully.

    Please kindly advice on my following questions. Thank you.

    1. I tried to receive data by SmartRF with the address set to the same as syncword of TX side and whitening option unchecked.

    But it seems it didn't work. If I am using the BLE PHY correctly I would be able to do this. Is my understanding is correct?

    2. I try to enable the settings of pOverrides2Mbps other than pOverrides1Mbps but it seems it didn't works properly. Would you mind to provide the reference code of that?

  • 1) I am not familiar with BLE so unfortunately I do not know if you should be able to receive the packets using the API used in STudio. I tried, but was not able to get it working either. I guess that you will need to use your own SW on both the RX and the TX side.

    There will be support for prop mode for CC2640R2 in the next release of SmartRF Studio (in a couple of weeks, I think). It will support 100 and 250 kbps.

    To run the 2 mbps settings exported from Studio you need to use the high speed API and not the prop API.

    The HS API is used in the PER test.

    BR

    Siri