CC2541广播丢包问题
各位大神好,我在用CC2541测试广播数据的时候粗略估计丢包率有10%,大家是怎么解决的,跟连接参数什么的有关系吗?
我是在从机例程上修改的,参数如下:
#define SBP_PERIODIC_EVT_PERIOD 500
// What is the advertising interval when device is discoverable (units of 625us, 160=100ms)
#define DEFAULT_ADVERTISING_INTERVAL 80
// Limited discoverable mode advertises for 30.72s, and then stops
// General discoverable mode advertises indefinitely
#if defined ( CC2540_MINIDK )
#define DEFAULT_DISCOVERABLE_MODE GAP_ADTYPE_FLAGS_LIMITED
#else
#define DEFAULT_DISCOVERABLE_MODE GAP_ADTYPE_FLAGS_GENERAL //-----------------------------------普通模式
#endif // defined ( CC2540_MINIDK )
// Minimum connection interval (units of 1.25ms, 80=100ms) if automatic parameter update request is enabled
#define DEFAULT_DESIRED_MIN_CONN_INTERVAL 80
// Maximum connection interval (units of 1.25ms, 800=1000ms) if automatic parameter update request is enabled
#define DEFAULT_DESIRED_MAX_CONN_INTERVAL 100
// Slave latency to use if automatic parameter update request is enabled
#define DEFAULT_DESIRED_SLAVE_LATENCY 0
// Supervision timeout value (units of 10ms, 1000=10s) if automatic parameter update request is enabled
#define DEFAULT_DESIRED_CONN_TIMEOUT 200 //连接超时时间
// Whether to enable automatic parameter update request when a connection is formed
#define DEFAULT_ENABLE_UPDATE_REQUEST TRUE
// Connection Pause Peripheral time value (in seconds)
#define DEFAULT_CONN_PAUSE_PERIPHERAL 3
我定义了两个数组,都是15字节,在定时函数里连续发送,Data2的数据差不多每10次就丢一次包,Data1没有发现丢包,现在不知道怎么回事。
static void performPeriodicTask( void )
{ SimpleProfile_SetParameter( SIMPLEPROFILE_CHAR4,SIMPLEPROFILE_CHAR4_LEN, Data1);
SimpleProfile_SetParameter( SIMPLEPROFILE_CHAR4,SIMPLEPROFILE_CHAR4_LEN, Data2);
}
加大连接间隔试试呢
用BTOOL测试没有问题,看来是串口程序有问题