WICED CODE 1006 wiced_join_ap_specfic

Getting the following logs. Takes about 40 seconds to join a Wifi Network on a P1. Is there something that blocks this to cause this?

Serial connection closed. Attempting to reconnect...
Serial monitor opened successfully:
0000004788 [hal.wlan] ERROR: wiced_join_ap_specific(), result: 1006
0000004788 [hal.wlan] INFO: Joining Divs hotspot
0000004788 [hal.wlan] TRACE: Free RAM connect: 46416
0000008044 [hal.wlan] ERROR: wiced_join_ap_specific(), result: 1006
0000008044 [hal.wlan] INFO: Joining Divs hotspot
0000008044 [hal.wlan] TRACE: Free RAM connect: 46416
0000011301 [hal.wlan] ERROR: wiced_join_ap_specific(), result: 1006
0000011447 [hal.wlan] INFO: Joining Divs hotspot
0000011447 [hal.wlan] TRACE: Free RAM connect: 46416
0000014705 [hal.wlan] ERROR: wiced_join_ap_specific(), result: 1006
0000014705 [hal.wlan] INFO: Joining Divs hotspot
0000014705 [hal.wlan] TRACE: Free RAM connect: 46416
0000017964 [hal.wlan] ERROR: wiced_join_ap_specific(), result: 1006
0000017964 [hal.wlan] INFO: Joining Divs hotspot
0000017964 [hal.wlan] TRACE: Free RAM connect: 46416
0000021219 [hal.wlan] ERROR: wiced_join_ap_specific(), result: 1006
0000021365 [hal.wlan] INFO: Joining Divs hotspot
0000021365 [hal.wlan] TRACE: Free RAM connect: 46416
0000024629 [hal.wlan] ERROR: wiced_join_ap_specific(), result: 1006
0000024629 [hal.wlan] INFO: Joining Divs hotspot
0000024629 [hal.wlan] TRACE: Free RAM connect: 46416
0000027886 [hal.wlan] ERROR: wiced_join_ap_specific(), result: 1006
0000027886 [hal.wlan] INFO: Joining Divs hotspot
0000027886 [hal.wlan] TRACE: Free RAM connect: 46416
0000031146 [hal.wlan] ERROR: wiced_join_ap_specific(), result: 1006
0000031292 [hal.wlan] INFO: Joining Divs hotspot
0000031292 [hal.wlan] TRACE: Free RAM connect: 46416
0000034547 [hal.wlan] ERROR: wiced_join_ap_specific(), result: 1006
0000034547 [hal.wlan] INFO: Joining Divs hotspot
0000034547 [hal.wlan] TRACE: Free RAM connect: 46416
0000037560 [hal.wlan] INFO: Bringing WiFi interface up with DHCP

Here is my code:

#include <math.h>;
#include <vector>;
#include "OneButton.h"
#include "Particle.h"
#include "SPI_tft.h"
#include "application.h"
#include "graphics.h"
#include "photon-thermistor.h"
#include "pid.h"

#define TFT_DC P1S4
#define TFT_CS P1S5

SYSTEM_THREAD(ENABLED);
SYSTEM_MODE(SEMI_AUTOMATIC);

SerialLogHandler logHandler(Serial, LOG_LEVEL_TRACE);
unsigned long time1;
unsigned long time2;
bool timeChecked = true;
SPI_tft tft = SPI_tft(TFT_CS, TFT_DC, 0);

void setup() {
  tft.begin();
  tft.setRotation(2);
  tft.clear(BLACK);
  tft.setTextColor(WHITE, BLACK);
  time1 = millis();
  Particle.connect();
}

void loop() {
  if (Particle.connected() && timeChecked) {
    time2 = millis();
    Serial.println(time2 - time1);
    timeChecked = false;
  }
}

Which Device OS are you using?

  • ERROR_WWD_AUTHENTICATION_FAILED (1006)
    You will get this error if authentication failed trying to connect to the AP

Have you got an antenna attached and could you try with it switched to use the external antenna.

IMHO - only using Particle.connect() with SEMI_AUTOMATIC is not a good idea. Better to check that there are credentials stored then WiFi.connect() wait with timeout, test for WiFi.ready or local IP address not zeros (assuming DHCP) then call Particle.connect() once when WiFi connected. This better handles the failures that can occur.