Skip to content

Instantly share code, notes, and snippets.

View vvb333007's full-sized avatar
🤙

Slava Logunov vvb333007

🤙
View GitHub Profile
@vvb333007
vvb333007 / micros.ino
Created May 26, 2026 13:56
Undocumented counters on ESP32-S3
// ESP32-S3 Microsecond Counters: 32/64-bit, read/write
// 4 full 64bit usec counters (read/write) and one 32 bit freerunning counter
//
// Two ways to get a microsecond timestamp:
//
// 1. Very fast, but returns only the lower 32 bits
// 2. Full 64-bit timestamp, slightly slower
//
// For simplicity, this example uses the Arduino framework.
//
@vvb333007
vvb333007 / gist:d3ef7e1fce628507ae2ceb92bd8aea0c
Created May 19, 2026 03:18
32bit and 64bit microseconds counters on ESP32-S3. Undocumented.
// Example for ESP32-S3: two ways to read a microsecond timestamp.
//
// 1. Very fast, but returns only the lower 32 bits
// 2. Full 64-bit timestamp, slightly slower
//
// For simplicity, this example uses the Arduino framework.
//
// vvb333007@gmail.com
//
//
@vvb333007
vvb333007 / di.S
Last active May 29, 2026 05:49
ESP32 / ESP32-S2 / ESP32-S3 hardware debugging features and how to use them in your own sketches.
// Intercept DebugInterrupt and call a handler written in C (Xtensa, windowed ABI)
//
// Interrupt handlers for levels 4, 5, 6 and 7 must be written in assembly.
// This is because the system does not invoke them like a regular C function.
// This file contains an assembly adapter that calls regular C code.
//
#ifdef __XTENSA__
#include <xtensa/coreasm.h>