# majerle/canopenstm32 architecture

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

- Interactive diagram: https://gitdiagram.com/majerle/canopenstm32
- Repository: https://github.com/majerle/canopenstm32

## Overview

This repository provides CANopenNode-based STM32 demos, including a legacy STM32H735G-DK FDCAN implementation in bare-metal and FreeRTOS variants. The documented workflow initializes the board and CANopen node, configures CANopen services such as PDO, then processes communication and application work. The tree omits the main CANopenNode stack and newer examples, so those documented subsystems are represented without invented source paths; connections are limited to README or indexed evidence.

Main entry points: [`legacy/stm32h7xx_fdcan/Src/main.c`](https://github.com/majerle/canopenstm32/blob/master/legacy/stm32h7xx_fdcan/Src/main.c) (Bare-metal demo), [`legacy/stm32h7xx_fdcan_rtos/Src/main.c`](https://github.com/majerle/canopenstm32/blob/master/legacy/stm32h7xx_fdcan_rtos/Src/main.c) (RTOS demo), [`legacy/source/OD.c`](https://github.com/majerle/canopenstm32/blob/master/legacy/source/OD.c) (Object dictionary), [`legacy/source/CO_driver_stm32h735g-dk.c`](https://github.com/majerle/canopenstm32/blob/master/legacy/source/CO_driver_stm32h735g-dk.c) (CAN driver)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_apps["CANopen demos"]
  node_bare_app["Bare-metal demo<br/>[main.c]"]
  node_rtos_app["RTOS demo<br/>[main.c]"]
end

subgraph group_protocol["CANopen domain"]
  node_canopen_stack["CANopen stack"]
  node_object_dictionary[("Object dictionary<br/>[OD.c]")]
  node_storage_example["Blank storage<br/>[CO_storageBlank.c]"]
end

subgraph group_platform["STM32 platform"]
  node_can_driver["CAN driver"]
  node_stm32_hal["STM32 HAL"]
  node_board_io["Board communication"]
  node_stm32_port["STM32 CANopen port<br/>[CO_driver_STM32.c]"]
end

subgraph group_rtos["RTOS support"]
  node_cmsis_os["CMSIS-RTOS2 adapter<br/>[cmsis_os2.c]"]
  node_freertos["FreeRTOS kernel<br/>[tasks.c]"]
end

node_developer(("Demo user"))
node_can_network(("CAN network"))
node_board_outputs(("Board LEDs / VCP"))

node_developer -->|"runs demo"| node_bare_app
node_developer -->|"runs demo"| node_rtos_app
node_bare_app -->|"initializes and processes"| node_canopen_stack
node_rtos_app -->|"initializes and processes"| node_canopen_stack
node_bare_app -->|"uses dictionary"| node_object_dictionary
node_rtos_app -->|"uses dictionary"| node_object_dictionary
node_object_dictionary -.->|"supplies data"| node_canopen_stack
node_canopen_stack -.->|"uses port"| node_can_driver
node_can_driver -->|"uses FDCAN HAL"| node_stm32_hal
node_bare_app -->|"uses communication"| node_board_io
node_rtos_app -->|"uses communication"| node_board_io
node_canopen_stack -->|"communicates over CAN"| node_can_network
node_bare_app -.->|"reports and controls"| node_board_outputs
node_rtos_app -->|"calls RTOS API"| node_cmsis_os
node_cmsis_os -->|"adapts kernel calls"| node_freertos
node_canopen_stack -.->|"optional storage"| node_storage_example
node_canopen_stack -.->|"uses STM32 port"| node_stm32_port

click node_bare_app "https://github.com/majerle/canopenstm32/blob/master/legacy/stm32h7xx_fdcan/Src/main.c"
click node_rtos_app "https://github.com/majerle/canopenstm32/blob/master/legacy/stm32h7xx_fdcan_rtos/Src/main.c"
click node_object_dictionary "https://github.com/majerle/canopenstm32/blob/master/legacy/source/OD.c"
click node_can_driver "https://github.com/majerle/canopenstm32/blob/master/legacy/source/CO_driver_stm32h735g-dk.c"
click node_stm32_hal "https://github.com/majerle/canopenstm32/blob/master/legacy/drivers/STM32H7xx_HAL_Driver/Inc/stm32h7xx_hal_fdcan.h"
click node_board_io "https://github.com/majerle/canopenstm32/blob/master/legacy/source/comm_stm32h735g-dk.c"
click node_stm32_port "https://github.com/majerle/canopenstm32/blob/master/CANopenNode_STM32/CO_driver_STM32.c"
click node_storage_example "https://github.com/majerle/canopenstm32/blob/master/CANopenNode_STM32/CO_storageBlank.c"
click node_cmsis_os "https://github.com/majerle/canopenstm32/blob/master/legacy/libs/FreeRTOS/Source/CMSIS_RTOS_V2/cmsis_os2.c"
click node_freertos "https://github.com/majerle/canopenstm32/blob/master/legacy/libs/FreeRTOS/Source/tasks.c"

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_bare_app,node_rtos_app,node_developer toneBlue
class node_canopen_stack,node_object_dictionary,node_storage_example toneAmber
class node_can_driver,node_stm32_hal,node_board_io,node_stm32_port toneMint
class node_cmsis_os,node_freertos toneRose
class node_can_network,node_board_outputs toneIndigo
```

## Components

### CANopen demos

- [Bare-metal demo](https://github.com/majerle/canopenstm32/blob/master/legacy/stm32h7xx_fdcan/Src/main.c): `legacy/stm32h7xx_fdcan/Src/main.c`
- [RTOS demo](https://github.com/majerle/canopenstm32/blob/master/legacy/stm32h7xx_fdcan_rtos/Src/main.c): `legacy/stm32h7xx_fdcan_rtos/Src/main.c`

### CANopen domain

- **CANopen stack**
- [Object dictionary](https://github.com/majerle/canopenstm32/blob/master/legacy/source/OD.c): `legacy/source/OD.c`
- [Blank storage](https://github.com/majerle/canopenstm32/blob/master/CANopenNode_STM32/CO_storageBlank.c): `CANopenNode_STM32/CO_storageBlank.c`

### STM32 platform

- [CAN driver](https://github.com/majerle/canopenstm32/blob/master/legacy/source/CO_driver_stm32h735g-dk.c): `legacy/source/CO_driver_stm32h735g-dk.c`
- [STM32 HAL](https://github.com/majerle/canopenstm32/blob/master/legacy/drivers/STM32H7xx_HAL_Driver/Inc/stm32h7xx_hal_fdcan.h): `legacy/drivers/STM32H7xx_HAL_Driver/Inc/stm32h7xx_hal_fdcan.h`
- [Board communication](https://github.com/majerle/canopenstm32/blob/master/legacy/source/comm_stm32h735g-dk.c): `legacy/source/comm_stm32h735g-dk.c`
- [STM32 CANopen port](https://github.com/majerle/canopenstm32/blob/master/CANopenNode_STM32/CO_driver_STM32.c): `CANopenNode_STM32/CO_driver_STM32.c`

### RTOS support

- [CMSIS-RTOS2 adapter](https://github.com/majerle/canopenstm32/blob/master/legacy/libs/FreeRTOS/Source/CMSIS_RTOS_V2/cmsis_os2.c): `legacy/libs/FreeRTOS/Source/CMSIS_RTOS_V2/cmsis_os2.c`
- [FreeRTOS kernel](https://github.com/majerle/canopenstm32/blob/master/legacy/libs/FreeRTOS/Source/tasks.c): `legacy/libs/FreeRTOS/Source/tasks.c`

### Other components

- **Demo user**
- **CAN network**
- **Board LEDs / VCP**

## Connections

- Demo user → Bare-metal demo: runs demo (evidence: `README.md`)
- Demo user → RTOS demo: runs demo (evidence: `README.md`)
- Bare-metal demo → CANopen stack: initializes and processes (evidence: `legacy/stm32h7xx_fdcan/Src/main.c`)
- RTOS demo → CANopen stack: initializes and processes (evidence: `legacy/stm32h7xx_fdcan_rtos/Src/main.c`)
- Bare-metal demo → Object dictionary: uses dictionary (evidence: `legacy/stm32h7xx_fdcan/Src/main.c`)
- RTOS demo → Object dictionary: uses dictionary (evidence: `legacy/stm32h7xx_fdcan_rtos/Src/main.c`)
- Object dictionary → CANopen stack: supplies data
- CANopen stack → CAN driver: uses port
- CAN driver → STM32 HAL: uses FDCAN HAL (evidence: `legacy/source/CO_driver_stm32h735g-dk.c`)
- Bare-metal demo → Board communication: uses communication (evidence: `legacy/stm32h7xx_fdcan/Src/main.c`)
- RTOS demo → Board communication: uses communication (evidence: `legacy/stm32h7xx_fdcan_rtos/Src/main.c`)
- CANopen stack → CAN network: communicates over CAN (evidence: `README.md`)
- Bare-metal demo → Board LEDs / VCP: reports and controls
- RTOS demo → CMSIS-RTOS2 adapter: calls RTOS API (evidence: `legacy/stm32h7xx_fdcan_rtos/Src/main.c`)
- CMSIS-RTOS2 adapter → FreeRTOS kernel: adapts kernel calls (evidence: `legacy/libs/FreeRTOS/Source/CMSIS_RTOS_V2/cmsis_os2.c`)
- CANopen stack → Blank storage: optional storage
- CANopen stack → STM32 CANopen port: uses STM32 port (evidence: `README.md`)
