Use the
function in
esp_mesh.h (
https://github.com/espressif/esp-idf/bl ... sh.h#L1515), it's way faster (<1us).
Here's a console log of 25 consecutive TSF timestamp readouts using the mesh-lib function:
Code: Select all
␛[0;32mI (8884) SyncTSF: <------------------- TIMESTAMP LOG START ------------------->␛[0m
␛[0;32mI (8884) SyncTSF: TSF Timestamp idx 0: 740327222␛[0m
␛[0;32mI (8884) SyncTSF: TSF Timestamp idx 1: 740327227␛[0m
␛[0;32mI (8884) SyncTSF: TSF Timestamp idx 2: 740327228␛[0m
␛[0;32mI (8894) SyncTSF: TSF Timestamp idx 3: 740327229␛[0m
␛[0;32mI (8894) SyncTSF: TSF Timestamp idx 4: 740327230␛[0m
␛[0;32mI (8904) SyncTSF: TSF Timestamp idx 5: 740327231␛[0m
␛[0;32mI (8904) SyncTSF: TSF Timestamp idx 6: 740327231␛[0m
␛[0;32mI (8914) SyncTSF: TSF Timestamp idx 7: 740327232␛[0m
␛[0;32mI (8914) SyncTSF: TSF Timestamp idx 8: 740327233␛[0m
␛[0;32mI (8924) SyncTSF: TSF Timestamp idx 9: 740327234␛[0m
␛[0;32mI (8934) SyncTSF: TSF Timestamp idx 10: 740327235␛[0m
␛[0;32mI (8934) SyncTSF: TSF Timestamp idx 11: 740327236␛[0m
␛[0;32mI (8944) SyncTSF: TSF Timestamp idx 12: 740327237␛[0m
␛[0;32mI (8944) SyncTSF: TSF Timestamp idx 13: 740327238␛[0m
␛[0;32mI (8954) SyncTSF: TSF Timestamp idx 14: 740327238␛[0m
␛[0;32mI (8954) SyncTSF: TSF Timestamp idx 15: 740327239␛[0m
␛[0;32mI (8964) SyncTSF: TSF Timestamp idx 16: 740327240␛[0m
␛[0;32mI (8964) SyncTSF: TSF Timestamp idx 17: 740327241␛[0m
␛[0;32mI (8974) SyncTSF: TSF Timestamp idx 18: 740327242␛[0m
␛[0;32mI (8974) SyncTSF: TSF Timestamp idx 19: 740327243␛[0m
␛[0;32mI (8984) SyncTSF: TSF Timestamp idx 20: 740327244␛[0m
␛[0;32mI (8984) SyncTSF: TSF Timestamp idx 21: 740327245␛[0m
␛[0;32mI (8994) SyncTSF: TSF Timestamp idx 22: 740327245␛[0m
␛[0;32mI (9004) SyncTSF: TSF Timestamp idx 23: 740327246␛[0m
␛[0;32mI (9004) SyncTSF: TSF Timestamp idx 24: 740327247␛[0m
␛[0;32mI (9014) SyncTSF: <-------------------- TIMESTAMP LOG END -------------------->␛[0m
--- exit ---
And here is the same using the WiFi-lib function:
Code: Select all
␛[0;32mI (8914) SyncTSF: <------------------- TIMESTAMP LOG START ------------------->␛[0m
␛[0;32mI (8914) SyncTSF: TSF Timestamp idx 0: 1143745768␛[0m
␛[0;32mI (8914) SyncTSF: TSF Timestamp idx 1: 1143745870␛[0m
␛[0;32mI (8924) SyncTSF: TSF Timestamp idx 2: 1143745952␛[0m
␛[0;32mI (8924) SyncTSF: TSF Timestamp idx 3: 1143746034␛[0m
␛[0;32mI (8934) SyncTSF: TSF Timestamp idx 4: 1143746116␛[0m
␛[0;32mI (8934) SyncTSF: TSF Timestamp idx 5: 1143746198␛[0m
␛[0;32mI (8944) SyncTSF: TSF Timestamp idx 6: 1143746280␛[0m
␛[0;32mI (8944) SyncTSF: TSF Timestamp idx 7: 1143746362␛[0m
␛[0;32mI (8954) SyncTSF: TSF Timestamp idx 8: 1143746444␛[0m
␛[0;32mI (8954) SyncTSF: TSF Timestamp idx 9: 1143746527␛[0m
␛[0;32mI (8964) SyncTSF: TSF Timestamp idx 10: 1143746609␛[0m
␛[0;32mI (8964) SyncTSF: TSF Timestamp idx 11: 1143746691␛[0m
␛[0;32mI (8974) SyncTSF: TSF Timestamp idx 12: 1143746773␛[0m
␛[0;32mI (8974) SyncTSF: TSF Timestamp idx 13: 1143746855␛[0m
␛[0;32mI (8984) SyncTSF: TSF Timestamp idx 14: 1143746937␛[0m
␛[0;32mI (8994) SyncTSF: TSF Timestamp idx 15: 1143747019␛[0m
␛[0;32mI (8994) SyncTSF: TSF Timestamp idx 16: 1143747101␛[0m
␛[0;32mI (9004) SyncTSF: TSF Timestamp idx 17: 1143747183␛[0m
␛[0;32mI (9004) SyncTSF: TSF Timestamp idx 18: 1143747266␛[0m
␛[0;32mI (9014) SyncTSF: TSF Timestamp idx 19: 1143747348␛[0m
␛[0;32mI (9014) SyncTSF: TSF Timestamp idx 20: 1143747438␛[0m
␛[0;32mI (9024) SyncTSF: TSF Timestamp idx 21: 1143747520␛[0m
␛[0;32mI (9024) SyncTSF: TSF Timestamp idx 22: 1143747602␛[0m
␛[0;32mI (9034) SyncTSF: TSF Timestamp idx 23: 1143747684␛[0m
␛[0;32mI (9034) SyncTSF: TSF Timestamp idx 24: 1143747766␛[0m
␛[0;32mI (9044) SyncTSF: <-------------------- TIMESTAMP LOG END -------------------->␛[0m
Note however, that the mesh function will only read the STA MAC's TSF-timer value. So to use this function with an AP, you'd either have to put it in APSTA mode and use the STA's TSF-timer for synchronization or you find a way to start the STA TSF-timer without the STA actually running.