W600 AP-sta example upload error

Hi again,

I’m playing with the Wio Lite W600 and trying to get the following AP-sta example to upload (board selected as WIO W600 or Generic W600 board):

#include <Arduino.h>
#include <W600WiFi.h>
#include <Dns.h>

int wifi_connect_as_sta()
{
Serial.println(String(“WiFi.mac: “) + String(WiFi.macAddressStr()));
WiFi.setAutoReconnect(false);
WiFi.begin((const char *)“0123456789”, (const char *)”############”);
int status = 0;
do
{
status = WiFi.status();
delay(500);
Serial.print(".");
//printf(“status: %d\n”, status);
} while (WL_CONNECTED != status);
Serial.println();
delay(1000);

Serial.println(String("IPv4 Address: ") + WiFi.localIP().toString());
Serial.println(String("IPv4 Netmask: ") + WiFi.subnetMask().toString());
Serial.println(String("IPv4 GateWay: ") + WiFi.getwayIP().toString());
Serial.println(String("IPv4 DNS: ") + WiFi.dnsIP().toString());
Serial.println(String("IPv4 DNS1: ") + WiFi.dnsIP(1).toString());
Serial.println(String("connected BSSID(str): ") + String(WiFi.BSSIDstr()));
Serial.println(String("current RSSI: ") + String(WiFi.RSSI()));

}

int wifi_connect_as_softap()
{
WiFi.softAP(“Wio Lite W600”, “0828143737”);
delay(1000);
Serial.println("-----------------------------------------");
Serial.println(String("STANUM: ") + String(WiFi.softAPgetStationNum()));
Serial.println(String("AP IP: ") + String(WiFi.softAPIP()));
Serial.println(String("AP MAC: ") + String(WiFi.softAPmacAddress()));
Serial.println(String("AP SSID: ") + String(WiFi.softAPSSID()));
Serial.println(String("AP PSK: ") + String(WiFi.softAPPSK()));
}

void w600_arduino_setup()
{
printf("[%s %s %d]\n", FILE, func, LINE);
WiFi.mode(WIFI_AP_STA);
wifi_connect_as_sta();
delay(1000);
wifi_connect_as_softap();
}

int sleep_cnt(int cnt)
{
int sleep_cnt = cnt;
int i = 0;
for (i = 1; i <= sleep_cnt ; i++)
{
if ((i - 1) % 20 == 0)
{
Serial.println();
}
else if ((i-1) % 10 == 0)
{
Serial.print(" ");
}
else if ((i-1) % 5 == 0)
{
Serial.print(’ ‘);
}
Serial.print(’.’);
delay(1000);
}
Serial.println();
}
void w600_arduino_loop()
{
Serial.println(“Hello From W600_EV Board Serial\n”);
DNSClient dns;
char *resolve = NULL;
if (dns.getHostByName(“www.baidu.com”, resolve))
{
printf(“www.baidu.com: %s\n”, resolve);
}
sleep_cnt(60);
}

void setup() {
printf(“setup()\n”);
// put your setup code here, to run once:
w600_arduino_setup();
}

void loop() {
w600_arduino_loop();
}

Code complies OK, but when Uploading I get the following error:
Use binary to upgrade the firmware.
Serial open success! com: COM9, baudrate: 115200.
Waiting for restarting device …
Start send ESC thread.
Start serial read thread.
Start restart thread.
First try cycle…
An error occurred while uploading the sketch

I’m not really sure why it is failing at this point, so any thoughts would be helpful.

Thanks in advance!

If you have trouble downloading, you can press the reset button twice to enter the download mode @jrosshort

Thanks @Baozhu, I will try that!