Cloud handshake failed, code=17

I have a Boron on a 3rd party SIM (freedompop) that I just powered on after a few days of downtime and while it’s connecting to the Internet fine it’s not connecting to the Particle cloud. First if periodically spewed the following error:

0000220663 [comm.dtls] ERROR: handshake failed -6800
0000220666 [comm.protocol.handshake] ERROR: handshake failed with code 17
0000220669 [system] WARN: Cloud handshake failed, code=17

Then it switched to:

0000302260 [system] ERROR: Failed to determine server address
0000302264 [system] WARN: Cloud socket connection failed: -230
0000302267 [system] WARN: Internet available, Cloud not reachable!
0000302270 [system] WARN: Handling cloud error: 3

Then it went back to the handshake failed error. It has now been sitting like that for over 10 minutes. Where do I look up what these obscure error codes mean?
I’m running 1.2.0 beta-1

I Have has (and still have) similar issues. to help get more info I am using this to troubleshoot

In setup()

System.on(all_events, handle_all_the_events);
// ---------------------------------------------------------------------------
void handle_all_the_events(system_event_t event, int param )
// ---------------------------------------------------------------------------
{
    const int maxSizeOfEventText = 59;
    const int maxSizeOfEventMsg = 60;

    char systemParamMsg[maxSizeOfEventMsg] = "Non defined event"; // undefined event in DeviceOS
    
    switch (event) {
        case setup_begin: // signals the device has entered setup mode
            snprintf(systemParamMsg, maxSizeOfEventText, "Setup started");   
            break;
        case setup_update: // periodic event signaling the device is still in setup mode.
            snprintf(systemParamMsg, maxSizeOfEventText, "Setup busy for last %d ms", param);
            break;
        case setup_end: // signals setup mode was exited
            snprintf(systemParamMsg, maxSizeOfEventText, "Setup ended after %d ms", param);
            break;
        case network_credentials: // network credentials were changed
            switch(param) {
                case network_credentials_added:
                    snprintf(systemParamMsg, maxSizeOfEventText, "Network credentials added" ); 
                    break;   
                case network_credentials_cleared:
                    snprintf(systemParamMsg, maxSizeOfEventText, "Network credentials cleared" ); 
                    break;   
                default:
                    snprintf(systemParamMsg, maxSizeOfEventText, "Unknown network_credentials event ID [%d]", event ); // unknown event so just show value
                    break;
            } 
            break;
        case network_status: // network connection status
            switch(param) {
                case network_status_powering_on:
                    snprintf(systemParamMsg, maxSizeOfEventText, "Network starting" ); 
                    break;   
                case network_status_on:
                    snprintf(systemParamMsg, maxSizeOfEventText, "Network on" ); 
                    break;   
               case network_status_powering_off:
                    snprintf(systemParamMsg, maxSizeOfEventText, "Network stopping" ); 
                    break;   
                case network_status_off:
                    snprintf(systemParamMsg, maxSizeOfEventText, "Network off" ); 
                    break;   
               case network_status_connecting:
                    snprintf(systemParamMsg, maxSizeOfEventText, "Network connecting" ); 
                    break;   
                case network_status_connected:
                    snprintf(systemParamMsg, maxSizeOfEventText, "Network connected" ); 
                    break;   
                default:
                    snprintf(systemParamMsg, maxSizeOfEventText, "Unknown network_status event ID [%d]", event ); // unknown event so just show value
                    break;
            } 
            break;
        case cloud_status: // cloud connection status
            switch (param) {
                case cloud_status_connecting:
                    snprintf(systemParamMsg, maxSizeOfEventText, "Cloud connecting" ); 
                    break;
                case cloud_status_connected:
                    snprintf(systemParamMsg, maxSizeOfEventText, "Cloud connected" ); 
                    break;
                case cloud_status_disconnecting:
                    snprintf(systemParamMsg, maxSizeOfEventText, "Cloud disconnecting" ); 
                    break;
                case cloud_status_disconnected:
                    snprintf(systemParamMsg, maxSizeOfEventText, "Cloud disconnected" ); 
                    break;
                default:
                    snprintf(systemParamMsg, maxSizeOfEventText, "Unknown cloud_status event ID [%d]", event ); // unknown event so just show value
                    break;
            }    
            break;
        case button_status: // button pressed or released
            snprintf(systemParamMsg, maxSizeOfEventText, "Mode button pressed for %d ms", param);
            break;
        case firmware_update: // firmware update status
            switch (param) {
                case firmware_update_begin:
                    snprintf(systemParamMsg, maxSizeOfEventText, "F/W update started" ); 
                    break;
                case firmware_update_progress:
                    snprintf(systemParamMsg, maxSizeOfEventText, "F/W update in progress" ); 
                    break;
                case firmware_update_complete:
                    snprintf(systemParamMsg, maxSizeOfEventText,"F/W update done" ); 
                    break;
                case firmware_update_failed:
                    snprintf(systemParamMsg, maxSizeOfEventText, "F/W update failed" ); 
                    break;
                default:
                    snprintf(systemParamMsg, maxSizeOfEventText, "Unknown firmware_update event ID [%d]", event ); // unknown event so just show value
                    break;
            }  
            break;
        case firmware_update_pending: //  notifies the application that a firmware update is available. 
            snprintf(systemParamMsg, maxSizeOfEventText, "Firmware update available");
            break;
        case reset_pending: // notifies the application that the system would like to reset
            snprintf(systemParamMsg, maxSizeOfEventText, "Reset requested");
            break;
        case reset: // notifies that the system will reset once the application has completed handling this event
            snprintf(systemParamMsg, maxSizeOfEventText, "Reset started");
            tbDisconnect();
            break;
        case button_click: // event sent each time setup button is clicked
            snprintf(systemParamMsg, maxSizeOfEventText, "Mode button clicked %d times", system_button_clicks(param) );
            break;
        case button_final_click: // at the end of a series of clicks.
            snprintf(systemParamMsg, maxSizeOfEventText, "Mode button clicked %d times in total", system_button_clicks(param) );
            break;
        case time_changed: // device time changed
            switch (param) {
                case time_changed_manually:
                    snprintf(systemParamMsg, maxSizeOfEventText, "Time updated manually" ); 
                    break;
                case time_changed_sync:
                    snprintf(systemParamMsg, maxSizeOfEventText, "Time synchronised" ); 
                    break;
                default:
                    snprintf(systemParamMsg, maxSizeOfEventText, "Unknown time_changed event ID [%d]", event ); // unknown event so just show value
                    break;
            }
            break;
        case low_battery: // low battery condition is detected
            checkBattV(); // sends particle.publish immediately with battery level
            break;
        case out_of_memory: // out of memeory
            snprintf(systemParamMsg, maxSizeOfEventText, "Out of memory : %d bytes required", param );
            break;
        default: // undefined event in DeviceOS
            snprintf(systemParamMsg, maxSizeOfEventText, "Unknown event ID [%d]", event ); // unknown event so just show value
            break;
    }
    
    Log.warn(systemParamMsg);
    
    // special cses where the Log message needs to be shown before the next action i.e. Reset]
    switch (event) {
        case firmware_update_pending: //  notifies the application that a firmware update is available. 
            gracefullReset();
            break;
        case reset_pending: // notifies the application that the system would like to reset
            gracefullReset();
        default:
            break;
    }
}

I haven’t found the cloud codes (17, -230 etc) yet …

1 Like

Hi @tve and @shanevanj ,

Would you be able to re run the same tests and grab the same logs by testing our v1.3.0-alpha.1 prelease?

I would be interested to know if you notice any difference in behavior on our latest alpha release.

I will test - however since 1.2.1-rc.2 99% of my issues have disappeared ! - it seems like there were message queuing issues and resultant lockups in DeviceOS. I did do a brutal function to attempt to connect to an external server and then restart after 4 failures - that certainly brought everything back to life - but not ideal.

mmmm - finger trouble - I can’t see the 1.3.0 in the devices drawer and if I try

particle flash fMonPA_prototype_1 argon-system-part1@1.3.0-alpha.1.bin

I got a lot of 0000443340 [app] WARN: F/W update in progress
from my code above and then after a short while SOS(10) - and reboot

Alpha versions are usually not available on the build farms.
If you want an application built against that version you’d need to do it locally by downloading the device OS repo.

However, if the actual change is in the device OS part and not in the application binary you can run your 1.2.1-rc.2 application on the alpha device OS.

BTW, I’d rather flash via USB in DFU Mode
particle flash --usb argon-system-part1@1.3.0-alpha.1.bin -v

After that either particle flash --usb tinker -v or flash your own 1.2.1-rc.2 targeted application.

Also, the tag of this thread suggests Boron but that binary is for Argon - which device are you actually flashing???

@ScruffR’s statement is correct. Alphas will need to be grabbed directly from the Device OS repo.

With that said, if your issues were resolved in 1.2.1-rc.2 – no obligation on updating to try and resolve this. Alphas should be for testing purposes only if you are in a non functional state. Should they be resolved, I would actually recommend staying on 1.2.1-rc.2 until a more stable version is released.

Let me know if you have any difficulties downgrading down to 1.2.1-rc.2.

2 Likes