A Novel Communication Method using PWM and Capture Function of DSP for Parallel Controlled Power Electronics Systems

Parallel operation by multiple power converters is typical in microgrids. The communication method for parallel control mainly applies MODBUS RTU (Remote Terminal Unit), and the control performance largely depends on the communication speed. This paper proposes a new communication method that enables fast and accurate communication between master and slave systems combined in parallel using the PWM and capture functions of DSP used as the power converter controller. In the proposed communication method, the transmitting side uses the PWM function of DSP to generate a pulse waveform whose pulse width changes according to the reference command and transmits it to the receiving side. Suppose the capture function of the receiving side DSP is set to the time difference rising and falling edge mode. The set event occurs when the capture signal is detected and initializes the counter value to zero. At this time, it detects the counter signal and receives data. We explain the proposed communication method’s principle, characteristics, and noise-canceling method and evaluate the accuracy and stability through data transmission and reception experiments. Finally, three 10kW single-phase electronic loads are connected to the R, S, and T phases to form a three-phase electronic load, and a master and two slaves are designated. The validity of the proposed communication method is verified through the current control response according to the command.

communication is explained in detail. Also, a method for removing noise from communication data is introduced. Section 4 proves the validity of the proposed communication method experimentally. The primary communication state is verified, and the way of compensating for communication delay is verified experimentally. Finally, by using a threephase electronic load system, the experiment proves that the master and slave power converters are accurately controlled by the proposed communication method.

A. MODBUS PROTOCOL
MODBUS is a protocol for client-server communication between devices connected to the network. Since it is connected using a communication line bus or connected in a parallel structure with other types of network devices, it is the most commonly used communication method in the industrial field [12]. The transmission mode of MODBUS is divided into two transmission modes: RTU (Remote Terminal Unit) and ASCII, according to the data encoding method as shown in Fig. 1. In RTU mode, it transmits data in the form of an 8-bit binary. In ASCII mode, communication time is longer than in RTU mode because it divides each character by 4-bit and transmits in the form of two characters. Therefore, ASCII mode is advantageous for communication methods to check errors or view data values, and the industrial field widely uses RTU mode because of its good transmission efficiency.

B. MODBUS FUNCTION CODE
The MODBUS function code is divided mainly according to the data access unit and the read/write function, as given in Table I. resistance of the transmission line and transfer the reference to each master-slave power conversion system. Therefore, the function codes used are 03(0x03), 04(0x04), 06(0x06), and 10(0x10). (0x03) Read Holding Registers: As a command to read the read/write-enabled word memory area, the memory allocated to the Read Holding Register represents the memory for module setting (module ID, communication setting, etc.) and output. Read Holding Register should check analog output command status and module communication setting status. The maximum length of register 0x03 is 125 words. (0x04) Read Input Register: This is a command to read the word input memory area. To read an analog input, we must use the 0x04 function. The Read Input Register memory area is not writable. Be careful if we try to write to the Read Input Register area because data is written to the Holding Register area of the same address. The maximum length of the register is 125 words. (0x06) Write Single Register: This command is used to change data for one word of Holding Register. This function is used when outputting digital output in word units or resetting communication ID.
(0x10) Write Multiple Register: Holding Register command is used to change several words simultaneously in the memory area. This function is proper when changing four analog output channels simultaneously. The maximum length of the register is 120 words. Fig. 2 shows each data frame for request and response of the 0x03 function code. A data frame is a request to read 3 data starting from address 0x6B (decimal number 107). Slave's unique ID (1Byte), function code (0x03), upper 1 Byte (8bit), lower 1 Byte (8bit) of the start address of the data to be read from the slave, the upper 8 bits of the number of data to be read from the start address of the slave memory area. It is defined in the order of CRC (Cyclical Redundancy Checking/2Byte) calculated from the lower 8 bits, the slave ID to the lower 1 Byte of the number of data. The response frame consists of the slave's unique ID (1Byte), the function code (0x03), the Byte size (0x06) of the response data according to the number of three requested data, and the start address of the receiver corresponding to the start address 0x6B of the requested data: 108~110. It responds up to the data value (0x02, 0x2B, 0x00, 0x00, 0x00, and 0x64) stored in the upper and lower 1 Byte of each data up to the address, and the 2 Byte CRC value is calculated from the Byte size of the response data to the lower data of the last address. The data frame for each request and response of function codes 0x04, 0x06, and 0x10 appear similar to 0x03.

2) CYCLICAL REDUNDANCY CHECKING (CRC)
Various error detection methods have been studied and applied to reduce the error rate during communication [13]- [19].

III. PROPOSED PWM-CAPTURE FUNCTION BASED BIDIRECTIONAL COMMUNICATION
The bidirectional communication proposed in this paper differs from the existing communication method in that it uses the PWM and Capture functions of the DSP (Digital signal processor). Instead of using PWM as a switching signal, it is used to express the size of the data using the width of the pulse, and it is used together with the Capture function to enable bidirectional communication.

A. HOW TO GENERATE PWM IN DSP
The PWM signal consists of duty D, frequency f, and period T to express the width of the pulse, and the magnitude of the signal is divided into High(1) and Low(0) PWM pulses. In Fig. 3(a), the duty ratio D represents the signal's ON interval expressed as a pulse in PWM. It means that the magnitude of the signal is significant as the duty ratio D is closer to 100[%]. In this paper, the duty ratio D of the PWM signal is expressed as a counter value for the pulse width using the capture function of the DSP to detect the data size and use it as a reference signal and communication data for control of a parallel-connected power conversion system. As shown in Fig. 3(b), in order to generate PWM, the timer/counter function inside the DSP is used. The pulse width of the PWM signal is adjusted by setting the maximum value (period) and comparison setting value (compare) of the timer. The maximum counter value set in DSP with a 16-bit timer is 65535 (0xFFFF). Any value between 0 and 65535 can be set as the pulse width period to generate the desired PWM frequency. The timer is reset to zero when the maximum counter value is reached to the set frequency. Repeating this generates a counter value in the form of a triangular wave, as shown in Fig. 3(b). The pulse width (duty ratio, D) that determines the size of the PWM signal is made through the generated counter value corresponding to 0~1500 and the comparison setting value (compare). The PWM output pin maintains Low when the timer counter value is smaller than the comparison setting value. When it is greater than the comparison setting value, it maintains High. According to the PWM generation mode, High and Low signal conditions can be changed.

B. SIGNAL DETECTION METHOD USING DSP'S CAPTURE FUNCTION
The capture function of DSP is to detect the time information of the pulse signal. Period (duty) is measured by the time between the edge of the input pulse detected through the counter. Also, by generating an interrupt at the edge of the pulse, it is possible to control it by synchronizing it with the edge of an external signal. eCAP, the Capture function of TI's TMS320F28X series used in this paper, has four modes: Absolute time-stamp rising edge mode, Absolute time-stamp rising and falling edge mode, Time difference (delta) rising edge mode, and Time difference (delta) rising and falling edge mode.
The time difference (delta) rising and falling edge mode shown in Fig. 4 detects both the rising edge and the falling edge of the input signal. Using the counter reset when CEVTx occurs, the period and width of each pulse can be detected. When CEVTx occurs at the edge, the counter is automatically reset to zero, so the period and frequency of each pulse by the capture counter are as follows.
In this paper, the communication data uses the duty corresponding to the PWM pulse's ON interval to control the power conversion system. First, the transmitting side generates a pulse waveform whose pulse width is changed according to the reference command of PWM, and this signal is applied as a capture input signal of the receiving side through a communication line. Suppose the capture function on the receiving side is set to Time difference (delta) rising and falling edge mode. The counter signal is detected while initializing the set event occurrence to zero when the capture signal is detected. In this paper, Capture event 1 and Capture event 2 are applied, event 1 is set to occur at the rising edge of the pulse signal, and event 2 occurs at the falling edge of the pulse signal. Therefore, the Capture counter is reset to zero at the rising edge where the PWM pulse becomes ON and at the falling edge when the PWM pulse becomes OFF. The counter value of the PWM ON section received through the Capture function is determined as (3).
Here, Cap 1 and Cap 2 are count_value_register. When the pulse width of the transmitting side defined by (3) is transmitted to the receiving side, the counter value is detected using the capture function of the receiving side, and the detected signal is used as each data for system control. Fig. 6 shows the configuration of bidirectional communication using PWM and Capture functions of DSP. Depending on the number of channels of PWM and Capture, both halfduplex and full-duplex are possible. Fig. 6(a) shows that half-duplex communication is possible using each PWM-Capture channel of Master and Slave. However, since data transmission and reception are not performed simultaneously, an enable signal is used to distinguish transmission and reception operations. In the case of Fig. 6(b), using two channels of PWM and Capture functions in the Master and Slave, it is possible to implement a full-duplex communication method that can transmit and receive simultaneously. In this case, there is no need for an enabled signal to distinguish between transmission and reception. The MODBUS communication method will be described based on TMS320F28335, TI's DSP mainly used for power conversion systems. The clock speed of the TMS320F28335 is 150MHz. At this time, the data transmission speed of MODBUS can be used up to 1Mbps.  When using the CPU clock of 150MHz, the counter value for 8-bit data transmission is 256. As shown in Fig. 7(a), when the same type of communication frame as the MODBUS protocol is applied, the data transmission rate is about 64μs. If this is transmitted in the form of a PWM signal expressed in 256 counter values with 8-bit data based on the system clock of 150MHz, about 13.6μs of data transmission time is required, as shown in Fig. 7

D. DATA GENERATION METHOD USING THE PROPOSED PWM-CAPTURE FUNCTION
The communication protocol using the PWM-Capture function proposed in this paper is divided into two data transmission methods. One is a broadcast method in which the same data is transmitted to controlled slaves connected in parallel. The other is data transmitted by designating each slave when the number of slaves has a value of 16 or less.   Fig. 8(a) shows a broadcast data frame that transmits the same reference data in a batch for parallel control of slaves. It transmits the control command to the slaves operated parallel with the same value. The first information of the data frame is a start bit for detecting the start of transmission data. Since MODBUS is asynchronous communication, for the data transmitted from the Master, the slave must distinguish the data's beginning and end. A pulse having a constant width is used as a start signal to indicate the start of a data frame. The second data frame is Status information for the operation status of the slave. It is data information for the classification of Run-Stop status and current, voltage, resistance, and power commands. The command data type is sent to distinguish the control data command sent from the Master. The third data represents the actual command data to be controlled by the slave. In this way, a frame with three pieces of data information can transmit information that is at least 2.5 times higher than that of the existing MODBUS protocol data frame. Fig. 8(b) shows the data frame for transmitting the command to a specific slave among the slaves operated in parallel. The first data is the start bit, as shown in Fig. 8(a). The second status data is the status information of the slave for parallel control and indicates the ID (Adress) of the designated slave and the operation command of the slave. It is data information for classifying the type of command to be transmitted. Then, the actual command data corresponding to each slave is transferred for parallel operation.   Fig. 9(a) shows the PWM signal for data frame transmission in an ideal condition where noise does not occur. If the communication line becomes long, a signal delay, as shown in Fig. 9(b), occurs due to the line impedance of R and C of the line, which causes an error in the pulse width. A start bit is used to solve this problem. As shown in Fig. 10 Fig. 9(b), and appears in the same form in all data. When the receiving side removes the counter value corresponding to the start bit, the offset value for data delay is included. Therefore, the remaining data also has a valid data value in which the offset value for the line impedance is compensated.
Here T total is one cycle of communication data. T clk is PWM and Capture counter clock. C max is PWM counter max. Bit R_data is the number of valid data bits. Bit dummy_data is the number of dummy data bits. Fig. 11 shows the noise-canceling technique by removing dummy data to secure data reliability. The counter value of the PWM pulse width to secure the actual 8-bit data is 256, which represents the minimum counter value that can be used in an ideal state without noise. Compared to general MODBUS, the data transmission speed of the proposed method is about 4.7 times faster, and it has a time margin of 2-bit. Based on the data transfer rate of the same time, the data value by the pulse width can have a data value of 10 bits, so the lower 2 bits can be used as dummy data and removed. Fig. 11 shows the operation flow for securing reliable transmission/reception data through the 2-bit dummy data canceling method. The maximum counter value and time using the valid data and the number of dummy data bits are the same as (4) and (5).

A. VERIFICATION OF COMMUNICATION METHOD BETWEEN MASTER AND SLAVE
To verify the communication method between the Master and the slave, the proposed method's data transmission/reception function is verified using the data frames of the existing MODBUS Protocol: 0x04 (Read Input Register) and 0x10 (Write Multiple Register). Fig. 13(a) results from data transmission/reception using the function code of 0x04 when the Master requests 1 data. Fig.  13(b) results from data transmission/reception using the function code of 0x04 when the Master requests 2 data.   Fig. 14(a) shows the response of the slave when 3 data is sent from the Master. Fig. 14(b) shows the response of the slave when 10 data is sent from the Master. Fig. 13 and Fig. 14 generate data frames using the pulse width of PWM function according to the general MODBUS function code rule to verify data transmission/reception using the proposed PWM-Capture function. When this PWM-Capture communication method is applied, it can be confirmed that communication data transmission/reception between Master and slave is performed without any problem.

B. PROPOSED COMMUNICATION PROTOCOL EXPERIMENT
The experiment verified the validity of the proposed communication data frame for parallel control of the power conversion system.  Fig. 15 shows the proposed communication data frame. ① is the start signal of the data frame, ② is the function code, ③ is the status, ④ is the control reference 1, and ⑤ is the control reference 2. Here, ③ status indicates the classification and status of the command value and has an 8bit data signal. The upper 4 bits indicate the operation status, and the lower 4 have data values for classifying the types of operation command values (I, R, P, and V). After receiving the command data sent from the Master, the slave changes the data enable signal from Low to High and sends the response data to the function code back to the Master.   16 shows the experimental data transmission/reception results between Master and slave using the proposed data frame. Fig. 16(a) is the experimental waveform when the Master's retransmission period due to timeout is applied as 5ms during communication between the Master and the slave. One cycle of the power conversion system operating at 60Hz is 16.67ms. Therefore, when the data update period of the control reference is 5ms, the control response speed is slow. Fig. 16(b) shows that the data retransmission period is set to 1ms to ensure control responsiveness and stable data transmission/reception between Master and slave due to timeout. It shows the Master's transmit data, the slave's receive data, and the master and slave data enable signals when the transmission period is 1ms. The data enable signal is a signal for distinguishing between the transmission and reception of data between the Master and the slave. The enable state is determined according to the high and low values of the enable signal. The high state is the data transmission area, and the low state is the data reception area. When the enable signal is high for the Master to transmit, the slave must wait in the low state to receive the data sent from the Master to the slave. Conversely, when the slave sends a response signal, the enable signal is created with the slave high and the master low. Fig. 16(c) is Fig. 16(b)'s enlarged waveform. Fig. 17(a) shows the response data sent by the slave to the Master. When the data enable signal of the slave is high, the slave transmits the function code requested by the master and response data to the received data. Fig. 17(b) is an enlarged waveform of the red dotted line in Fig. 17(a).   Fig. 19 is the data output waveform of the master side when the proposed communication method is applied to the parallel-controlled power conversion system. It can be confirmed that the Master's transmission and the slave's response data are transmitted and received correctly.

C. COMMUNICATION LINE DELAY TEST
In the proposed PWM-Capture function, the communication method can secure valid data by using dummy data to compensate for communication line delay. An arbitrary communication line is configured to verify the performance of the proposed method between the Master and the slave of the parallel-controlled power conversion system, and a stability test for data transmission/reception is performed.     Fig. 21(b) show the transmission data sent from the Master to the slave and the data signal received from the slave when the length of the communication line is 100m and 300m, respectively. Although the two lines have a difference in length of 200m, the data signal waveform does not show a significant difference. The status of data transmission between Master and slave is verified by checking the transmit/receive response data value for each line using CCS software for DSP driving. The experiment confirmed that the data was transmitted stably on the communication line up to 300m. Fig. 22(a) shows the transmission/reception data waveform according to the impedance change by fixing the line between the Master and the slave at 300m and adding R and C further to check the effect of the communication line impedance. Fig. 22(a) shows the distortion of the slave received data due to the length of the communication line and the added impedance. Through the experiment, when a value of 20Ω and 20nF, or more, is added to the communication line, the start bit overflow occurs between the Master and the slave due to data distortion, making data transmission/reception difficult. Therefore, an automatic initialization setting sequence of the start bit according to the line impedance is required.  Fig. 22(b) shows the transmission/reception data waveform when the length of the communication line is less than 10m under the same conditions. Through the experiment, it can be confirmed that the longer the communication line or, the higher the resistance, the greater the data error. However, the error of the control reference, such as voltage, current, and power of the power conversion system, is deficient, so there is no problem in system control. The communication method using the proposed PWM-Capture function can operate up to 300m in length, so it is suitable for operating Master and slave equipment of a parallel-controlled power conversion system in the actual field. Table II shows the differences between the existing MODBUS method and the proposed PWM-Capture method. The existing MODBUS method cannot change the protocol, but the protocol can be freely changed between transmitting and receiving devices in the proposed method. Based on 8-bit data transmission, when the start bit is included, the difference in transmission speed is up to 6 times. In addition, the communication speed can be freely changed according to the number of parallel control devices and the amount of data according to the broadcast or slave designation method. Since various protocol types can be applied to parallelcontrolled power conversion devices, it can be used as a new universal communication method.  Fig. 23 shows three single-phase electronic loads used to verify the proposed communication method. Connect three single-phase electronic loads to R, S, and T phases and use them as three-phase electronic loads for testing. Each 10kW single-phase load is connected to the R, S, T, and N phases. Among them, the electronic load connected to the R-N phase plays the role of a master, and the two electronic loads connected to S-N and T-N are slaves, respectively. The threephase power system can be controlled for each phase through the parallel operation of three single-phase electronic loads. The operational performance of the proposed communication method is verified through three-phase balanced control and unbalanced control with different control setpoints for each phase. The electronic load connected to the R phase was designated as Master, the S phase as Slave1, and the T phase as the electronic load of Slave2, and the experiment was conducted. Fig. 24(a) is an experimental waveform when the R-phase current command value is increased from 5% to 25% among three electronic loads composed of three phases. It can be confirmed that the current command value is transmitted by the proposed communication method, and the current in the R phase is accurately controlled. Fig. 24(b) is an enlarged waveform of Fig. 24(a).   Fig. 26 shows the confusion matrix used to verify the reliability of the proposed communication method. Signal data was verified using 200 test signals, respectively, when the impedance of the communication line was 1Ω or less, 5Ω, or 20Ω. Here, True Positives (TP) correspond to a case where a 1 (High) signal is correctly recognized as a 1 (High). False Negatives (FN) are cases in which a 1 (High) signal is incorrectly recognized as a 0 (Low) signal. False Positives (FP) are cases in which a 0 (Low) signal is incorrectly recognized as a 1 (High). True Negatives (TN) are cases in which a 0 (Low) signal is correctly recognized as a 0 (Low) [29]- [34].   (6). It is the result of the number of times that the 1 (High) signal of the test signal is correctly classified as 1 and the 0 (Low) signal as 0. When the impedance of the communication line is less than 5ohm, the Accuracy is 0.985 or higher, but at 20Ω, it drops to 0.94. Therefore, in a communication line with a longer distance, it is necessary to correct the start bit according to the size of the impedance through the initialization process.

E. RELIABILITY VERIFICATION OF THE PROPOSED COMMUNICATION METHOD
TP TN Accuracy TP TN FP FN      (6) Fig. 27(b) is the precision analysis result calculated from the confusion matrix and (7). It is a criterion for evaluating how reliably an analytical model presents results. When the communication impedance is less than 5Ω, it shows a high precision of 0.99, but at 20Ω, it drops to 0.912.

TP Precision TP FP
  Fig. 27(c) is the confusion matrix and the recall analysis result calculated by (8). It is a measure related to communication practicality that can be compared with precision. It shows a high recall result of 0.98 or more at low impedance but drops to 0.97 at 20Ω.

TP Recall TP FN
  Fig. 27(d) is the result of the analysis of the F1 score calculated from the confusion matrix and (9). The F1 score is the harmonic average of precision and recall. Since the communication test signal is imbalanced, the F1 score is analyzed and presented in addition to Accuracy. It can be seen that it is almost similar to the accuracy result shown in Fig. 27(a).
Precision Recall F1_score 2 Precision Recall     (9) V. CONCLUSION we propose a new communication method that enables fast and accurate communication between master and slave systems combined in parallel using the PWM and Capture functions of DSP. The proposed communication method uses the pulse width in the PWM function of DSP to express the size of the data and uses it together with the Capture function to enable bidirectional communication. When using the 150MHz CPU clock, the MODBUS protocol requires about 64μs to transmit 8 data frames. The proposed communication method takes about 13.6μs to transmit in the form of a pulse signal using the PWM function of DSP. It was confirmed that the data transmission speed could be improved by about 4.7 times. Also, thanks to the fast data transmission speed, it can have a data value of 10 bits, so noise canceling is possible by removing the lower 2 bits by using them as dummy data. The experiment of the proposed method confirmed that the communication line operates accurately and stably up to a maximum length of 300m and a line impedance of 20Ω and 20nF. It was confirmed that the proposed communication method works correctly from the current control response experiment according to the command value through the electronic load of the master-slave configuration operated in parallel. In conclusion, the proposed communication method has sufficient potential to replace the existing MODBUS method because it enables fast and accurate communication using the DSP's internal function used for power converter control.