Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Define CAN interrupt pins #1266

Merged
merged 2 commits into from
Jan 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions docs/extra-build-config.md
Original file line number Diff line number Diff line change
Expand Up @@ -340,6 +340,13 @@ Some modules may require setting the frequency of the crystal oscillator used on

CAN_OSCILLATOR="8000000"

Configure the interrupt pin to the one connected to the CAN module. By default,
the pins are set to 25 for can0 and 24 for can1. To change them to 12 and 16,
the following variables also have to be set:

CAN0_INTERRUPT_PIN = "12"
CAN1_INTERRUPT_PIN = "16"

Tested modules:

* PiCAN2 (16 MHz crystal): <http://skpang.co.uk/catalog/pican2-canbus-board-for-raspberry-pi-23-p-1475.html>
Expand Down
8 changes: 5 additions & 3 deletions recipes-bsp/bootfiles/rpi-config_git.bb
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@ GPIO_IR ?= "18"
GPIO_IR_TX ?= "17"

CAN_OSCILLATOR ?= "16000000"
CAN0_INTERRUPT_PIN ?= "25"
CAN1_INTERRUPT_PIN ?= "24"

ENABLE_UART ??= ""

Expand Down Expand Up @@ -268,12 +270,12 @@ do_deploy() {
# ENABLE DUAL CAN
if [ "${ENABLE_DUAL_CAN}" = "1" ]; then
echo "# Enable DUAL CAN" >>$CONFIG
echo "dtoverlay=mcp2515-can0,oscillator=${CAN_OSCILLATOR},interrupt=25" >>$CONFIG
echo "dtoverlay=mcp2515-can1,oscillator=${CAN_OSCILLATOR},interrupt=24" >>$CONFIG
echo "dtoverlay=mcp2515-can0,oscillator=${CAN_OSCILLATOR},interrupt=${CAN0_INTERRUPT_PIN}" >>$CONFIG
echo "dtoverlay=mcp2515-can1,oscillator=${CAN_OSCILLATOR},interrupt=${CAN1_INTERRUPT_PIN}" >>$CONFIG
# ENABLE CAN
elif [ "${ENABLE_CAN}" = "1" ]; then
echo "# Enable CAN" >>$CONFIG
echo "dtoverlay=mcp2515-can0,oscillator=${CAN_OSCILLATOR},interrupt=25" >>$CONFIG
echo "dtoverlay=mcp2515-can0,oscillator=${CAN_OSCILLATOR},interrupt=${CAN0_INTERRUPT_PIN}" >>$CONFIG
fi


Expand Down
Loading