Closed oscaropenness closed 4 years ago
I have the same issue. I have not even been able to execute the basic examples for HTCC-AB01 due to the error of the micros () function.
This appears to be a bug and really should be fixed for compatibility with the basics of the Arduino framework.
I have same problem
Also having the same issue with Lorawan example getting the error in Adafruit_NeoPixel.h and using a dallas DS18B20. I have Adafruit NeoPixel v1.3.5 installed.
In file included from C:\Arduino\hardware\CubeCell\ASR650x-Arduino\libraries\LoRa\src\LoRaWan_APP.cpp:3:0:
C:\Arduino\libraries\Adafruit_NeoPixel/Adafruit_NeoPixel.h: In member function 'boolean Adafruit_NeoPixel::canShow() const':
C:\Arduino\libraries\Adafruit_NeoPixel/Adafruit_NeoPixel.h:234:58: error: 'micros' was not declared in this scope boolean canShow(void) const { return (micros()-endTime) >= 300L; }
Just added two examples: micros and millis.
micros
The micros function uses the internal system ticker (48MHz timer), this timer of ASR6501 is not accurate, as tested, it has 1.7% error.
The delay in the example is 1000ms, ideally, the output value here should be 1000000.
But look at the printed time stamp, each print have 20 - 22ms error. It means the actual delay(1000);
spend 1020 - 1022ms. Because the delay uses internal system ticker too.
So the error is (1020000 - 1002735) / 1020000 ≈ 1.7%
That’s why I didn’t use system ticker for LoRaWAN operations. Another problem is the system ticker can’t run during the deep sleep period, wake up from deep sleep will make the micros back to 0.
millis
The millis function uses external 32.768KHz RTC clock, it a very accurate timer, and can run during the deep sleep period. As the picture has shown, it’s the same with the delay time.
But the minimum period is 1/32768 ≈ 30us
, can’t be the source of micros.
This problem also talk here: http://community.heltec.cn/t/cubecell-micros-function/985/3
For using ultrasonic sensors, accurate (microsecond) time measurements are necessary. The
micros()
function seems currently not implemented in the board definition for the ArduinoIDE. Using the implementedmillis()
function is unfortunately not precise enough.Can the
micros()
function be implemented inArduino.h
as well?