From a93a44457d27264bc84f2cd49544f00a69e5d04a Mon Sep 17 00:00:00 2001 From: Damiano Ferrari Date: Tue, 23 Jan 2024 18:16:38 +0100 Subject: [PATCH 1/2] rpi-config: Add CAN0_INTERRUPT_PIN and CAN1_INTERRUPT_PIN variable Current configuration hard-code the values of the CAN interrupt pins. This setting allows to change them. The default values are the same as before. Signed-off-by: Damiano Ferrari --- recipes-bsp/bootfiles/rpi-config_git.bb | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/recipes-bsp/bootfiles/rpi-config_git.bb b/recipes-bsp/bootfiles/rpi-config_git.bb index d9d8bb05a..8bad1f7e7 100644 --- a/recipes-bsp/bootfiles/rpi-config_git.bb +++ b/recipes-bsp/bootfiles/rpi-config_git.bb @@ -29,6 +29,8 @@ GPIO_IR ?= "18" GPIO_IR_TX ?= "17" CAN_OSCILLATOR ?= "16000000" +CAN0_INTERRUPT_PIN ?= "25" +CAN1_INTERRUPT_PIN ?= "24" ENABLE_UART ??= "" @@ -247,12 +249,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 From eede0d6dbb3ab988bbb1373efd95777dc784d2a4 Mon Sep 17 00:00:00 2001 From: Damiano Ferrari Date: Tue, 23 Jan 2024 18:20:36 +0100 Subject: [PATCH 2/2] docs: add info on how to set different CAN interrupt pins Signed-off-by: Damiano Ferrari --- docs/extra-build-config.md | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/docs/extra-build-config.md b/docs/extra-build-config.md index 6c546794b..e934be0c5 100644 --- a/docs/extra-build-config.md +++ b/docs/extra-build-config.md @@ -314,6 +314,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):