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: 官方WOR示例跑不起来

Part Number: CC1310

我想请问一下我这里的板子没有显示屏,于是我屏蔽了相关的代码,因为定义的按键不一样也重新映射了接口,但是无法跑起来

Tx端接收如下,Rx端我没有改,请问哪边有可能出问题?

/***** Defines *****/
/* Wake-on-Radio configuration */
#define WOR_WAKEUPS_PER_SECOND 2

/* TX number of random payload bytes */
#define PAYLOAD_LENGTH 30

/* WOR Example configuration defines */
#define WOR_PREAMBLE_TIME_RAT_TICKS(x) \
((uint32_t)(4000000*(1.0f/(x))))

/* TX task stack size and priority */
#define TX_TASK_STACK_SIZE 1024
#define TX_TASK_PRIORITY 2


/***** Prototypes *****/
static void txTaskFunction(UArg arg0, UArg arg1);
static void initializeTxAdvCmdFromTxCmd(rfc_CMD_PROP_TX_ADV_t* RF_cmdPropTxAdv, rfc_CMD_PROP_TX_t* RF_cmdPropTx);


/***** Variable declarations *****/
/* TX task objects and task stack */
static Task_Params txTaskParams;
Task_Struct txTask; /* not static so you can see in ROV */
static uint8_t txTaskStack[TX_TASK_STACK_SIZE];

/* TX packet payload (length +1 to fit length byte) and sequence number */
static uint8_t packet[PAYLOAD_LENGTH +1];
static uint16_t seqNumber;

/* RF driver objects and handles */
static RF_Object rfObject;
static RF_Handle rfHandle;

/* Pin driver objects and handles */
static PIN_Handle ledPinHandle;
static PIN_Handle buttonPinHandle;
static PIN_State ledPinState;
static PIN_State buttonPinState;

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

/* Advanced TX command for sending long preamble */
static rfc_CMD_PROP_TX_ADV_t RF_cmdPropTxAdv;

/*
* 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
};

/*
* Application button pin configuration table:
* - Buttons interrupts are configured to trigger on falling edge.
*/
PIN_Config buttonPinTable[] = {
Ang_C_W_B | PIN_INPUT_EN | PIN_PULLUP | PIN_IRQ_NEGEDGE,
PIN_TERMINATE
};


/***** Function definitions *****/
/* Pin interrupt Callback function board buttons configured in the pinTable. */
void buttonCallbackFunction(PIN_Handle handle, PIN_Id pinId) {

/* Simple debounce logic, only toggle if the button is still pushed (low) */
CPUdelay((uint32_t)((48000000/3)*0.050f));
if (!PIN_getInputValue(pinId)) {
/* Post TX semaphore to TX task */
Semaphore_post(txSemaphoreHandle);
}
}

/* TX task initialization function. Runs once from main() */
void txTaskInit()
{
/* Initialize TX semaphore */
Semaphore_construct(&txSemaphore, 0, NULL);
txSemaphoreHandle = Semaphore_handle(&txSemaphore);

/* Initialize and create TX task */
Task_Params_init(&txTaskParams);
txTaskParams.stackSize = TX_TASK_STACK_SIZE;
txTaskParams.priority = TX_TASK_PRIORITY;
txTaskParams.stack = &txTaskStack;
Task_construct(&txTask, txTaskFunction, &txTaskParams, NULL);
}

/* TX task function. Executed in Task context by TI-RTOS when the scheduler starts. */
static void txTaskFunction(UArg arg0, UArg arg1)
{
/* Setup callback for button pins */
PIN_Status status = PIN_registerIntCb(buttonPinHandle, &buttonCallbackFunction);
//Assert_isTrue((status == PIN_SUCCESS), NULL);

/* Initialize the radio */
RF_Params rfParams;
RF_Params_init(&rfParams);

/* Initialize TX_ADV command from TX command */
initializeTxAdvCmdFromTxCmd(&RF_cmdPropTxAdv, &RF_cmdPropTx);

/* Set application specific fields */
RF_cmdPropTxAdv.pktLen = PAYLOAD_LENGTH +1; /* +1 for length byte */
RF_cmdPropTxAdv.pPkt = packet;
//RF_cmdPropTxAdv.preTrigger.triggerType = TRIG_REL_START;
RF_cmdPropTxAdv.preTrigger.triggerType = TRIG_NOW;
RF_cmdPropTxAdv.preTime = WOR_PREAMBLE_TIME_RAT_TICKS(WOR_WAKEUPS_PER_SECOND);

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

/* Set the frequency */
RF_runCmd(rfHandle, (RF_Op*)&RF_cmdFs, RF_PriorityNormal, NULL, 0);
PIN_setOutputValue(ledPinHandle, Board_PIN_LED0,!PIN_getOutputValue(Board_PIN_LED0));
/* Enter main TX loop */
while(1)
{
/* Wait for a button press */
Semaphore_pend(txSemaphoreHandle, BIOS_WAIT_FOREVER);

/* Create packet with incrementing sequence number and random payload */
packet[0] = PAYLOAD_LENGTH;
packet[1] = (uint8_t)(seqNumber >> 8);
packet[2] = (uint8_t)(seqNumber++);
uint8_t i;
for (i = 3; i < PAYLOAD_LENGTH +1; i++)
{
packet[i] = rand();
}

/* Send packet */
RF_runCmd(rfHandle, (RF_Op*)&RF_cmdPropTxAdv, RF_PriorityNormal, NULL, 0);

/* Toggle LED */
PIN_setOutputValue(ledPinHandle, Board_PIN_LED1, !PIN_getOutputValue(Board_PIN_LED1));
}
}

/* Copy the basic RX configuration from CMD_PROP_RX to CMD_PROP_RX_SNIFF command. */
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;
}


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

/* Open LED pins */
ledPinHandle = PIN_open(&ledPinState, pinTable);
//Assert_isTrue(ledPinHandle != NULL, NULL);

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

/* Initialize task */
txTaskInit();

/* Start BIOS */
BIOS_start();

return (0);
}