Skip to content

arch/arm: Fix FlexCAN config initializers clobbering rx_pin instead of enable_high - #19721

Open
Javinator9889 wants to merge 3 commits into
apache:masterfrom
Javinator9889:bugfix/s32k1_fix_flexcan_config
Open

arch/arm: Fix FlexCAN config initializers clobbering rx_pin instead of enable_high#19721
Javinator9889 wants to merge 3 commits into
apache:masterfrom
Javinator9889:bugfix/s32k1_fix_flexcan_config

Conversation

@Javinator9889

@Javinator9889 Javinator9889 commented Aug 6, 2026

Copy link
Copy Markdown
Contributor

Summary

The FlexCAN per-controller config initializers in three ARM drivers contain a
copy-paste defect: inside the CAN2 (and, on S32K3XX, CAN3) blocks a second
.rx_pin designator appears where .enable_high was intended. C designated
initializers let a later designator for the same member silently override an
earlier one, so .rx_pin = PIN_CANx_RX is discarded and .enable_high is
never assigned at all, falling back to 0 from static zero-initialization.

Testing

Tested locally on a S32K1 device with a CAN interface connected to it. The changes done to the other boards were not physically validated (but the error would be the same as they share the pins definition)

The `rx_pin` configuration when `CONFIG_S32K1XX_FLEXCAN2` is defined is
overwritten if `PIN_CAN2_ENABLE` is defined, breaking the flexcan config
for S32K1 MCU. Additionally, the `.enable_high` configuration points to
a non-defined constant/macro (looks like a legacy from the first driver
definition). Based on regularly maintained drivers (such as s32k3), this
was changed to `CAN2_ENABLE_OUT`

Signed-off-by: Javier Alonso <javieralonso@geotab.com>
The `rx_pin` configuration when `CONFIG_KINETIS_FLEXCAN2` is defined is
overwritten if `PIN_CAN2_ENABLE` is defined, breaking the flexcan config
for Kinetis MCU. Additionally, the `.enable_high` configuration points to
a non-defined constant/macro (looks like a legacy from the first driver
definition). Based on regularly maintained drivers (such as s32k3), this
was changed to `CAN2_ENABLE_OUT`

Signed-off-by: Javier Alonso <javieralonso@geotab.com>
The `rx_pin` configuration when `CONFIG_S32K3XX_FLEXCAN2` is defined is
overwritten if `PIN_CAN2_ENABLE` is defined, breaking the flexcan config
for S32K3 MCU.

Signed-off-by: Javier Alonso <javieralonso@geotab.com>
@Javinator9889
Javinator9889 force-pushed the bugfix/s32k1_fix_flexcan_config branch from 1d506e0 to 96c505e Compare August 6, 2026 15:10
@Javinator9889 Javinator9889 changed the title arch/arm/src/s32k1xx/s32k1xx_flexcan.c: do not overwrite rx_pin configuration on #ifdef PIN_CAN2_ENABLE else branch arch/arm: Fix FlexCAN config initializers clobbering rx_pin instead of enable_high Aug 6, 2026
@github-actions github-actions Bot added Arch: arm Issues related to ARM (32-bit) architecture Size: XS The size of the change in this PR is very small Size: S The size of the change in this PR is small and removed Size: XS The size of the change in this PR is very small labels Aug 6, 2026
@github-actions

github-actions Bot commented Aug 6, 2026

Copy link
Copy Markdown

MemBrowse Memory Report

esp32-devkitc

  • ROM: .flash.text +8 B (+0.0%, 124,408 B / 4,194,272 B, total: 3% used)
  • irom0_0_seg: .flash.text +8 B (+0.0%, 88,612 B / 3,342,304 B, total: 3% used)

qemu-armv8a

  • Code: .text.readline_common +8 B (+0.0%, 318,974 B)

qemu-intel64

  • Code: .text +3 B (+0.0%, 8,658,920 B)

rx65n-rsk2mb

@Javinator9889

Copy link
Copy Markdown
Contributor Author

Looks like there was a runner failure... And I cannot re-trigger the pipeline

@Javinator9889

Copy link
Copy Markdown
Contributor Author

Looks like there was a runner failure... And I cannot re-trigger the pipeline

@xiaoxiang781216 do you mind re-running the pipeline? The jobs did fail because of an HTTP error and the remaining jobs got cancelled because of it

@xiaoxiang781216

Copy link
Copy Markdown
Contributor

Looks like there was a runner failure... And I cannot re-trigger the pipeline

@xiaoxiang781216 do you mind re-running the pipeline? The jobs did fail because of an HTTP error and the remaining jobs got cancelled because of it

restarted.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Arch: arm Issues related to ARM (32-bit) architecture Size: S The size of the change in this PR is small

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants