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

CC1352 EVENT事件不能唤醒TASK

Event_Params eventParam;
Event_Params_init(&eventParam);
Event_construct(&radioOperationEventStruct, &eventParam);
radioOperationEventHandle = Event_handle(&radioOperationEventStruct);

uint32_t events = Event_pend(radioOperationEventHandle, 0, RADIO_EVENT_ALL, BIOS_WAIT_FOREVER);

if(events & RADIO_EVENT_JOIN_NWM_RECEIVED)
{
Nwk_Join_Key_func();
if(EasyLink_receiveAsync(RxReceive_amge_Callback, 0) != EasyLink_Status_Success)
{
System_abort("EasyLink_receiveAsync failed");
}
}

static void NwkJoinCallback(PIN_Handle handle, PIN_Id pinId)
{
/* Debounce logic, only toggle if the button is still pushed (low) */
CPUdelay(8000*50);
if (PIN_getInputValue(NwkJoin_key) == 0)
{
Event_post(radioOperationEventHandle, RADIO_EVENT_JOIN_NWM_RECEIVED);
}
}

当运行   Event_post(radioOperationEventHandle, RADIO_EVENT_JOIN_NWM_RECEIVED); 没有触发 TASK中的if(events & RADIO_EVENT_JOIN_NWM_RECEIVED)这里  搞不明白!

Viki Shi:

你用Semaphore_post是否可以唤醒?

gui tan:

回复 Viki Shi:

我试试看一下

gui tan:

回复 gui tan:

void ConcentratorRadioTask_init(void) {
/* Create event used internally for state changes */Event_Params eventParam;Event_Params_init(&eventParam);Event_construct(&radioOperationEventStruct, &eventParam);radioOperationEventHandle = Event_handle(&radioOperationEventStruct);
/* Create the concentrator radio protocol task */Task_Params_init(&concentratorRadioTaskParams);concentratorRadioTaskParams.stackSize = CONCENTRATORRADIO_TASK_STACK_SIZE;concentratorRadioTaskParams.priority = CONCENTRATORRADIO_TASK_PRIORITY;concentratorRadioTaskParams.stack = &concentratorRadioTaskStack;Task_construct(&concentratorRadioTask, concentratorRadioTaskFunction, &concentratorRadioTaskParams, NULL);
/*******************************user**********************************************/NwkLedPinHandle= PIN_open(&NwkLedPinState, NwkLedPinTable);
NwkkeyJoinHandle = PIN_open(&NwkkeyJoinPinState, NwkkeyPinTable);
if (!NwkLedPinHandle){System_abort("Error initializing board 3.3V domain pins\n");}
/* Setup callback for button pins */if (PIN_registerIntCb(NwkkeyJoinHandle, &NwkJoinCallback) != 0){System_abort("Error registering button callback function");}
Clock_Params clkParams;Clock_Params_init(&clkParams);
clkParams.startFlag = FALSE;Clock_construct(&ledBlink_Nwk_Join_Clock, ledBlink_Nwk_Join_RadioCb, 0, &clkParams);//1ledBlink_Nwk_Join_ClockHandle = Clock_handle(&ledBlink_Nwk_Join_Clock);
Clock_construct(&GPRS_data_ClockStruct, Post_Sensor_DataCb, 0, &clkParams);GPRS_data_ClockHandle = Clock_handle(&GPRS_data_ClockStruct);
Mailbox_Params sensor_data_mbxParams;Mailbox_Params_init(&sensor_data_mbxParams);
sensor_data_mbxParams.buf =(Ptr)Packet_mailboxBuffer;sensor_data_mbxParams.bufSize = sizeof(Packet_mailboxBuffer);Mailbox_construct(&sensor_data_mbxStruct, sizeof(BeaconPacket),NUMMSGS, &sensor_data_mbxParams, NULL);sensor_data_mbxHandle = Mailbox_handle(&sensor_data_mbxStruct);
/*********************test**********************************/Semaphore_Params semParam;Semaphore_Params_init(&semParam);
Semaphore_construct(&test_Sem, 1, &semParam);test_SemHandle = Semaphore_handle(&test_Sem);

}

static void concentratorRadioTaskFunction(UArg arg0, UArg arg1)
{/* Initialize EasyLink */EasyLink_Params easyLink_params;EasyLink_Params_init(&easyLink_params);easyLink_params.ui32ModType = RADIO_EASYLINK_MODULATION;if(EasyLink_init(&easyLink_params) != EasyLink_Status_Success){ System_abort("EasyLink_init failed");}
/*读取本身IEEE*/EasyLink_getIeeeAddr(ApiMac_IeeeAddrExt);// //打点这里没有运行到这里
while(1)
{delay1_ms(100);delay1_ms(100); Semaphore_pend(test_SemHandle, BIOS_WAIT_FOREVER);
uint8_t tesp=16;tesp++;
}
}

static void NwkJoinCallback(PIN_Handle handle, PIN_Id pinId)
{/* Debounce logic, only toggle if the button is still pushed (low) */CPUdelay(8000*50);if (PIN_getInputValue(NwkJoin_key) == 0){//Event_post(radioOperationEventHandle, RADIO_EVENT_JOIN_NWM_RECEIVED);
Semaphore_post(test_SemHandle);//这可看得到运行到这里}
}

gui tan:

回复 Viki Shi:

EasyLink_Params easyLink_params;EasyLink_Params_init(&easyLink_params);easyLink_params.ui32ModType = RADIO_EASYLINK_MODULATION;

if(EasyLink_init(&easyLink_params) != EasyLink_Status_Success){ System_abort("EasyLink_init failed");}//跑到这里 就好像跑不下去了

Viki Shi:

回复 gui tan:

复位过后卡住了?是否复位不完全,reset或者断电后重新上电试试

gui tan:

回复 Viki Shi:

int main(void)
{/* Call driver init functions. */Board_initGeneral();
/* Initialize the UART and SPI for the display driver. *///Display_init();
//UART_init();//SPI_init();
/* Initialize concentrator tasks */ConcentratorRadioTask_init();ConcentratorTask_init();
/* Start BIOS */BIOS_start();
return (0);
}

static void concentratorRadioTaskFunction(UArg arg0, UArg arg1)
{/* Initialize EasyLink */
// EasyLink_Params easyLink_params;
//EasyLink_Params_init(&easyLink_params);
// easyLink_params.ui32ModType = RADIO_EASYLINK_MODULATION;
// if(EasyLink_init(&easyLink_params) != EasyLink_Status_Success){
//System_abort("EasyLink_init failed");
//}
/*读取本身IEEE*/EasyLink_getIeeeAddr(ApiMac_IeeeAddrExt);while (1) {

delay1_ms(100);delay1_ms(100);delay1_ms(100);///这里只是运行过几次 后面就没有运行了Semaphore_pend(test_SemHandle, BIOS_WAIT_FOREVER);
uint8_t tesp=16;tesp++;

}
}

static void concentratorTaskFunction(UArg arg0, UArg arg1)
{/* Initialize display and try to open both UART and LCD types of display. */
//Display_Params params;
//Display_Params_init(&params);
//params.lineClearMode = DISPLAY_CLEAR_BOTH;
/* Open both an available LCD display and an UART display.* Whether the open call is successful depends on what is present in the* Display_config[] array of the board file.** Note that for SensorTag evaluation boards combined with the SHARP96x96* Watch DevPack, there is a pin conflict with UART such that one must be* excluded, and UART is preferred by default. To display on the Watch* DevPack, add the precompiler define BOARD_DISPLAY_EXCLUDE_UART.*/
//hDisplayLcd = Display_open(Display_Type_LCD, &params);
//hDisplaySerial = Display_open(Display_Type_UART, &params);
/* Check if the selected Display type was found and successfully opened */
//if (hDisplaySerial)
//{
//Display_printf(hDisplaySerial, 0, 0, "Waiting for nodes…");
//}
/* Check if the selected Display type was found and successfully opened */
//if (hDisplayLcd)
//{
//Display_printf(hDisplayLcd, 0, 0, "Waiting for nodes…");
//}
/* Register a packet received callback with the radio task */
//ConcentratorRadioTask_registerPacketReceivedCallback(packetReceivedCallback);

/* Enter main task loop */while(1) {
delay_ms(100);delay_ms(1000);//都 在这里个任务-里运行

}
}
我发现在这里

赞(0)
未经允许不得转载:TI中文支持网 » CC1352 EVENT事件不能唤醒TASK
分享到: 更多 (0)