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: cc1310

Part Number: CC1310
Other Parts Discussed in Thread: SYSBIOS

how to get the received data which i m transmitting actually i want to see the received data in docklight software using UART...

  • What SW do you run on CC1310?
  • CCS is IDE. I mean what SW or FW you download to run on CC1310.
  • simplelink_cc13x0_sdk_1_60_00_21
  • Have you looked at the UART echo examples in the SDK?
  • There are lots of examples in simplelink_cc13x0_sdk_1_60_00_21. Which example do you test?
  • yes i have added the code in my rx_tx code.
  • see this is my code
    for master my priority for tx is higher than Rx
    and for slave my priority for Rx is higher than Tx


    /***** Includes *****/
    #include <stdlib.h>
    #include <xdc/std.h>
    #include <xdc/cfg/global.h>
    #include <xdc/runtime/System.h>
    #include <ti/posix/ccs/unistd.h>
    /* BIOS module Header files */
    #include <ti/sysbios/BIOS.h>
    #include <ti/sysbios/knl/Task.h>
    #include <ti/sysbios/knl/clock.h>

    /* Drivers */
    #include "RF.h"
    #include <ti/drivers/PIN.h>
    #include <ti/drivers/GPIO.h>
    #include <ti/drivers/UART.h>
    #include <ti/devices/cc13x0/driverlib/rf_prop_mailbox.h>


    /* Board Header files */
    #include "Board.h"

    #include "RFQueue.h"
    #include "smartrf_settings/smartrf_settings.h"

    #include <stdlib.h>

    #include <ti/drivers/UART.h>

    #define TASKSTACKSIZE 768
    static Task_Params taskParams;
    Task_Struct task0Struct;
    Char task0Stack[TASKSTACKSIZE];
    /* Pin driver handle */
    static PIN_Handle ledPinHandle;
    static PIN_State ledPinState;
    /*
    * Application LED pin configuration table:
    * - All LEDs board LEDs are off.
    */
    PIN_Config pinTable[] =
    {
    Board_LED1 | PIN_GPIO_OUTPUT_EN | PIN_GPIO_LOW | PIN_PUSHPULL | PIN_DRVSTR_MAX,
    Board_LED2 | PIN_GPIO_OUTPUT_EN | PIN_GPIO_LOW | PIN_PUSHPULL | PIN_DRVSTR_MAX,
    PIN_TERMINATE
    };

    /***** Defines *****/
    #define RX_TASK_STACK_SIZE 1024
    #define RX_TASK_PRIORITY 3


    /* rxpacket RX Configuration */
    #define DATA_ENTRY_HEADER_SIZE 8 /* Constant header size of a Generic Data Entry */
    #define MAX_LENGTH 100 /* 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 2 /* The Data Entries data field will contain:
    * 1 Header byte (RF_cmdPropRx.rxConf.bIncludeHdr = 0x1)
    * Max 30 payload bytes
    * 1 status byte (RF_cmdPropRx.rxConf.bAppendStatus = 0x1) */



    /***** Prototypes *****/
    static void rxTaskFunction(UArg arg0, UArg arg1);
    static void callback(RF_Handle h, RF_CmdHandle ch, RF_EventMask e);


    /***** Variable declarations for Rx *****/
    static Task_Params rxTaskParams;
    Task_Struct rxTask; /* not static so you can see in ROV */
    static uint8_t rxTaskStack[RX_TASK_STACK_SIZE];

    static RF_Object rrfObject;
    static RF_Handle rrfHandle;

    /* Tx RF handle and object*/
    static RF_Object trfObject;
    static RF_Handle trfHandle;

    /* 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);
    #endif
    static uint8_t rxDataEntryBuffer[RF_QUEUE_DATA_ENTRY_BUFFER_SIZE(NUM_DATA_ENTRIES,MAX_LENGTH,NUM_APPENDED_BYTES)];

    /* Receive dataQueue for RF Core to fill in data */
    static dataQueue_t dataQueue;
    static rfc_dataEntryGeneral_t* currentDataEntry;
    static uint8_t rxpacketLength;
    static uint8_t* rxpacketDataPointer;

    static PIN_Handle pinHandle;

    //static uint8_t rxpacket[MAX_LENGTH + NUM_APPENDED_BYTES - 1]; /* The length byte is stored in a separate variable */

    /*Tx parameters */

    #define TX_TASK_STACK_SIZE 1024
    #define TX_TASK_PRIORITY 2

    #define PAYLOAD_LENGTH 30
    #define PACKET_INTERVAL (uint32_t)(4000000*2.0f)

    static void txTaskFunction(UArg arg0, UArg arg1);
    static uint8_t txPacket[PAYLOAD_LENGTH];

    static uint8_t txTaskStack[TX_TASK_STACK_SIZE];
    static Task_Params txTaskParams;
    Task_Struct txTask;

    UART_Handle uart;
    UART_Params uartParams;
    #define UARTSTACKSIZE 768
    Task_Struct taskUARTStruct;
    Char taskUARTStack[UARTSTACKSIZE];
    Task_Params uartTaskParams;
    #define TASKSTACKSIZE 768
    static Task_Params taskParams;
    Task_Struct task0Struct;
    Char task0Stack[TASKSTACKSIZE];





    /***** Function definitions *****/
    void RfTask_init(PIN_Handle ledPinHandle)
    {
    pinHandle = ledPinHandle;
    /* Rx task parameters */
    Task_Params_init(&rxTaskParams);
    rxTaskParams.stackSize = RX_TASK_STACK_SIZE;
    rxTaskParams.priority = RX_TASK_PRIORITY;
    rxTaskParams.stack = &rxTaskStack;
    rxTaskParams.arg0 = (UInt)1000000;
    Task_construct(&rxTask, rxTaskFunction, &rxTaskParams, NULL);

    /* Tx task parameters */
    Task_Params_init(&txTaskParams);
    txTaskParams.stackSize = TX_TASK_STACK_SIZE;
    txTaskParams.priority = TX_TASK_PRIORITY;
    txTaskParams.stack = &txTaskStack;
    txTaskParams.arg0 = (UInt)1000000;
    Task_construct(&txTask, txTaskFunction, &txTaskParams, NULL);
    }

    static void rxTaskFunction(UArg arg0, UArg arg1)
    {
    RF_Params rfParams;
    RF_Params_init(&rfParams);
    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 */
    RF_cmdPropRx.pQueue = &dataQueue; /* Set the Data Entity queue for received data */
    RF_cmdPropRx.rxConf.bAutoFlushIgnored = 1; /* Discard ignored rxpackets from Rx queue */
    RF_cmdPropRx.rxConf.bAutoFlushCrcErr = 1; /* Discard rxpackets with CRC error from Rx queue */
    RF_cmdPropRx.maxPktLen = MAX_LENGTH; /* Implement rxpacket length filtering to avoid PROP_ERROR_RXBUF */
    RF_cmdPropRx.pktConf.bRepeatOk = 0;
    RF_cmdPropRx.pktConf.bRepeatNok = 0;

    if (!rrfHandle)
    {
    /* Request access to the radio */
    rrfHandle = RF_open(&rrfObject, &RF_prop, (RF_RadioSetup*)&RF_cmdPropRadioDivSetup, &rfParams);

    /* Set the frequency */
    RF_postCmd(rrfHandle, (RF_Op*)&RF_cmdFs, RF_PriorityNormal, NULL, 0);
    }

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

    }

    void callback(RF_Handle h, RF_CmdHandle ch, RF_EventMask e)
    {
    if (e & RF_EventRxEntryDone)
    {
    /* Toggle pin to indicate RX */
    PIN_setOutputValue(pinHandle, Board_LED2,!PIN_getOutputValue(Board_LED2));
    /* Get current unhandled data entry */

    currentDataEntry = RFQueue_getDataEntry();
    rxpacketLength = *(uint8_t*)(&currentDataEntry->data+2);
    // rxpacketDataPointer = (uint8_t*)(&currentDataEntry->data + 1);

    rxpacketDataPointer = (uint8_t*)(&currentDataEntry->data + 3);
    // memcpy(rxpacketDataPointer,rxpacketDataPointer,sizeof(rxpacketDataPointer));

    UART_write(uart, "\nreceived from master\n", 22);

    UART_write(uart, rxpacketDataPointer,sizeof(rxpacketDataPointer));
    // UART_write(uart, &currentDataEntry, 1);
    RFQueue_nextEntry();
    }
    }

    static void txTaskFunction(UArg arg0, UArg arg1)
    {

    uint32_t curtime;
    RF_Params rfParams;
    RF_Params_init(&rfParams);

    RF_cmdPropTx.pktLen = PAYLOAD_LENGTH;
    RF_cmdPropTx.pPkt = txPacket;
    RF_cmdPropTx.startTrigger.triggerType = TRIG_ABSTIME;
    RF_cmdPropTx.startTrigger.pastTrig = 1;
    RF_cmdPropTx.startTime = 0;

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

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

    /* Get current time */
    curtime = RF_getCurrentTime();
    while(1)
    {

    /* send packet */
    txPacket[0] = 0x1;
    txPacket[1] = 26;
    uint8_t i;
    int8_t data='a';
    // UART_write(uart,"\nnew\n", 5);
    for (i=2; i < 28; i++)
    {
    txPacket[i] = data++;
    // txPacket[i] = ((0x01)^(data));
    // UART_write(uart,&txPacket[i], 1);
    }


    /* Set absolute TX time to utilize automatic power management */
    curtime += PACKET_INTERVAL;
    RF_cmdPropTx.startTime = curtime;
    /* Send packet */
    RF_EventMask result = RF_runCmd(trfHandle, (RF_Op*)&RF_cmdPropTx, RF_PriorityNormal, NULL, 0);
    if (!(result & RF_EventLastCmdDone))
    {
    /* Error */
    while(1);
    }

    PIN_setOutputValue(pinHandle, Board_LED1,!PIN_getOutputValue(Board_LED1));

    //usleep(100000);
    }

    }

    /* ======== main ======== */
    int main(void)
    {
    /* Call board init functions. */
    Board_initGeneral();

    /* Open LED pins */
    ledPinHandle = PIN_open(&ledPinState, pinTable);
    if(!ledPinHandle)
    {
    System_abort("Error initializing board LED pins\n");
    }


    UART_init();
    /* Create a UART with data processing off. */
    UART_Params_init(&uartParams);
    uartParams.writeDataMode = UART_DATA_TEXT;
    uartParams.readDataMode = UART_DATA_TEXT;
    uartParams.readReturnMode = UART_RETURN_FULL;
    uartParams.readEcho = UART_ECHO_OFF;
    uartParams.baudRate = 115200;

    uart = UART_open(Board_UART0, &uartParams);

    /* Initialize task */
    RfTask_init(ledPinHandle);

    /* Start BIOS */
    BIOS_start();



    return (0);
    }
  • I'm not familiar with docklight. Could you elaborate a bit about what your issue is?
  • my packet length is 30 but i m sending data of 26 length so 4 null's i m getting . i thought may be i m not fetching the data properly or dont know from where i have to fetch the data in receiver side.