M
M
Michael2021-03-11 12:49:34
WiFi
Michael, 2021-03-11 12:49:34

Error connecting ESP8266 to ThingWorx Server (Fatal exception 28)?

I'm having trouble connecting a NodeMCU board to a ThingWorx Foundation server.
Used this manual

The server is needed to create IoT devices and smart home as well.

A piece of code from the manual. The main thing here is WiFi Definitions and ThingWorx server definitions. These are the parts that I edited for myself, replacing the Wi-Fi SSID with the name of the network to which I am connected and the password for this network.
I replaced the TWPlatformBaseURL with a link that was generated when I started the trial version of the remote ThingWorx server.
The AppKey is the application key I created on this server (it determines which IP addresses can connect to my server).

/**
 * 
 * ESP8266_ThingWorx_REST_Demo.ino
 *
 *  
 *  (c) PTC, Inc. 2016-2020
 *
 */

#include <Arduino.h>
#include <ESP8266WiFi.h>
#include <ESP8266HTTPClient.h>
#include <WiFiClientSecureBearSSL.h>

//////////////////////
// WiFi Definitions //
//////////////////////
const char WiFiSSID[] = "Liberty454"; // WiFi access point SSID
const char WiFiPSK[] = "Flutie22"; // WiFi password - empty string for open access points

//////////////////////////////////////////////
// ThingWorx server definitions            //
//  modify for a specific platform instance //
//////////////////////////////////////////////
const char TWPlatformBaseURL[] = "https://pp-2007011431nt.devportal.ptc.io";
const char appKey[] = "2d4e9440-3e51-452f-a057-b55d45289264";


Next, I connected the NodeMCU board, uploaded the sketch to it:
sketch

Here is what I get from the Port Monitor in the Arduino IDE.
WiFi connected
IP address: 
*мойIPАдресс*
DeviceID>ESP8266Board-FXX
[httpsGetPropertry] begin...GET URL>https://pp-2103XXXXXXXX.devportal.ptc.io/Thingworx/Things/ESP8266Board-FXX/Properties/SomeNumber?appKey=МойAppKey<
Fatal exception 28(LoadProhibitedCause):
epc1=0x4020a2c0, epc2=0x00000000, epc3=0x00000000, excvaddr=0x00300030, depc=0x00000000


Wi-Fi connects, the problem occurs exactly when the httpsGetPropertry request occurs.
Apparently, he cannot find Things / ESP8266Board-FXX and an error crashes. Although in theory, if this thing is not found, it will create it automatically. It didn't work in my case, but even when I manually created the ESP8266Board-FXX object, I still got the same fatal exception error.

I need the NodeMCU to connect to the server and create a Thing there with my ESP8266 board.
Tried to explain in the most understandable way.

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question