Skip to content

CAN2 RX fix#9

Draft
LelsersLasers wants to merge 3 commits intomainfrom
millan/can_rx_fix
Draft

CAN2 RX fix#9
LelsersLasers wants to merge 3 commits intomainfrom
millan/can_rx_fix

Conversation

@LelsersLasers
Copy link
Copy Markdown
Member

@LelsersLasers LelsersLasers commented Apr 15, 2026

CAN2 is a slave of CAN1, so RX has to be "routed through" CAN1. Solution: even though we don't use CAN1, enable it and start it.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Enables and initializes CAN1 so that CAN2 (bxCAN “slave” instance on STM32F4) can reliably receive messages by ensuring the master CAN peripheral is also brought up.

Changes:

  • Added CAN1 MSP init/deinit handling and reference-counted CAN1 clock enabling alongside CAN2.
  • Added CAN1 handle, init function, and startup sequence in main.c prior to starting CAN2.
  • Updated CubeMX .ioc to enable CAN1 peripheral and assign PD0/PD1 for CAN1.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 4 comments.

File Description
AutonomousDistroBoard/Core/Src/stm32f4xx_hal_msp.c Adds CAN1 MSP init/deinit (GPIO + clock refcount) so CAN1 can be enabled alongside CAN2.
AutonomousDistroBoard/Core/Src/main.c Introduces hcan1, initializes/starts CAN1 before CAN2.
AutonomousDistroBoard/AutonomousDistroBoard.ioc Enables CAN1 in CubeMX config and assigns CAN1 pins.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread AutonomousDistroBoard/Core/Src/stm32f4xx_hal_msp.c
Comment thread AutonomousDistroBoard/Core/Src/main.c
Comment thread AutonomousDistroBoard/Core/Src/main.c Outdated
Comment thread AutonomousDistroBoard/AutonomousDistroBoard.ioc Outdated
@LelsersLasers LelsersLasers requested a review from shb-png April 16, 2026 00:02
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.

2 participants