# FPGA-Based Manchester Decoder for IEEE 802.15.7 Visible Light Communications
## 2 Architecture of the Receiver
### The Synchronization of the Receiver  
The problem of transmitter-receiver synchronization is well known in the field, and several techniques have been proposed in the literature [32]. As anticipated, the receiver has no a priori knowledge on where the borders of the bits are located along the incoming data sequence. It is necessary to implement some mechanism that finds the positions of the borders and maintains the sequence dynamically synchronized. In fact, even if the transmitter and receiver share the same nominal communication rate, unavoidable differences on their local oscillators make the calculation of the timings in the two apparatuses not perfectly equal. The result is that, without correction, the time-markers of the receiver are likely to accumulate a phase error with respect to the data produced by the transmitter, Moreover, this phase error increases in time and eventually prevents a correct communication [15]. In this application, we use the phase \(\varphi\), calculated by (7), to locate the bit boundaries at the start of the transmission, and then to dynamically maintain the right position during the remaining part of the communication. To better understand the process, let us imagine that the receiver places the tentative borders of the bit like depicted in Figure 2 (red-dashed lines). In this example the bit transmitted has a '0' value and the tentative bit-slice is placed with a phase error \(\varphi_{e}\). The error can be due to noise on the signal or simply because this is the first transmitted bit, and thus the receiver has no history to help in locating the right position. The data-slice delimited by the red interval is processed for phase calculation as detailed in the previous sections. In this condition, from (7), the resulting phase \(\varphi\) is not \(90^{\circ}\) like it should be ideally for the '0' value of the bit (see Table 2), but it results around \(\varphi=-150^{\circ}\). This info is precious for the receiver that can calculate the phase error: \(\varphi_{e}=-150^{\circ}-90^{\circ}+180^{\circ}=-60^{\circ}\). Now the receiver knows that the borders were placed with a delay of \(60^{\circ}\). Thanks to this knowledge, the error is corrected, and the next bit can be located with much higher accuracy, as shown in Figure 2. From now on the receiver is synchronized and dynamically maintains the lock by correcting the error \(\varphi_{e}\) at every step. At this point the error is due only to the noise on the signal, and the receiver maintains the synchronization as long as the SNR is sufficiently high. It should be noted that in the example of Figure 2, the last samples of the red slice (1 st tentative bit) are used in the calculation of the phase (7) for the 1 st bit, and, after the correction, are used again in the calculation of the phase for the 2 nd bit. Similarly, it happens that when the error is positive (advance tentative position), some samples are not used at all. The example of Figure 2 can be extended to analyze the general condition. Figure 3 shows how the phase \(\varphi\) calculated by (7) changes according to the phase error \(\varphi_{e}\). The graph reports the cases for bit of value '0' and '1'. \begin{table}
\begin{tabular}{c c c c c} \hline \hline
**BIT** & **Symbols** & **I** & **Q** & **Phase** \\ \hline
0 & 01 & 0 & +2A & \(+90^{\circ}\) \\
1 & 10 & 0 & \(-2\)A & \(-90^{\circ}\) \\ \hline \hline \end{tabular}
\end{table} 
Table 2: Values of _I, Q,_ and phase for an ideal Manchester signal of \(\pm\)A levels. Figure 2: The receiver tentatively places the borders of the first bit in the position delimited by the red-dashed segments. The phase error with respect to the true bit is calculated and used to correct the border positions (magenta dashed lines) for the 2 nd bit. Given a phase \(\varphi\), Table 3 summarizes the decision about the bit value and the estimation of the error \(\varphi_{e}\) to be used in the positioning of the next bit-slice.