各位大神:
请问有跑过rfEasylink例程吗? 我在修改为625bps rate的时候数据接收不到,请问是怎么回事?
当然发送程序也改成了625bps 速率,另外都是868频率发送。
Eggsy Pang:
可以把你在rfEasylink例程中修改的部分贴出来吗?
Levi:
回复 Eggsy Pang:
就下面两个地方,一个配置为625,另一个收的timeout改为500ms了,也试过改为1s,还是不行。
另外我把tx的修改的也贴出来吧:
这就是全部;tx没问题看到发送完成对应的灯闪烁了。
Eggsy Pang:
回复 Levi:
下载我们的GUI调试软件,SmartRF Studio 7,接上接收方,看看有没有收到。
Levi:
回复 Eggsy Pang:
刚测试了 没有收到数据;但是在另一个开发板上烧的rfPaketErrorRate的程序中配置成LRM模式能收到rfEasyLinkTx发送的数据。
Eggsy Pang:
回复 Levi:
可能是SmartRF Studio 7没有设置好,不过根据你说rfPaketErrorRate的程序可以接到到,证明空中有数据,rfPaketErrorRate接收方程序,是让CC1310一直出于接收情况,而rfEasyLinkRx程序,是间隔接收,你把rfEasyLinkTx例程改一下,让CC1310一直发送,试下能不能接收
Levi:
回复 Eggsy Pang:
不行啊,rx就是收不到,就算用rfPaketErrorRate发送也收不到;是不是EasyLink的接收程序有问题啊?
Eggsy Pang:
回复 Levi:
把接收的程序用文字发上来,非图片,就把main函数所在的文件的内容贴上来就行,我测试下
Levi:
回复 Eggsy Pang:
/* * Copyright (c) 2015-2016, Texas Instruments Incorporated * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of Texas Instruments Incorporated nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */
/* * ======== rfEasyLinkTx.c ======== *//* XDCtools Header files */#include <xdc/std.h>#include <xdc/runtime/System.h>#include <xdc/runtime/Error.h>
/* BIOS Header files */#include <ti/sysbios/BIOS.h>#include <ti/sysbios/knl/Task.h>#include <ti/sysbios/knl/Semaphore.h>#include <ti/sysbios/knl/Clock.h>
/* TI-RTOS Header files */#include <ti/drivers/PIN.h>
/* Board Header files */#include "Board.h"
/* EasyLink API Header files */#include "easylink/EasyLink.h"
/***** Defines *****/
/* Undefine to remove address filter and async mode */#define RFEASYLINKRX_ASYNC#define RFEASYLINKRX_ADDR_FILTER
#define RFEASYLINKEX_TASK_STACK_SIZE 1024#define RFEASYLINKEX_TASK_PRIORITY 2
/* Pin driver handle */static PIN_Handle ledPinHandle;static PIN_State ledPinState;
/* * Application LED pin configuration table: * – All LEDs board LEDs are off. */PIN_Config pinTable[] = { Board_LED1 | PIN_GPIO_OUTPUT_EN | PIN_GPIO_LOW | PIN_PUSHPULL | PIN_DRVSTR_MAX, Board_LED2 | PIN_GPIO_OUTPUT_EN | PIN_GPIO_LOW | PIN_PUSHPULL | PIN_DRVSTR_MAX, PIN_TERMINATE};
/***** Variable declarations *****/static Task_Params rxTaskParams;Task_Struct rxTask; /* not static so you can see in ROV */static uint8_t rxTaskStack[RFEASYLINKEX_TASK_STACK_SIZE];
/* The RX Output struct contains statistics about the RX operation of the radio */PIN_Handle pinHandle;
#ifdef RFEASYLINKRX_ASYNCstatic Semaphore_Handle rxDoneSem;#endif
/***** Function definitions *****/#ifdef RFEASYLINKRX_ASYNCvoid rxDoneCb(EasyLink_RxPacket * rxPacket, EasyLink_Status status){ if (status == EasyLink_Status_Success) { /* Toggle LED2 to indicate RX */ PIN_setOutputValue(pinHandle, Board_LED2,!PIN_getOutputValue(Board_LED2)); } else if(status == EasyLink_Status_Aborted) { /* Toggle LED1 to indicate command aborted */ //PIN_setOutputValue(pinHandle, Board_LED1,!PIN_getOutputValue(Board_LED1)); } else { /* Toggle LED1 and LED2 to indicate error */ PIN_setOutputValue(pinHandle, Board_LED1,!PIN_getOutputValue(Board_LED1)); PIN_setOutputValue(pinHandle, Board_LED2,!PIN_getOutputValue(Board_LED2)); }
Semaphore_post(rxDoneSem);}#endif
static void rfEasyLinkRxFnx(UArg arg0, UArg arg1){#ifndef RFEASYLINKRX_ASYNC EasyLink_RxPacket rxPacket = {0};#endif
#ifdef RFEASYLINKRX_ASYNC /* Create a semaphore for Async*/ Semaphore_Params params; Error_Block eb;
/* Init params */ Semaphore_Params_init(¶ms); Error_init(&eb);
/* Create semaphore instance */ rxDoneSem = Semaphore_create(0, ¶ms, &eb);#endif //RFEASYLINKRX_ASYNC
EasyLink_init(EasyLink_Phy_625bpsLrm);
/* If you wich to use a frequency other than the default use * the below API * EasyLink_setFrequency(868000000); */
#ifdef RFEASYLINKRX_ADDR_FILTER uint8_t addrFilter = 0xaa; EasyLink_enableRxAddrFilter(&addrFilter, 1, 1);#endif //RFEASYLINKRX_ADDR_FILTER
while(1) {#ifdef RFEASYLINKRX_ASYNC EasyLink_receiveAsync(rxDoneCb, 0);
/* Wait 500ms for Rx */ if(Semaphore_pend(rxDoneSem, (500000 / Clock_tickPeriod)) == FALSE) { /* RX timed out abort */ if(EasyLink_abort() == EasyLink_Status_Success) { /* Wait for the abort */ Semaphore_pend(rxDoneSem, BIOS_WAIT_FOREVER); } }#else rxPacket.absTime = 0; EasyLink_Status result = EasyLink_receive(&rxPacket);
if (result == EasyLink_Status_Success) { /* Toggle LED2 to indicate RX */ PIN_setOutputValue(pinHandle, Board_LED2,!PIN_getOutputValue(Board_LED2)); } else { /* Toggle LED1 and LED2 to indicate error */ PIN_setOutputValue(pinHandle, Board_LED1,!PIN_getOutputValue(Board_LED1)); PIN_setOutputValue(pinHandle, Board_LED2,!PIN_getOutputValue(Board_LED2)); }#endif //RX_ASYNC }}
void rxTask_init(PIN_Handle ledPinHandle) { pinHandle = ledPinHandle;
Task_Params_init(&rxTaskParams); rxTaskParams.stackSize = RFEASYLINKEX_TASK_STACK_SIZE; rxTaskParams.priority = RFEASYLINKEX_TASK_PRIORITY; rxTaskParams.stack = &rxTaskStack; rxTaskParams.arg0 = (UInt)1000000;
Task_construct(&rxTask, rfEasyLinkRxFnx, &rxTaskParams, NULL);}
/* * ======== main ======== */int main(void){ /* Call board init functions. */ Board_initGeneral();
/* Open LED pins */ ledPinHandle = PIN_open(&ledPinState, pinTable); if(!ledPinHandle) { System_abort("Error initializing board LED pins\n"); }
/* Clear LED pins */ PIN_setOutputValue(ledPinHandle, Board_LED1, 0); PIN_setOutputValue(ledPinHandle, Board_LED2, 0);
rxTask_init(ledPinHandle);
/* Start BIOS */ BIOS_start();
return (0);}
Eggsy Pang:
回复 Levi:
我这边是可以的,下面是1s的接收程序
/* XDCtools Header files */#include <xdc/std.h>#include <xdc/runtime/System.h>#include <xdc/runtime/Error.h>
/* BIOS Header files */#include <ti/sysbios/BIOS.h>#include <ti/sysbios/knl/Task.h>#include <ti/sysbios/knl/Semaphore.h>#include <ti/sysbios/knl/Clock.h>
/* TI-RTOS Header files */#include <ti/drivers/PIN.h>
/* Board Header files */#include "Board.h"
/* EasyLink API Header files */#include "easylink/EasyLink.h"
/***** Defines *****/
/* Undefine to remove address filter and async mode */#define RFEASYLINKRX_ASYNC#define RFEASYLINKRX_ADDR_FILTER
#define RFEASYLINKEX_TASK_STACK_SIZE 1024#define RFEASYLINKEX_TASK_PRIORITY 2
/* Pin driver handle */static PIN_Handle ledPinHandle;static PIN_State ledPinState;
/* * Application LED pin configuration table: * – All LEDs board LEDs are off. */PIN_Config pinTable[] = { Board_LED1 | PIN_GPIO_OUTPUT_EN | PIN_GPIO_LOW | PIN_PUSHPULL | PIN_DRVSTR_MAX, Board_LED2 | PIN_GPIO_OUTPUT_EN | PIN_GPIO_LOW | PIN_PUSHPULL | PIN_DRVSTR_MAX, PIN_TERMINATE};
/***** Variable declarations *****/static Task_Params rxTaskParams;Task_Struct rxTask; /* not static so you can see in ROV */static uint8_t rxTaskStack[RFEASYLINKEX_TASK_STACK_SIZE];
/* The RX Output struct contains statistics about the RX operation of the radio */PIN_Handle pinHandle;
#ifdef RFEASYLINKRX_ASYNCstatic Semaphore_Handle rxDoneSem;#endif
/***** Function definitions *****/#ifdef RFEASYLINKRX_ASYNCvoid rxDoneCb(EasyLink_RxPacket * rxPacket, EasyLink_Status status){ if (status == EasyLink_Status_Success) { /* Toggle LED2 to indicate RX */ PIN_setOutputValue(pinHandle, Board_LED2,!PIN_getOutputValue(Board_LED2)); } else if(status == EasyLink_Status_Aborted) { /* Toggle LED1 to indicate command aborted */ PIN_setOutputValue(pinHandle, Board_LED1,!PIN_getOutputValue(Board_LED1)); } else { /* Toggle LED1 and LED2 to indicate error */ PIN_setOutputValue(pinHandle, Board_LED1,!PIN_getOutputValue(Board_LED1)); PIN_setOutputValue(pinHandle, Board_LED2,!PIN_getOutputValue(Board_LED2)); }
Semaphore_post(rxDoneSem);}#endif
static void rfEasyLinkRxFnx(UArg arg0, UArg arg1){#ifndef RFEASYLINKRX_ASYNC EasyLink_RxPacket rxPacket = {0};#endif
#ifdef RFEASYLINKRX_ASYNC /* Create a semaphore for Async*/ Semaphore_Params params; Error_Block eb;
/* Init params */ Semaphore_Params_init(¶ms); Error_init(&eb);
/* Create semaphore instance */ rxDoneSem = Semaphore_create(0, ¶ms, &eb);#endif //RFEASYLINKRX_ASYNC
EasyLink_init(EasyLink_Phy_625bpsLrm); EasyLink_setFrequency(868000000);
#ifdef RFEASYLINKRX_ADDR_FILTER uint8_t addrFilter = 0xaa; EasyLink_enableRxAddrFilter(&addrFilter, 1, 1);#endif //RFEASYLINKRX_ADDR_FILTER
while(1) {#ifdef RFEASYLINKRX_ASYNC EasyLink_receiveAsync(rxDoneCb, 0);
/* Wait 300ms for Rx */ if(Semaphore_pend(rxDoneSem, (1000000 / Clock_tickPeriod)) == FALSE) { /* RX timed out abort */ if(EasyLink_abort() == EasyLink_Status_Success) { /* Wait for the abort */ Semaphore_pend(rxDoneSem, BIOS_WAIT_FOREVER); } }#else rxPacket.absTime = 0; EasyLink_Status result = EasyLink_receive(&rxPacket);
if (result == EasyLink_Status_Success) { /* Toggle LED2 to indicate RX */ PIN_setOutputValue(pinHandle, Board_LED2,!PIN_getOutputValue(Board_LED2)); } else { /* Toggle LED1 and LED2 to indicate error */ PIN_setOutputValue(pinHandle, Board_LED1,!PIN_getOutputValue(Board_LED1)); PIN_setOutputValue(pinHandle, Board_LED2,!PIN_getOutputValue(Board_LED2)); }#endif //RX_ASYNC }}
void rxTask_init(PIN_Handle ledPinHandle) { pinHandle = ledPinHandle;
Task_Params_init(&rxTaskParams); rxTaskParams.stackSize = RFEASYLINKEX_TASK_STACK_SIZE; rxTaskParams.priority = RFEASYLINKEX_TASK_PRIORITY; rxTaskParams.stack = &rxTaskStack; rxTaskParams.arg0 = (UInt)1000000;
Task_construct(&rxTask, rfEasyLinkRxFnx, &rxTaskParams, NULL);}
/* * ======== main ======== */int main(void){ /* Call board init functions. */ Board_initGeneral();
/* Open LED pins */ ledPinHandle = PIN_open(&ledPinState, pinTable); if(!ledPinHandle) { System_abort("Error initializing board LED pins\n"); }
/* Clear LED pins */ PIN_setOutputValue(ledPinHandle, Board_LED1, 0); PIN_setOutputValue(ledPinHandle, Board_LED2, 0);
rxTask_init(ledPinHandle);
/* Start BIOS */ BIOS_start();
return (0);}
Eggsy Pang:
回复 Levi:
发送方我用的是smart RF radio 7,如图配置步骤: