sl-perception created pull request seb/saltylab-firmware#677

sl-perception
Tue, 17 Mar 2026 20:32:14 -0400

677#fix: remap CAN from CAN2/PB12-13 to CAN1/PB8-9 (Issue #676)#

Summary

Root cause: Mamba F722S MK2 does not expose PB12/PB13 externally; Waveshare CAN module is wired to the SCL (PB8) and SDA (PB9) header pads

Swap CAN2 → CAN1, GPIO_PIN_12/13 → GPIO_PIN_8/9, GPIO_AF9_CAN2 → GPIO_AF9_CAN1 in can_driver_init()

Drop __HAL_RCC_CAN2_CLK_ENABLE() — CAN1 is self-clocked

Move filter bank from 14 → 0 (bank 14 is the CAN2 slave-start boundary; CAN1 master banks start at 0)

I2C1 conflict resolved: BME280 already moved to I2C2 (PB10/PB11), so PB8/PB9 are free

Test plan

Build firmware and flash to FC (USB-connected to mbpm4)

Verify CAN bus enumerates: candump on Orin /dev/ttyACM0 shows motor controller feedback frames

Verify motor velocity commands reach BLDC controllers (RPM follows balance PID output)

Confirm no I2C1 regression (baro/mag paths gracefully absent if I2C1 unused)

🤖 Generated with Claude Code