## 5 Software of Near-Field Based Communication for the WPT System
On the receiver side, the phase shift due to the synchronization position drift can, therefore, be estimated. For the WPT part, the synchronization position is compensated for via the estimated time shift, which avoids the coil misalignment resulting from a synchronization position offset. For the communication part, the phases of all subcarriers in the calibration stage can be used as phase references in the demodulation for the upcoming symbols. Therefore, the coil misalignment will not affect the bit decision later with the data symbols. Symbol 2 is reserved for informing the receiver side about the WPT-related status of the transmitter side. In this work, 2 bits were used to indicate the power transfer status:  
* \"00\": the active side (referring to the NFC transmitter) is not ready for WPT;
* \"01\": the active side is only ready for forward WPT;
* \"10\": the active side is only ready for reverse WPT;
* \"11\": the active side is ready for both directions of WPT. The next four symbols are reserved for the transmission of the WPT control parameters on the receiver side. In this work, up to 60 subcarriers can be used, each modulated via BPSK. The communication system was tested with four and eight subcarriers, for which the achieved data rates were 0.66 Mbsp and 1.32 Mbsp, respectively. The four-subcarrier-version achieved better SNR than the eight-subcarrier-version because the available amplitude of each subcarrier that equaled the maximal DAC voltage range divided by the number of subcarriers was greater. To achieve high tuning resolution in the duty cycle and phase offset, two symbols (8 bits or 16 bits) were reserved for each control parameter. The timing diagram in Figure 10 shows one complete tuning process. The active side's control parameters are unchanged, and the maximum value of the sawtooth signal determines the active side-switching frequency. The blue and red lines are control thresholds together with extra flip-flops, and the two gate signals of both high-side MOSFETs on two half-bridges are generated. As a result, the distance between the blue and red lines determines the duty cycle of the resulting voltage wave, which is illustrated in the second row. The NFC signal is modulated and transmitted simultaneously with the gate signal generation; thus, the passive side's WPT synchronization and control parameters are updated, which is shown in the middle of the figure. Figure 10: Timing diagram of the WPT gate signal modulation and the communication-based control parameter tuning process of both sides. In the beginning of the sawtooth signal that is modulated on the passive side via its onboard crystal, a slight phase drift referring to the primary sawtooth signal is illustrated. The phase drift is due to the frequency tolerance of two crystal oscillators on both sides. Therefore, the synchronization signal is applied periodically to reset the passive side counter (i.e., the sawtooth signal), which is marked with the blue star. During the stage of control parameter adjusting, the blue and red lines are adjusted correspondingly to achieve the required duty cycle and phase of the passive side.