Cli list shows device offline, exposed functions not exposed

I am playing around with the CLI. I do a particle list and I get a list of my devices. They show offline, whether they are online or not. If a device is breathing cyan, shouldn’t it report as online?

If I type a particle list right after a reset, I can get an ‘online’ result (but only once). It seems like there’s a very short window where the device is reporting as online. Once it’s breathing cyan, it will always report ‘offline’. Why would that be?

When I can get it to show up online, it doesn’t list any exposed functions, even though I have a few in the code. I thought I was going crazy so I flashed the below, super simple code. Shouldn’t this work? Again I get the same result as above.

int LED = D7;

void setup(void)
    {
    pinMode(LED, OUTPUT);
    
    Particle.function("ledtest", LedTest);
    digitalWrite(LED, LOW);
    }


    int LedTest(String command){
        if (command == "on"){
           digitalWrite(LED, HIGH);
           return 1;
           }   
    }

void loop() {

}

What device is that?

a photon.

Are you compiling against v0.5.0? I haven’t encountered such issues with the Photon though.

Can you try loading tinker firmware and see if that happens?

@vinistois also please make sure you have the latest version of the CLI using npm update -g particle-cli.

peekay, I did do that update right before starting my session. But the command didn’t seem to do or return anything, just a small delay and then back to the prompt. I am using 1.12 which seems to be the latest build.

I was hoping I could flash tinker from the android app but it seems to be unable to, it always gives me the message “unable to reflash tinker”. So I did it in the cli with the photon connected over usb. I tried to update the firmware but got this error:

so I flashed tinker from the cli which worked:

Tinker worked one time and let me get into the main tinkering screen. The behavior is the same, it will show up “online” for a couple of seconds after a reboot, but then goes back offline. Tinker shows a red dot and says “Offline”, when the photon is right here happily breathing cyan.

I should mention my photon is only a couple of feet from the router.

@vinistois, I suggest you run particle update with the Photon in DFU (blinking yellow) mode. This will make sure you have the latest system parts on the device.

The flash command you got the error on assumed that you had the precompiled system parts bin files in the directory.

Thanks for the help and suggestions!

Look what we have accomplished:

finally a function was exposed! However, couple of seconds later:

still breathing cyan… I should add it breaths cyan 90% of the time. Sometimes, its blinking green for awhile, then breathes cyan again. A short while ago I had an IFTT channel pushing notifications to me when the device would go offline. It sent me 168 messages in one night so I turned it off. It seems to be resetting very often, at least every 5 minutes or so.

@vinistois, you seem to have a bigger issue with wifi or cloud disconnecting. First, I suggest wiping your wifi credentials and resetting them.

What wifi AP are you connecting to and how (WEP, WPA, WPA2, etc)? Do you have other Photons connected to the same AP?

I did exactly that just last night. I actually started seriously doubting my router, so I fired up a backup with a different ssid and reset the credentials. It didn’t help. I went back to my normal router and flashed a new firmware onto it. I was thinking the signal was too weak or somehow flakey and that was causing the dropouts. I took apart my project and brought the photon right next to the router. But I keep getting the same result.

Is there a way to see the RSSI through the CLI? I don’t have an antenna connected anymore (its attached to the project box). The photon is only plugged into usb power and nothing else, a few feet from the router.

I am connected to my regular home wifi that a dozen other devices are connected to, with wpa2 aes. This photon worked properly before, it was sending regular updates from i2c sensors to ubidots for a few weeks without issue. I don’t have any other photons connected here right now, but I have in the past.

Wait - you had an external antenna connected before? Did you ever use WiFi.selectAntenna(ANT_EXTERNAL) in the past? Because that setting is really sticky - it even stays selected in safe mode, through firmware upgrades, etc… ANT_AUTO will fall back to the internal antenna, but ANT_EXTERNAL will continue to use a non-existent external antenna, generally unsuccessfully.

2 Likes

Oh I didn’t know that! Yes it was using a 5dbi external antenna because the project is about 30 feet from the router.

I added WiFi.selectAntenna(ANT_AUTO); to the code…

It is doing much better. It still reports as offline 1/10 times that I ping it with a “particle list”. The led is also flashing green every minute or so, then back to breathing cyan. But we are definitely getting somewhere! It is much more responsive.

edit: now that I can turn the led on and off using particle call, I can see there are still major issues. about half the time, the device does not respond and the call times out, even as the photon is breathing cyan.

2 Likes

Oh crap!

Something here does not look right.

Ya, like no onboard antenna!!! Whaaaaat!

haha I have no clue :confused:

I had a little antenna plugged into it for weeks, then I used the larger antenna that’s mounted to the box. I have no clue when this happened, but obviously it fell off somehow. The trace that leads into it’s pad is lifted off the board as well. It must have been a mechanical impact. Crazy.

Should it still work fine with an external antenna?

I’m guessing this is for sure the source of my issues?

@vinistois, it should work as long as your external antenna is plugged in. That is crazy!

Amazing how many hours one can sink into software troubleshooting only to find out a part has been sheared off the board entirely.

Is it possible to get real-time rssi, or cloud “uptime” information to help troubleshoot connectivity issues? Perhaps over serial or an attached lcd?

Thanks very much for your assistance troubleshooting. Once we started talking about antenna issues I took a look at the board and the photos of what it should look like, otherwise I would have never noticed.

1 Like

@vinistois, there is nothing in the system firmware to display real-time RSSI. However, this can be added to your app easily. It could easily be made to drive an external LCD display via serial or I2C. :wink:

Ok. I have the circuit board patch antenna connected and it works so well now. It breathes cyan consistently without resetting, and I can call functions remotely without issues, and it programs much faster now. woot. back to business.

1 Like