From 1a288dfd2163d1f437d76a7960517b2d63fb04d6 Mon Sep 17 00:00:00 2001 From: Jean Alinei Date: Fri, 27 Jun 2025 13:15:33 +0200 Subject: [PATCH 1/2] Fixed issue when no power shield declared, non longer calling non existent safety API. Signed-off-by: Jean Alinei --- .../zephyr/src/uninterruptible_synchronous_task.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/zephyr/modules/owntech_task_api/zephyr/src/uninterruptible_synchronous_task.cpp b/zephyr/modules/owntech_task_api/zephyr/src/uninterruptible_synchronous_task.cpp index 19f5426e..0d6bf8a5 100644 --- a/zephyr/modules/owntech_task_api/zephyr/src/uninterruptible_synchronous_task.cpp +++ b/zephyr/modules/owntech_task_api/zephyr/src/uninterruptible_synchronous_task.cpp @@ -32,6 +32,7 @@ #include "hrtim.h" #include "SpinAPI.h" +#ifdef CONFIG_OWNTECH_SAFETY_API #include "safety_internal.h" #include "SafetyAPI.h" @@ -44,6 +45,8 @@ void thread_error(void *, void *, void *); K_THREAD_DEFINE(thread_error_id, STACKSIZE, thread_error, NULL, NULL, NULL, PRIORITY, 0, 0); +#endif + /** * Local variables and constants */ @@ -69,7 +72,7 @@ static bool safety_alert = false; /* Private API */ - +#ifdef CONFIG_OWNTECH_SAFETY_API void thread_error(void *, void *, void *) { while (1) @@ -99,6 +102,7 @@ void thread_error(void *, void *, void *) k_msleep(200); } } +#endif void user_task_proxy() { From 15133e510b7c9838acbb6984ff89f840361a5b23 Mon Sep 17 00:00:00 2001 From: Jean Alinei Date: Fri, 27 Jun 2025 13:47:30 +0200 Subject: [PATCH 2/2] Add support for src/app.ini as user side ini file. Add support for newest hardware versions. Signed-off-by: Jean Alinei --- platformio.ini | 52 +-- .../shields/ownverter/ownverter_v1_1_0.conf | 5 + .../ownverter/ownverter_v1_1_0.overlay | 421 ++++++++++++++++++ zephyr/boards/shields/twist/twist_v1_4_2.conf | 5 + .../boards/shields/twist/twist_v1_4_2.overlay | 348 +++++++++++++++ 5 files changed, 803 insertions(+), 28 deletions(-) create mode 100644 zephyr/boards/shields/ownverter/ownverter_v1_1_0.conf create mode 100644 zephyr/boards/shields/ownverter/ownverter_v1_1_0.overlay create mode 100644 zephyr/boards/shields/twist/twist_v1_4_2.conf create mode 100644 zephyr/boards/shields/twist/twist_v1_4_2.overlay diff --git a/platformio.ini b/platformio.ini index d151d84e..3016a62b 100644 --- a/platformio.ini +++ b/platformio.ini @@ -11,11 +11,13 @@ # The following selects the default environment that is used by VS Code "build" and "upload" buttons # Available environments: # - USB (default) -- Upload to the board using USB serial -# - STLink -- Upload to the board using ST Link (requires an aditional ST Link; allows debug) +# - STLink -- Upload to the board using ST Link (requires an additional ST Link; allows debug) default_envs = USB # Do not edit or remove the following line -extra_configs = owntech/pio_extra.ini +extra_configs = + owntech/pio_extra.ini + src/app.ini lib_dir = owntech/lib libdeps_dir = owntech/lib @@ -23,35 +25,29 @@ libdeps_dir = owntech/lib # Do not edit or remove the following line [env] -# Defines board -# Supported boards: -# - spin (default) -# - nucleo_g474re -board = spin +# |-----------------------------------------------------| +# | Supported Board Options | +# |-----------------------------------------------------| +# | Board Name | Board Versions | +# |-----------------|-----------------------------------| +# | spin | 1_0_0, 1_1_0, 1_2_0 | +# |-----------------------------------------------------| +# | Supported Shield Options | +# |-----------------------------------------------------| +# | Shield Name | Shield Versions | +# |-----------------|-----------------------------------| +# | twist | 1_2_0, 1_3_0, 1_4_0, 1_4_1, 1_4_2 | +# | ownverter | 0_9_0, 1_0_0, 1_1_0 | +# |-----------------------------------------------------| -# Defines board version -# Supported version: -# - 1_0_0 -# - 1_1_0 +# Selected Board and Version +board = spin board_version = 1_2_0 -# Defines shield -# Supported shields: -# - twist -# - ownverter +# Selected Shield Name and Version board_shield = twist - -# Defines shield version -# Refers to shield silkscreen to set shield version. -# Supported version twist: -# - 1_2_0 -# - 1_3_0 -# - 1_4_0 -# - 1_4_1 -# Supported version ownverter: -# - 0_9_0 -# - 1_0_0 -board_shield_version = 1_4_1 +board_shield_version = 1_4_2 +# To remove the shield entirely, comment out both `board_shield` and `board_shield_version` lines. # Compiler settings build_flags = @@ -66,7 +62,7 @@ monitor_speed = 115200 # board_id = 0123456789ABCDEF # PlatformIO libraries: uncomment a line to enable an OwnTech Power API Library, -# or add the name of a PlatformIO libray to enable it. +# or add the name of a PlatformIO library to enable it. # One library per line, 4 spaces at the beginning of the line. lib_deps= control_library = https://github.com/owntech-foundation/control_library.git diff --git a/zephyr/boards/shields/ownverter/ownverter_v1_1_0.conf b/zephyr/boards/shields/ownverter/ownverter_v1_1_0.conf new file mode 100644 index 00000000..543f4724 --- /dev/null +++ b/zephyr/boards/shields/ownverter/ownverter_v1_1_0.conf @@ -0,0 +1,5 @@ +CONFIG_OWNTECH_NGND_DRIVER=n +CONFIG_OWNTECH_UART_API=n + +CONFIG_USB_DEVICE_MANUFACTURER="OwnTech Technologies" +CONFIG_USB_DEVICE_PRODUCT="OWNVERTER_V1_1_0" \ No newline at end of file diff --git a/zephyr/boards/shields/ownverter/ownverter_v1_1_0.overlay b/zephyr/boards/shields/ownverter/ownverter_v1_1_0.overlay new file mode 100644 index 00000000..e1fc80eb --- /dev/null +++ b/zephyr/boards/shields/ownverter/ownverter_v1_1_0.overlay @@ -0,0 +1,421 @@ +/* + * Copyright (c) 2023-2024 OwnTech. + * + * SPDX-License-Identifier: LGPL-2.1 + */ + +/ { + choosen{ + zephyr,can-primary = &fdcan2; + }; + + pcb: pcb{ + compatible= "shield-pcb"; + shield-name = "OWNVERTER"; + shield-version = "v1.1.0"; + }; + + powershield: power-shield{ + compatible = "power-leg"; + default-frequency = <200000>; + min-frequency = <200000>; + leg1: leg1{ + leg-name = "LEG1"; + pwms = <&pwma 1 0>, <&pwma 2 0>; + pwm-pin-num = <12 14>; + driver-pin-num = <19>; + current-pin-num = <25>; + default-adc = "ADC_1"; + default-adc-decim = <1>; + default-edge-trigger = "EdgeTrigger_up"; + default-dead-time = <100 100>; + default-modulation = "UpDwn"; + default-phase-shift = <0>; + status = "okay"; + }; + + leg2: leg2{ + leg-name = "LEG2"; + pwms = <&pwmc 1 0>, <&pwmc 2 0>; + pwm-pin-num = <2 4>; + driver-pin-num = <22>; + current-pin-num = <30>; + default-adc = "ADC_2"; + default-adc-decim = <1>; + default-edge-trigger = "EdgeTrigger_up"; + default-dead-time = <100 100>; + default-modulation = "UpDwn"; + default-phase-shift = <0>; + status = "okay"; + }; + + leg3: leg3{ + leg-name = "LEG3"; + pwms = <&pwme 1 0>, <&pwme 2 0>; + pwm-pin-num = <10 11>; + driver-pin-num = <56>; + current-pin-num = <1>; + default-adc = "UNKNOWN_ADC"; + default-adc-decim = <1>; + default-edge-trigger = "EdgeTrigger_up"; + default-dead-time = <100 100>; + default-modulation = "UpDwn"; + default-phase-shift = <0>; + status = "okay"; + }; + }; + + shield-sensors { + /* Voltage channels */ + v1low: v1-low { + compatible = "shield-sensors"; + sensor-name = "V1_LOW"; + default-gain = <0x3d3851ec>; + default-offset = <0xc2b867f0>; + sensor-conv-type = "LINEAR"; + v1-low-adc1 { + io-channels = <&adc1 6>; + spin-pin = <24>; + }; + v1-low-adc2 { + io-channels = <&adc2 6>; + spin-pin = <24>; + }; + status = "okay"; + }; + + v2low: v2-low { + compatible = "shield-sensors"; + sensor-name = "V2_LOW"; + default-gain = <0x3d3851ec>; + default-offset = <0xc2b867f0>; + sensor-conv-type = "LINEAR"; + v2-low-adc1 { + io-channels = <&adc1 1>; + spin-pin = <29>; + }; + v2-low-adc2 { + io-channels = <&adc2 1>; + spin-pin = <29>; + }; + status = "okay"; + }; + + v3low: v3-low { + compatible = "shield-sensors"; + sensor-name = "V3_LOW"; + default-gain = <0x3d3851ec>; + default-offset = <0xc2b867f0>; + sensor-conv-type = "LINEAR"; + v3-low-adc2 { + io-channels = <&adc2 4>; + spin-pin = <44>; + }; + status = "okay"; + }; + + vhigh: v-high { + compatible = "shield-sensors"; + sensor-name = "V_HIGH"; + default-gain = <0x3cf57710>; + default-offset = <0x00000000>; + sensor-conv-type = "LINEAR"; + v-high-adc1 { + io-channels = <&adc1 8>; + spin-pin = <26>; + }; + v-high-adc2 { + io-channels = <&adc2 8>; + spin-pin = <26>; + }; + status = "okay"; + }; + + vneutr: vneutr { + compatible = "shield-sensors"; + sensor-name = "V_NEUTR"; + default-gain = <0x3f800000>; + default-offset = <0x00000000>; + sensor-conv-type = "LINEAR"; + vneutr-adc1 { + io-channels = <&adc1 15>; + spin-pin = <31>; + }; + status = "okay"; + }; + + /* Current channels */ + + i1low: i1-low { + compatible = "shield-sensors"; + sensor-name = "I1_LOW"; + default-gain = <0x3ba3d70a>; + default-offset = <0xc1200000>; + sensor-conv-type = "LINEAR"; + i1-low-adc1 { + io-channels = <&adc1 7>; + spin-pin = <25>; + }; + i1-low-adc2 { + io-channels = <&adc2 7>; + spin-pin = <25>; + }; + status = "okay"; + }; + + i2low: i2-low { + compatible = "shield-sensors"; + sensor-name = "I2_LOW"; + default-gain = <0x3ba3d70a>; + default-offset = <0xc1200000>; + sensor-conv-type = "LINEAR"; + i2-low-adc1 { + io-channels = <&adc1 2>; + spin-pin = <30>; + }; + i2-low-adc2 { + io-channels = <&adc2 2>; + spin-pin = <30>; + }; + status = "okay"; + }; + + i3low: i3-low { + compatible = "shield-sensors"; + sensor-name = "I3_LOW"; + default-gain = <0x3d3851ec>; + default-offset = <0xc2b867f0>; + sensor-conv-type = "LINEAR"; + v3-low-adc1 { + io-channels = <&adc1 14>; + spin-pin = <1>; + }; + v3-low-adc2 { + io-channels = <&adc2 14>; + spin-pin = <1>; + }; + status = "okay"; + }; + + ihigh: i-high { + compatible = "shield-sensors"; + sensor-name = "I_HIGH"; + default-gain = <0x3ba3d70a>; + default-offset = <0xc1200000>; + sensor-conv-type = "LINEAR"; + i-high-adc1 { + io-channels = <&adc1 9>; + spin-pin = <27>; + }; + i-high-adc2 { + io-channels = <&adc2 9>; + spin-pin = <27>; + }; + status = "okay"; + }; + + /* Other channels */ + + temp: temp-sensor { + compatible = "shield-sensors"; + sensor-name = "TEMP_SENSOR"; + default-r0 = <0x461c4000>; + default-b = <0x4557a000>; + default-rdiv = <0x469c4000>; + default-t0 = <0x43951333>; + sensor-conv-type = "THERMISTANCE"; + mux-spin-pin-1 = <15>; + mux-spin-pin-2 = <21>; + temp-sensor-adc2 { + io-channels = <&adc2 15>; + spin-pin = <6>; + }; + status = "okay"; + }; + + analog: analog-comm { + compatible = "shield-sensors"; + sensor-name = "ANALOG_COMM"; + default-gain = <0x3f800000>; + default-offset = <0x00000000>; + sensor-conv-type = "LINEAR"; + extra-sensor-adc2 { + io-channels = <&adc2 5>; + spin-pin = <35>; + }; + status = "okay"; + }; + + sin: analog-sin { + compatible = "shield-sensors"; + sensor-name = "ANALOG_SIN"; + default-gain = <0x3f800000>; + default-offset = <0x00000000>; + sensor-conv-type = "LINEAR"; + analog-sin-adc2 { + io-channels = <&adc2 11>; + spin-pin = <43>; + }; + status = "okay"; + }; + cos: analog-cos { + compatible = "shield-sensors"; + sensor-name = "ANALOG_COS"; + default-gain = <0x3f800000>; + default-offset = <0x00000000>; + sensor-conv-type = "LINEAR"; + analog-cos-adc2 { + io-channels = <&adc2 17>; + spin-pin = <45>; + }; + status = "okay"; + }; + }; + + shield-safety-thresholds { + + /* Voltage thresholds */ + + v1lowtd: v1-low-td { + compatible = "safety-thresholds"; + sensor-name = "V1_LOW"; + threshold-name = "V1_LOW_TD"; + threshold-high = <0x428c0000>; /* 70.0 */ + threshold-low = <0xc1200000>; /* -10.0 */ + status = "okay"; + }; + + v2lowtd: v2-low-td { + compatible = "safety-thresholds"; + sensor-name = "V2_LOW"; + threshold-name = "V2_LOW_TD"; + threshold-high = <0x428c0000>; /* 70.0 */ + threshold-low = <0xc1200000>; /* -10.0 */ + status = "okay"; + }; + + v3lowtd: v3-low-td { + compatible = "safety-thresholds"; + sensor-name = "V3_LOW"; + threshold-name = "V3_LOW_TD"; + threshold-high = <0x428c0000>; /* 70.0 */ + threshold-low = <0xc1200000>; /* -10.0 */ + status = "okay"; + }; + + vhightd: v-high-td { + compatible = "safety-thresholds"; + sensor-name = "V_HIGH"; + threshold-name = "V_HIGH_TD"; + threshold-high = <0x42c80000>; /* 100.0 */ + threshold-low = <0x41200000>; /* 10.0 */ + status = "okay"; + }; + + /* Current thresholds */ + + i1lowtd: i1-low-td { + compatible = "safety-thresholds"; + sensor-name = "I1_LOW"; + threshold-name = "I1_LOW_TD"; + threshold-high = <0x40e00000>; /* 7.0 */ + threshold-low = <0xc0e00000>; /* -7.0 */ + status = "okay"; + }; + + i2lowtd: i2-low-td { + compatible = "safety-thresholds"; + sensor-name = "I2_LOW"; + threshold-name = "I2_LOW_TD"; + threshold-high = <0x40e00000>; /* 7.0 */ + threshold-low = <0xc0e00000>; /* -7.0 */ + status = "okay"; + }; + + i3lowtd: i3-low-td { + compatible = "safety-thresholds"; + sensor-name = "I3_LOW"; + threshold-name = "I3_LOW_TD"; + threshold-high = <0x40e00000>; /* 7.0 */ + threshold-low = <0xc0e00000>; /* -7.0 */ + status = "okay"; + }; + + /* Other channels thresholds */ + + temptd: temp-sensor-td { + compatible = "safety-thresholds"; + sensor-name = "TEMP_SENSOR"; + threshold-name = "TEMP_SENSOR_TD"; + threshold-high = <0x428c0000>; /* 70C */ + threshold-low = <0xc1a00000>; /* -20C */ + status = "disabled"; + }; + + analogtd: analog-comm-td { + compatible = "safety-thresholds"; + sensor-name = "ANALOG_COMM"; + threshold-name = "ANALOG_COMM_TD"; + threshold-high = <0x00000000>; + threshold-low = <0x00000000>; + status = "disabled"; + }; + }; +}; + +// UART / RS485 transceiver + +&usart3 { + pinctrl-0 = < &usart3_tx_pc10 &usart3_rx_pc11 >; + pinctrl-names = "default"; + current-speed = <10625000>; + status = "okay"; +}; + +// CAN + +&fdcan2 { + pinctrl-0 = <&fdcan2_rx_pb5 &fdcan2_tx_pb6>; + pinctrl-names = "default"; + bitrate = <500000>; + sample-point = <875>; + bitrate-data = <500000>; + sample-point-data = <875>; + status = "okay"; + transceiver0: can-phy0 { + compatible = "ti,tcan334", "can-transceiver-gpio"; + max-bitrate = <1000000>; + standby-gpios = <&gpiob 4 GPIO_ACTIVE_HIGH>; + #phy-cells = <0>; + }; +}; + +&pwma { + status = "okay"; +}; + +&pwmc { + status = "okay"; +}; + +&pwmd { + status = "disabled"; +}; + +&pwme { + status = "okay"; +}; + +&pwmf { + status = "disabled"; +}; + + +&hrtim1 { + scin: scin { + pinctrl-0 = <&hrtim1_scin_pb2>; + }; + scout: scout { + pinctrl-0 = <&hrtim1_scout_pb1>; + }; +}; diff --git a/zephyr/boards/shields/twist/twist_v1_4_2.conf b/zephyr/boards/shields/twist/twist_v1_4_2.conf new file mode 100644 index 00000000..bf7defe6 --- /dev/null +++ b/zephyr/boards/shields/twist/twist_v1_4_2.conf @@ -0,0 +1,5 @@ +CONFIG_OWNTECH_NGND_DRIVER=n +CONFIG_OWNTECH_UART_API=n + +CONFIG_USB_DEVICE_MANUFACTURER="OwnTech Technologies" +CONFIG_USB_DEVICE_PRODUCT="TWIST_V1_4_2" \ No newline at end of file diff --git a/zephyr/boards/shields/twist/twist_v1_4_2.overlay b/zephyr/boards/shields/twist/twist_v1_4_2.overlay new file mode 100644 index 00000000..fbe26c57 --- /dev/null +++ b/zephyr/boards/shields/twist/twist_v1_4_2.overlay @@ -0,0 +1,348 @@ +/* + * Copyright (c) 2023-2024 OwnTech. + * + * SPDX-License-Identifier: LGPL-2.1 + */ + +/ { + choosen{ + zephyr,can-primary = &fdcan2; + thingset,can = &fdcan2; + }; + + pcb: pcb{ + compatible= "shield-pcb"; + shield-name = "TWIST"; + shield-version = "v1.4.2"; + }; + + powershield: power-shield{ + compatible = "power-leg"; + default-frequency = <200000>; + min-frequency = <50000>; + leg1: leg1{ + leg-name = "LEG1"; + pwms = <&pwma 1 0>, <&pwma 2 0>; + pwm-pin-num = <12 14>; + capa-pin-num = <7>; + driver-pin-num = <19>; + current-pin-num = <30>; + default-adc = "ADC_1"; + default-adc-decim = <1>; + default-edge-trigger = "EdgeTrigger_up"; + default-dead-time = <100 100>; + default-modulation = "UpDwn"; + default-phase-shift = <0>; + status = "okay"; + }; + + leg2: leg2{ + leg-name = "LEG2"; + pwms = <&pwmc 1 0>, <&pwmc 2 0>; + pwm-pin-num = <2 4>; + capa-pin-num = <56>; + driver-pin-num = <22>; + current-pin-num = <25>; + default-adc = "ADC_2"; + default-adc-decim = <1>; + default-edge-trigger = "EdgeTrigger_up"; + default-dead-time = <100 100>; + default-modulation = "UpDwn"; + default-phase-shift = <0>; + status = "okay"; + }; + }; + + shield-sensors { + /* Voltage channels */ + v1low: v1-low { + compatible = "shield-sensors"; + sensor-name = "V1_LOW"; + default-gain = <0x3d3851ec>; + default-offset = <0xc2b867f0>; + sensor-conv-type = "LINEAR"; + v1-low-adc1 { + io-channels = <&adc1 1>; + spin-pin = <29>; + }; + v1-low-adc2 { + io-channels = <&adc2 1>; + spin-pin = <29>; + }; + status = "okay"; + }; + + v2low: v2-low { + compatible = "shield-sensors"; + sensor-name = "V2_LOW"; + default-gain = <0x3d3851ec>; + default-offset = <0xc2b867f0>; + sensor-conv-type = "LINEAR"; + v2-low-adc1 { + io-channels = <&adc1 6>; + spin-pin = <24>; + }; + v2-low-adc2 { + io-channels = <&adc2 6>; + spin-pin = <24>; + }; + status = "okay"; + }; + + vhigh: v-high { + compatible = "shield-sensors"; + sensor-name = "V_HIGH"; + default-gain = <0x3cf57710>; + default-offset = <0x00000000>; + sensor-conv-type = "LINEAR"; + v-high-adc1 { + io-channels = <&adc1 9>; + spin-pin = <27>; + }; + v-high-adc2 { + io-channels = <&adc2 9>; + spin-pin = <27>; + }; + status = "okay"; + }; + + /* Current channels */ + + i1low: i1-low { + compatible = "shield-sensors"; + sensor-name = "I1_LOW"; + default-gain = <0x3ba3d70a>; + default-offset = <0xc1200000>; + sensor-conv-type = "LINEAR"; + i1-low-adc1 { + io-channels = <&adc1 2>; + spin-pin = <30>; + }; + i1-low-adc2 { + io-channels = <&adc2 2>; + spin-pin = <30>; + }; + status = "okay"; + }; + + i2low: i2-low { + compatible = "shield-sensors"; + sensor-name = "I2_LOW"; + default-gain = <0x3ba3d70a>; + default-offset = <0xc1200000>; + sensor-conv-type = "LINEAR"; + i2-low-adc1 { + io-channels = <&adc1 7>; + spin-pin = <25>; + }; + i2-low-adc2 { + io-channels = <&adc2 7>; + spin-pin = <25>; + }; + status = "okay"; + }; + + ihigh: i-high { + compatible = "shield-sensors"; + sensor-name = "I_HIGH"; + default-gain = <0x3ba3d70a>; + default-offset = <0xc1200000>; + sensor-conv-type = "LINEAR"; + i-high-adc1 { + io-channels = <&adc1 8>; + spin-pin = <26>; + }; + i-high-adc2 { + io-channels = <&adc2 8>; + spin-pin = <26>; + }; + status = "okay"; + }; + + /* Other channels */ + + temp1: temp-sensor-1 { + compatible = "shield-sensors"; + sensor-name = "TEMP_SENSOR_1"; + default-r0 = <0x461c4000>; + default-b = <0x4557a000>; + default-rdiv = <0x469c4000>; + default-t0 = <0x43951333>; + sensor-conv-type = "THERMISTANCE"; + analog-comm-adc4 { + io-channels = <&adc4 5>; + spin-pin = <6>; + }; + status = "okay"; + }; + + temp2: temp-sensor-2 { + compatible = "shield-sensors"; + sensor-name = "TEMP_SENSOR_2"; + default-r0 = <0x461c4000>; + default-b = <0x4557a000>; + default-rdiv = <0x469c4000>; + default-t0 = <0x43951333>; + sensor-conv-type = "THERMISTANCE"; + temp-sensor-adc3 { + io-channels = <&adc3 12>; + spin-pin = <31>; + }; + status = "okay"; + }; + + analog: analog-comm { + compatible = "shield-sensors"; + sensor-name = "ANALOG_COMM"; + default-gain = <0x3f800000>; + default-offset = <0x00000000>; + sensor-conv-type = "LINEAR"; + extra-sensor-adc2 { + io-channels = <&adc2 5>; + spin-pin = <35>; + }; + status = "okay"; + }; + }; + + shield-safety-thresholds { + + /* Voltage thresholds */ + + v1lowtd: v1-low-td { + compatible = "safety-thresholds"; + sensor-name = "V1_LOW"; + threshold-name = "V1_LOW_TD"; + threshold-high = <0x428c0000>; /* 70.0 */ + threshold-low = <0xc1200000>; /* -10.0 */ + status = "okay"; + }; + + v2lowtd: v2-low-td { + compatible = "safety-thresholds"; + sensor-name = "V2_LOW"; + threshold-name = "V2_LOW_TD"; + threshold-high = <0x428c0000>; /* 70.0 */ + threshold-low = <0xc1200000>; /* -10.0 */ + status = "okay"; + }; + + vhightd: v-high-td { + compatible = "safety-thresholds"; + sensor-name = "V_HIGH"; + threshold-name = "V_HIGH_TD"; + threshold-high = <0x42c80000>; /* 100.0 */ + threshold-low = <0x41200000>; /* 10.0 */ + status = "okay"; + }; + + /* Current thresholds */ + + i1lowtd: i1-low-td { + compatible = "safety-thresholds"; + sensor-name = "I1_LOW"; + threshold-name = "I1_LOW_TD"; + threshold-high = <0x40e00000>; /* 7.0 */ + threshold-low = <0xc0e00000>; /* -7.0 */ + status = "okay"; + }; + + i2lowtd: i2-low-td { + compatible = "safety-thresholds"; + sensor-name = "I2_LOW"; + threshold-name = "I2_LOW_TD"; + threshold-high = <0x40e00000>; /* 7.0 */ + threshold-low = <0xc0e00000>; /* -7.0 */ + status = "okay"; + }; + + ihightd: i-high-td { + compatible = "safety-thresholds"; + sensor-name = "I_HIGH"; + threshold-name = "I_HIGH_TD"; + threshold-high = <0x40e00000>; /* 7.0 */ + threshold-low = <0xc0e00000>; /* -7.0 */ + status = "okay"; + }; + + /* Other channels thresholds */ + + temptd1: temp-sensor-1-td { + compatible = "safety-thresholds"; + sensor-name = "TEMP_SENSOR_1"; + threshold-name = "TEMP_SENSOR_1_TD"; + threshold-high = <0x428c0000>; /* 70C */ + threshold-low = <0xc1a00000>; /* -20C */ + status = "disabled"; + }; + + temptd2: temp-sensor-2-td { + compatible = "safety-thresholds"; + sensor-name = "TEMP_SENSOR_2"; + threshold-name = "TEMP_SENSOR_2_TD"; + threshold-high = <0x428c0000>; /* 70C */ + threshold-low = <0xc1a00000>; /* -20C */ + status = "disabled"; + }; + + + analogtd: analog-comm-td { + compatible = "safety-thresholds"; + sensor-name = "ANALOG_COMM"; + threshold-name = "ANALOG_COMM_TD"; + threshold-high = <0x00000000>; + threshold-low = <0x00000000>; + status = "disabled"; + }; + }; +}; + +// UART / RS485 transceiver + +&usart3 { + pinctrl-0 = < &usart3_tx_pc10 &usart3_rx_pc11 >; + pinctrl-names = "default"; + current-speed = <10625000>; + status = "okay"; +}; + +// CAN + +&fdcan2 { + pinctrl-0 = <&fdcan2_rx_pb5 &fdcan2_tx_pb6>; + pinctrl-names = "default"; + bitrate = <500000>; + sample-point = <875>; + bitrate-data = <2000000>; + sample-point-data = <875>; + status = "okay"; +}; + +&pwma { + status = "okay"; +}; + +&pwmc { + status = "okay"; +}; + +&pwmd { + status = "disabled"; +}; + +&pwme { + status = "disabled"; +}; + +&pwmf { + status = "disabled"; +}; + +&hrtim1 { + scin: scin { + pinctrl-0 = <&hrtim1_scin_pb2>; + }; + scout: scout { + pinctrl-0 = <&hrtim1_scout_pb1>; + }; +};