====== Exercise: Scanning faster ====== In this lesson, we are finishing the receiver. The maximum number of channels that could be scanned is limited. Scanning could only be successful, if the actions that are required to be done does not exceed the length of the preamble. E.g Times, that has to be taken into account are: * the time needed to switch from idle state to receive state and vice versa (e.g. $50\mu s$), * the time to measure the RSSI (e.g. $990\mu s$), * the time to read or write the registers of CC1200 (SPI overhead e.g. $60\mu s$), * the time to perform a strobe command (SPI overhead e.g. $140\mu s$), * and for sure the processing time of the Beaglebone Black. Summing up the time will get a minimum time required of $1.18 ms$. In contrast, the time of a single bit will be $0.83 ms$. This means at liest 2 bits are needed to recognize a frequency. This computation neglects the processing time of the Beaglebone Black and is only a rough estimate. The numbers are taken from Texas Instruments. The question that arises is: What can be done to speed up the scanning process ? If the scanning is faster, the baude rate can be higher or assuming the same baud rate, the preamble could be shorter to support the same number of channels. The answer could be to look deeper at the scanning process: Changing the frequency need every time a calibration of the Voltage Controlled Oscillator (VCO). Calibration means, that the VCO must be re-configured. Calibration is done normally every time leaving the idle state and switching to receiving or transmitting state. The calibration overhead is included in the measured SPI overhead. To fasten calibration, CC1200 offers a pre-calibration mode. Pre-calibration means, that you select a frequency by programming the FREQ registers. Afterwards you instruct a manual calibration by performing the SCAL strobe command. The SCAL strobe instructs the CC1200 to do a calibration of the VCO by the selected frequency. If the calibration is done (CC1200 is back in idle state) the result of the calibration is sorted in the FS_CHP, FS_VCO4 and FS_VCO2 registers. This means, whenever you like to jump to a frequency, just program the FREQ registers and the three mentioned register in idle state and jump to receive or transmit state without calibration. This only works, if automatic calibration has been disabled in the SETTLING_CFG register. Doing this will reduce the SPI overhead from $140\mu s$ to approximately $60\mu s$ and the over-all processing time to $1.1 ms$. Remark: The reason of using auto calibration is, that the calibration process is dependent from temperature changes. Without auto-calibration it could happen, that sender and receiver get out of synchronization. Therefor pre-calibration is needed from time to time. ===== Requirements ===== This task requires * a ready BeagleBone Black equipped with the CC1200. * 4C attached to a second BeagleBone Black equipped with the CC1200. * 4C sending packets with a symbol rate of 1.2 kBaude and a preamble count of 6 Bytes. ===== Tasks ===== * the programming is done by extending the source files from the previous lesson [[network_protocol_programming_lab:robust|Exercise: Making the system robust against disturbances]]. * Extend your program by pre-calibration. * For testing, start your program and use the same test scenarios used by [[network_protocol_programming_lab:robust|Exercise: Making the system robust against disturbances]]. * To open the possibility to test, that pre-calibration is really faster than auto-calibration, make sure, that both calibration methods can be enabled and disabled. ===== Hints ===== * First disable auto-calibration. If using the tree frequencies recommended, no packet reception should be possible. * After pre calibration and loading the calibration registers, packet reception will be possible.