AnsweredAssumed Answered

SPWF01SA11: SSL/TLS Error: Unable to connect (-1)

Question asked by Fede Rico on Apr 26, 2018

Hi there,


I'm working on an STM32F103 connected via USART to a WiFi Module SPWF01SA11.


The communication between MCU and WiFi module works well:

  • I can connect to WiFi network,
  • I can obtain the NTP time via TCP socket.


When I try to open a secure TLS socket with AWS I get the error: SSL/TLS Error: Unable to connect (-1).


I load the certitifcates (rootCa, Client Certificate and Client Private key) into the WiFi module and I receive back "OK" for each certificate, also for the time and domain.


I load the certificate with this function:

  TLS_Certificate caCert;
  TLS_Certificate tlsCert;
  TLS_Certificate certKey;
  TLS_Certificate domainClient;
  caCert.certificate            = caCertificate;
  caCert.certificate_size       = strlen((const char *)caCertificate) - 1;
  tlsCert.certificate           = tlsCertificate;
  tlsCert.certificate_size      = strlen((const char *)tlsCertificate) - 1;
  certKey.certificate           = certificateKey;
  certKey.certificate_size      = strlen((const char *)certificateKey) - 1;
  domainClient.certificate      = clientDomain;
  domainClient.certificate_size = strlen((const char *)clientDomain) - 1;

  wifi_set_socket_certificates(caCert, tlsCert, certKey, domainClient, unixTime)


Each certificare is a uint8_t pointer.


I used the AWS endpoint ad client domain. It this right?


I use this function to open the TLS socket:

wifiStatus = wifi_socket_client_open((uint8_t *)hostname, 
                                     (uint8_t *)socketType,



In detail, what does "SSL/TLS Error: Unable to connect (-1)" means? Is there a list of the meaning of each error?


Thanks for the help!