polito.it
Politecnico di Torino (logo)

Design and Implementation of Ethernet-Based Real-Time SPI Protocol Management using dSPACE HIL Simulator and STMicroelectronics Boards

Usama Islam

Design and Implementation of Ethernet-Based Real-Time SPI Protocol Management using dSPACE HIL Simulator and STMicroelectronics Boards.

Rel. Massimo Violante. Politecnico di Torino, Corso di laurea magistrale in Ingegneria Elettronica (Electronic Engineering), 2025

[img] PDF (Tesi_di_laurea) - Tesi
Licenza: Creative Commons Attribution Non-commercial No Derivatives.

Download (11MB)
Abstract:

Real-time Hardware-in-the-Loop (HIL) simulation is crucial for the comprehensive testing and validation of automotive Electronic Control Units (ECUs) before they are integrated into a vehicle. Robust HIL environments can easily interface with ECUs over Ethernet; however, critical components like Battery Management Systems (BMS) and sensors/actuators often rely on short-distance, low-latency protocols such as SPI. This thesis presents the design, implementation, and verification of a real-time communication bridge between Ethernet-based UDP protocols and full-duplex SPI interfaces, addressing the challenge of integrating such SPI-based devices into Ethernet-based HIL simulators. Implemented on STM32F207ZG Nucleo boards configured in a Master-Slave topology, the Master board interfaces with an external HIL environment (dSPACE or a Python-based prototype) via Ethernet (UDP protocol). The Master board translates received UDP payloads into SPI transactions for the Slave board. The Slave board processes these SPI commands/data from the Master and returns the corresponding response. The development started with a Python-driven UDP-SPI echo prototype and upgraded into a reliable communication system, along with the key features being a custom SPI protocol with robust framing, software-based CRC-8 for data validity, and support for variable-length/type data transactions. The system utilizes DMA-based SPI transfers to achieve a deterministic 1-ms cycle time for SPI transactions. An important enhancement was the implementation of circular DMA on the Slave board for continuous data handling and response generation. On the Master, SPI transactions were triggered by incoming UDP packets and are supported by a polling mechanism for continuous data streams from the Slave. The implemented Ethernet-SPI Bridge was successfully integrated with the dSPACE SCALEXIO platform. Distinct Simulink models for echo verification and command-based sensor streaming were configured via dSPACE ConfigurationDesk. These models were deployed as real-time applications and controlled using dSPACE ControlDesk to generate UDP dynamic values or specific commands and subsequently receive/display the corresponding echo data or emulated sensor responses from the STM32 system. This hardware-software co-simulation showed effective command handling for various sensor modes (Idle, Speed, Gyro, Accel) and accurate real-time data feedback to the HIL environment. The resulting solution demonstrates a stable and responsive Ethernet-SPI bridge capable of sustained 1-ms data exchange in the context of HIL simulation, with error detection and recovery mechanisms. This research provides a practical and flexible framework for real-time sensor emulation that can be directly applicable to industrial automotive HIL testing and lays a strong foundation for future integration with automotive ECUs and the development of ISO-compliant communication modules.

Relatori: Massimo Violante
Anno accademico: 2024/25
Tipo di pubblicazione: Elettronica
Numero di pagine: 118
Soggetti:
Corso di laurea: Corso di laurea magistrale in Ingegneria Elettronica (Electronic Engineering)
Classe di laurea: Nuovo ordinamento > Laurea magistrale > LM-29 - INGEGNERIA ELETTRONICA
Aziende collaboratrici: Kineton Srl
URI: http://webthesis.biblio.polito.it/id/eprint/36620
Modifica (riservato agli operatori) Modifica (riservato agli operatori)