SSLClient icon indicating copy to clipboard operation
SSLClient copied to clipboard

Please, help me to fix (m_update_engine): Error writing to m_client

Open CNSNGopenSourceProjects opened this issue 2 years ago • 2 comments

I am trying to use the EthernetAWSIoT.ino on RP2040, but I've never connect to AWS cloud due to the Error writing to m_client. The displayed messages are: 12:28:44.197 -> Initialize Ethernet with DHCP: 12:28:46.094 -> My IP address: 192.168.15.13 12:28:46.094 -> Attempting MQTT connection...(SSLClient)(SSL_ERROR)(m_update_engine): Error writing to m_client 12:28:46.177 -> (SSLClient)(SSL_ERROR)(m_update_engine): 1 12:28:46.177 -> (SSLClient)(SSL_ERROR)(connected): Not connected because write error is set 12:28:46.177 -> (SSLClient)(SSL_ERROR)(m_print_ssl_error): SSL_CLIENT_WRITE_FAIL 12:28:46.213 -> (SSLClient)(SSL_WARN)(m_run_until): Terminating with write error: 12:28:46.213 -> (SSLClient)(SSL_WARN)(m_run_until): 4 12:28:46.213 -> (SSLClient)(SSL_ERROR)(m_start_ssl): Failed to initlalize the SSL layer 12:28:46.213 -> (SSLClient)(SSL_ERROR)(m_print_br_error): Unknown error code: 0 12:28:46.213 -> failed, rc=-2 try again in 5 seconds 12:28:51.179 -> (SSLClient)(SSL_ERROR)(connected): Not connected because write error is set 12:28:51.213 -> (SSLClient)(SSL_ERROR)(m_print_ssl_error): SSL_CLIENT_WRITE_FAIL 12:28:51.213 -> Attempting MQTT connection...(SSLClient)(SSL_ERROR)(connected): Not connected because write error is set 12:28:51.213 -> (SSLClient)(SSL_ERROR)(m_print_ssl_error): SSL_CLIENT_WRITE_FAIL 12:28:51.213 -> (SSLClient)(SSL_ERROR)(connected): Not connected because write error is set 12:28:51.213 -> (SSLClient)(SSL_ERROR)(m_print_ssl_error): SSL_CLIENT_WRITE_FAIL 12:28:51.287 -> (SSLClient)(SSL_ERROR)(m_update_engine): Error writing to m_client 12:28:51.287 -> (SSLClient)(SSL_ERROR)(m_update_engine): 1 12:28:51.287 -> (SSLClient)(SSL_ERROR)(connected): Not connected because write error is set 12:28:51.287 -> (SSLClient)(SSL_ERROR)(m_print_ssl_error): SSL_CLIENT_WRITE_FAIL 12:28:51.287 -> (SSLClient)(SSL_WARN)(m_run_until): Terminating with write error: 12:28:51.287 -> (SSLClient)(SSL_WARN)(m_run_until): 4 12:28:51.287 -> (SSLClient)(SSL_ERROR)(m_start_ssl): Failed to initlalize the SSL layer 12:28:51.287 -> (SSLClient)(SSL_ERROR)(m_print_br_error): Unknown error code: 0 12:28:51.287 -> failed, rc=-2 try again in 5 seconds

I did few small changes only:

  1. Replace the includes for <SPI.h> and <EthernetLarge.h> by the "defines.h" from EtherneticGenerics.
  2. Add the contents of the PEM files of device certificates and private key. I known it is working since I tested using ESP32+WifiClientSecure.
  3. Change the subscription to do not use shadow (I am not so sure how to use it yet).

I hope you can help me.

Best regards,

Fernando

CNSNGopenSourceProjects avatar Feb 01 '23 15:02 CNSNGopenSourceProjects

I am using W5500 Ethernet shield.

CNSNGopenSourceProjects avatar Feb 01 '23 16:02 CNSNGopenSourceProjects

I used the same code with ESP32 and it works fine. The only change I had to do was replace the EthernetGenerics by Ethernet. It means the problem is related to RP2040. :(

CNSNGopenSourceProjects avatar Feb 02 '23 20:02 CNSNGopenSourceProjects