Niklas SchoeningandClaude Opus 5.5 46398252ad Implement spindle PWM and H-bridge control
Fill in the LibSpindle platform callbacks so the spindle commands
(spindle start/stop/status) drive the BTS7960 H-bridge.

- spindleLogic.c: SPINDLE_SetDutyCycle sets the TIM2 compare values,
  CH4 (SPINDLE_PWM_R) for forward and CH3 (SPINDLE_PWM_L) for backward,
  the inactive channel is set to 0 first. SPINDLE_EnaPWM switches both
  half bridges via SPINDLE_ENA_L/R. Both PWM channels are started in
  init_spindle_custom before the spindle instance is created.
- main.h: export htim2 so the spindle module can access the timer.
- consoleLogic.c: report CAP_HAS_SPINDLE and CAP_HAS_SPINDLE_STATUS in
  the capability command.
- main.c: fix typo in the playground task output.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-16 21:13:37 +02:00
2026-10-16 18:25:42 +02:00
2026-10-16 18:25:42 +02:00
2026-10-16 18:25:42 +02:00
2026-10-16 18:25:42 +02:00
2026-10-16 18:25:42 +02:00
2026-10-16 18:25:42 +02:00

Frässpindel – HNP

Firmware für die Ansteuerung einer Frässpindel und eines Schrittmotors (L6474) auf einem STM32H755ZI (Dual-Core: Cortex-M7 + Cortex-M4). Projekt im Rahmen von Hardwarenahes Programmieren von Echtzeitsystemen.

Die eigentliche Anwendung läuft auf dem Cortex-M7 unter FreeRTOS. Der Cortex-M4 wird nur gestartet und über OpenAMP/HSEM synchronisiert.

Projektstruktur

.
├── stepper_h7/          STM32CubeIDE-/Makefile-Projekt
│   ├── CM7/             Anwendung (Cortex-M7, FreeRTOS)
│   ├── CM4/             Cortex-M4
│   ├── Common/          gemeinsamer Startcode
│   ├── Drivers/         STM32 HAL / CMSIS
│   ├── Middlewares/     OpenAMP
│   └── stepper_h7.ioc   CubeMX-Konfiguration
├── libs/                externe Bibliotheken (über relative Pfade eingebunden)
│   ├── FreeRTOS-LTS/
│   ├── LibL6474/        Schrittmotortreiber
│   ├── LibRTOSConsole/  Konsole über UART
│   ├── LibSpindle/      Spindelansteuerung
│   └── LibHALMockup/, LibCMocka/   Unit-Tests
├── spec/                Pflichtenheft, Interfacespezifikation, Laborbericht
└── doc/                 Schaltpläne, Registerbeschreibungen

stepper_h7 referenziert ../libs relativ. Die Ordnerstruktur muss deshalb erhalten bleiben.

Hardware

Funktion Pin Makro (CM7/Core/Inc/main.h)
LED grün PB0 LED_GREEN_GPIO_Port, LED_GREEN_Pin
LED gelb PE1 LED_YELLOW_GPIO_Port, LED_YELLOW_Pin
LED rot PB14 LED_RED_GPIO_Port, LED_RED_Pin
User-Taste PC13 USR_BUTTON_GPIO_Port, USR_BUTTON_Pin
Debug-UART PD8/PD9 (USART3, 115200 Baud)

Bauen und Flashen

Variante A: STM32CubeIDE (Windows / macOS / Linux)

  1. File → Import → Existing Projects into Workspace und stepper_h7 auswählen (stepper_h7_CM7 und stepper_h7_CM4 werden mit importiert).
  2. stepper_h7_CM7 (und stepper_h7_CM4) bauen.
  3. Eine Debug-Konfiguration anlegen. Die .launch-Dateien sind bewusst nicht im Repo, weil sie rechnerspezifische Pfade enthalten.

Variante B: VS Code + Makefile

Voraussetzungen:

  • STM32CubeCLT (enthält arm-none-eabi-gcc, ST-LINK-GDB-Server, CubeProgrammer)
  • Umgebungsvariable STM32CLT_PATH auf das CubeCLT-Installationsverzeichnis setzen
  • make (macOS: xcode-select --install)
  • VS-Code-Extensions: Cortex-Debug, RTOS Views, C/C++, Serial Monitor
cd stepper_h7
make cm7 -j      # nur Cortex-M7
make all -j      # M7 + M4
make clean

Debuggen über stepper_h7.code-workspace und die Konfiguration Debug CM7 ST-Link V3.

Nicht im Repository

  • Build-Ausgaben (Debug/, build/)
  • Hersteller-Datenblätter (doc/Datasheets/), z. B. das STM32H7 Reference Manual (RM0399)
  • Windows-spezifische Dateien (MSVC-Projekte, DLLs/EXEs von CMocka)
S
Description
Projekt Hardwarenahes Programmieren
Readme
16 MiB
0 Stars 1 Watchers 0 Forks
Languages
C 89.2%
HTML 3.8%
CMake 1.7%
Ruby 1.5%
JavaScript 1.1%
Other 2.6%