nodemcu will not connect to network

I have played with bare ESP12E units without connection problems. I am not trying a nodemcu v1 unit. Using the example programs in the ESP8266 libarary I can scan the networks ok, but I cannot log the unit onto my network with the sample program or any program that runs on my bare ESP12E units.
I switched on debugging and the monitor continually repeats -
reconnect
f 0, scandone
state: 0 -> 2 (b0)
state: 2 -> 3 (0)
state: 3 -> 0 (1)
the WiFi.status() is always 6.
I can program the unit to do non-wifi things no problem, so it the processor works.
I spent some time looking on the net and found various bits about flash memory issues, but they involved
state:3 -> 5
not as above, and none of the suggested solutions worked.
Any ideas? Or do I just have a bad unit.
I switched on debugging and the monitor continually repeats -
reconnect
f 0, scandone
state: 0 -> 2 (b0)
state: 2 -> 3 (0)
state: 3 -> 0 (1)
the WiFi.status() is always 6.
I can program the unit to do non-wifi things no problem, so it the processor works.
I spent some time looking on the net and found various bits about flash memory issues, but they involved
state:3 -> 5
not as above, and none of the suggested solutions worked.
Any ideas? Or do I just have a bad unit.