Mbedtls and RSA problem

I’ve mbedtls nonRTOS server device. I’m trying to communicate with PLC Client. But before the using PLC, I’m trying to use python tls client.

I’ve a problem with when I use below cert and key file with below method:

    Generate 2048-bit RSA private key:
    
    openssl genrsa -out key.pem 2048
    
    Generate a Certificate Signing Request:
    
    openssl req -new -sha256 -key key.pem -out csr.csr
    
    Generate a self-signed x509 certificate suitable for use on web servers.
    
    openssl req -x509 -sha256 -days 365 -key key.pem -in csr.csr -out certificate.pem
    
    Create SSL identity file in PKCS12 as mentioned here
    
    openssl pkcs12 -export -out client-identity.p12 -inkey key.pem -in certificate.pem

I get above code from here: openssl - Creating a .p12 file - Stack Overflow

I need to p12 file using in PLC Client. When I trying to use certificate.pem and key.pem in mbedtls-servers system and when I use the certificate.pem in python client side, I get below situation:
enter image description here

Server couldnt send key exchange message waiting forever.

But If I generate the key and cert file below method:

openssl req -new -x509 -days 365 -nodes -out cert.pem -keyout key.pem

They communicate successfuly.

How can I solve the problem why the server waiting to send key exchange message when I generate key and cert file with first method