# aimethercat/ecatv2_ax58100_h750_universal architecture

> Architecture diagram of the GitHub repository aimethercat/ecatv2_ax58100_h750_universal, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-09-29). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/aimethercat/ecatv2_ax58100_h750_universal
- Repository: https://github.com/aimethercat/ecatv2_ax58100_h750_universal

## Overview

This is STM32H750 firmware for an AX58100 EtherCAT slave, exposing configurable robotics peripherals to an EtherCAT master. The main runtime path is board startup, EtherCAT slave communication, task-list loading, then periodic peripheral tasks; task management also watches master connectivity and notifies running tasks for connection-loss handling. The README documents safe actuator states, state-change reset behavior, and the supported peripheral families. Sampled source confirms startup and task dispatch; detailed SOES internals and several peripheral implementations were not sampled, so their wiring is shown only where documented or evident from the task manager.

Main entry points: [`Application/task_manager.cpp`](https://github.com/aimethercat/ecatv2_ax58100_h750_universal/blob/main/Application/task_manager.cpp) (Runnable threads), [`Application/soes_application.cpp`](https://github.com/aimethercat/ecatv2_ax58100_h750_universal/blob/main/Application/soes_application.cpp) (SOES application), [`Application/initializer.cpp`](https://github.com/aimethercat/ecatv2_ax58100_h750_universal/blob/main/Application/initializer.cpp) (Initialization), [`Core/Src/freertos.c`](https://github.com/aimethercat/ecatv2_ax58100_h750_universal/blob/main/Core/Src/freertos.c) (FreeRTOS scheduler)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_startup["Startup and scheduling"]
  node_mcu["STM32H750<br/>[main.c]"]
  node_initializer["Initialization<br/>[initializer.cpp]"]
  node_freertos["FreeRTOS scheduler<br/>[freertos.c]"]
end

subgraph group_ethercat["EtherCAT slave"]
  node_soes["SOES application"]
  node_esc["AX58100 ESC"]
end

subgraph group_tasks["Dynamic task runtime"]
  node_taskmgr["Task manager<br/>[task_manager.cpp]"]
  node_taskdefs["Task definitions<br/>[task_defs.hpp]"]
  node_args[("EtherCAT arguments<br/>[buffer_utils.cpp]")]
  node_taskthread["Runnable threads<br/>[task_manager.cpp]"]
  node_safety["Connection handling<br/>[task_manager.cpp]"]
end

subgraph group_io["Peripheral interfaces"]
  node_rc["RC receivers<br/>[dbus_rc.cpp]"]
  node_motors["Motor control<br/>[lk_motor.cpp]"]
  node_dshot["DSHOT ESC output<br/>[dshot.cpp]"]
  node_pwm["PWM outputs<br/>[pwm_onboard.cpp]"]
  node_sensors["Sensors and power<br/>[adc.cpp]"]
  node_can["CAN peripherals<br/>[hipnuc_imu_can.cpp]"]
  node_uartpwm["External PWM<br/>[pwm_external.cpp]"]
end

node_master(("EtherCAT master"))

node_master -->|"exchanges EtherCAT"| node_esc
node_esc -->|"provides slave interface"| node_soes
node_mcu -->|"calls initialize"| node_initializer
node_initializer -->|"prepares scheduler"| node_freertos
node_freertos -->|"schedules"| node_taskmgr
node_master -->|"sends task configuration"| node_soes
node_soes -->|"signals task readiness"| node_taskmgr
node_taskmgr -->|"reads arguments"| node_args
node_taskmgr -->|"selects task type"| node_taskdefs
node_taskmgr -->|"creates runnable threads"| node_taskthread
node_taskthread -->|"runs selected task"| node_rc
node_taskthread -->|"runs selected task"| node_motors
node_taskthread -->|"runs selected task"| node_dshot
node_taskthread -->|"runs selected task"| node_pwm
node_taskthread -->|"runs selected task"| node_sensors
node_taskthread -->|"runs selected task"| node_can
node_taskthread -.->|"runs selected task"| node_uartpwm
node_taskmgr -->|"monitors connection"| node_safety
node_safety -->|"notifies loss or recovery"| node_taskthread

click node_mcu "https://github.com/aimethercat/ecatv2_ax58100_h750_universal/blob/main/Core/Src/main.c"
click node_initializer "https://github.com/aimethercat/ecatv2_ax58100_h750_universal/blob/main/Application/initializer.cpp"
click node_freertos "https://github.com/aimethercat/ecatv2_ax58100_h750_universal/blob/main/Core/Src/freertos.c"
click node_soes "https://github.com/aimethercat/ecatv2_ax58100_h750_universal/blob/main/Application/soes_application.cpp"
click node_taskmgr "https://github.com/aimethercat/ecatv2_ax58100_h750_universal/blob/main/Application/task_manager.cpp"
click node_taskdefs "https://github.com/aimethercat/ecatv2_ax58100_h750_universal/blob/main/Application/task_defs.hpp"
click node_args "https://github.com/aimethercat/ecatv2_ax58100_h750_universal/blob/main/Utils/buffer_utils.cpp"
click node_taskthread "https://github.com/aimethercat/ecatv2_ax58100_h750_universal/blob/main/Application/task_manager.cpp"
click node_safety "https://github.com/aimethercat/ecatv2_ax58100_h750_universal/blob/main/Application/task_manager.cpp"
click node_rc "https://github.com/aimethercat/ecatv2_ax58100_h750_universal/blob/main/Application/Task/dbus_rc.cpp"
click node_motors "https://github.com/aimethercat/ecatv2_ax58100_h750_universal/blob/main/Application/Task/lk_motor.cpp"
click node_dshot "https://github.com/aimethercat/ecatv2_ax58100_h750_universal/blob/main/Application/Task/dshot.cpp"
click node_pwm "https://github.com/aimethercat/ecatv2_ax58100_h750_universal/blob/main/Application/Task/pwm_onboard.cpp"
click node_sensors "https://github.com/aimethercat/ecatv2_ax58100_h750_universal/blob/main/Application/Task/adc.cpp"
click node_can "https://github.com/aimethercat/ecatv2_ax58100_h750_universal/blob/main/Application/Task/hipnuc_imu_can.cpp"
click node_uartpwm "https://github.com/aimethercat/ecatv2_ax58100_h750_universal/blob/main/Application/Task/pwm_external.cpp"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_mcu,node_initializer,node_freertos toneBlue
class node_soes,node_esc toneAmber
class node_taskmgr,node_taskdefs,node_args,node_taskthread,node_safety toneMint
class node_rc,node_motors,node_dshot,node_pwm,node_sensors,node_can,node_uartpwm toneRose
class node_master toneIndigo
```

## Components

### Startup and scheduling

- [STM32H750](https://github.com/aimethercat/ecatv2_ax58100_h750_universal/blob/main/Core/Src/main.c): `Core/Src/main.c`
- [Initialization](https://github.com/aimethercat/ecatv2_ax58100_h750_universal/blob/main/Application/initializer.cpp): `Application/initializer.cpp`
- [FreeRTOS scheduler](https://github.com/aimethercat/ecatv2_ax58100_h750_universal/blob/main/Core/Src/freertos.c): `Core/Src/freertos.c`

### EtherCAT slave

- [SOES application](https://github.com/aimethercat/ecatv2_ax58100_h750_universal/blob/main/Application/soes_application.cpp): `Application/soes_application.cpp`
- **AX58100 ESC**

### Dynamic task runtime

- [Task manager](https://github.com/aimethercat/ecatv2_ax58100_h750_universal/blob/main/Application/task_manager.cpp): `Application/task_manager.cpp`
- [Task definitions](https://github.com/aimethercat/ecatv2_ax58100_h750_universal/blob/main/Application/task_defs.hpp): `Application/task_defs.hpp`
- [EtherCAT arguments](https://github.com/aimethercat/ecatv2_ax58100_h750_universal/blob/main/Utils/buffer_utils.cpp): `Utils/buffer_utils.cpp`
- [Runnable threads](https://github.com/aimethercat/ecatv2_ax58100_h750_universal/blob/main/Application/task_manager.cpp): `Application/task_manager.cpp`
- [Connection handling](https://github.com/aimethercat/ecatv2_ax58100_h750_universal/blob/main/Application/task_manager.cpp): `Application/task_manager.cpp`

### Peripheral interfaces

- [RC receivers](https://github.com/aimethercat/ecatv2_ax58100_h750_universal/blob/main/Application/Task/dbus_rc.cpp): `Application/Task/dbus_rc.cpp`
- [Motor control](https://github.com/aimethercat/ecatv2_ax58100_h750_universal/blob/main/Application/Task/lk_motor.cpp): `Application/Task/lk_motor.cpp`
- [DSHOT ESC output](https://github.com/aimethercat/ecatv2_ax58100_h750_universal/blob/main/Application/Task/dshot.cpp): `Application/Task/dshot.cpp`
- [PWM outputs](https://github.com/aimethercat/ecatv2_ax58100_h750_universal/blob/main/Application/Task/pwm_onboard.cpp): `Application/Task/pwm_onboard.cpp`
- [Sensors and power](https://github.com/aimethercat/ecatv2_ax58100_h750_universal/blob/main/Application/Task/adc.cpp): `Application/Task/adc.cpp`
- [CAN peripherals](https://github.com/aimethercat/ecatv2_ax58100_h750_universal/blob/main/Application/Task/hipnuc_imu_can.cpp): `Application/Task/hipnuc_imu_can.cpp`
- [External PWM](https://github.com/aimethercat/ecatv2_ax58100_h750_universal/blob/main/Application/Task/pwm_external.cpp): `Application/Task/pwm_external.cpp`

### Other components

- **EtherCAT master**

## Connections

- EtherCAT master → AX58100 ESC: exchanges EtherCAT
- AX58100 ESC → SOES application: provides slave interface
- STM32H750 → Initialization: calls initialize
- Initialization → FreeRTOS scheduler: prepares scheduler
- FreeRTOS scheduler → Task manager: schedules
- EtherCAT master → SOES application: sends task configuration
- SOES application → Task manager: signals task readiness
- Task manager → EtherCAT arguments: reads arguments
- Task manager → Task definitions: selects task type
- Task manager → Runnable threads: creates runnable threads
- Runnable threads → RC receivers: runs selected task
- Runnable threads → Motor control: runs selected task
- Runnable threads → DSHOT ESC output: runs selected task
- Runnable threads → PWM outputs: runs selected task
- Runnable threads → Sensors and power: runs selected task
- Runnable threads → CAN peripherals: runs selected task
- Runnable threads → External PWM: runs selected task
- Task manager → Connection handling: monitors connection
- Connection handling → Runnable threads: notifies loss or recovery
