Closed
Description
Hardware:
Board: Heltec WiFi LoRa v2
Core Installation version: 1.0.4
IDE name: Arduino IDE
Flash Frequency: 80Mhz
PSRAM enabled: no
Computer OS: Windows 10
Description:
I am trying to get exact timing information on a Heltec WiFi LoRa v2 and FSK modulated signals.
For accuracy reasons i switched to timerBegin() / timerRead().
After switching I realized that my channel hopping code was not working properly anymore.
Did a lot of debugging and found out that timerRead() always returns the previous timer value, the value that i expected from the previous call.
Executing timerRead() twice (!) gives the exact timer value i expected.
Sketch:
void setup()
{
Serial.begin(115200);
hw_timer_t *timer_distance = timerBegin(2, 80, true);
uint64_t timestamp1 = timerRead(timer_distance);
delay(111);
uint64_t timestamp2 = timerRead(timer_distance);
delay(555);
uint64_t timestamp3 = timerRead(timer_distance);
delay(457);
uint64_t timestamp4 = timerRead(timer_distance);
uint64_t timestamp5 = timerRead(timer_distance);
Serial.printf("1 to 2: %6u - expected 111000\n", timestamp2 - timestamp1);
Serial.printf("2 to 3: %6u - expected 555000\n", timestamp3 - timestamp2);
Serial.printf("3 to 4: %6u - expected 457000\n", timestamp4 - timestamp3);
Serial.printf("4 to 5: %6u - expected 0\n", timestamp5 - timestamp4);
}
void loop()
{
}
Messages:
1 to 2: 14 - expected 111000
2 to 3: 110841 - expected 555000
3 to 4: 555000 - expected 457000
4 to 5: 457000 - expected 0
Metadata
Metadata
Assignees
Labels
No labels