Hello @Surya
after long hours of searching and debugging I found the reason why I2C would fail. It starts to fail as soon as SSL is invoked. The SSL library uses an analog GPIO as input for its random seed. And in your code you used GPIO2 which is one of M5AtomS3 Groove GPIOs.
So to get rid of the I2C error try changing the GPIO used for random seed to GPIO10.
//SSLClient ethClientSSL(ethClient, TAs, (size_t)TAs_NUM, 2);
SSLClient ethClientSSL(ethClient, TAs, (size_t)TAs_NUM, GPIO_NUM_10);
Thanks
Felix