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.

WoR communication with UART

Other Parts Discussed in Thread: CC1310

I open this new thread for more clarity and more in-depth debugging. I'm working with WoR mode and serial communication. Everything works very well, consumption is very low and I like it. I have a problem, my project has the functionality to communicate two devices set with the same address that I store inside the memory. This project works very well without WoR, but since I implemented this low-power mode I'm having problems. I enclose my code, as you can see in the TX_to_RF () function I send a packet of message length written in UART with the 4 bytes of addressing. The function Read_From_RF (), has the function of comparing the addresses and printing. This doesn't work for me. But if I use this setting here, it works but without addressing. I need help.

/*
 * Copyright (c) 2016,
 * All rights reserved.
 * Author: Castaldo Mario (RadioControlli Team)
 *
 */

/***** Includes *****/
#include <stdlib.h>
#include <xdc/std.h>
#include <xdc/cfg/global.h>
#include <xdc/runtime/System.h>
#include <xdc/runtime/Assert.h>

#include <ti/sysbios/BIOS.h>
#include <ti/sysbios/knl/Task.h>
#include <ti/sysbios/knl/Semaphore.h>
#include <ti/sysbios/knl/Clock.h>


/* Drivers */
#include <ti/drivers/rf/RF.h>
#include <driverlib/rf_prop_mailbox.h>
#include <driverlib/cpu.h>
#include <ti/drivers/UART.h>
#include <ti/drivers/PIN.h>

#include <ti/drivers/pin/PINCC26XX.h>
#include <driverlib/aon_batmon.h>
#include <driverLib/flash.h>
#include <driverLib/vims.h>

/* Board Header files */
#include "Board.h"
#include "RFQueue.h"
#include "smartrf_settings/smartrf_settings.h"
#include "Memory/Memory.h"
#include <string.h>

/******** Pin ********/
static PIN_Handle pinHandle;
static PIN_Handle buttonPinHandle;
static PIN_State ledPinState;
static PIN_State buttonPinState;
PIN_Config pinTable[] =
{
    Relay_1   | PIN_GPIO_OUTPUT_EN | PIN_GPIO_LOW | PIN_PUSHPULL | PIN_DRVSTR_MAX,
    Relay_2   | PIN_GPIO_OUTPUT_EN | PIN_GPIO_LOW | PIN_PUSHPULL | PIN_DRVSTR_MAX,
    S_ON    | PIN_GPIO_OUTPUT_EN | PIN_GPIO_LOW | PIN_PUSHPULL | PIN_DRVSTR_MAX,
    S_OFF   | PIN_GPIO_OUTPUT_EN | PIN_GPIO_LOW | PIN_PUSHPULL | PIN_DRVSTR_MAX,
    RTS | PIN_INPUT_EN  | PIN_PULLDOWN | PIN_HYSTERESIS,                             /* Button is active low          */
    CTS | PIN_GPIO_OUTPUT_EN | PIN_GPIO_LOW   | PIN_PUSHPULL,                     /* UART TX pin at inactive level   */
    PIN_TERMINATE
};

PIN_Config buttonPinTable[] = {
    T1 | PIN_INPUT_EN | PIN_PULLUP | PIN_IRQ_NEGEDGE,
    PIN_TERMINATE
};

/*------------------------------------------------------------------------------------------------------------------*/
/*------------------------------------------------------- RF -------------------------------------------------------*/
/*------------------------------------------------------------------------------------------------------------------*/
static RF_Handle rfHandle;
static RF_CmdHandle rfcmdHandle;
static RF_Object rfObject;


/*------------------------------------------------------- TX -------------------------------------------------------*/
#define DATA_ENTRY_HEADER_SIZE 8  /* Constant header size of a Generic Data Entry */
#define MAX_LENGTH             125 /* 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) */
static uint8_t packet[MAX_LENGTH + NUM_APPENDED_BYTES - 1]; /* The length byte is stored in a separate variable */

static rfc_CMD_PROP_TX_ADV_t RF_cmdPropTxAdv;

static volatile uint8_t dummy;
/*------------------------------------------------------- RX -------------------------------------------------------*/
#define RX_TASK_STACK_SIZE 1024
#define RX_TASK_PRIORITY   1
static uint8_t rxTaskStack[RX_TASK_STACK_SIZE];
static char From_RF1[MAX_LENGTH + NUM_APPENDED_BYTES - 4]; /* The length byte is stored in a separate variable */
static Task_Params rxTaskParams;
Task_Struct rxTask;                                     /* not static so you can see in ROV */

#if defined(__TI_COMPILER_VERSION__)
#pragma DATA_ALIGN (rxDataEntryBuffer, 4);
#elif defined(__IAR_SYSTEMS_ICC__)
#pragma data_alignment = 4
#endif
static uint8_t rxDataEntryBuffer[RF_QUEUE_DATA_ENTRY_BUFFER_SIZE(NUM_DATA_ENTRIES,
                                                                 MAX_LENGTH,
                                                                 NUM_APPENDED_BYTES)];

static rfc_CMD_PROP_RX_SNIFF_t RF_cmdPropRxSniff;

/* 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 uint8_t* rssiDataPointer;
int8_t rssi;
//int8_t baud;
static rfc_propRxOutput_t rxStatistics;
static volatile struct WorStatistics worStatistics;


/*------------------------------------------------------------------------------------------------------------------*/
/*----------------------------------------------------- RS 232 -----------------------------------------------------*/
/*------------------------------------------------------------------------------------------------------------------*/
#define STACK_SIZE_RS232     768
static UART_Handle uart;
static UART_Params uartParams;
static Char Stack_RS232[STACK_SIZE_RS232];
static Task_Params Params_RS232;
Task_Struct Struct_RS232;                               /* not static so you can see in ROV */
static char From_RS232[MAX_LENGTH];
static char Dato_da_RF[MAX_LENGTH];
static char Addr_da_RF[4];
static uint8_t RS232_To_Local;

/*------------------------------------------------------------------------------------------------------------------*/
/*----------------------------------------------------- Memory  ----------------------------------------------------*/
/*------------------------------------------------------------------------------------------------------------------*/

/* Symbols are defined in the linker script. */

const uint32_t IND_START_FLASH = (uint32_t)&__FLASH_ADDR;
const uint32_t DIM_FLASH      = (uint32_t)&__FLASH_SIZE;
const uint32_t IND_FLASH_DATI = (uint32_t)&__FLASH_DATA_ADDR;
const uint32_t DIM_FLASH_DATI = (uint32_t)&__FLASH_DATA_SIZE;

/*------------------------------------------------------------------------------------------------------------------*/
/*----------------------------------------------------- Generic ----------------------------------------------------*/
/*------------------------------------------------------------------------------------------------------------------*/
static char Write_Output_St[9];
//static char Write_Long_Rl[1];
static char RW_BR_Value[1];
int comando = 0;

static Clock_Struct relayClock;
static Clock_Struct relayClock_2;
static Clock_Struct relayClock_3;
static Clock_Struct relayClock_4;

#define WOR_WAKEUPS_PER_SECOND  2

#define WOR_PREAMBLE_TIME_RAT_TICKS(x) \
    ((uint32_t)(8000000*(1.0f/(x))))

/* Wake-on-Radio mode. Can be:
 * - RSSI only
 * - PQT, preamble detection
 * - Both, first RSSI and then PQT if RSSI  */
#define WOR_MODE CarrierSenseMode_RSSIandPQT

/* Threshold for RSSI based Carrier Sense in dBm */
#define WOR_RSSI_THRESHOLD      ((int8_t)(-111))

/* Data Rate in use */
#define WOR_RF_PHY_DATARATE_50KBPS  0 // 2-GFSK 50Kbps
#define WOR_RF_PHY_DATARATE_100KBPS 1 // 2-GFSK 100Kbps
#define WOR_RF_PHY_DATARATE_200KBPS 2 // 2-GFSK 200Kbps
#define WOR_RF_PHY_DATARATE_300KBPS 3 // 2-GFSK 300Kbps
#define WOR_RF_PHY_DATARATE_400KBPS 4 // 2-GFSK 400Kbps
#define WOR_RF_PHY_DATARATE_500KBPS 5 // 2-GFSK 500Kbps

#define WOR_RF_PHY_DATARATE WOR_RF_PHY_DATARATE_50KBPS

/* Macro used to set actual wakeup interval */
#define WOR_WAKE_UP_MARGIN_S 0.010f
#define WOR_WAKE_UP_INTERVAL_RAT_TICKS(x) \
    ((uint32_t)(8000000*(1.0f/(x) - (WOR_WAKE_UP_MARGIN_S))))

Semaphore_Struct semStruct;
Semaphore_Handle semHandle;

#define TIMER_TASK_STACK_SIZE 512
Task_Struct tasktimer0Struct;
Char tasktimer0Stack[TIMER_TASK_STACK_SIZE];

/* TX Semaphore */
static Semaphore_Struct txSemaphore;
static Semaphore_Handle txSemaphoreHandle;

struct WorStatistics {
  uint32_t doneIdle;
  uint32_t doneIdleTimeout;
  uint32_t doneRxTimeout;
  uint32_t doneOk;
};

/* Modes of carrier sense possible */
enum CarrierSenseMode {
    CarrierSenseMode_RSSI,
    CarrierSenseMode_PQT,
    CarrierSenseMode_RSSIandPQT,
};

char input;

/***** Prototypes *****/
static void rxTaskFunction(UArg arg0, UArg arg1);
static void call_RF_RX(RF_Handle h, RF_CmdHandle ch, RF_EventMask e);
static void RS232(UArg arg0, UArg arg1);
static void configureSniffCmd(rfc_CMD_PROP_RX_SNIFF_t* rxSniffCmd, enum CarrierSenseMode mode, uint32_t datarate, uint8_t wakeupPerSecond);
static uint32_t calculateSymbolRate(uint8_t prescaler, uint32_t rateWord);

static void initializeSniffCmdFromRxCmd(rfc_CMD_PROP_RX_SNIFF_t* rxSniffCmd, rfc_CMD_PROP_RX_t* rxCmd);
static void initializeTxAdvCmdFromTxCmd(rfc_CMD_PROP_TX_ADV_t* RF_cmdPropTxAdv, rfc_CMD_PROP_TX_t* RF_cmdPropTx);

void RxTask_init()
{

    /* Initialize TX semaphore */
        Semaphore_construct(&txSemaphore, 0, NULL);
        txSemaphoreHandle = Semaphore_handle(&txSemaphore);

    Task_Params_init(&rxTaskParams);
    rxTaskParams.stackSize = RX_TASK_STACK_SIZE;
    rxTaskParams.priority = RX_TASK_PRIORITY;
    rxTaskParams.stack = &rxTaskStack;
    rxTaskParams.arg0 = (UInt)1000000;



    /* Begin Construct RF BIOS objects per unmodulated test */
    RF_cmdTxTest.endTrigger.triggerType = TRIG_ABSTIME;
    RF_cmdTxTest.endTrigger.pastTrig = 1;
    /* Explicitly configure CW (1) or Modulated (0). Default modulated mode is PRBS-15. */
    RF_cmdTxTest.config.bUseCw = 1;
    /* End Construct RF BIOS objects per unmodulated test */


    Task_construct(&rxTask, rxTaskFunction, &rxTaskParams, NULL);

}

void buttonCallbackFunction(PIN_Handle handle, PIN_Id pinId) {


    CPUdelay((uint32_t)((48000000/3)*0.050f));
    if (!PIN_getInputValue(pinId)) {

        Semaphore_post(txSemaphoreHandle);
    }
}

void init_RS232(void)
{
    /* Construct RS232 BIOS objects */
    Task_Params_init(&Params_RS232);
    Params_RS232.stackSize = STACK_SIZE_RS232;
    Params_RS232.arg0 = 10 / Clock_tickPeriod;                         
    Params_RS232.stack = &Stack_RS232;

    Task_construct(&Struct_RS232, (Task_FuncPtr)RS232, &Params_RS232, NULL);

    /* Create a UART with data processing off. */
    UART_Params_init(&uartParams);                                  

    uartParams.dataLength = UART_LEN_8;                                 
    uartParams.parityType = UART_PAR_NONE;                              
    uartParams.stopBits = UART_STOP_ONE;                                
    uartParams.writeDataMode = UART_DATA_BINARY;                        
    uartParams.readDataMode = UART_DATA_BINARY;                  
    uartParams.readReturnMode = UART_RETURN_NEWLINE;                  
    uartParams.readEcho = UART_ECHO_OFF;

    uartParams.readTimeout = 1000;                                      
    uart = UART_open(Board_UART0, &uartParams);                        
}

void Read_From_RF(char RFRead[MAX_LENGTH + NUM_APPENDED_BYTES - 4])
{
    uint8_t i;

    if (RFRead != NULL)
    {
        for (i = 0; i < 4; i++) Addr_da_RF[i] = RFRead[i];

        for (i = 0; i < 4; i++)
        {
            if (Addr_da_RF[i] != MyAddr[i])
            {
                PIN_setOutputValue(pinHandle, S_ON,Out_Low);
                for (i = 0; i < MAX_LENGTH; i++) From_RS232[i] = NULL;
                PIN_setOutputValue(pinHandle, S_ON,Out_High);
                return;
            }
        }
        for (i = 4; i < MAX_LENGTH; i++) Dato_da_RF[i-4] = RFRead[i];
        UART_write(uart,&Dato_da_RF,packetLength);
    }
}
void TX_To_RF(char input[MAX_LENGTH]){

                              uint8_t i = 0;

                              rfcmdHandle = RF_postCmd(rfHandle, (RF_Op*)&RF_cmdFs, RF_PriorityNormal, NULL, 0);
                              if (PIN_getInputValue(Sel_Mod_Unmod) && input[0] != 0)
                                  {

                              for(i = 0;i<4; i++) packet[i] = RemoteAddr[i];

                                         for(i=0; i<strlen(input); i++) packet[i+4] = input[i];

                                           RF_cmdPropTxAdv.pPkt = packet;
                                           RF_cmdPropTxAdv.pktLen = strlen(input)+4;

                                           RF_runCmd(rfHandle, (RF_Op*)&RF_cmdPropTxAdv, RF_PriorityNormal, NULL, 0);
                                           RF_yield(rfHandle);
                                           Semaphore_pend(txSemaphoreHandle, BIOS_WAIT_FOREVER);
                                  }

                                           RF_cancelCmd(rfHandle, rfcmdHandle, 0);
}

/*
 *  ======== RS232 ========
 *  Task for this function is created statically. See the project's .cfg file.
 */

void RS232(UArg arg0, UArg arg1)
{
    uint8_t i;

    if (uart == NULL)                                                               
    {
        PIN_setOutputValue(pinHandle, S_OFF,Out_Low);
        System_abort("Error opening the UART");
    }

    /* Setup callback for button pins */
        PIN_Status status = PIN_registerIntCb(buttonPinHandle, &buttonCallbackFunction);
        Assert_isTrue((status == PIN_SUCCESS), NULL);


    /* Set the frequency */
    RF_cmdFs.frequency = configInRam.Freq/10 + 860;
    RF_cmdFs.fractFreq = configInRam.Freq % 10 * 6553;
    /* Set RF Power */
    RF_cmdPropRadioDivSetup.txPower = outputPower[configInRam.Power-48].txPower;
    RF_postCmd(rfHandle, (RF_Op*)&RF_cmdFs, RF_PriorityNormal, NULL, 0);
    RF_runCmd(rfHandle, (RF_Op*)&RF_cmdPropRadioDivSetup, RF_PriorityNormal, NULL, 0);


    while (1)
    {

  
        if (From_RF1[0] != NULL)                                  
        {
            Read_From_RF(From_RF1);                                
                                   
            for (i = 0; i < MAX_LENGTH; i++) From_RF1[i] = NULL;    
            for (i = 0; i < MAX_LENGTH; i++) Dato_da_RF[i] = NULL; 
        }
        else
        {
            RF_cmdPropTxAdv.pPkt = 0;
            UART_read(uart, &From_RS232, sizeof(From_RS232));           
            if (From_RS232[0] == 0);
            else
            {
                PIN_setOutputValue(pinHandle, CTS,Out_High);
                Analyze_RS232_String(From_RS232);
                if (RS232_To_Local == 0) TX_To_RF(From_RS232);
                
                if (From_RS232[0] != 0)
                {
                    for (i = 0; i < MAX_LENGTH; i++) From_RS232[i] = NULL; 
                    for (i = 0; i < MAX_LENGTH+4; i++) packet[i] = NULL;  
                    RF_cmdPropTxAdv.pPkt = 0;
                }
                PIN_setOutputValue(pinHandle, CTS,Out_Low);
            }
        }
    }
}

static void rxTaskFunction(UArg arg0, UArg arg1)
{
    RF_Params rfParams;
    RF_Params_init(&rfParams);

    PINCC26XX_setMux(pinHandle, Relay_1, PINCC26XX_MUX_RFC_GPO0);

    initializeTxAdvCmdFromTxCmd(&RF_cmdPropTxAdv, &RF_cmdPropTx);
    initializeSniffCmdFromRxCmd(&RF_cmdPropRxSniff, &RF_cmdPropRx);

    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);
    }

    uint32_t datarate = calculateSymbolRate(RF_cmdPropRadioDivSetup.symbolRate.preScale,
                                                RF_cmdPropRadioDivSetup.symbolRate.rateWord);

    configureSniffCmd(&RF_cmdPropRxSniff, WOR_MODE, datarate, WOR_WAKEUPS_PER_SECOND);

    /* Modify CMD_PROP_TX command for application needs */
    RF_cmdPropTxAdv.pktLen = MAX_LENGTH;
    RF_cmdPropTxAdv.pPkt = 0;
    RF_cmdPropTxAdv.preTrigger.triggerType = TRIG_REL_START;
    RF_cmdPropTxAdv.preTime = WOR_PREAMBLE_TIME_RAT_TICKS(WOR_WAKEUPS_PER_SECOND);


    /* Modify CMD_PROP_RX command for application needs */
    RF_cmdPropRxSniff.pQueue = &dataQueue;           /* Set the Data Entity queue for received data */
    RF_cmdPropRxSniff.rxConf.bAutoFlushIgnored = 0;  /* Discard ignored packets from Rx queue */
    RF_cmdPropRxSniff.rxConf.bAutoFlushCrcErr = 0;   /* Discard packets with CRC error from Rx queue */
    RF_cmdPropRxSniff.maxPktLen = MAX_LENGTH;        /* Implement packet length filtering to avoid PROP_ERROR_RXBUF */
    RF_cmdPropRxSniff.pOutput = (uint8_t*)&rxStatistics;

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

    while(1)
    {

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

        RF_cmdPropRxSniff.startTime += WOR_WAKE_UP_INTERVAL_RAT_TICKS(WOR_WAKEUPS_PER_SECOND);

        /* Schedule command, do not wait for completion */
        RF_runCmd(rfHandle, (RF_Op*)&RF_cmdPropRxSniff, RF_PriorityNormal, &call_RF_RX, RF_EventRxEntryDone);

    }
}
static void initializeTxAdvCmdFromTxCmd(rfc_CMD_PROP_TX_ADV_t* RF_cmdPropTxAdv, rfc_CMD_PROP_TX_t* RF_cmdPropTx)
{
    #define RADIO_OP_HEADER_SIZE 14

    /* Copy general radio operation header from TX commmand to TX_ADV */
    memcpy(RF_cmdPropTxAdv, RF_cmdPropTx, RADIO_OP_HEADER_SIZE);

    /* Set command to CMD_PROP_TX_ADV */
    RF_cmdPropTxAdv->commandNo = CMD_PROP_TX_ADV;

    /* Copy over relevant parameters */
    RF_cmdPropTxAdv->pktConf.bFsOff = RF_cmdPropTx->pktConf.bFsOff;
    RF_cmdPropTxAdv->pktConf.bUseCrc = RF_cmdPropTx->pktConf.bUseCrc;
    RF_cmdPropTxAdv->syncWord = RF_cmdPropTx->syncWord;
}

/* Calculates datarate from prescaler and rate word */
static uint32_t calculateSymbolRate(uint8_t prescaler, uint32_t rateWord)
{
    /* Calculate datarate according to TRM Section 23.7.5.2:
     * f_baudrate = (R * f_ref)/(p * 2^20)
     *   - R = rateWord
     *   - f_ref = 24Mhz
     *   - p = prescaler */
    uint64_t numerator = rateWord*24000000ULL;
    uint64_t denominator = prescaler*1048576ULL;
    uint32_t result = (uint32_t)(numerator/denominator);
    return result;
}

/* Copies all RX options from the SmartRF Studio exported RX command to the RX Sniff command */
static void initializeSniffCmdFromRxCmd(rfc_CMD_PROP_RX_SNIFF_t* rxSniffCmd, rfc_CMD_PROP_RX_t* rxCmd)
{

    /* Copy RX configuration from RX command */
    memcpy(rxSniffCmd, rxCmd, sizeof(rfc_CMD_PROP_RX_t));

    /* Change to RX_SNIFF command from RX command */
    rxSniffCmd->commandNo = CMD_PROP_RX_SNIFF;
}

/* Configures Sniff-mode part of the RX_SNIFF command based on mode, datarate and wakeup interval */
static void configureSniffCmd(rfc_CMD_PROP_RX_SNIFF_t* rxSniffCmd, enum CarrierSenseMode mode, uint32_t datarate, uint8_t wakeupPerSecond)
{
    /* Enable or disable RSSI */
    if ((mode == CarrierSenseMode_RSSI) || (mode == CarrierSenseMode_RSSIandPQT)) {
        rxSniffCmd->csConf.bEnaRssi        = 1;
    } else {
        rxSniffCmd->csConf.bEnaRssi        = 0;
    }

    /* Enable or disable PQT */
    if ((mode == CarrierSenseMode_PQT) || (mode == CarrierSenseMode_RSSIandPQT)) {
        rxSniffCmd->csConf.bEnaCorr        = 1;
        rxSniffCmd->csEndTrigger.triggerType  = TRIG_REL_START;
    } else {
        rxSniffCmd->csConf.bEnaCorr        = 0;
        rxSniffCmd->csEndTrigger.triggerType  = TRIG_NEVER;
    }

    /* General Carrier Sense configuration */
    rxSniffCmd->csConf.operation       = 1; /* Report Idle if RSSI reports Idle to quickly exit if not above
                                                 RSSI threshold */
    rxSniffCmd->csConf.busyOp          = 0; /* End carrier sense on channel Busy (the receiver will continue when
                                                 carrier sense ends, but it will then not end if channel goes Idle) */
    rxSniffCmd->csConf.idleOp          = 1; /* End on channel Idle */
    rxSniffCmd->csConf.timeoutRes      = 1; /* If the channel is invalid, it will return PROP_DONE_IDLE_TIMEOUT */

    /* RSSI configuration */
    rxSniffCmd->numRssiIdle            = 1; /* One idle RSSI samples signals that the channel is idle */
    rxSniffCmd->numRssiBusy            = 1; /* One busy RSSI samples signals that the channel is busy */
    rxSniffCmd->rssiThr    = (int8_t)WOR_RSSI_THRESHOLD; /* Set the RSSI threshold in dBm */

    /* PQT configuration */
    rxSniffCmd->corrConfig.numCorrBusy = 1;   /* One busy PQT samples signals that the channel is busy */
    rxSniffCmd->corrConfig.numCorrInv  = 1;   /* One busy PQT samples signals that the channel is busy */

    /* Calculate basic timing parameters */
    uint32_t symbolLengthUs  = 1000000UL/datarate;
    uint32_t preambleSymbols = (1000000UL/wakeupPerSecond)/symbolLengthUs;
#if defined(DeviceFamily_CC26X0R2)
    uint8_t syncWordSymbols  = RF_cmdPropRadioSetup.formatConf.nSwBits;
#else
    uint8_t syncWordSymbols  = RF_cmdPropRadioDivSetup.formatConf.nSwBits;
#endif// DeviceFamily_CC26X0R2

    /* Calculate sniff mode parameters */
    #define US_TO_RAT_TICKS 8
    #define CORR_PERIOD_SYM_MARGIN 32
    #define RX_END_TIME_SYM_MARGIN 16
    #define CS_END_TIME_MIN_TIME_SYM 60
#if ((WOR_RF_PHY_DATARATE == WOR_RF_PHY_DATARATE_50KBPS)  || \
     (WOR_RF_PHY_DATARATE == WOR_RF_PHY_DATARATE_100KBPS) || \
     (WOR_RF_PHY_DATARATE == WOR_RF_PHY_DATARATE_200KBPS))
    #define CS_END_TIME_MIN_TIME_STATIC_US 300
#elif ((WOR_RF_PHY_DATARATE == WOR_RF_PHY_DATARATE_300KBPS) || \
       (WOR_RF_PHY_DATARATE == WOR_RF_PHY_DATARATE_400KBPS))
    #define CS_END_TIME_MIN_TIME_STATIC_US 200
#elif (WOR_RF_PHY_DATARATE == WOR_RF_PHY_DATARATE_500KBPS)
    #define CS_END_TIME_MIN_TIME_STATIC_US 250
#else
#error "WOR_RF_PHY_DATARATE is undefined or has an invalid option"
#endif

    /* Represents the time in which we need to receive corrConfig.numCorr* correlation peaks to detect preamble.
     * When continously checking the preamble quality, this period has to be wide enough to also contain the sync
     * word, with a margin. If it is not, then there is a chance the SNIFF command will abort while receiving the
     * sync word, as it no longer detects a preamble. */
    uint32_t correlationPeriodUs = (syncWordSymbols + CORR_PERIOD_SYM_MARGIN)*symbolLengthUs;

    /* Represents the time where we will force a check if preamble is present (only done once).
     * The main idea is that his should be shorter than "correlationPeriodUs" so that if we get RSSI valid, but
     * there is not a valid preamble on the air, we will leave RX as quickly as possible. */
    uint32_t csEndTimeUs = (CS_END_TIME_MIN_TIME_SYM*symbolLengthUs + CS_END_TIME_MIN_TIME_STATIC_US);

    /* Represents the maximum time from the startTrigger to when we expect a sync word to be received. */
    uint32_t rxEndTimeUs = (preambleSymbols + syncWordSymbols + RX_END_TIME_SYM_MARGIN)*symbolLengthUs;

    /* Set sniff mode timing configuration in sniff command in RAT ticks */
    rxSniffCmd->corrPeriod = (uint16_t)(correlationPeriodUs * US_TO_RAT_TICKS);
    rxSniffCmd->csEndTime  = (uint32_t)(csEndTimeUs * US_TO_RAT_TICKS);
    rxSniffCmd->endTime    = (uint32_t)(rxEndTimeUs * US_TO_RAT_TICKS);

    /* Set correct trigger types */
    rxSniffCmd->endTrigger.triggerType   = TRIG_REL_START;
    rxSniffCmd->startTrigger.triggerType = TRIG_ABSTIME;
    rxSniffCmd->startTrigger.pastTrig    = 1;
}

void call_RF_RX(RF_Handle h, RF_CmdHandle ch, RF_EventMask e)
{

    if (e & RF_EventRxEntryDone)
    {
   //     do{

                            /* Toggle LED on RX */


                            /* 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 +0);

                            /* This code block is added to avoid a compiler warning.
                            * Normally, an application will reference these variables for
                            * useful data. */

                            if (From_RF1[0] == NULL) memcpy(From_RF1, packetDataPointer, (packetLength));


                            RFQueue_nextEntry();



                        }
}

/*
 *  ======== main ========
 */
int main(void)
{
    static char Read_Config_St[13];
    int z;

    /* Call board init functions. */
    Board_initGeneral();



    Semaphore_Params semParams;
    Semaphore_Params_init(&semParams);
    Semaphore_construct(&semStruct, 0, &semParams);

    semHandle = Semaphore_handle(&semStruct);

    /* Open LED pins */
    pinHandle = PIN_open(&ledPinState, pinTable);
    if(!pinHandle) System_abort("Error initializing board LED pins\n");
    else
    {      
        _delay_cycles(2*24000000*0.500);                                
    }

    /* Open Button pins */
       buttonPinHandle = PIN_open(&buttonPinState, buttonPinTable);
       Assert_isTrue(buttonPinHandle != NULL, NULL);

    /* Initialize task */
    RxTask_init();
    ReadFlash(IND_FLASH_DATI,Read_Memory,29);
    Read_Config_St[0] = '^';
    for (z = 0; z < 12; z++) Read_Config_St[z+1] = Read_Memory[z];         
    for (z = 12; z < 20; z++) Write_Output_St[z-12] = Read_Memory[z];    
    RW_BR_Value[0] = Read_Memory[20];                                      

    LocalConfigureDevice(Read_Config_St);
    WriteOutputState(Write_Output_St);
    PIN_setOutputValue(pinHandle, Relay_1,Write_Output_St[0]);  
    PIN_setOutputValue(pinHandle, Relay_2,Write_Output_St[1]);   
    init_RS232();                                                                                       

    /* Start BIOS */
    BIOS_start();

    return (0);
}

TX:

void TX_To_RF(char input[MAX_LENGTH]){

                              uint8_t i = 0;

                              rfcmdHandle = RF_postCmd(rfHandle, (RF_Op*)&RF_cmdFs, RF_PriorityNormal, NULL, 0);
                              if (PIN_getInputValue(Sel_Mod_Unmod) && input[0] != 0)
                                  {

                              for(i = 0;i<4; i++) packet[i] = RemoteAddr[i];

                                         for(i=0; i<strlen(input); i++) packet[i] = input[i];

                                           RF_cmdPropTxAdv.pPkt = packet;
                                           RF_cmdPropTxAdv.pktLen = packet[0]+1;

                                           RF_runCmd(rfHandle, (RF_Op*)&RF_cmdPropTxAdv, RF_PriorityNormal, NULL, 0);
                                           RF_yield(rfHandle);
                                           Semaphore_pend(txSemaphoreHandle, BIOS_WAIT_FOREVER);
                                  }

                                           RF_cancelCmd(rfHandle, rfcmdHandle, 0);
}

RX: 

void Read_From_RF(char RFRead[MAX_LENGTH + NUM_APPENDED_BYTES - 4])
{
    uint8_t i;

    if (RFRead != NULL)
    {
        for (i = 0; i < 4; i++) Addr_da_RF[i] = RFRead[i];

        for (i = 0; i < 4; i++)
        {
            if (Addr_da_RF[i] != MyAddr[i])
            {
                
                for (i = 0; i < MAX_LENGTH; i++) From_RS232[i] = NULL;
                
                return;
            }
        }
        for (i = 4; i < MAX_LENGTH; i++) Dato_da_RF[i-4] = RFRead[i];
      //  UART_write(uart,&Dato_da_RF,packetLength);
    }
}

In this case I printf here and it works without address and not printf in Read_From:RF():

void call_RF_RX(RF_Handle h, RF_CmdHandle ch, RF_EventMask e)
{

    if (e & RF_EventRxEntryDone)
    {

                            /* Toggle LED on RX */


                            /* 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 +0);

                            /* This code block is added to avoid a compiler warning.
                            * Normally, an application will reference these variables for
                            * useful data. */

                            if (From_RF1[0] == NULL) memcpy(From_RF1, packetDataPointer, (packetLength));


                            RFQueue_nextEntry();

                            UART_write(uart, &From_RF1, packetLength);

                        }
}

Please, help me!