From c2cbafe78f6d97cd74f2604cac7066cf2e7861bd Mon Sep 17 00:00:00 2001 From: Jakub Luzny Date: Thu, 16 Jul 2020 14:39:38 +0200 Subject: rpi-config: Add CAN_OSCILLATOR variable to set mcp2515 crystal frequency Current configuration (16MHz) is made for the PiCAN2 board that uses 16MHz crystal. This setting allows for use of Waveshare RS485 CAN HAT that has 8MHz crystal soldered (although according to Waveshare there is also a 12MHz crystal version of the board). Signed-off-by: Jakub Luzny --- 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 afdbce6..be84aa6 100644 --- a/recipes-bsp/bootfiles/rpi-config_git.bb +++ b/recipes-bsp/bootfiles/rpi-config_git.bb @@ -28,6 +28,8 @@ VC4DTBO ?= "vc4-kms-v3d" GPIO_IR ?= "18" GPIO_IR_TX ?= "17" +CAN_OSCILLATOR ?= "16000000" + inherit deploy nopackages do_deploy() { @@ -201,12 +203,12 @@ do_deploy() { # ENABLE DUAL CAN if [ "${ENABLE_DUAL_CAN}" = "1" ]; then echo "# Enable DUAL CAN" >>${DEPLOYDIR}/bcm2835-bootfiles/config.txt - echo "dtoverlay=mcp2515-can0,oscillator=16000000,interrupt=25" >>${DEPLOYDIR}/bcm2835-bootfiles/config.txt - echo "dtoverlay=mcp2515-can1,oscillator=16000000,interrupt=24" >>${DEPLOYDIR}/bcm2835-bootfiles/config.txt + echo "dtoverlay=mcp2515-can0,oscillator=${CAN_OSCILLATOR},interrupt=25" >>${DEPLOYDIR}/bcm2835-bootfiles/config.txt + echo "dtoverlay=mcp2515-can1,oscillator=${CAN_OSCILLATOR},interrupt=24" >>${DEPLOYDIR}/bcm2835-bootfiles/config.txt # ENABLE CAN elif [ "${ENABLE_CAN}" = "1" ]; then echo "# Enable CAN" >>${DEPLOYDIR}/bcm2835-bootfiles/config.txt - echo "dtoverlay=mcp2515-can0,oscillator=16000000,interrupt=25" >>${DEPLOYDIR}/bcm2835-bootfiles/config.txt + echo "dtoverlay=mcp2515-can0,oscillator=${CAN_OSCILLATOR},interrupt=25" >>${DEPLOYDIR}/bcm2835-bootfiles/config.txt fi # Append extra config if the user has provided any -- cgit v1.2.3-54-g00ecf