Chameleon Ultra crystal oscillator offset
Measure how fast or slow your Chameleon Ultra's 32 MHz crystal runs, against internet time.
- 1Connect
- 2Measure
- 3Result
Connect your Chameleon Ultra
Plug your CU in to USB, not Bluetooth, and close anything else using it, such as the CU app or the Python CLI. This browser-based tool requires Chrome or Edge on a computer. See below for alternative options.
Keep this tab open in the foreground with the computer awake, stay on the same network, and keep the CU away from readers.
starting
–Measuring needs the test firmware: stock v2.3.0 plus a crystal tick counter (source). Chameleon Ultra only, not Lite. Flashing keeps your slots and saved cards. When you're done, flash stock v2.3.0 back, or use "Flash a file" for another application DFU package (a .zip). The FSK self-trim test firmware has the counter too: if your CU is on it, measure without flashing.
Measurement details
This computer relative to the time servers
About this plot
Each dot is one request to a time server and shows how far this computer's clock has moved relative to that server since the start of the run. The line only uses the fastest requests (blue for Akamai, orange for Cloudflare), and its slope shows the overall rate at which the computer's clock is moving away from internet time. A line falling 1 ms over 5 minutes means the computer's clock runs 3.3 ppm slow.
CU relative to this computer
About this plot
Each dot is one reading from the CU's crystal tick counter and shows how far the CU's clock has moved relative to this computer since the start of the run. The slope shows how quickly the crystal is moving away from this computer's clock, and the scatter represents USB delays. The crystal's true offset (how fast or slow it runs in absolute terms) is this plot's slope plus the computer clock's slope from the other plot.
Command line (Python script)
hfxo_ntp.py performs the same measurement using NTP. It also needs the test firmware.
curl -LO https://mfcarroll.github.io/rfid-test-tools/chameleon/crystal/hfxo_ntp.py uv run hfxo_ntp.py /dev/tty.usbmodemXXXX
uv installs pyserial automatically.
curl -LO https://mfcarroll.github.io/rfid-test-tools/chameleon/crystal/hfxo_ntp.py pipx run hfxo_ntp.py /dev/tty.usbmodemXXXX
pipx installs pyserial automatically.
curl -LO https://mfcarroll.github.io/rfid-test-tools/chameleon/crystal/hfxo_ntp.py pip install pyserial python3 hfxo_ntp.py /dev/tty.usbmodemXXXX
On macOS or Linux (on Linux the port is usually /dev/ttyACM0).
curl.exe -LO https://mfcarroll.github.io/rfid-test-tools/chameleon/crystal/hfxo_ntp.py py -m pip install pyserial py hfxo_ntp.py COM5
In PowerShell or the Command Prompt.
Options
For developers
The test firmware adds command 3125 to the CU's protocol, a tick
counter for the crystal-driven 16 MHz clock (branch feat/hfxo-count).
- It takes one byte: 0 starts the counter and holds the crystal on, 1 reads it, 2 stops it.
- The reply is 20 bytes, big-endian: u64 ticks, u32 timer overflows, u32 raw timer value, u16 lapses (times the crystal was released while counting), u8 running, u8 crystal on now.
- A run with any lapse is rejected: LF activity can release the crystal, so keep the CU away from readers while measuring.