Error occurs when converting ECDH key value to PEM format

hello
I succeeded in creating the ecdh public key value through mbedtls.

When checking the data below with HEX dump, the example data is as follows.

04 b3 62 ff b5 d5 1e d0 04 6c 4d 57 02 87 06 13
87 51 e2 50 ad cc 7e 95 4a e8 36 26 3b a0 56 7e
ef 3c b7 67 77 18 3f 91 e7 da b2 ce a9 fb 4b 5f
04 ec ba 2b b3 d6 0f 79 f6 d2 f0 50 29 78 da f6
ad

I want to convert this data into pem key form as shown below. At this time, I want to include ASN.1 data in the packet,
When I print the log as below, I get an error.

E (4644) TEST_GATT: Public key Write Err : -14720
E (4654) TEST_GATT: Public key Write Setup Err : PK - Unavailable feature, e.g. RSA disabled for RSA key

Here’s the code.

int app_mbedtls_send_data_encrypt(uint8_t *device_pubkey)
{
    mbedtls_pk_context pk_ctx;
    mbedtls_pk_init(&pk_ctx);
    mbedtls_ecp_keypair ecp_keypair;
    mbedtls_pk_ec(pk_ctx);
    uint8_t out_buf[256];
    int err;
    char error_message[256] = {0};
   
    err = mbedtls_pk_setup(&pk_ctx, mbedtls_pk_info_from_type(MBEDTLS_PK_ECKEY));
    if(err != 0)
    {
        ESP_LOGE(TAG, "Public key Setup Err : %d", err);
        mbedtls_strerror(err,(char *) error_message, sizeof(error_message));
        ESP_LOGE(TAG, "Public key Setup Err : %s", device_pubkey);
        mbedtls_pk_free(&pk_ctx);
        return APP_FAIL;
    }


    ESP_LOGI(TAG, "Debug1" );
    err = mbedtls_pk_write_pubkey_pem(&pk_ctx, device_pubkey, SIZE_ECDH_PUB_KEY);
    if(err < 0)
    {
        ESP_LOGE(TAG, "Public key Write Err : %d", err);
        mbedtls_strerror(err,(char *) error_message, sizeof(error_message));
        ESP_LOGE(TAG, "Public key Write Setup Err : %s", error_message);
        mbedtls_pk_free(&pk_ctx);
        return APP_FAIL;
    }
    ESP_LOG_BUFFER_HEXDUMP(TAG, device_pubkey, SIZE_ECDH_PUB_KEY, ESP_LOG_WARN);

    // err =  mbedtls_pk_write_pubkey_pem(&pk_ctx, device_pubkey, SIZE_ECDH_PUB_KEY);
    // if(err != 0)
    // {
    //     ESP_LOGE(TAG, "Public key Pem Write Err : %d", err);
    //     mbedtls_pk_free(&pk_ctx);
    //     return APP_FAIL;
    // }
    

    mbedtls_pk_free(&pk_ctx);
    return APP_SUCCESS;
}