====== Exercise: Making the system robust against disturbances ====== In the next step, the receiver need to be more robust against errors. An error will occur, if an RSSI is detected, but no packet was transmitted. Another reason for an error could be, if not our transmitter has transmitted the packet, but an unknown sender. In these two cases, the receiver will not recognize the sync word and our program will be blocked. But this is not the only error that could happen: The receiver will wait for the number of bytes, that is written in the length field of the packet. But, if the length field is corrupted, the number of bytes can be larger, than the number of bytes of the packet. If this happened the receiver will wait for ever. Both kind of error can be avoided by timers. In the first case, if no sync work will be received, there will be no data in the FIFO. An also, if the length field is too large, the FIFO becomes empty and will remain empty. Therefore a solution of the problem could be, that after some time, there must be some data in the FIFO. If not, the frame reception can be aborted. In this lesson, you should control data reception be timers. It is up to you, how timers will be implemented. Timers could be simple implemented by software loops incrementing a variable, by delay functions or by interrupt service routines. ===== 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:scanning|Exercise: Scanning the channel and packet reception]]. * Extend your program to control packet reception by timers. * For testing, start your program and use the same test scenarios used by [[network_protocol_programming_lab:scanning|Exercise: Scanning the channel and packet reception]]. * If an error occurs, your program should continue receiving packets. Perhaps some data will be lost, but receiving continues. ===== Hints ===== * Pay attention on the timer values: The time waiting for data within a packet is normally shorter than waiting for the first payload byte. The time waiting for the first payload byte of the packet includes some preamble bits (but maybe not all) and the sync word bits. Whereas the time between two bytes within the packet is exactly 8bit plus some overhead.