Photon and syncTime

In attempting to compile a MQTT sketch in the Web IDE, I get:

../../../build/target/user/platform-6/libuser.a(mqttsender.o): In function `CloudClass::syncTime()':
/spark/compile_service/shared/workspace/6_hal_12_0/firmware-private/user/../wiring/inc/spark_wiring_cloud.h:103: undefined reference to `spark_protocol_send_time_request'
collect2: error: ld returned 1 exit status
make: *** [/spark/compile_service/shared/workspace/6_hal_12_0/firmware-priva461a74c6cafc0dc90054fea5bf282765cadc00bb3a70b793f0f710caa581.elf] Error 1

The sketch compiles and works fine on the Spark core but compilation fails for the Photon as above. Any fix available?

EDIT: removing Spark.syncTime(); did the trick and so far seems unnecessary as it seemed for Spark core. Is synchTime gone for Photon?

1 Like

Seems like some issue with the photon side. Opened an issue here:

1 Like

Looks like we have a fix soon:

1 Like

I get the following error when trying to use Spark.syncTime() in my Photon project:

undefined reference to 'spark_protocol_send_time_request'

Hi @tjp

I moved your post over here. The github issue is one post up by @kennethlimcp

Bottom line: fixed soon.

1 Like

Sorry, I guess I missed this post :-/

1 Like

Hi, the problem still persists. Web IDE & Spark.syncTime() tested (and not working) on July 9, 2015 with a Photon.

Please wait for the release of 0.4.3 for photon which has the fix

Any timelines for this release (I have the same issue).

@Kevin, within the next two weeks :smile:

@peekay123, any update on this issue. Looks like this has been open for almost a month. For me time does not seem to sync at bootup either

Have you tried upgrading to 0.4.3, which should contain the fix according to @kennethlimcp? Steps to do so can be found here:
The auto update feature is planned to be released shortly, so that should make it easier :smile:

@sasi, as @Moors7 said, the problem (FreeRTOS resetting the RTC) was fixed in the latest release. As for the synched time vs NIST time, I flagged the issue with @Dave and he is looking into a solution (I think!).

1 Like

I’m having the same issue, building using the Web IDE. I’ve updated the Photon to 0.4.3 OTA using particle-cli, but the build is still failing with error:

/spark/compile_service/shared/workspace/6_hal_12_0/firmware-private/user/../wiring/inc/spark_wiring_cloud.h:103: undefined reference to `spark_protocol_send_time_request'

The Web IDE settings page shows “you are building with spark firmware v0.3.4” but there is no other option to select the latest firmware. I’ve refreshed the page and disconnected/reconnected the Photon but v0.4.3 does not show as an option in the Web IDE. I’m guessing v0.4.3 is not supported yet in the Web IDE? I’ll try to build locally for now.

  • V0.3.4. is only for the Core
  • currently version for Photon is V0.4.1 so yup… V0.4.3 is not updated yet.

Building locally for now will work :smile:

Thanks @kennethlimcp, I’m trying to compile using particle-cli, but getting the same error. How do I set which version to compile against? Can’t seem to work it out using the cli options?

Edit: ok I think the cli actually uses the cloud to compile(?), so I’m probably using the wrong tool!

Particle CLI is not local compiling as it still uses the Build farm. :smiley:

There’s currently no option to switch versions :wink:

This should give you the right tools:

Thanks guys, I’ve installed the toolchain, amended the application.cpp file slightly and built the new firmware. I located the user-part.bin file and attempted to flash it OTA using the particle-cli:

particle flash photon1 user-part.bin

The cli responds with “update started” status and I can see the Photon LED status flash magenta to indicate a firmware update, then reboot and re-connect to the cloud.

But it appears the firmware isn’t actually updated. It appears the last firmware flashed through the web IDE is still running (LED blink app). So I just flashed a different app through the web IDE and that was successful. Tried again to flash the user-part.bin using the cli and it appears again to go through the flashing process but not actually flash the new firmware. I’m guessing the new firmware is being rejected at the installation stage on the device? Perhaps the versions are incompatible, although I believe I’m using all v0.4.3 code?

Before doing the above, I updated the system firmware to v0.4.3 using:

particle flash YOUR_DEVICE_NAME  system-part1-0.4.3-photon.bin
particle flash YOUR_DEVICE_NAME  system-part2-0.4.3-photon.bin

To install the toolchain, I downloaded and ran the installer (today) from here and followed the instructions from here.

Could you send me your user-part.bin binary and I’ll take a look. (And some details of how I know that it’s working!) Thanks :slight_smile: