IEEE 802.15.4 subsystem
Sign in or create your account | Project List | Help
IEEE 802.15.4 subsystem Git Source Tree
Root/
| Source at commit c9e52c1978ed11ef9c404b381131b67703705fbb created 7 years 3 months ago. By Werner Almesberger, atusb/atusb.kicad_pcb: bring back component references | |
|---|---|
| 1 | Arbitrary-precision frequency counter |
| 2 | ===================================== |
| 3 | |
| 4 | Theory of operation |
| 5 | ------------------- |
| 6 | |
| 7 | The arbitrary-precision frequency counter counts clock cycles of a |
| 8 | frequency source that is assumed to be free from drift. It compares the |
| 9 | count with the host's system clock. If the system clock is synchronized |
| 10 | with an accurate NTP reference, measurements with arbitrarily high |
| 11 | accuracy can be obtained. |
| 12 | |
| 13 | In practice, this is limited by the the frequency source's drift and |
| 14 | the time one is willing to wait. If NTP maintains the system time |
| 15 | with an accuracy of +/- 100 ms, obtaining measurements with an |
| 16 | accuracy of +/- 1 ppm would take about 28 hours. |
| 17 | |
| 18 | Additional error sources, such as the round-trip time when requesting |
| 19 | a sample from the microcontroller, are also considered in the accuracy |
| 20 | calculation. |
| 21 | |
| 22 | The counter consists of a board based on a C8051F320 microcontroller |
| 23 | and the control software on the host. The microcontroller counts |
| 24 | events in a free-running 16 bit counter that is regularly read and |
| 25 | extended to 32 bits. The 32 bit counter is periodically queried by |
| 26 | the host. |
| 27 | |
| 28 | The microcontroller's counter can count at a frequency of up to 3 MHz. |
| 29 | (SYSCLK/4) |
| 30 | |
| 31 | In order to protect against transmission errors not detected by USB's |
| 32 | CRC, which are occur relatively often, each packet is protected by a |
| 33 | CRC-32 and an inverted copy of the payload. Corrupted packets are |
| 34 | rejected by the host. |
| 35 | |
| 36 | The 32 bit counter wraps around at most once very 21.8 ms. The 32 bit |
| 37 | counter wraps around at most every 1431 s. The host extends the 32 bit |
| 38 | counter to 64 bits, and calculates frequency and accuracy from the |
| 39 | count and the run time of the measurement application. |
| 40 | |
| 41 | |
| 42 | Performing a measurement |
| 43 | ------------------------ |
| 44 | |
| 45 | To perform a measurement, connect the CNTR board's probe input to the |
| 46 | clock source and then run the "cntr" application on the host. An |
| 47 | accuracy goal (in ppm) can be specified on the command line (see |
| 48 | below). |
| 49 | |
| 50 | The host polls the microcontroller every 100 ms and displays the run |
| 51 | time (in seconds), the measured frequency, and the accuracy achieved |
| 52 | so far. |
| 53 | |
| 54 | Measurements can be stopped by pressing ^C or by specifying an |
| 55 | accuracy goal. At the end, the total number of events counted and |
| 56 | communication statistics are displayed. |
| 57 | |
| 58 | |
| 59 | Updating the firmware |
| 60 | --------------------- |
| 61 | |
| 62 | The protocol revision and the build date of the firmware of the CNTR |
| 63 | board can be queried with "cntr -i". |
| 64 | |
| 65 | To update the firmware, run |
| 66 | cntr -r; sleep 1 && dfu-util -d 0x20b7:0xcb72 -D cntr.bin |
| 67 | |
| 68 | |
| 69 | Known issues (version 2 hardware) |
| 70 | --------------------------------- |
| 71 | |
| 72 | - the input circuit does not perform well. See ECN0006 for details. |
| 73 | - the MMCX connector is hard to solder because of its large thermal |
| 74 | capacitance and surface |
| 75 | - the lateral pads of the MMCX connector could be wider |
| 76 | - manufacturing tolerances can push the USB connector a bit inside |
| 77 | the board, making its signal pins overshoot the pads |
| 78 | - the ground fill under the LED causes a secondary cathode contact |
| 79 | (which is harmless on this case) |
| 80 | |
