TI中文支持网
TI专业的中文技术问题搜集分享网站

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

Kevin Qiu1:

跑不起来debug时卡在什么位置?注意按键在这个程序中很重要,它用来控制发送数据包,在发送数据包时LED会切换

,

K:

现在这边发送的解决了,那边中断设置有点问题,但是RX端收不到数据

,

Kevin Qiu1:

将Rx端换成launchpad可以收到数据吗,可以在smartRF studio中用两个板子测试发送和接收,如果也不能收到数据,那可能是硬件上存在频偏

,

K:

我用smartRF收得到,暂时身边没有lanchpad

,

Kevin Qiu1:

只修改端口映射不应影响正常的收发,使用rfPacketTx和rfPacketRx例程正常吗

,

K:

这边我修改了发送端的TriggerType,重新改回来了,就ok了,另外我想问一下低功耗是不是就是standby模式

,

Kevin Qiu1:

低功耗就是在不传输数据时进入到standby模式

,

K:

好的,谢谢

,

Kevin Qiu1:

不客气

赞(0)
未经允许不得转载:TI中文支持网 » CC1310: 官方WOR示例跑不起来
分享到: 更多 (0)