# Marine Diesel Engine Fault Detection Based on Xilinx ZYNQ SoC
## 3 Results
### Data Processing on the PS Terminal in ZYNQ
#### 3.1.2 PS Terminal Data Collection Program  
According to the communication protocol mentioned above, corresponding IP cores were established on the Block Design interface. Among them, AXI_GPIO emulates the I2C protocol using GPIO, the UART is implemented using the official Uart16550 IP core, and the SPI section utilizes the AXI_SPI IP core written in VHDL language. Following the testing mentioned earlier, we confirm that data acquisition is achievable. It only requires connecting sensors with the aforementioned parameters to the PS port of ZYNQ. Through  
\begin{table}
\begin{tabular}{c c} \hline \hline
**Characteristic Dimension** & **Unit** \\ \hline Boost Pressure At Outlet & bar \\ Turbocharger Outlet Flow & m/s \\ Turbocharger Inlet Temperature & \({}^{\circ}\)C \\ Intercooler Inlet Pressure & bar \\ Intercooler Outlet Flow Rate & m/s \\ Intercooler Outlet Temperature & \({}^{\circ}\)C \\ Cylinder Inlet Pressure & bar \\ Cylinder Inlet Flow Rate & m/s \\ Cylinder Inlet Temperature & \({}^{\circ}\)C \\ Cylinder Exhaust Temperature & bar \\ Exhaust Manifold Pressure & bar \\ Exhaust Manifold Flow Rate & m/s \\ Exhaust Manifold Temperature & \({}^{\circ}\)C \\ Turbocharger Outlet Pressure & bar \\ Turbocharger Outlet Flow Rate & m/s \\ Turbocharger Outlet Temperature & \({}^{\circ}\)C \\ Air Intake Rate & kg/s \\ Fuel Consumption Rate & g/kW\_h \\ Maximum Brake Pressure & bar \\ Maximum Pressure Rise Rate & Bar/deg \\ Power & Bar/deg \\ IMEP & bar \\ BMEP & bar \\ \hline \hline \end{tabular}
\end{table}
Table 2: Characteristic parameter list.  
experimentation, it has been determined that ZYNQ can support up to 32 connected devices; refer to the Block Design schematic in Figure 7.  
When the upper computer sends a start command, the LoRa module will receive the command through the RX pin of the UART16550. The command will be parsed using the command parsing function on the PS side, which will start the designated module. When the sensor detects data, it will enter the corresponding IP core module according to the communication protocol. After data processing using the PS side function, the data will be sent to the CNN IP module. The IP module will interact with the four convolution modules on the PL side via the AXI bus of the GP interface. After the CNN IP module completes the calculation, the result will be sent to the LoRa module through the TX pin of the UART16550, thereby completing one data processing cycle. This process repeats, allowing for real-time computing functionality.  
The actual implementation effect can be referred to in the topology diagram in Figure 8. Since it supports SPI, I2C, and UART communication protocols, compatible sensors can be connected to the ZYNQ7010. After data processing, messages are sent via the LoRa module. The LoRa module on the PC side receives the messages and displays the results on a PC application, achieving data visualization.  
The data received from the sensors are processed on the PS side of ZYNQ. Data processing is conducted using C language within the \"static void data processing(void *pvParameters)\" task of the FreeRTOS operating system. When data are received from  
Figure 8: Hardware implementation topology.  
Figure 7: Block design schematic.  
other sensors, such as MPU6050, after a certain amount of data accumulation, the FreeRTOS message queue's sending function is utilized. Simultaneously, within the data processing function, the message queue's data receiving functionality is set up. Upon receiving the data, the data undergo processing, and subsequently, using the message queue functionality, the processed data are sent to the \"static void cnn_use(void \"pvParameters\" task for convolutional calculations; refer to the flow chart in Figure 9.