1.67 clock offset

Posted on
  • Hi All,

    I have two espruino's both with:

    http://www.espruino.com/Clocks

    The 32Khz Watch Crystal soldered onto it. I tried the clock example from that page as well as my own implementation and there is quite a big drift: depending on which espruino I use, 1 - 3 seconds on the minute.

    Did anyone else notice this?

    The program I want to use this for is a simple light switch. On in the morning, off in the afternoon.

    1. var hours = 21;
    2. var minutes = 58;
    3. var seconds = 0;
    4. var port = {pin:C6, brightness:0};
    5. var fadeInterval = 5;
    6. function timestep() {
    7. seconds += 1;
    8. if (seconds == 60) {
    9. seconds = 0;
    10. minutes += 1;
    11. }
    12. if (minutes == 60) {
    13. minutes = 0;
    14. hours += 1;
    15. }
    16. if (hours == 24) {
    17. hours = 0;
    18. }
    19. updateBehaviourFade();
    20. }
    21. /**
    22. * This fades in the lights on the port.pin
    23. * @param {Number} fadeInterval | time in seconds to fade in
    24. */
    25. function fadeIn(fadeInterval) {
    26. if (port.brightness == 0) {
    27. analogWrite(port.pin,1/255);
    28. var fadeInID = setInterval(function () {
    29. port.brightness += 1/255;
    30. if (port.brightness > 1) {
    31. analogWrite(port.pin,1);
    32. port.brightness = 1;
    33. clearInterval(fadeInID);
    34. }
    35. else {
    36. analogWrite(port.pin,port.brightness);
    37. }
    38. },
    39. fadeInterval*1000/255
    40. );
    41. }
    42. }
    43. /**
    44. * This fades out the lights on the port.pin
    45. * @param {Number} fadeInterval | time in seconds to fade out
    46. */
    47. function fadeOut(fadeInterval) {
    48. if (port.brightness == 1) {
    49. analogWrite(port.pin,1 - 1/255);
    50. var fadeOutID = setInterval(function () {
    51. port.brightness -= 1/255;
    52. if (port.brightness < 0) {
    53. port.brightness = 0;
    54. analogWrite(port.pin,0);
    55. clearInterval(fadeOutID);
    56. }
    57. else {
    58. analogWrite(port.pin,port.brightness);
    59. }
    60. },
    61. fadeInterval*1000/255
    62. );
    63. }
    64. }
    65. function updateBehaviourFade() {
    66. if (hours >= 8 && port.brightness == 0) {
    67. fadeIn(fadeInterval);
    68. }
    69. if (hours >= 23 && port.brightness == 1) {
    70. fadeOut(fadeInterval);
    71. }
    72. }
    73. function onInit() {
    74. analogWrite(C6,0);
    75. setInterval(timestep,1000);
    76. }

    Would the fading interfere with the clock?

    Regards,

    Alex

    PS. also the fading isn't linear.. it seems to be faster and slower during the fading cycle.

  • It sounds a lot like you're still working off the internal oscillator... That kind of accuracy is what you'd expect from it.

    Can you try copying and pasting this into the console?

    1. ["NONE","LSE","LSI","HSE"][((peek32(0x40021020)&768)>>8)]

    If the watch crystal is working properly, it should return 'LSE', but if not it'd return 'LSI'.

    The fading shouldn't interfere with the RTC at all... You're using setInterval there, which should be absolutely fine - but you can now actually use the Date class and clock module if you want to. It means that you don't have to keep track of time every second if you don't want to, and you get the day of the week/etc too:

    1. var Clock = require("clock").Clock;
    2. var clk=new Clock("Jun 23, 2014 12:18:02");
    3. // every time the button is pressed, print the current time..
    4. setInterval(function() {
    5. var d=clk.getDate();
    6. // you can then use d.getHours() and g.getMinutes()
    7. }, 10000/*or whatever*/);

    As far as the non-linear fading, I'm not sure. Is it not just that the light you're using is itself non-linear? For instance I believe that if you have an LED, pulsing it at 10% duty cycle will probably generate more than 10% of the light that you'd get by running it at 100% duty cycle.

    You might also find that specifying a frequency when using analogWrite would help out with that: analogWrite(port.pin,port.brightness,{freq:500});

  • Hi Gordon,

    Thanks for the answer, I'll test this as soon as I have time!

    Regards.

    Alex

  • (on a sidenote, the forum isn't remembering notify by email?)

  • Hi Gordon,

    It's returning LSE, also I clocked it again, 8 seconds on 3 minutes. There's also a HM-10 on these espruino's, would that matter? Its only a serial connection right?

    Regards,

    Alex

  • Ok, that's good then. Hm10 won't be an issue.

    Can you check the value from getTime and see if that wanders off, or whether it's just setInterval?

  • Just wondering, is it possible that the crystal you're using is 32000hz and not 32768hz? I just assumed that all 32khz crystals were the latter (because of how they'd be used), but maybe not...

    8 secs in 3 minutes is very close to the difference between the two crystals. If it's accurately losing that much time you could just correct it in the value you give to setInterval.

  • Hi Gordon,

    I'm yet to test the getTime function but I ordered these crystals:
    http://nl.farnell.com/jsp/search/productdetail.jsp?SKU=1652573

    Unless they gave me the wrong ones It should be 32768hz..

  • Yes, those look perfect. It'd definitely be interesting to see whether getTime has problems too.

    Does it seem like Espruino's internal clock is running too quickly, or too slowly?

  • Hi Gordon,

    I tried getTime with one of them. Here are the results:

    1. Running onInit()...
    2. 22 27 1 8.89654541015
    3. 22 27 2 9.87362384796
    4. 22 27 3 10.85043907165
    5. >["NONE","LSE","LSI","HSE"][((peek32(0x40021020)&768)>>8)]
    6. ="LSE"
    7. 22 27 4 11.82781124114
    8. 22 27 5 12.80497169494
    9. 22 27 6 13.78127479553
    10. 22 27 7 14.75885581970
    11. 22 27 8 15.73618793487
    12. 22 27 9 16.71329021453
    13. 22 27 10 17.68983268737
    14. 22 27 11 18.66729640960
    15. 22 27 12 19.64469623565
    16. 22 27 13 20.62130546569
    17. 22 27 14 21.59873771667
    18. 22 27 15 22.57538700103
    19. 22 27 16 23.55257987976
    20. 22 27 17 24.52955722808
    21. 22 27 18 25.50629901885
    22. 22 27 19 26.48370838165
    23. 22 27 20 27.46107578277
    24. 22 27 21 28.43755435943
    25. 22 27 22 29.41496467590
    26. 22 27 23 30.39203929901
    27. 22 27 24 31.36863899230
    28. 22 27 25 32.34608268737
    29. 22 27 26 33.32317829132
    30. 22 27 27 34.30036544799
    31. 22 27 28 35.27692508697
    32. 22 27 29 36.25446891784
    33. 22 27 30 37.23196983337
    34. 22 27 31 38.20841407775
    35. 22 27 32 39.17696094512
    36. 22 27 33 40.14436244964
    37. 22 27 34 41.11141586303
    38. 22 27 35 42.07813072204
    39. 22 27 36 43.04565048217
    40. 22 27 37 44.01294136047
    41. 22 27 38 44.97966384887
    42. 22 27 39 45.94723033905
    43. 22 27 40 46.91443347930
    44. 22 27 41 47.88146877288
    45. 22 27 42 48.84821319580
    46. 22 27 43 49.81562614440
    47. 22 27 44 50.78271198272
    48. 22 27 45 51.74902725219
    49. 22 27 46 52.71672534942
    50. 22 27 47 53.68405914306
    51. 22 27 48 54.65052795410
    52. 22 27 49 55.61753273010
    53. 22 27 50 56.58525753021
    54. 22 27 51 57.55184650421
    55. 22 27 52 58.51905536651
    56. 22 27 53 59.48586845397
    57. 22 27 54 60.45320510864
    58. 22 27 55 61.42058277130
    59. 22 27 56 62.38734245300
    60. 22 27 57 63.35481452941
    61. 22 27 58 64.32194614410
    62. 22 27 59 65.28926372528
    63. 22 28 0 66.25617694854
    64. 22 28 1 67.22333431243
    65. 22 28 2 68.19010353088
    66. 22 28 3 69.15674114227
    67. 22 28 4 70.12435626983
    68. 22 28 5 71.09159755706
    69. 22 28 6 72.05858993530
    70. 22 28 7 73.02545547485
    71. 22 28 8 73.99303150177
    72. 22 28 9 74.95989799499
    73. 22 28 10 75.92654418945
    74. 22 28 11 76.89402294158
    75. 22 28 12 77.86119842529
    76. 22 28 13 78.82830810546
    77. 22 28 14 79.79456424713
    78. 22 28 15 80.76237297058
    79. 22 28 16 81.72950744628
    80. 22 28 17 82.69598865509
    81. 22 28 18 83.66352081298
    82. 22 28 19 84.63085842132
    83. 22 28 20 85.59737682342
    84. 22 28 21 86.56439304351
    85. 22 28 22 87.53121662139
    86. 22 28 23 88.49844074249
    87. 22 28 24 89.46592426300
    88. 22 28 25 90.43259620666
    89. 22 28 26 91.40005779266
    90. 22 28 27 92.36719226837
    91. 22 28 28 93.33396911621
    92. 22 28 29 94.30138015747
    93. 22 28 30 95.26851844787
    94. 22 28 31 96.23584556579
    95. 22 28 32 97.20260143280
    96. 22 28 33 98.17017459869
    97. 22 28 34 99.13756942749
    98. 22 28 35 100.10418987274
    99. 22 28 36 101.07176780700
    100. 22 28 37 102.03902435302
    101. 22 28 38 103.00602912902
    102. 22 28 39 103.97282505035
    103. 22 28 40 104.94040489196
    104. 22 28 41 105.90770339965
    105. 22 28 42 106.87440109252
    106. 22 28 43 107.84176254272
    107. 22 28 44 108.80907344818
    108. 22 28 45 109.77622699737
    109. 22 28 46 110.74252700805
    110. 22 28 47 111.71034812927
    111. 22 28 48 112.67763710021
    112. 22 28 49 113.64414405822
    113. 22 28 50 114.61173534393
    114. 22 28 51 115.57839584350
    115. 22 28 52 116.54544925689
    116. 22 28 53 117.51273441314
    117. 22 28 54 118.47938537597
    118. 22 28 55 119.44679546356
    119. 22 28 56 120.41403484344
    120. 22 28 57 121.38079738616
    121. 22 28 58 122.34818935394
    122. 22 28 59 123.31535625457
    123. 22 29 0 124.28244972229
    124. 22 29 1 125.24951934814
    125. 22 29 2 126.21704196929
    126. 22 29 3 127.18405437469
    127. 22 29 4 128.15081787109
    128. 22 29 5 129.11840724945
    129. 22 29 6 130.08529472351
    130. 22 29 7 131.05198574066
    131. 22 29 8 132.01952838897
    132. 22 29 9 132.98675060272
    133. 22 29 10 133.95380210876
    134. 22 29 11 134.92061901092
    135. 22 29 12 135.88815116882
    136. 22 29 13 136.85531616210
    137. 22 29 14 137.82149314880
    138. 22 29 15 138.78920650482
    139. 22 29 16 139.75653076171
    140. 22 29 17 140.72360706329
    141. 22 29 18 141.69012451171
    142. 22 29 19 142.65779495239
    143. 22 29 20 143.62495136260
    144. 22 29 21 144.59137916564
    145. 22 29 22 145.55818462371
    146. 22 29 23 146.52558612823
    147. 22 29 24 147.49297714233
    148. 22 29 25 148.45994281768
    149. 22 29 26 149.42677593231
    150. 22 29 27 150.39429092407
    151. 22 29 28 151.36148071289
    152. 22 29 29 152.32823085784
    153. 22 29 30 153.29566287994
    154. 22 29 31 154.26294803619
    155. 22 29 32 155.22980785369
    156. 22 29 33 156.19702720642
    157. 22 29 34 157.16458511352
    158. 22 29 35 158.13157749176
    159. 22 29 36 159.09837818145
    160. 22 29 37 160.06590938568
    161. 22 29 38 161.03356742858
    162. 22 29 39 162.00023937225
    163. 22 29 40 162.96779060363
    164. 22 29 41 163.93502902984
    165. 22 29 42 164.90207576751
    166. 22 29 43 165.86882972717
    167. 22 29 44 166.83629417419
    168. 22 29 45 167.80352115631
    169. 22 29 46 168.76992511749
    170. 22 29 47 169.73762893676
    171. 22 29 48 170.70493888854
    172. 22 29 49 171.67143344879
    173. 22 29 50 172.63846778869
    174. 22 29 51 173.60614681243
    175. 22 29 52 174.57280635833
    176. 22 29 53 175.53966617584
    177. 22 29 54 176.50644588470
    178. 22 29 55 177.47377395629
    179. 22 29 56 178.44114017486
    180. 22 29 57 179.40784454345
    181. 22 29 58 180.37530517578
    182. 22 29 59 181.34243965148
    183. 22 30 0 182.30955028533
    184. 22 30 1 183.27625942230
    185. 22 30 2 184.24385643005
    186. 22 30 3 185.21126842498
    187. 22 30 4 186.17786598205
    188. 22 30 5 187.14545059204
    189. 22 30 6 188.11270713806
    190. 22 30 7 189.07970333099
    191. 22 30 8 190.04650974273
    192. 22 30 9 191.01412582397
    193. 22 30 10 191.98157882690
    194. 22 30 11 192.94823455810
    195. 22 30 12 193.91568279266
    196. 22 30 13 194.88286590576
    197. 22 30 14 195.84993267059
    198. 22 30 15 196.81623935699
    199. 22 30 16 197.78408527374
    200. 22 30 17 198.75120639801
    201. 22 30 18 199.71769332885
    202. 22 30 19 200.68547439575
    203. 22 30 20 201.65268230438
    204. 22 30 21 202.61917877197
    205. 22 30 22 203.58617210388
    206. 22 30 23 204.55388450622
    207. 22 30 24 205.52055644989
    208. 22 30 25 206.48801231384
    209. 22 30 26 207.45453739166
    210. 22 30 27 208.42182731628
    211. 22 30 28 209.38918209075
    212. 22 30 29 210.35595798492
    213. 22 30 30 211.32342720031
    214. 22 30 31 212.29054927825
    215. 22 30 32 213.25790596008
    216. 22 30 33 214.22473812103
    217. 22 30 34 215.19185161590
    218. 22 30 35 216.15999317169
    219. 22 30 36 217.12664890289
    220. 22 30 37 218.09422779083
    221. 22 30 38 219.06140232086
    222. 22 30 39 220.02842235565
    223. 22 30 40 220.99529457092
    224. 22 30 41 221.96289157867
    225. 22 30 42 222.93021774291
    226. 22 30 43 223.89696311950
    227. 22 30 44 224.86442661285
    228. 22 30 45 225.83157253265
    229. 22 30 46 226.79866313934
    230. 22 30 47 227.76496028900
    231. 22 30 48 228.73280620574
    232. 22 30 49 229.70020866394
    233. 22 30 50 230.66671943664
    234. 22 30 51 231.63428211212
    235. 22 30 52 232.60087776184
    236. 22 30 53 233.56793117523
    237. 22 30 54 234.53498554229
    238. 22 30 55 235.50187206268
    239. 22 30 56 236.46923542022
    240. 22 30 57 237.43669700622
    241. 22 30 58 238.40335559844
    242. 22 30 59 239.37069702148
    243. 22 31 0 240.33797454833
    244. 22 31 1 241.30460739135
    245. 22 31 2 242.27206420898
    246. 22 31 3 243.23953437805
    247. 22 31 4 244.20658493041
    248. 22 31 5 245.17336845397
    249. 22 31 6 246.14100742340
    250. 22 31 7 247.10786342620
    251. 22 31 8 248.07446098327
    252. 22 31 9 249.04199314117
    253. 22 31 10 250.00922775268

    In case its not clear: HH-mm-ss getTime().

    getTime() does seem to be OK, 4 minutes take 232 seconds, which is what the getTime() tells us and what I clocked on a stopwatch.

    I soldered on a new crystal (same batch) with these results. I'll check the other espruino..

  • Here is the other one, v1.65

    1. Running onInit()...
    2. 22 27 1 21.6793498992919921875
    3. 22 27 2 22.6577320098876953125
    4. 22 27 3 23.63539981842041015625
    5. 22 27 4 24.6135311126708984375
    6. 22 27 5 25.59200000762939453125
    7. 22 27 6 26.56999301910400390625
    8. 22 27 7 27.54819965362548828125
    9. 22 27 8 28.5260028839111328125
    10. 22 27 9 29.504459381103515625
    11. 22 27 10 30.48296642303466796875
    12. 22 27 11 31.460605621337890625
    13. 22 27 12 32.4389801025390625
    14. 22 27 13 33.4174594879150390625
    15. 22 27 14 34.39554691314697265625
    16. 22 27 15 35.373382568359375
    17. 22 27 16 36.35190486907958984375
    18. 22 27 17 37.33017826080322265625
    19. >["NONE","LSE","LSI","HSE"][((peek32(0x40021020)&768)>>8)]
    20. ="LSE"
    21. 22 27 18 38.30799102783203125
    22. 22 27 19 39.28640842437744140625
    23. 22 27 20 40.26471233367919921875
    24. 22 27 21 41.24311065673828125
    25. 22 27 22 42.220947265625
    26. 22 27 23 43.19915866851806640625
    27. 22 27 24 44.17764949798583984375
    28. 22 27 25 45.1553211212158203125
    29. 22 27 26 46.13389301300048828125
    30. 22 27 27 47.1121234893798828125
    31. 22 27 28 48.09015178680419921875
    32. 22 27 29 49.06807708740234375
    33. 22 27 30 50.04666805267333984375
    34. 22 27 31 51.024890899658203125
    35. 22 27 32 51.99732208251953125
    36. 22 27 33 52.96969318389892578125
    37. 22 27 34 53.9417438507080078125
    38. 22 27 35 54.91380405426025390625
    39. 22 27 36 55.88543605804443359375
    40. 22 27 37 56.85776805877685546875
    41. 22 27 38 57.8298473358154296875
    42. 22 27 39 58.8011150360107421875
    43. 22 27 40 59.7736797332763671875
    44. 22 27 41 60.7458362579345703125
    45. 22 27 42 61.7172794342041015625
    46. 22 27 43 62.68971729278564453125
    47. 22 27 44 63.66189670562744140625
    48. 22 27 45 64.63356304168701171875
    49. 22 27 46 65.6055278778076171875
    50. 22 27 47 66.57803249359130859375
    51. 22 27 48 67.5496959686279296875
    52. 22 27 49 68.52170467376708984375
    53. 22 27 50 69.493465423583984375
    54. 22 27 51 70.46565341949462890625
    55. 22 27 52 71.4378414154052734375
    56. 22 27 53 72.40976047515869140625
    57. 22 27 54 73.38159942626953125
    58. 22 27 55 74.3539581298828125
    59. 22 27 56 75.32599544525146484375
    60. 22 27 57 76.29769992828369140625
    61. 22 27 58 77.26997280120849609375
    62. 22 27 59 78.24228382110595703125
    63. 22 28 0 79.2143840789794921875
    64. 22 28 1 80.1859912872314453125
    65. 22 28 2 81.15838527679443359375
    66. 22 28 3 82.13042449951171875
    67. 22 28 4 83.10216045379638671875
    68. 22 28 5 84.07446765899658203125
    69. 22 28 6 85.04660129547119140625
    70. 22 28 7 86.0183620452880859375
    71. 22 28 8 86.99079799652099609375
    72. 22 28 9 87.96288013458251953125
    73. 22 28 10 88.93489551544189453125
    74. 22 28 11 89.9065151214599609375
    75. 22 28 12 90.87888813018798828125
    76. 22 28 13 91.85096645355224609375
    77. 22 28 14 92.822284698486328125
    78. 22 28 15 93.794811248779296875
    79. 22 28 16 94.76702117919921875
    80. 22 28 17 95.73899173736572265625
    81. 22 28 18 96.71039485931396484375
    82. 22 28 19 97.6830501556396484375
    83. 22 28 20 98.6552276611328125
    84. 22 28 21 99.62683391571044921875
    85. 22 28 22 100.59920978546142578125
    86. 22 28 23 101.5708065032958984375
    87. 22 28 24 102.54278850555419921875
    88. 22 28 25 103.5148906707763671875
    89. 22 28 26 104.48648929595947265625
    90. 22 28 27 105.4586944580078125
    91. 22 28 28 106.43090152740478515625
    92. 22 28 29 107.402645111083984375
    93. 22 28 30 108.374965667724609375
    94. 22 28 31 109.3471012115478515625
    95. 22 28 32 110.31902313232421875
    96. 22 28 33 111.2907810211181640625
    97. 22 28 34 112.263031005859375
    98. 22 28 35 113.23541259765625
    99. 22 28 36 114.20707225799560546875
    100. 22 28 37 115.179164886474609375
    101. 22 28 38 116.15148448944091796875
    102. 22 28 39 117.123111724853515625
    103. 22 28 40 118.09561920166015625
    104. 22 28 41 119.067718505859375
    105. 22 28 42 120.03966426849365234375
    106. 22 28 43 121.01142406463623046875
    107. 22 28 44 121.9838428497314453125
    108. 22 28 45 122.95589733123779296875
    109. 22 28 46 123.92756175994873046875
    110. 22 28 47 124.89993381500244140625
    111. 22 28 48 125.871959686279296875
    112. 22 28 49 126.843891143798828125
    113. 22 28 50 127.81539154052734375
    114. 22 28 51 128.7880573272705078125
    115. 22 28 52 129.7601871490478515625
    116. 22 28 53 130.73161220550537109375
    117. 22 28 54 131.70409107208251953125
    118. 22 28 55 132.676342010498046875
    119. 22 28 56 133.647891998291015625
    120. 22 28 57 134.6198272705078125
    121. 22 28 58 135.59224605560302734375
    122. 22 28 59 136.56395053863525390625
    123. 22 29 0 137.5361194610595703125
    124. 22 29 1 138.50775909423828125
    125. 22 29 2 139.4799404144287109375
    126. 22 29 3 140.45213985443115234375
    127. 22 29 4 141.42403125762939453125
    128. 22 29 5 142.39580821990966796875
    129. 22 29 6 143.36806964874267578125
    130. 22 29 7 144.34004116058349609375
    131. 22 29 8 145.31172847747802734375
    132. 22 29 9 146.283924102783203125
    133. 22 29 10 147.25627994537353515625

    Also not correct, yet it shows in the getTime(), same as my stopwatch.
    The first espruino is v1.67.

    It seems to be much worse after I upload the code and type save(). If I just upload the code and manually call onInit() it it better. Here is the manually called onInit of the 1.67:

    1. 22 27 1 62.04144763946
    2. 22 27 2 63.01845932006
    3. 22 27 3 63.99542236328
    4. 22 27 4 64.97240543365
    5. 22 27 5 65.94935226440
    6. 22 27 6 66.92637348175
    7. 22 27 7 67.90332508087
    8. 22 27 8 68.88040161132
    9. 22 27 9 69.85738754272
    10. 22 27 10 70.83437252044
    11. 22 27 11 71.81145000457
    12. 22 27 12 72.78848361968
    13. 22 27 13 73.76540756225
    14. 22 27 14 74.74249744415
    15. 22 27 15 75.71944808959
    16. 22 27 16 76.69649982452
    17. 22 27 17 77.67348861694
    18. 22 27 18 78.65042209625
    19. 22 27 19 79.62742900848
    20. 22 27 20 80.60446739196
    21. 22 27 21 81.58142375946
    22. 22 27 22 82.55840396881
    23. 22 27 23 83.53532123565
    24. 22 27 24 84.51234245300
    25. 22 27 25 85.48942184448
    26. 22 27 26 86.46641731262
    27. 22 27 27 87.44345855712
    28. 22 27 28 88.42042732238
    29. 22 27 29 89.39747524261
    30. 22 27 30 90.37452411651
    31. 22 27 31 91.35165119171
    32. 22 27 32 92.31992244720
    33. 22 27 33 93.28700923919
    34. 22 27 34 94.25407695770
    35. 22 27 35 95.22115898132
    36. 22 27 36 96.18831157684
    37. 22 27 37 97.15537548065
    38. 22 27 38 98.12246131896
    39. 22 27 39 99.08957481384
    40. 22 27 40 100.05665969848
    41. 22 27 41 101.02373504638
    42. 22 27 42 101.99077320098
    43. 22 27 43 102.95787715911
    44. 22 27 44 103.92503166198
    45. 22 27 45 104.89206600189
    46. 22 27 46 105.85916900634
    47. 22 27 47 106.82629871368
    48. 22 27 48 107.79339790344
    49. 22 27 49 108.76051902770
    50. 22 27 50 109.72761917114
    51. 22 27 51 110.69474792480
    52. 22 27 52 111.66183185577
    53. 22 27 53 112.62894058227
    54. 22 27 54 113.59606552124
    55. 22 27 55 114.56319427490
    56. 22 27 56 115.53030586242
    57. 22 27 57 116.49734687805
    58. 22 27 58 117.46439456939
    59. 22 27 59 118.43156623840
    60. 22 28 0 119.39883327484
    61. 22 28 1 120.36578750610
    62. 22 28 2 121.33287811279
    63. 22 28 3 122.30000400543
    64. 22 28 4 123.26710796356
    65. 22 28 5 124.23418426513
    66. 22 28 6 125.20124530792
    67. 22 28 7 126.16832637786
    68. 22 28 8 127.13538837432
    69. 22 28 9 128.10246276855
    70. 22 28 10 129.06960964202
    71. 22 28 11 130.03668880462
    72. 22 28 12 131.00378131866
    73. 22 28 13 131.97083473205
    74. 22 28 14 132.93795204162
    75. 22 28 15 133.90508079528
    76. 22 28 16 134.87220001220
    77. 22 28 17 135.83931541442
    78. 22 28 18 136.80638217926
    79. 22 28 19 137.77352046966
    80. 22 28 20 138.74057006835
    81. 22 28 21 139.70764160156
    82. 22 28 22 140.67482089996
    83. 22 28 23 141.64192008972
    84. 22 28 24 142.60910320281
    85. 22 28 25 143.57615947723
    86. 22 28 26 144.54324245452
    87. 22 28 27 145.51032924652
    88. 22 28 28 146.47754764556
    89. 22 28 29 147.44473648071
    90. 22 28 30 148.41178321838
    91. 22 28 31 149.37881755828
    92. 22 28 32 150.34591579437
    93. 22 28 33 151.31318759918
    94. >["NONE","LSE","LSI","HSE"][((peek32(0x40021020)&768)>>8)]
    95. ="LSI"
    96. 22 28 34 152.28048610687
    97. >["NONE","LSE","LSI","HSE"][((peek32(0x40021020)&768)>>8)]
    98. ="LSI"
    99. 22 28 35 153.24770450592
    100. 22 28 36 154.21473979949
    101. 22 28 37 155.18192100524
    102. 22 28 38 156.14902687072
    103. 22 28 39 157.11621379852
    104. 22 28 40 158.08322429656
    105. 22 28 41 159.05019569396
    106. 22 28 42 160.01736259460
    107. 22 28 43 160.98453330993
    108. 22 28 44 161.95175552368
    109. 22 28 45 162.91889667510
    110. 22 28 46 163.88599586486
    111. 22 28 47 164.85312747955
    112. 22 28 48 165.82012844085
    113. 22 28 49 166.78721332550
    114. 22 28 50 167.75431919097
    115. 22 28 51 168.72135639190
    116. 22 28 52 169.68845653533
    117. 22 28 53 170.65542411804
    118. 22 28 54 171.62252998352
    119. 22 28 55 172.58959102630
    120. 22 28 56 173.55673122406
    121. 22 28 57 174.52383327484
    122. 22 28 58 175.49096393585
    123. 22 28 59 176.45804309844
    124. 22 29 0 177.42534351348
    125. 22 29 1 178.39237117767
    126. 22 29 2 179.35943412780
    127. 22 29 3 180.32653617858
    128. 22 29 4 181.29371166229
    129. 22 29 5 182.26078987121
    130. 22 29 6 183.22798061370
    131. 22 29 7 184.19512653350
    132. 22 29 8 185.16219806671
    133. 22 29 9 186.12931823730
    134. 22 29 10 187.09645080566

    This one is LSI again, I don't know why... Time is spot - on though!

  • It seems to sometimes forget it is LSE. Sometimes when I plug it in, it says LSI, then I reset it (with the button) and it is LSE again. When it was LSI the timing was correct. Any ideas? Either I'm a sucky (though very consistent :)) solderer or something somewhere is wrong...

  • I think it can take a few seconds to switch over to LSE - the oscillator takes a while to stabilise and Espruino runs off of LSI until it has. If it fails to start the oscillator (note that you can't use C15 for anything as that is an oscillator pin) then it'll stay with LSI, so that could be what's happening in some cases?

    So you're saying that the time from getTime is always correct, but it's just the interval that isn't working properly? If so it'll be some issue with the Espruino firmware itself.

  • This is definitely some issue with Espruino... My guess is that when the intervals changed (with the 32 bit switch) something got messed up. I'll look into it and should hopefully get a fix in for the 1v68 version.

  • Ok, fixed. You can try out a pre-release build (once it has built) in an hour or so at:

    http://www.espruino.com/binaries/git/commits/b7e330060a3c0d7ff1fe56583cd0e57caa749849

    Just go there, copy the link address of the binary, and paste it into the 'advanced flasher' text box in the Web IDE's settings page.

  • Hi Gordon,

    Thanks for the fix! I'll wait for 1.68 before trying it out since I'll be on holidays anyway. Glad you found it so quickly!

    Regards

  • Post a reply
    • Bold
    • Italics
    • Link
    • Image
    • List
    • Quote
    • code
    • Preview
    • $ Donate
About

1.67 clock offset

Posted by Avatar for Alex @Alex

Actions