# PSG5 Diagnostic Bluetooth Tool – STM32H5

Embedded diagnostic and communication tool for PSG5 diesel injection control units, built on **STM32H5** with **Bluetooth connectivity**.

This project is part of the Herlic Components diagnostic and control platform, focused on reliable communication, testing, and service workflows for professional diesel ECU environments.

---

## Overview

This firmware implements a Bluetooth-enabled diagnostic interface designed to communicate with PSG5-based ECUs and associated workshop tools.

Main goals of the project:

- Reliable **Bluetooth communication interface**
- Fast and deterministic **embedded real-time firmware**
- Robust **diagnostic protocol handling**
- Safe **PSG5 communication and validation**
- Expandable architecture for future diagnostic services
- Secure migration path toward STM32H5 platform

The system is intended for professional workshop and development environments.

---

## Hardware Platform

- **MCU:** STM32H5 series
- **IDE:** STM32CubeIDE / STM32CubeMX
- **Communication:** Bluetooth UART bridge
- **Debug:** ST-Link / SWD
- **Power:** Automotive 12V environment with regulated rails

---

## Project Structure

```text
bpdt-repo/
├── Firmware/               # Application code
├── Hardware/               # KiCad project files
├── Docs/                   # Documentation (Protocol, Instructions, Images...)
├── Production/             # Ready files

└── README.md
````

---

## Main Features

* Bluetooth communication stack
* Frame parser / packet builder
* Session control state machine
* Keep-alive supervision
* ECU identification
* EEPROM / memory read services
* Diagnostic command execution
* Timeout and retry handling
* Non-blocking ISR-friendly architecture

---

## Development Environment

Recommended tools:

* **STM32CubeIDE 2.x**
* **STM32CubeMX**
* **Git**
* **Gitea**
* **ST-Link Utility / STM32CubeProgrammer**

---

## Build

Open the project in STM32CubeIDE and build:

```bash
Project -> Build Project
```

Or from terminal if using headless tools:

```bash
make all
```

Generated binaries:

* `.elf`
* `.hex`
* `.bin`

---

## Flashing

Use STM32CubeProgrammer or CubeIDE:

```text
Run -> Debug
```

or

```text
Run -> Run As -> STM32 Cortex-M C/C++ Application
```

---

## Current Development Status

Current migration phase:

* [x] Repository initialized
* [x] STM32H5 platform selected
* [ ] CubeMX base project
* [ ] Bluetooth driver migration
* [ ] Protocol migration
* [ ] Diagnostic validation
* [ ] Real ECU testing
* [ ] Production release

---

## Version Control Workflow

Typical workflow:

```bash
git pull
git add .
git commit -m "Describe changes"
git push
```

---

## Notes

This repository may include:

* firmware sources
* CubeIDE project files
* diagnostic protocol implementation
* future KiCad hardware revisions

Build artifacts are excluded through `.gitignore`.

---

## Maintainer

**Herlic Components**
Professional diesel ECU diagnostics and control electronics

---

## License

Internal development / proprietary project

```
```
