2024-03-07 06:01 PM
Dear Technical team,
We are developing an IoT product using STM32H750.
The application starts a task cycle to publish customer information to the cloud platform by MQTT Publish API.
At the same time, we make a ping tests to target board from the PC host,
but found that there is a probability of a hardfault problem occurring.
if stop the ping test, there are not the issues.
I would like to know if there are any things to pay attention to when using the mqtt interface to send data?
Thanks,
Martin.Xu
2024-03-13 11:55 PM
Hello all,
Could you provide us any update on this issues?
By the way, I found if stop the ping , I still see the issues.
let me share the test code:
int mqtt_send_message(char *msg,int len)
{
char tx_topic[512];
memset(tx_topic,0,sizeof(tx_topic));
if(mqtt_connection_status != MQTT_CONNECT_ACCEPTED)
{
return -1;
}
if(len > 512)
{
printf("Invalid Message Length\n\r");
return -1;
}
sprintf(tx_topic,"/EC4000/tx_topic/D002%08X%08X%08X",HAL_GetUIDw0(),HAL_GetUIDw1(),HAL_GetUIDw2());
mqtt_publish(mqtt_client, tx_topic,msg,len,0,0,mqtt_request_cb,NULL);
}
void MqttClondLoopTask(void *argument)
{
unsigned char mqtt_tx_msg[64];
osDelay(5000);
while (1)
{
osDelay(5000);
if(PollMqttConnect() == 0)
{
memset(mqtt_tx_msg,0,sizeof(mqtt_tx_msg));
sprintf(mqtt_tx_msg,"EC4000 Inner Temperture:%2.1f\n\r",DRV_GetIndoorTemp());
mqtt_send_message(mqtt_tx_msg,strlen(mqtt_tx_msg));
}
}