Mbedtls_ssl_handshake return error -0x2700

Hi @KennethSong
There are several reasons for certificate verification to fail.
Invalid certificate being one of them.

  • Have you set the correct trusted root CA certificate?
  • Is the server hostname same as the certificate CN in subject name \ subject alternative name ?

You should check what the verification flags are to determine the reasons, by calling mbedtls_ssl_get_verify_result()

P.S. I also tried to enable the error log by adding MBEDTLS_DEBUG_C and set Debug_Level to 4, but i can not get the log through serial. Do anyone know why?

Have you set correct debug function in mbedtls_ssl_conf_dbg() ?
regards,
Mbed TLS Team member
Ron