主题中讨论的其他器件:LAUNCHXL-CC26X2R1、 CC2652R、 CC2652RB、 SysConfig
你好!
我一直在尝试发送虚拟802.15.4帧、但遗憾的是、器件在运行时卡住:
RF_EventMask ev = RF_runCmd(rfHandle, (RF_Op*)&RF_cmdIeeeTx_ieee154_0, RF_PriorityNormal, NULL, 0);
更具体地说、是在线路上的 RF_PendCmd
/* Wait for semaphore */ SemaphoreP_pend(&h->state.semSync, SemaphoreP_WAIT_FOREVER);
下面是我的完整代码:
/*
* ======== myradio.c ========
*/
/* For usleep() */
#include <unistd.h>
#include <stddef.h>
/* Driver Header files */
#include <ti/drivers/rf/RF.h>
#include <ti/drivers/GPIO.h>
#include <ti/drivers/UART2.h>
#include <ti/devices/cc13x2_cc26x2/driverlib/rf_prop_mailbox.h>
/* Driver configuration */
#include "ti/drivers/rf/RFCC26X2.h"
#include "ti_drivers_config.h"
#include "ti_radio_config.h"
//our source
#include "debug_utils.h"
//configs
#define PAYLOAD_LENGTH 30
#define PACKET_INTERVAL 500000
//globals
static RF_Object rfObject;
static RF_Handle rfHandle;
static uint8_t packet[0x1E];
static uint16_t seqNumber;
void fill_packet(){
packet[0] = (uint8_t) (seqNumber >> 8);
packet[1] = (uint8_t) (seqNumber);
seqNumber++;
for(int i = 2; i < PAYLOAD_LENGTH; i++){
packet[i] = rand();
}
print_string("\r\n ====================\r\n");
print_string("SENDING PACKET:\r\n");
debug_print_hex_array(packet, PAYLOAD_LENGTH);
print_string("\r\n ====================\r\n");
}
/*
* ======== mainThread ========
*/
void *mainThread(void *arg0){
//init LED
GPIO_init();
GPIO_setConfig(CONFIG_GPIO_0, GPIO_CFG_OUT_STD | GPIO_CFG_OUT_LOW);
//init debug
debug_uart_init();
print_string("Starting....\r\n");
//intit RF
RF_Params rfParams;
RF_Params_init(&rfParams);
RF_cmdIeeeTx_ieee154_0.pPayload = packet;
RF_cmdIeeeTx_ieee154_0.startTrigger.triggerType = TRIG_NOW;
rfHandle = RF_open(&rfObject, &RF_prop_ieee154_0, (RF_RadioSetup*) &RF_cmdRadioSetup_ieee154_0, &rfParams);
if(rfHandle == NULL){
print_string("GOT NULL rfHANDLE!!!");
}
int st = RF_postCmd(rfHandle, (RF_Op*) &RF_cmdFs_ieee154_0, RF_PriorityNormal, NULL, 0);
if(st < 0){
print_string("FS init failed");
}
GPIO_write(CONFIG_GPIO_0, CONFIG_GPIO_LED_ON);
print_string("Init finished, starting tx\r\n");
while(1){
//send packet
fill_packet();
RF_EventMask ev = RF_runCmd(rfHandle, (RF_Op*)&RF_cmdIeeeTx_ieee154_0, RF_PriorityNormal, NULL, 0);
print_string("PACKET SENT, STATUS:\r\n");
print_rf_event_mask(ev);
uint32_t cmdStatus = ((volatile RF_Op*)&RF_cmdIeeeTx_ieee154_0)->status;
print_rf_prop(cmdStatus);
RF_yield(rfHandle);
usleep(PACKET_INTERVAL);
}
return NULL;
}
有什么想法吗? 我尝试在 TI-RTOS 下运行它、以防出现这种情况、但目前还不幸运。
非常感谢!
e2e.ti.com/.../3718.ti_5F00_radio_5F00_config.he2e.ti.com/.../2705.ti_5F00_radio_5F00_config.c