各位大佬,我在使用PB-03F实现STM32L4单片机与电脑上基于QT6.9编写的程序通讯,实测通讯功能正常,但是总会出现经过10-20秒蓝牙自动断连的问题;另外必须使用PB-03F自带的UUID进行连接,因此手机蓝牙和电脑蓝牙都连不上PB-03F,是不是需要修改它的UUID呢?STM32驱动配置PB-03F的代码如下,我是小白,还不会烧录固件,如果有必要烧录固件我会再买个学习。跪求给我大佬指点
/* 蓝牙初始化流程 ------------------------------------------------------*/
void Bluetooth_Init(void)
{
// printf("Initing!\r\n");
// 1. 测试AT指令
if (!BT_SendCommand("AT", "OK", 1000))
{
printf("BT not responding!\r\n");
return;
}
// 2. 关闭回显(避免接收冗余信息)
if (!BT_SendCommand("ATE0", "OK", 1000))
{
printf("no ATE!\r\n");
return;
}
// 3. 设置工作模式(0=主机模式,1=从机模式)
if (!BT_SendCommand("AT+BLEMODE=0", "OK", 1000))
{
printf("no transparent!\r\n");
return;
}
// 4. 设备重启
BT_SendCommand("AT+RST", "NULL", 1000);
// 5. 设置蓝牙名称(最多16字符)
if (!BT_SendCommand("AT+BLENAME=Stmr_RRN", "OK", 1000))
{
printf("no name!\r\n");
return;
}
// 6. 设置配对码(4位数字)
if (!BT_SendCommand("AT+BLEAUTH=456789", "OK", 1000))
{
printf("no pswd!\r\n");
return;
}
BT_SendCommand("AT+RST", "NULL", 1000);
//printf("Configuration complete!\r\n");
}