I am not sure about the platform you are using. There are other simple snip applications using which you can try to see if it is a problem only with this snip.
scan - to see if it is seeing networks around
https_client - Is a simple https_client , but it joins the wifi before connecitng over https.
Looks like from you logs you are using 2.4 is both tries. It's not clear what you mean by
"Initially WIFI module is working fine with this code. But now when WIFI module is connected to the router it is showing failed to join"
1) What you showing could happen if you don't have the password set correctly or if you don't have antenna hooked up and you are far away from your router.
2) It also could happens if you are using a USB cable that doesn't supply enough power.
Iam using WICED SDK 2.4.0.What i meant to say was ,I have flashed this UART Setup and UART Messages Over Webpage in the wifi module few weeks back it was working fine.But for the past two days Iam facing this problem... I have tried snip-tcp client example also .But It is showing failed to join Smartx.... SSID and password are set correctly... Router is near to the wifi module...Iam using DC supply to power the wifi module.....I tried changing the board and i flashed UART Setup and UART Messages Over Webpage code in the new board and it is working fine...