Try changing your phone's keyboard or keyboard theme. Sometimes the characters being typed appear to be correct, but somehow the wifi sees it as a typo, thus the error.
The same thing happened to me just yesterday. Try changing the keyboard or theme of keyboard on your phone. For some reason the wifi may not be recognizing the passcode your typing and thinks its wrong. Thus the failure code. It worked for me.