我在STM32WB中的数据有问题,请给我任何解决方法的建议。
我通过 STM32WB(客户端)中的 BLE5 将数据发送到 STM32WB(服务器)。如果我只发送一个字节就可以了。但是我需要在循环中实时从 ADC 发送数据。
通过中断(按钮 -
CFG_TASK_SW1_BUTTON_PUSHED_ID
)我调用文件 p2p_server_app.c中的函数
P2PS_Send_Notification
void P2PS_APP_Init(void)
{
UTIL_SEQ_RegTask( 1<< CFG_TASK_SW1_BUTTON_PUSHED_ID, UTIL_SEQ_RFU, P2PS_Send_Notification );
return;
}
只是为了测试,我在循环中以下一个格式
4 5 5 5
发送数据(这里可以使用循环吗?),函数中的下一个代码P2PS_Send_Notification
:
void P2PS_Send_Notification(void)
{
int start_data = 4;
int local = 5;
while (1)
{
for (int i = 0; i<5; i++)
{
P2PS_STM_App_Update_Char(P2P_NOTIFY_CHAR_UUID, (uint8_t *) (&start_data));
for (int j = 0; j<3; j++)
{
P2PS_STM_App_Update_Char(P2P_NOTIFY_CHAR_UUID, (uint8_t *) (&local));
}
}
}
但是在服务器脚本中,我收到了
4 5 5 5 4 5 5 4 5 5 5 4 4 5 5 5
好像有什么东西打断了我的循环
已解决,服务端的 MCU 比客户端的 MCU 运行得更快