Here's the sequence including messages to the second serial port (I'm using a 1284 chip with 2 uarts) - as you'll see - list of APs no problem - but won't connect despite passport being correct
Sending AT+CWMODE=1
AT+CWMODE=1
no change
Sending AT+CIPMODE=0
AT+CIPMODE=0
OK
Initiating with AT+RST
Sending AT+GMR restart
AT+GMR
00160901
OK
Sending AT+CWMODE? check mode
AT+CWMODE?
+CWMODE:1
OK
Sending AT+CWLAP
AT+CWLAP
Setting user and pass AT+CWJAP="Office","192168l974"
AT+CWJAP="Office","192168l974"
busy now ...
+CWLAP:(0,"",0)
+CWLAP:(1,"BTHomeHub-D48F",-91)
+CWLAP:(0,"BTWiFi",-87)
+CWLAP:(4,"loft-east",-49)
+CWLAP:(4,"SKY48870",-90)
+CWLAP:(4,"BTHub4-N9T3",-89)
+CWLAP:(3,"Office",-39)
+CWLAP:(4,"loft-west",-76)
+CWLAP:(4,"SKY533A0",-85)
OK
Sending AT+CWJAP?
AT+CWJAP?
+CWJAP:"Office"
OK
Sending AT+CIFSR - IP address?
AT+CIFSR
ERROR
Sending AT+CIFSR - IP address?
AT+CIFSR
ERROR