Expand description
The counter a concentrator stamps packets against.
Every packet the chip hears carries the value of a counter running at 32 MHz, and every packet the chip sends at a chosen moment is given a value of that same counter. It is what a receive window is measured against, so a gateway that answers an uplink is really doing arithmetic on this counter and nothing else.
Two things make it harder than reading a number. The counter is 27 bits wide, so it rolls over about every two minutes, and the chip does not say how many times it has. A reader therefore keeps a little state: the last value it saw and how many times it has seen the count go backward. A packet is widened against that same state, and the rule is not the same one, because a packet whose count is above the last reading was heard before the most recent rollover rather than after it.
Nothing here reads a register. The bytes come from one burst and this turns them into a counter, so the arithmetic can be checked without hardware.
Structs§
- Counter
- Both counters a concentrator keeps.
- Tracked
- One counter, and what is known about how often it has rolled over.
Constants§
- COUNTERS
- Where both counters are read from, in one burst.
- COUNTERS_
LEN - How many bytes that burst carries: four for each counter.
- COUNTER_
BITS - How many bits the counter actually holds.
- TICKS_
PER_ US - How many ticks of the counter make a microsecond.
- WRAPS
- How many rollovers are counted before the count itself repeats.
Functions§
- disagrees
- Whether a second reading of the counters disagrees with the first.