Setting statis IP of the Photon2 is not working

Hi all,
I'm trying to setup Static IP on my Photon2 but it doesn't seem to work. It connects using different IP.
Here is my code:

#include "Particle.h"

SYSTEM_MODE(MANUAL);

SYSTEM_THREAD(ENABLED);

SerialLogHandler logHandler(LOG_LEVEL_INFO);


void setup() {

  WiFi.setConfig(NetworkInterfaceConfig()
  .source(NetworkInterfaceConfigSource::STATIC)
  .address({192,168,1,201}, {255,255,255,0})
  .gateway(SockAddr({192,168,1,1}))
  .dns(SockAddr({192,168,1,1}))
  .dns(SockAddr({8,8,8,8})));

  WiFi.connect();
  Particle.connect();
}

void loop() {

}

The first thing I'd so is add this to the top of the loop and monitor the USB serial debug log.

waitFor(Serial.isConnected, 10000);

There should be some clues in the log. The code looks correct at first glance. One common situation is if flashing the code required an update to Device OS on the device it will go online using the previous configuration until updated OTA. This is because the new firmware you flashed can't run until the upgrade is complete.

Thanks, this is the log:

0000008200 [net.ifapi] INFO: Netif wl3 link UP, profile=home
0000008211 [system.nm] INFO: State changed: IFACE_UP -> IFACE_LINK_UP
0000009800 [hal] INFO: DNS server list changed
0000009803 [system.nm] INFO: State changed: IFACE_LINK_UP -> IP_CONFIGURED
0000009806 [system] INFO: Cloud: connecting
0000009827 [system] INFO: Read Server Address = type:1,domain:$id.udp.particle.io
0000009866 [system] WARN: Failed to load session data from persistent storage
0000009900 [system] INFO: Discarding session data
0000010030 [system] INFO: Cloud socket=0, connecting to 52.45.184.198#5684
0000010066 [system] INFO: Cloud socket connected
0000010089 [system] INFO: Starting handshake: presense_announce=0
0000010118 [comm.protocol.handshake] INFO: Establish secure connection
0000010151 [comm.dtls] INFO: (CMPL,RENEG,NO_SESS,ERR) restoreStatus=2
0000012777 [comm.protocol.handshake] INFO: Sending HELLO message
0000012928 [comm.protocol.handshake] INFO: Handshake completed
0000012957 [comm.dtls] INFO: session cmd (CLS,DIS,MOV,LOD,SAV): 4
0000012988 [comm.dtls] INFO: session cmd (CLS,DIS,MOV,LOD,SAV): 3
0000013772 [system] INFO: Send spark/device/last_reset event
0000013809 [comm] INFO: Sending TIME request
0000013832 [system] INFO: Sending application DESCRIBE
0000013862 [system] INFO: Sending subscriptions
0000013884 [comm.protocol] INFO: Sending subscriptions
0000013916 [comm.dtls] INFO: session cmd (CLS,DIS,MOV,LOD,SAV): 4
0000014768 [comm.dtls] INFO: session cmd (CLS,DIS,MOV,LOD,SAV): 3
0000015487 [comm.protocol] INFO: Received TIME response: 1716153973
0000015621 [comm.dtls] INFO: session cmd (CLS,DIS,MOV,LOD,SAV): 4
0000015650 [comm.dtls] INFO: session cmd (CLS,DIS,MOV,LOD,SAV): 3
0000015878 [system] INFO: All handshake messages have been processed
0000015910 [comm.dtls] INFO: session cmd (CLS,DIS,MOV,LOD,SAV): 4
0000015938 [comm.dtls] INFO: session cmd (CLS,DIS,MOV,LOD,SAV): 3
0000016072 [system] INFO: Cloud connected
0000016095 [comm.protocol] INFO: Received DESCRIBE request; flags: 0x04

Could this be an issue:

0000009866 [system] WARN: Failed to load session data from persistent storage
0000009900 [system] INFO: Discarding session data

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.