adafruit / Adafruit_WICED_Arduino

Adafruit WICED Feather Arduino BSP
https://www.adafruit.com/products/3056
27 stars 19 forks source link

Fractional seconds read from getISO8601Time() seems incorrect #75

Closed JasonSickler closed 7 years ago

JasonSickler commented 7 years ago

I am looking at the ISO8601 time readout in from my Adafriut WICED device, after it has connected to my WiFi LAN (so the RTC is synced). Using this code in loop(): iso8601_time_t t; Feather.getISO8601Time(&t); Serial.printf("\"%s\" = ",t.minute);

I get the following series of readouts: "22:04.058176Z" "22:04.063176Z" "22:04.002640Z" "22:04.007640Z" "22:04.012640Z" "22:04.017640Z" "22:04.022640Z" "22:04.027640Z" "22:04.032640Z" "22:04.037640Z" "22:04.042640Z" "22:04.047640Z" "22:04.052640Z" "22:04.057640Z" "22:04.062640Z" "22:04.002104Z" "22:04.007104Z"

The sub_seconds values appear to be wrong, counting up to around 0.06, then wrap around, and the first decimal place stays at zero. This cycles around about 12 times per second. The wrap-around of the sub_seconds value does NOT correspond to a change in the seconds value, but the sub-seconds value does appear to reset to zero when the seconds value changes. "22:05.065496Z" "22:05.004960Z" "22:05.009960Z" "22:05.014960Z" "22:06.003000Z" "22:06.008000Z" "22:06.013000Z" "22:06.018000Z"

FYI, Feather.getUtcTime() gives the correct epoch time in seconds.

I tried to dig into sdep(), which Feather.getISO8601Time() calls: return sdep(SDEP_CMD_GET_ISO8601_TIME, 0, NULL, NULL, iso8601_time); where iso8601_time is the pointer to a iso8601_time_t variable in which the result goes.

No luck so far. There is more digging to do, but I thought it time to bring this here. It appears to be a bug, or I'm doing something wrong. Thanks in advance for the help.

hathach commented 7 years ago

The issue is fixed in the development branch, we are testing to release the 0.6.5 in a day or two.

hathach commented 7 years ago

0.6.5 is live, please update and check to see if it fixes the issue.

JasonSickler commented 7 years ago

Ah, I see that the issue was identified already in March.

When I download the .zip release of 0.6.5, and try to install the contents in the Arduino IDE, I get that the library is invalid. That's true whether I use "Include Library-->Add .ZIPLibrary", manually extract to \Arduino\libraries\ or manual extract to [PERSONAL FOLDER\libraries. IDE Version is 1.8.2.

Also tried to trick it by putting the 0.6.5 contents into the 0.6.2 folder. When I do that, compiling works, but upload fails with:

java.io.IOException: Cannot run program "{runtime.tools.wiced_dfu.path}/wiced_dfu.exe": CreateProcess error=2, The system cannot find the file specified at java.lang.ProcessBuilder.start(ProcessBuilder.java:1048) at processing.app.helpers.ProcessUtils.exec(ProcessUtils.java:26) at cc.arduino.packages.Uploader.executeUploadCommand(Uploader.java:129) at cc.arduino.packages.uploaders.SerialUploader.uploadUsingPreferences(SerialUploader.java:207) at cc.arduino.UploaderUtils.upload(UploaderUtils.java:78) at processing.app.SketchController.upload(SketchController.java:713) at processing.app.SketchController.exportApplet(SketchController.java:686) at processing.app.Editor$DefaultExportHandler.run(Editor.java:2135) at java.lang.Thread.run(Thread.java:745) Caused by: java.io.IOException: CreateProcess error=2, The system cannot find the file specified at java.lang.ProcessImpl.create(Native Method) at java.lang.ProcessImpl.<init>(ProcessImpl.java:386) at java.lang.ProcessImpl.start(ProcessImpl.java:137) at java.lang.ProcessBuilder.start(ProcessBuilder.java:1029) ... 8 more An error occurred while uploading the sketch

Sorry if this is my ignorance, but can't see what I'm doing wrong here.

hathach commented 7 years ago

Hmm, can you remove the current BSP first and then install 0.6.5 using Arduino IDE -> Board Manager which is easier than downloading the zip package yourself.

JasonSickler commented 7 years ago

I started down the road of removing old version first, but then went right to manually putting in the new version. I needed to manually remove old version, and then go back to the library manager, instead of installing new version manually.

Compiles and uploads now. Unfortunately, from what I can tell, the same problem exists in the timestamping as I described above. Checked the library version again to be sure, and it says 0.6.5.

hathach commented 7 years ago

Did you upgrade the featherlib which contains the fix for the issue, choose the Section Featherlib instead of User Code and click upload icon

JasonSickler commented 7 years ago

The entire WICED BSP installed through the Library Manager. image

I manually went in to the folders to see that \featherlib\featherlib.* files were both the new versions, and they appear to be (2017-07-17 6:28AM modified date, sizes match up with GitHub). image

hathach commented 7 years ago

You will need to flash featherlib on the wiced board. Please choose Tool -> Section -> Feather Lib then click upload Icon to upgrade the featherlib

https://learn.adafruit.com/introducing-the-adafruit-wiced-feather-wifi/arduino-ide-setup#setting-the-section

JasonSickler commented 7 years ago

Ah, good. Just my ignorance. Vaguely recall doing this back when I started, but forgot.

And looks good! You guys are awesome, thank you!

hathach commented 7 years ago

No problems at all, we will close this issue now.