From a7246a008d5f30b4a2071f6fb82d71c14d539597 Mon Sep 17 00:00:00 2001 From: Alexander Kozhinov Date: Sun, 8 Dec 2024 09:29:08 +0100 Subject: [PATCH] app: boards: add mks_canable_v20 A new low price board supporting CANnectvity Signed-off-by: Alexander Kozhinov --- .../mks_canable_v20/mks_canable_v20.conf | 20 +++++++++ .../mks_canable_v20/mks_canable_v20.overlay | 42 +++++++++++++++++++ app/sample.yaml | 1 + 3 files changed, 63 insertions(+) create mode 100644 app/boards/makerbase/mks_canable_v20/mks_canable_v20.conf create mode 100644 app/boards/makerbase/mks_canable_v20/mks_canable_v20.overlay diff --git a/app/boards/makerbase/mks_canable_v20/mks_canable_v20.conf b/app/boards/makerbase/mks_canable_v20/mks_canable_v20.conf new file mode 100644 index 0000000..58e101f --- /dev/null +++ b/app/boards/makerbase/mks_canable_v20/mks_canable_v20.conf @@ -0,0 +1,20 @@ +# The three lines below are needed to reduce ROM usage +CONFIG_LTO=y +CONFIG_SIZE_OPTIMIZATIONS=y +CONFIG_ISR_TABLES_LOCAL_DECLARATION=y + +CONFIG_USB_DEVICE_GS_USB_TIMESTAMP=y +CONFIG_USB_DEVICE_GS_USB_TERMINATION=n +CONFIG_USB_DEVICE_GS_USB_MAX_CHANNELS=1 +CONFIG_USB_DEVICE_GS_USB_TIMESTAMP_SOF=y +CONFIG_USB_DEVICE_GS_USB_IDENTIFICATION=y + +CONFIG_LOG=y +CONFIG_USB_DRIVER_LOG_LEVEL_ERR=y +CONFIG_USB_DEVICE_LOG_LEVEL_ERR=y +CONFIG_USB_DEVICE_GS_USB_LOG_LEVEL_DBG=n +CONFIG_CANNECTIVITY_LOG_LEVEL_DBG=n + +# Use candleLight_fw VID:PID: +CONFIG_CANNECTIVITY_USB_VID=0x1d50 +CONFIG_CANNECTIVITY_USB_PID=0x606f diff --git a/app/boards/makerbase/mks_canable_v20/mks_canable_v20.overlay b/app/boards/makerbase/mks_canable_v20/mks_canable_v20.overlay new file mode 100644 index 0000000..e2b2131 --- /dev/null +++ b/app/boards/makerbase/mks_canable_v20/mks_canable_v20.overlay @@ -0,0 +1,42 @@ +/* + * Copyright (c) 2024 Alexander Kozhinov + * + * SPDX-License-Identifier: Apache-2.0 + */ + + #include + +/ { + cannectivity: cannectivity { + compatible = "cannectivity"; + timestamp-counter = <&counters2>; + + channel0 { + compatible = "cannectivity-channel"; + can-controller = <&fdcan1>; + state-gpios = <&gpioa 15 GPIO_ACTIVE_LOW>; /* blue led */ + activity-gpios = <&gpioa 0 GPIO_ACTIVE_LOW>; /* green led */ + }; + }; +}; + +&zephyr_udc0 { + gs_usb0: gs_usb0 { + compatible = "gs_usb"; + }; +}; + +&timers2 { + /* Timer with 1us tick used for CAN timestamp */ + st,prescaler = <159>; + counters2: counter { + status = "okay"; + }; +}; + +&fdcan1 { + reg = <0x40006400 0x400>, <0x4000a400 0x450>; + reg-names = "m_can", "message_ram"; + bosch,mram-cfg = <0x0 28 8 3 3 0 3 3>; + status = "okay"; +}; diff --git a/app/sample.yaml b/app/sample.yaml index 1828c78..57bd7ac 100644 --- a/app/sample.yaml +++ b/app/sample.yaml @@ -25,6 +25,7 @@ tests: - lpcxpresso55s16 - nucleo_h723zg - usb2canfdv1 + - mks_canable_v20 app.cannectivity.sof: depends_on: - usb_device