开发者社区> 问答> 正文

stm32+freeRTOS+esp8266+mqtt连接云失败

stm32+freeRTOS+esp8266+mqtt连接阿里云时,握手失败,串口打印 Performing the SSL/TLS handshake... [inf] _TLSConnectNetwork(353): failed ! mbedtls_ssl_handshake returned -0x4290

通过调整工程的heap和stack,解决了上述问题 但是又遇到了新的问题 设备端接收不到iot平台的数据,接收超时,导致连接又断开了,串口数据如下: packet-id=5, publish topic msg={ "method":"thing.event.property.post", "id":"123","params":{"temperature":0.00,"temperatureThreshold": 0},"version":"1.0.0"} ********publish success, packet-id=1 ********

********publish success, packet-id=2 ********

********publish success, packet-id=3 ********

***********topic subscribe success

接收超时mbedtls_net_recv_timeout 170: net_recv_timeout: receive data fail - 1 [inf] _network_ssl_read(442): ssl recv error: code = -76 [1;31m[err] IOT_MQTT_Yield(3215): error occur rc=-14 [0m[1;31m[err] iotx_mc_keepalive(2598): network is disconnected! [0mMQTT disconnect.mbedtls_net_send 127: net_send: send data fail - 1 [inf] _network_ssl_disconnect(515): ssl_disconnect [1;31m[err] IOT_MQTT_Yield(3215): error occur rc=-27 [0m[1;33m[inf] iotx_mc_handle_reconnect(2767): Waiting to reconnect... [0m[1;31m[err] IOT_MQTT_Yield(3215): error occur rc=-27 [0m[1;33m[inf] iotx_mc_handle_reconnect(2767): Waiting to reconnect... [0m[1;31m[err] IOT_MQTT_Yield(3215): error occur rc=-27 [0m[1;33m[inf] iotx_mc_handle_reconnect(2767): Waiting to reconnect... [0m[1;31m[err] IOT_MQTT_Yield(3215): error occur rc=-27 [0m[1;33m[inf] iotx_mc_handle_reconnect(2767): Waiting to reconnect... [0m[1;31m[err] IOT_MQTT_Yield(3215): error occur rc=-27 [0m[1;33m[inf] iotx_mc_handle_reconnect(2767): Waiting to reconnect... [0m[1;31m[err] IOT_MQTT_Yield(3215): error occur rc=-27 [0m[1;33m[inf] iotx_mc_handle_reconnect(2767): Waiting to reconnect... [0m[1;31m[err] IOT_MQTT_Yield(3215): error occur rc=-27 [0m[1;33m[inf] iotx_mc_handle_reconnect(2767): Waiting to reconnect... [0m[1;31m[err] iotx_mc_publish(2061): mqtt client state is error,state = 4 [0merror occur when publish sensor dataPush the User button (Blue) within the next 5 seconds if you want to update the device security parameters or credentials.

[1;33m[inf] guider_print_dev_guider_info(320): .................................................... [0m[1;33m[inf] guider_print_dev_guider_info(321): ProductKey : a1xmvaHbJQg [0m[1;33m[inf] guider_print_dev_guider_info(322): DeviceName : smartDevice01 [0m[1;33m[inf] guider_print_dev_guider_info(323): DeviceID : a1xmvaHbJQg.smartDevice01 [0m[1;33m[inf] guider_print_dev_guider_info(327): .................................................... [0m[1;33m[inf] guider_print_dev_guider_info(328): PartnerID Buf : ,partner_id=example.demo.partner-id [0m[1;33m[inf] guider_print_dev_guider_info(329): ModuleID Buf : ,module_id=example.demo.module-id [0m[1;33m[inf] guider_print_dev_guider_info(330): Guider URL : [0m[1;33m[inf] guider_print_dev_guider_info(332): Guider SecMode : 2 (TLS + Direct) [0m[1;33m[inf] guider_print_dev_guider_info(334): Guider Timestamp : 2524608000000 [0m[1;33m[inf] guider_print_dev_guider_info(338): .................................................... [0m[1;33m[inf] guider_print_conn_info(297): ----------------------------------------- [0m[1;33m[inf] guider_print_conn_info(298): Host : a1xmvaHbJQg.iot-as-mqtt.cn-shanghai.aliyuncs.com [0m[1;33m[inf] guider_print_conn_info(299): Port : 1883 [0m[1;33m[inf] guider_print_conn_info(304): ClientID : a1xmvaHbJQg.smartDevice01|securemode=2,timestamp=2524608000000,signmethod=hmacsha1,gw=0,ext=0,partner_id=example.demo.partner-id,module_id=example.demo.module-id| [0m[1;33m[inf] guider_print_conn_info(306): TLS PubKey : 801f3f0 ('-----BEGIN CERTI ...') [0m[1;33m[inf] guider_print_conn_info(309): ----------------------------------------- [0m[inf] HAL_SSL_Destroy(543): handle is NULL [1;33m[inf] iotx_mc_disconnect(2845): mqtt disconnect! [0m[1;33m[inf] iotx_mc_release(2938): mqtt release! [0m[1;33m[inf] iotx_mc_init(2336): MQTT init success! [0m[inf] _ssl_client_init(196): Loading the CA root certificate ... cert. version : 3 serial number : 04:00:00:00:00:01:15:4B:5A:C3:94 issuer name : C=BE, O=GlobalSign nv-sa, OU=Root CA, CN=GlobalSign Root CA subject name : C=BE, O=GlobalSign nv-sa, OU=Root CA, CN=GlobalSign Root CA issued on : 1998-09-01 12:00:00 expires on : 2028-01-28 12:00:00 signed using : RSA with SHA1 RSA key size : 2048 bits basic constraints : CA=true key usage : Key Cert Sign, CRL Sign [inf] _ssl_parse_crt(164): crt content:451 [inf] _ssl_client_init(204): ok (0 skipped) [inf] _TLSConnectNetwork(286): Connecting to /H嗺 /1883... mbedtls_net_connect 90: net_connect: open client fail - 1 [inf] _TLSConnectNetwork(295): failed ! net_connect returned -0x0044 [inf] _network_ssl_disconnect(515): ssl_disconnect [inf] HAL_SSL_Destroy(543): handle is NULL [1;31m[err] iotx_mc_connect(2692): TCP or TLS Connection failed [0m[inf] HAL_SSL_Destroy(543): handle is NULL [1;33m[inf] iotx_mc_disconnect(2845): mqtt disconnect! [0m[1;33m[inf] iotx_mc_release(2938): mqtt release! [0mMQTT construct failed mqtt example loop end!

展开
收起
游客h74ykpghcdjom 2019-12-04 16:30:06 3640 0
1 条回答
写回答
取消 提交回答
  • 你可以使用TCP 连接 MQTT 可以使用TCP和SSL 连接

    2020-02-25 01:09:07
    赞同 展开评论 打赏
问答排行榜
最热
最新

相关电子书

更多
RocketMQ Client-GO 介绍 立即下载
RocketMQ Prometheus Exporter 打造定制化 DevOps 平台 立即下载
基于 RocketMQ Prometheus Exporter 打造定制化 DevOps 平台 立即下载