Skip to content

Add STM32 CAN drivers and bxCAN transceiver#415

Draft
nhuvaoanh123 wants to merge 4 commits into
eclipse-openbsw:mainfrom
nhuvaoanh123:stm32-pr-3
Draft

Add STM32 CAN drivers and bxCAN transceiver#415
nhuvaoanh123 wants to merge 4 commits into
eclipse-openbsw:mainfrom
nhuvaoanh123:stm32-pr-3

Conversation

@nhuvaoanh123

Copy link
Copy Markdown
Contributor

Purpose of this PR

  • Bugfix
  • New Feature
  • Documentation Update
  • Other

Description

Third PR in the STM32 platform series. Adds CAN peripheral device drivers and the bxCAN transceiver adapter.

Modules added

Module Purpose
bspCan Low-level CAN device drivers — BxCanDevice (F4) and FdCanDevice (G4)
bxCanTransceiver OpenBSW ICanTransceiver adapter for bxCAN peripheral
unitTest STM32-specific unit test cmake infrastructure

Architecture

  • bspCan/CMakeLists.txt uses CAN_TYPE to select the correct driver at compile time
  • BxCanDevice: 3 TX mailboxes, 28 filter banks, hardware FIFO with overrun detection
  • FdCanDevice: 3 TX FIFO slots, 28 standard + 8 extended filters, FD frame support
  • Unit tests use mock register headers (test/include/mcu/mcu.h) for host-based verification

Milestone

cmake --preset tests-stm32-debug configures successfully. Unit tests (BxCanDeviceTest, BxCanTransceiverTest) run in CI Docker environment.

Depends on #414 (PR 2: BSP drivers). PR 3 of 10.

Related Issues

Part of STM32 platform port — see #413 for series overview.

Breaking Changes

  • Yes
  • No

Test Plan

  1. Configure unit tests: cmake --preset tests-stm32-debug
  2. Build and run: cmake --build --preset tests-stm32-debug && ctest --preset tests-stm32-debug
  3. Tests: BxCanDeviceTest, BxCanTransceiverTest, BxCanTransceiverIntegrationTest

Regression Tests

Have tests been added/updated? [x] Yes — BxCanDeviceTest, FdCanDeviceTest, BxCanTransceiverTest [ ] No

nhuvaoanh123 added a commit to nhuvaoanh123/openbsw that referenced this pull request Mar 30, 2026
Add the FdCanTransceiver module — OpenBSW ICanTransceiver adapter for
STM32G4 FDCAN peripheral. Mirrors the bxCAN transceiver from PR 3 but
supports FD frames (up to 64-byte payload) and extended filter banks.

- FdCanTransceiver: ICanTransceiver implementation for FDCAN
- Unit tests with mock FdCanDevice headers for host verification
- Updated bsp/CMakeLists.txt for CAN_TYPE-based transceiver selection

Milestone: `cmake --preset tests-stm32-debug` configures with both transceivers.
Depends on eclipse-openbsw#415 (PR 3: bxCAN/FDCAN drivers). PR 4 of 10.
nhuvaoanh123 pushed a commit to nhuvaoanh123/openbsw that referenced this pull request Mar 30, 2026
Add the FdCanTransceiver module — OpenBSW ICanTransceiver adapter for
STM32G4 FDCAN peripheral. Mirrors the bxCAN transceiver from PR 3 but
supports FD frames (up to 64-byte payload) and extended filter banks.

- FdCanTransceiver: ICanTransceiver implementation for FDCAN
- Unit tests with mock FdCanDevice headers for host verification
- Updated bsp/CMakeLists.txt for CAN_TYPE-based transceiver selection

Milestone: `cmake --preset tests-stm32-debug` configures with both transceivers.
Depends on eclipse-openbsw#415 (PR 3: bxCAN/FDCAN drivers). PR 4 of 10.
nhuvaoanh123 added a commit to nhuvaoanh123/openbsw that referenced this pull request Mar 30, 2026
Add the FdCanTransceiver module — OpenBSW ICanTransceiver adapter for
STM32G4 FDCAN peripheral. Mirrors the bxCAN transceiver from PR 3 but
supports FD frames (up to 64-byte payload) and extended filter banks.

- FdCanTransceiver: ICanTransceiver implementation for FDCAN
- Unit tests with mock FdCanDevice headers for host verification
- Updated bsp/CMakeLists.txt for CAN_TYPE-based transceiver selection

Milestone: `cmake --preset tests-stm32-debug` configures with both transceivers.
Depends on eclipse-openbsw#415 (PR 3: bxCAN/FDCAN drivers). PR 4 of 10.
nhuvaoanh123 added a commit to nhuvaoanh123/openbsw that referenced this pull request Mar 31, 2026
Add the FdCanTransceiver module — OpenBSW ICanTransceiver adapter for
STM32G4 FDCAN peripheral. Mirrors the bxCAN transceiver from PR 3 but
supports FD frames (up to 64-byte payload) and extended filter banks.

- FdCanTransceiver: ICanTransceiver implementation for FDCAN
- Unit tests with mock FdCanDevice headers for host verification
- Updated bsp/CMakeLists.txt for CAN_TYPE-based transceiver selection

Milestone: `cmake --preset tests-stm32-debug` configures with both transceivers.
Depends on eclipse-openbsw#415 (PR 3: bxCAN/FDCAN drivers). PR 4 of 10.
nhuvaoanh123 added a commit to nhuvaoanh123/openbsw that referenced this pull request Mar 31, 2026
Add the FdCanTransceiver module — OpenBSW ICanTransceiver adapter for
STM32G4 FDCAN peripheral. Mirrors the bxCAN transceiver from PR 3 but
supports FD frames (up to 64-byte payload) and extended filter banks.

- FdCanTransceiver: ICanTransceiver implementation for FDCAN
- Unit tests with mock FdCanDevice headers for host verification
- Updated bsp/CMakeLists.txt for CAN_TYPE-based transceiver selection

Milestone: `cmake --preset tests-stm32-debug` configures with both transceivers.
Depends on eclipse-openbsw#415 (PR 3: bxCAN/FDCAN drivers). PR 4 of 10.
@nhuvaoanh123 nhuvaoanh123 marked this pull request as draft May 1, 2026 19:16
@nhuvaoanh123 nhuvaoanh123 changed the title feat(stm32): bxCAN/FDCAN device drivers and CAN transceiver Add STM32 CAN drivers and bxCAN transceiver Jun 2, 2026
@nhuvaoanh123 nhuvaoanh123 deleted the stm32-pr-3 branch June 2, 2026 07:48
@nhuvaoanh123 nhuvaoanh123 reopened this Jun 2, 2026
@nhuvaoanh123 nhuvaoanh123 force-pushed the stm32-pr-3 branch 3 times, most recently from 5943ad8 to edd5db5 Compare June 2, 2026 08:23
Import the STM32F4 and STM32G4 CMSIS device headers from
STMicroelectronics' dedicated RIM-tracked repositories. Keep only the
F413 and G474 headers needed by the STM32 MCU foundation and record
the unused upstream headers as RIM ignores.
Add the STM32 platform entry point, chip CMake files, bspMcu startup
code, a software reset wrapper, and the STM32 unit-test presets. The
platform reuses the shared CMSIS core from libs/3rdparty/cmsis
instead of carrying a local copy.
Add STM32 BSP modules for clock, UART, GPIO, timer, ADC, and EEPROM,
plus interrupt handling primitives and the ETL platform glue.
@nhuvaoanh123 nhuvaoanh123 force-pushed the stm32-pr-3 branch 2 times, most recently from 5e65247 to 1f7657c Compare June 11, 2026 00:09
Add bxCAN and FDCAN device drivers with STM32 CAN tests.

Add the bxCAN transceiver adapter and unit-test registration.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant