Upgrade to Zephyr v3.0
This commit is contained in:
@@ -10,7 +10,7 @@ target_sources(app PRIVATE
|
||||
daq_driver.c
|
||||
device_status.cpp
|
||||
dcdc.cpp
|
||||
half_bridge.cpp
|
||||
half_bridge.c
|
||||
hardware.cpp
|
||||
leds.cpp
|
||||
load.cpp
|
||||
|
||||
+3
-3
@@ -142,7 +142,7 @@ K_THREAD_DEFINE(can_isotp, RX_THREAD_STACK_SIZE, can_isotp_thread, NULL, NULL, N
|
||||
#define TS_CAN_SOURCE_GET(id) (((uint32_t)id & TS_CAN_SOURCE_MASK) >> TS_CAN_SOURCE_POS)
|
||||
#define TS_CAN_DATA_ID_GET(id) (((uint32_t)id & TS_CAN_DATA_ID_MASK) >> TS_CAN_DATA_ID_POS)
|
||||
|
||||
CAN_DEFINE_MSGQ(sub_msgq, 10);
|
||||
CAN_MSGQ_DEFINE(sub_msgq, 10);
|
||||
|
||||
const struct zcan_filter ctrl_filter = {
|
||||
.id = TS_CAN_BASE_CONTROL,
|
||||
@@ -168,7 +168,7 @@ void can_pub_send(uint32_t can_id, uint8_t can_data[8], uint8_t data_len)
|
||||
if (data_len >= 0) {
|
||||
frame.dlc = data_len;
|
||||
|
||||
if (can_send(can_dev, &frame, K_MSEC(10), can_pub_isr, NULL) != CAN_TX_OK) {
|
||||
if (can_send(can_dev, &frame, K_MSEC(10), can_pub_isr, NULL) != 0) {
|
||||
LOG_DBG("Error sending CAN frame");
|
||||
}
|
||||
}
|
||||
@@ -190,7 +190,7 @@ void can_pubsub_thread()
|
||||
return;
|
||||
}
|
||||
|
||||
int filter_id = can_attach_msgq(can_dev, &sub_msgq, &ctrl_filter);
|
||||
int filter_id = can_add_rx_filter_msgq(can_dev, &sub_msgq, &ctrl_filter);
|
||||
if (filter_id < 0) {
|
||||
LOG_ERR("Unable to attach ISR [%d]", filter_id);
|
||||
return;
|
||||
|
||||
@@ -4,25 +4,25 @@
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
#define DT_DRV_COMPAT half_bridge
|
||||
|
||||
#include "half_bridge.h"
|
||||
|
||||
#include <zephyr.h>
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
#include "board.h"
|
||||
#include "mcu.h"
|
||||
#include "setup.h"
|
||||
|
||||
#ifdef CONFIG_SOC_FAMILY_STM32
|
||||
#include <pinmux/pinmux_stm32.h>
|
||||
#include <drivers/pinctrl.h>
|
||||
#include <soc.h>
|
||||
#include <stm32_ll_bus.h>
|
||||
#endif
|
||||
|
||||
#if BOARD_HAS_DCDC
|
||||
|
||||
#define DT_DRV_COMPAT half_bridge
|
||||
|
||||
// Get address of used timer from board dts
|
||||
#define TIMER_ADDR DT_REG_ADDR(DT_PARENT(DT_DRV_INST(0)))
|
||||
|
||||
@@ -46,13 +46,17 @@ static uint16_t clamp_ccr(uint16_t ccr_target)
|
||||
|
||||
#ifdef CONFIG_SOC_FAMILY_STM32
|
||||
|
||||
static const struct soc_gpio_pinctrl tim_pinctrl[] = ST_STM32_DT_INST_PINCTRL(0, 0);
|
||||
#define PINCTRL_NODE DT_NODELABEL(halfbridge)
|
||||
|
||||
PINCTRL_DT_DEFINE(PINCTRL_NODE);
|
||||
|
||||
static const struct pinctrl_dev_config *pincfg = PINCTRL_DT_DEV_CONFIG_GET(PINCTRL_NODE);
|
||||
|
||||
#if TIMER_ADDR == TIM3_BASE
|
||||
|
||||
static void tim_init_registers(int freq_kHz)
|
||||
{
|
||||
stm32_dt_pinctrl_configure(tim_pinctrl, ARRAY_SIZE(tim_pinctrl), TIMER_ADDR);
|
||||
pinctrl_apply_state(pincfg, PINCTRL_STATE_DEFAULT);
|
||||
|
||||
LL_APB1_GRP1_EnableClock(LL_APB1_GRP1_PERIPH_TIM3);
|
||||
|
||||
@@ -128,7 +132,7 @@ bool half_bridge_enabled()
|
||||
|
||||
static void tim_init_registers(int freq_kHz)
|
||||
{
|
||||
stm32_dt_pinctrl_configure(tim_pinctrl, ARRAY_SIZE(tim_pinctrl), TIMER_ADDR);
|
||||
pinctrl_apply_state(pincfg, PINCTRL_STATE_DEFAULT);
|
||||
|
||||
#ifdef LL_APB2_GRP1_PERIPH_TIM1
|
||||
LL_APB2_GRP1_EnableClock(LL_APB2_GRP1_PERIPH_TIM1);
|
||||
@@ -234,7 +238,7 @@ bool half_bridge_enabled()
|
||||
|
||||
static void tim_init_registers(int freq_kHz)
|
||||
{
|
||||
stm32_dt_pinctrl_configure(tim_pinctrl, ARRAY_SIZE(tim_pinctrl), TIMER_ADDR);
|
||||
pinctrl_apply_state(pincfg, PINCTRL_STATE_DEFAULT);
|
||||
|
||||
LL_APB2_GRP1_EnableClock(LL_APB2_GRP1_PERIPH_HRTIM1);
|
||||
|
||||
@@ -7,6 +7,11 @@
|
||||
#ifndef HALF_BRIDGE_H_
|
||||
#define HALF_BRIDGE_H_
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <stdbool.h>
|
||||
#include <stdint.h>
|
||||
|
||||
/**
|
||||
@@ -85,4 +90,8 @@ void half_bridge_stop();
|
||||
*/
|
||||
bool half_bridge_enabled();
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* HALF_BRIDGE_H_ */
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
#endif
|
||||
|
||||
#include <drivers/gpio.h>
|
||||
#include <power/reboot.h>
|
||||
#include <sys/reboot.h>
|
||||
|
||||
LOG_MODULE_REGISTER(hardware, CONFIG_HW_LOG_LEVEL);
|
||||
|
||||
|
||||
+17
-10
@@ -24,11 +24,9 @@
|
||||
#include <stm32_ll_rcc.h>
|
||||
#include <stm32_ll_tim.h>
|
||||
|
||||
#include <pinmux/pinmux_stm32.h>
|
||||
#include <drivers/pinctrl.h>
|
||||
#include <soc.h>
|
||||
|
||||
#define DT_DRV_COMPAT st_stm32_pwm
|
||||
|
||||
// all PWM charge controllers use TIM3 at the moment
|
||||
static TIM_TypeDef *tim = TIM3;
|
||||
|
||||
@@ -59,7 +57,11 @@ static TIM_TypeDef *tim = TIM3;
|
||||
#define PWM_GPIO_PIN_HIGH (GPIOC->IDR & GPIO_IDR_ID7)
|
||||
#endif
|
||||
|
||||
static const struct soc_gpio_pinctrl pwm_pinctrl[] = ST_STM32_DT_PINCTRL(pwm3, 0);
|
||||
#define PINCTRL_NODE DT_NODELABEL(pwm3)
|
||||
|
||||
PINCTRL_DT_DEFINE(PINCTRL_NODE);
|
||||
|
||||
static const struct pinctrl_dev_config *pincfg = PINCTRL_DT_DEV_CONFIG_GET(PINCTRL_NODE);
|
||||
|
||||
static bool _pwm_active;
|
||||
static int _pwm_resolution;
|
||||
@@ -77,7 +79,7 @@ static void TIM3_IRQHandler(void *args)
|
||||
|
||||
void pwm_signal_init_registers(int freq_Hz)
|
||||
{
|
||||
stm32_dt_pinctrl_configure(pwm_pinctrl, ARRAY_SIZE(pwm_pinctrl), (uint32_t)tim);
|
||||
pinctrl_apply_state(pincfg, PINCTRL_STATE_DEFAULT);
|
||||
|
||||
LL_APB1_GRP1_EnableClock(LL_APB1_GRP1_PERIPH_TIM3);
|
||||
|
||||
@@ -156,15 +158,20 @@ float pwm_signal_get_duty_cycle()
|
||||
return 0;
|
||||
}
|
||||
|
||||
void pwm_signal_set_duty_cycle(float duty) {}
|
||||
void pwm_signal_set_duty_cycle(float duty)
|
||||
{}
|
||||
|
||||
void pwm_signal_duty_cycle_step(int delta) {}
|
||||
void pwm_signal_duty_cycle_step(int delta)
|
||||
{}
|
||||
|
||||
void pwm_signal_init_registers(int freq_Hz) {}
|
||||
void pwm_signal_init_registers(int freq_Hz)
|
||||
{}
|
||||
|
||||
void pwm_signal_start(float pwm_duty) {}
|
||||
void pwm_signal_start(float pwm_duty)
|
||||
{}
|
||||
|
||||
void pwm_signal_stop() {}
|
||||
void pwm_signal_stop()
|
||||
{}
|
||||
|
||||
bool pwm_signal_high()
|
||||
{
|
||||
|
||||
@@ -132,19 +132,6 @@
|
||||
spi-uext = &spi1;
|
||||
i2c-uext = &i2c1;
|
||||
};
|
||||
|
||||
soc {
|
||||
// not (yet) provided by Zephyr dts, but necessary for dcdc node
|
||||
timers3: timers@40000400 {
|
||||
compatible = "st,stm32-timers";
|
||||
reg = <0x40000400 0x400>;
|
||||
clocks = <&rcc STM32_CLOCK_BUS_APB1 0x00000002>;
|
||||
interrupts = <16 0>;
|
||||
interrupt-names = "global";
|
||||
status = "disabled";
|
||||
label = "TIMERS_3";
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
&clk_hsi {
|
||||
@@ -168,6 +155,7 @@
|
||||
|
||||
&usart1 {
|
||||
pinctrl-0 = <&usart1_tx_pa9 &usart1_rx_pa10>;
|
||||
pinctrl-names = "default";
|
||||
current-speed = <115200>;
|
||||
status = "okay";
|
||||
};
|
||||
@@ -178,6 +166,7 @@
|
||||
|
||||
&usart2 {
|
||||
pinctrl-0 = <&usart2_tx_pa2 &usart2_rx_pa3>;
|
||||
pinctrl-names = "default";
|
||||
current-speed = <115200>;
|
||||
status = "okay";
|
||||
};
|
||||
@@ -188,12 +177,14 @@
|
||||
|
||||
&i2c1 {
|
||||
pinctrl-0 = <&i2c1_scl_pb6 &i2c1_sda_pb7>;
|
||||
pinctrl-names = "default";
|
||||
clock-frequency = <I2C_BITRATE_FAST>;
|
||||
status = "okay";
|
||||
};
|
||||
|
||||
&spi1 {
|
||||
pinctrl-0 = <&spi1_sck_pb3 &spi1_miso_pb4 &spi1_mosi_pb5>;
|
||||
pinctrl-names = "default";
|
||||
cs-gpios = <&gpioa 15 GPIO_ACTIVE_LOW>;
|
||||
status = "okay";
|
||||
};
|
||||
@@ -205,9 +196,10 @@
|
||||
&timers3 {
|
||||
status = "okay";
|
||||
|
||||
halfbridge {
|
||||
halfbridge: halfbridge {
|
||||
compatible = "half-bridge";
|
||||
pinctrl-0 = <&tim3_ch3_pb0 &tim3_ch4_pb1>;
|
||||
pinctrl-names = "default";
|
||||
frequency = <50000>;
|
||||
deadtime = <230>;
|
||||
};
|
||||
|
||||
@@ -3,11 +3,9 @@
|
||||
CONFIG_SOC_SERIES_STM32L0X=y
|
||||
CONFIG_SOC_STM32L072XX=y
|
||||
|
||||
#CONFIG_ARM_MPU=y
|
||||
|
||||
CONFIG_CLOCK_CONTROL=y
|
||||
|
||||
CONFIG_PINMUX=y
|
||||
CONFIG_PINCTRL=y
|
||||
|
||||
CONFIG_GPIO=y
|
||||
|
||||
|
||||
@@ -147,6 +147,7 @@
|
||||
|
||||
&usart1 {
|
||||
pinctrl-0 = <&usart1_tx_pa9 &usart1_rx_pa10>;
|
||||
pinctrl-names = "default";
|
||||
current-speed = <115200>;
|
||||
status = "okay";
|
||||
};
|
||||
@@ -157,6 +158,7 @@
|
||||
|
||||
&usart2 {
|
||||
pinctrl-0 = <&usart2_tx_pa2 &usart2_rx_pa3>;
|
||||
pinctrl-names = "default";
|
||||
current-speed = <115200>;
|
||||
status = "okay";
|
||||
};
|
||||
@@ -167,18 +169,21 @@
|
||||
|
||||
&i2c1 {
|
||||
pinctrl-0 = <&i2c1_scl_pa15 &i2c1_sda_pb7>;
|
||||
pinctrl-names = "default";
|
||||
clock-frequency = <I2C_BITRATE_STANDARD>;
|
||||
status = "okay";
|
||||
};
|
||||
|
||||
&spi1 {
|
||||
pinctrl-0 = <&spi1_sck_pb3 &spi1_miso_pb4 &spi1_mosi_pb5>;
|
||||
pinctrl-names = "default";
|
||||
cs-gpios = <&gpiob 6 GPIO_ACTIVE_LOW>;
|
||||
status = "okay";
|
||||
};
|
||||
|
||||
&spi2 {
|
||||
pinctrl-0 = <&spi2_sck_pb13 &spi2_miso_pb14 &spi2_mosi_pb15>;
|
||||
pinctrl-names = "default";
|
||||
cs-gpios = <&gpioa 5 GPIO_ACTIVE_LOW>;
|
||||
status = "okay";
|
||||
};
|
||||
@@ -190,9 +195,10 @@
|
||||
&timers1 {
|
||||
status = "okay";
|
||||
|
||||
halfbridge {
|
||||
halfbridge: halfbridge {
|
||||
compatible = "half-bridge";
|
||||
pinctrl-0 = <&tim1_ch1_pa8 &tim1_ch1n_pc13>;
|
||||
pinctrl-names = "default";
|
||||
frequency = <70000>;
|
||||
deadtime = <300>;
|
||||
};
|
||||
@@ -201,15 +207,17 @@
|
||||
/* TIM8 (CH2) used for charge pump */
|
||||
&timers8 {
|
||||
status = "okay";
|
||||
st,prescaler = <149>; /* reduce counter clock frequency to 1 MHz */
|
||||
pwm8: pwm {
|
||||
status = "okay";
|
||||
st,prescaler = <149>; /* reduce counter clock frequency to 1 MHz */
|
||||
pinctrl-0 = <&tim8_ch2_pb8>;
|
||||
pinctrl-names = "default";
|
||||
};
|
||||
};
|
||||
|
||||
&can1 {
|
||||
pinctrl-0 = <&fdcan1_rx_pa11 &fdcan1_tx_pa12>;
|
||||
pinctrl-names = "default";
|
||||
bus-speed = <500000>;
|
||||
bus-speed-data = <500000>;
|
||||
sjw = <1>;
|
||||
|
||||
@@ -55,7 +55,7 @@
|
||||
};
|
||||
|
||||
&timers1 {
|
||||
halfbridge {
|
||||
halfbridge: halfbridge {
|
||||
pinctrl-0 = <&tim1_ch1_pa8 &tim1_ch1n_pb13>;
|
||||
};
|
||||
};
|
||||
@@ -64,5 +64,6 @@
|
||||
status = "disabled";
|
||||
|
||||
/delete-node/ pinctrl-0;
|
||||
/delete-node/ pinctrl-names;
|
||||
/delete-node/ cs-gpios;
|
||||
};
|
||||
|
||||
@@ -4,11 +4,12 @@ CONFIG_SOC_SERIES_STM32G4X=y
|
||||
CONFIG_SOC_STM32G431XX=y
|
||||
|
||||
CONFIG_ARM_MPU=y
|
||||
CONFIG_HW_STACK_PROTECTION=y
|
||||
CONFIG_MPU_ALLOW_FLASH_WRITE=y
|
||||
|
||||
CONFIG_CLOCK_CONTROL=y
|
||||
|
||||
CONFIG_PINMUX=y
|
||||
CONFIG_PINCTRL=y
|
||||
|
||||
CONFIG_GPIO=y
|
||||
|
||||
|
||||
@@ -168,6 +168,7 @@
|
||||
|
||||
&usart1 {
|
||||
pinctrl-0 = <&usart1_tx_pa9 &usart1_rx_pa10>;
|
||||
pinctrl-names = "default";
|
||||
current-speed = <115200>;
|
||||
status = "okay";
|
||||
};
|
||||
@@ -178,6 +179,7 @@
|
||||
|
||||
&usart3 {
|
||||
pinctrl-0 = <&usart3_tx_pc10 &usart3_rx_pc11>;
|
||||
pinctrl-names = "default";
|
||||
current-speed = <115200>;
|
||||
status = "okay";
|
||||
};
|
||||
@@ -188,11 +190,13 @@
|
||||
|
||||
&i2c1 {
|
||||
pinctrl-0 = <&i2c1_scl_pa15 &i2c1_sda_pb7>;
|
||||
pinctrl-names = "default";
|
||||
status = "okay";
|
||||
};
|
||||
|
||||
&spi1 {
|
||||
pinctrl-0 = <&spi1_sck_pb3 &spi1_miso_pb4 &spi1_mosi_pb5>;
|
||||
pinctrl-names = "default";
|
||||
cs-gpios = <&gpiod 2 GPIO_ACTIVE_LOW>;
|
||||
status = "okay";
|
||||
};
|
||||
@@ -226,9 +230,10 @@
|
||||
&timers1 {
|
||||
status = "okay";
|
||||
|
||||
halfbridge {
|
||||
halfbridge: halfbridge {
|
||||
compatible = "half-bridge";
|
||||
pinctrl-0 = <&tim1_ch1_pa8 &tim1_ch1n_pb13>;
|
||||
pinctrl-names = "default";
|
||||
frequency = <70000>;
|
||||
deadtime = <300>;
|
||||
};
|
||||
@@ -240,21 +245,24 @@
|
||||
pwm3: pwm {
|
||||
status = "okay";
|
||||
pinctrl-0 = <&tim3_ch2_pc7>;
|
||||
pinctrl-names = "default";
|
||||
};
|
||||
};
|
||||
|
||||
/* TIM8 (CH1) used for charge pump */
|
||||
&timers8 {
|
||||
status = "okay";
|
||||
st,prescaler = <149>; /* reduce counter clock frequency to 1 MHz */
|
||||
pwm8: pwm {
|
||||
status = "okay";
|
||||
st,prescaler = <149>; /* reduce counter clock frequency to 1 MHz */
|
||||
pinctrl-0 = <&tim8_ch1_pc6>;
|
||||
pinctrl-names = "default";
|
||||
};
|
||||
};
|
||||
|
||||
&i2c3 {
|
||||
pinctrl-0 = <&i2c3_scl_pc8 &i2c3_sda_pc9>;
|
||||
pinctrl-names = "default";
|
||||
status = "okay";
|
||||
clock-frequency = <I2C_BITRATE_STANDARD>;
|
||||
eeprom@50 {
|
||||
|
||||
@@ -4,10 +4,11 @@ CONFIG_SOC_SERIES_STM32G4X=y
|
||||
CONFIG_SOC_STM32G431XX=y
|
||||
|
||||
CONFIG_ARM_MPU=y
|
||||
CONFIG_HW_STACK_PROTECTION=y
|
||||
|
||||
CONFIG_CLOCK_CONTROL=y
|
||||
|
||||
CONFIG_PINMUX=y
|
||||
CONFIG_PINCTRL=y
|
||||
|
||||
CONFIG_GPIO=y
|
||||
|
||||
|
||||
@@ -165,6 +165,7 @@
|
||||
|
||||
&usart1 {
|
||||
pinctrl-0 = <&usart1_tx_pa9 &usart1_rx_pa10>;
|
||||
pinctrl-names = "default";
|
||||
current-speed = <115200>;
|
||||
status = "okay";
|
||||
};
|
||||
@@ -175,6 +176,7 @@
|
||||
|
||||
&usart2 {
|
||||
pinctrl-0 = <&usart2_tx_pa2 &usart2_rx_pa3>;
|
||||
pinctrl-names = "default";
|
||||
current-speed = <115200>;
|
||||
status = "okay";
|
||||
};
|
||||
@@ -186,12 +188,14 @@
|
||||
&i2c1 {
|
||||
status = "okay";
|
||||
pinctrl-0 = <&i2c1_scl_pb6 &i2c1_sda_pb7>;
|
||||
pinctrl-names = "default";
|
||||
clock-frequency = <I2C_BITRATE_FAST>;
|
||||
};
|
||||
|
||||
&i2c2 {
|
||||
status = "okay";
|
||||
pinctrl-0 = <&i2c2_scl_pb10 &i2c2_sda_pb11>;
|
||||
pinctrl-names = "default";
|
||||
clock-frequency = <I2C_BITRATE_STANDARD>;
|
||||
eeprom@50 {
|
||||
// Microchip 24AA32A
|
||||
@@ -211,6 +215,7 @@
|
||||
|
||||
&spi1 {
|
||||
pinctrl-0 = <&spi1_sck_pb3 &spi1_miso_pb4 &spi1_mosi_pb5>;
|
||||
pinctrl-names = "default";
|
||||
cs-gpios = <&gpioc 13 GPIO_ACTIVE_LOW>;
|
||||
status = "okay";
|
||||
};
|
||||
@@ -222,9 +227,10 @@
|
||||
&timers1 {
|
||||
status = "okay";
|
||||
|
||||
halfbridge {
|
||||
halfbridge: halfbridge {
|
||||
compatible = "half-bridge";
|
||||
pinctrl-0 = <&tim1_ch1_pa8 &tim1_ch1n_pb13>;
|
||||
pinctrl-names = "default";
|
||||
frequency = <70000>;
|
||||
deadtime = <300>;
|
||||
};
|
||||
@@ -232,6 +238,7 @@
|
||||
|
||||
&can1 {
|
||||
pinctrl-0 = <&can_rx_pb8 &can_tx_pb9>;
|
||||
pinctrl-names = "default";
|
||||
bus-speed = <500000>;
|
||||
status = "okay";
|
||||
};
|
||||
|
||||
@@ -3,11 +3,9 @@
|
||||
CONFIG_SOC_SERIES_STM32F0X=y
|
||||
CONFIG_SOC_STM32F072XB=y
|
||||
|
||||
#CONFIG_ARM_MPU=y
|
||||
|
||||
CONFIG_CLOCK_CONTROL=y
|
||||
|
||||
CONFIG_PINMUX=y
|
||||
CONFIG_PINCTRL=y
|
||||
|
||||
CONFIG_GPIO=y
|
||||
|
||||
|
||||
@@ -139,6 +139,7 @@
|
||||
|
||||
&usart1 {
|
||||
pinctrl-0 = <&usart1_tx_pa9 &usart1_rx_pa10>;
|
||||
pinctrl-names = "default";
|
||||
current-speed = <115200>;
|
||||
status = "okay";
|
||||
};
|
||||
@@ -149,6 +150,7 @@
|
||||
|
||||
&usart2 {
|
||||
pinctrl-0 = <&usart2_tx_pa2 &usart2_rx_pa3>;
|
||||
pinctrl-names = "default";
|
||||
current-speed = <115200>;
|
||||
status = "okay";
|
||||
};
|
||||
@@ -159,6 +161,7 @@
|
||||
|
||||
&spi1 {
|
||||
pinctrl-0 = <&spi1_sck_pb3 &spi1_miso_pb4 &spi1_mosi_pb5>;
|
||||
pinctrl-names = "default";
|
||||
cs-gpios = <&gpiob 6 GPIO_ACTIVE_LOW>;
|
||||
status = "okay";
|
||||
};
|
||||
@@ -166,9 +169,10 @@
|
||||
&timers1 {
|
||||
status = "okay";
|
||||
|
||||
halfbridge {
|
||||
halfbridge: halfbridge {
|
||||
compatible = "half-bridge";
|
||||
pinctrl-0 = <&tim1_ch1_pa8 &tim1_ch1n_pb13>;
|
||||
pinctrl-names = "default";
|
||||
frequency = <70000>;
|
||||
deadtime = <300>;
|
||||
};
|
||||
@@ -200,6 +204,7 @@
|
||||
/* shared between UEXT and EEPROM */
|
||||
status = "okay";
|
||||
pinctrl-0 = <&i2c1_scl_pa15 &i2c1_sda_pb7>;
|
||||
pinctrl-names = "default";
|
||||
clock-frequency = <I2C_BITRATE_STANDARD>;
|
||||
eeprom@50 {
|
||||
// Microchip 24AA32A
|
||||
@@ -219,6 +224,7 @@
|
||||
|
||||
&can1 {
|
||||
pinctrl-0 = <&fdcan1_rx_pa11 &fdcan1_tx_pa12>;
|
||||
pinctrl-names = "default";
|
||||
bus-speed = <500000>;
|
||||
bus-speed-data = <500000>;
|
||||
sjw = <1>;
|
||||
|
||||
@@ -4,10 +4,11 @@ CONFIG_SOC_SERIES_STM32G4X=y
|
||||
CONFIG_SOC_STM32G431XX=y
|
||||
|
||||
CONFIG_ARM_MPU=y
|
||||
CONFIG_HW_STACK_PROTECTION=y
|
||||
|
||||
CONFIG_CLOCK_CONTROL=y
|
||||
|
||||
CONFIG_PINMUX=y
|
||||
CONFIG_PINCTRL=y
|
||||
|
||||
CONFIG_GPIO=y
|
||||
|
||||
|
||||
@@ -185,6 +185,7 @@
|
||||
|
||||
&usart1 {
|
||||
pinctrl-0 = <&usart1_tx_pc4 &usart1_rx_pc5>;
|
||||
pinctrl-names = "default";
|
||||
current-speed = <115200>;
|
||||
status = "okay";
|
||||
};
|
||||
@@ -195,6 +196,7 @@
|
||||
|
||||
&lpuart1 {
|
||||
pinctrl-0 = <&lpuart1_tx_pa2 &lpuart1_rx_pa3>;
|
||||
pinctrl-names = "default";
|
||||
current-speed = <115200>;
|
||||
status = "okay";
|
||||
};
|
||||
@@ -205,21 +207,24 @@
|
||||
|
||||
&i2c1 {
|
||||
pinctrl-0 = <&i2c1_scl_pb8 &i2c1_sda_pb9>;
|
||||
pinctrl-names = "default";
|
||||
status = "okay";
|
||||
};
|
||||
|
||||
&spi1 {
|
||||
pinctrl-0 = <&spi1_nss_pa4 &spi1_sck_pb3
|
||||
&spi1_miso_pa6 &spi1_mosi_pa7>;
|
||||
pinctrl-names = "default";
|
||||
status = "okay";
|
||||
};
|
||||
|
||||
&hrtim1 {
|
||||
status = "okay";
|
||||
|
||||
halfbridge {
|
||||
halfbridge: halfbridge {
|
||||
compatible = "half-bridge";
|
||||
pinctrl-0 = <&hrtim1_cha1_pa8 &hrtim1_cha2_pa9>;
|
||||
pinctrl-names = "default";
|
||||
frequency = <70000>;
|
||||
deadtime = <300>;
|
||||
};
|
||||
@@ -230,9 +235,10 @@
|
||||
&timers1 {
|
||||
status = "okay";
|
||||
|
||||
halfbridge {
|
||||
halfbridge: halfbridge {
|
||||
compatible = "half-bridge";
|
||||
pinctrl-0 = <&tim1_ch1_pa8 &tim1_ch1n_pb13>;
|
||||
pinctrl-names = "default";
|
||||
frequency = <70000>;
|
||||
deadtime = <300>;
|
||||
};
|
||||
@@ -271,11 +277,13 @@
|
||||
|
||||
&adc1 {
|
||||
pinctrl-0 = <&adc1_in1_pa0>;
|
||||
pinctrl-names = "default";
|
||||
status = "okay";
|
||||
};
|
||||
|
||||
&can1 {
|
||||
pinctrl-0 = <&fdcan1_rx_pa11 &fdcan1_tx_pa12>;
|
||||
pinctrl-names = "default";
|
||||
bus-speed = <500000>;
|
||||
bus-speed-data = <500000>;
|
||||
sjw = <1>;
|
||||
|
||||
@@ -7,7 +7,7 @@ CONFIG_SOC_STM32G474XX=y
|
||||
CONFIG_SERIAL=y
|
||||
|
||||
# enable pinmux
|
||||
CONFIG_PINMUX=y
|
||||
CONFIG_PINCTRL=y
|
||||
|
||||
# enable GPIO
|
||||
CONFIG_GPIO=y
|
||||
|
||||
@@ -146,25 +146,6 @@
|
||||
spi-uext = &spi1;
|
||||
i2c-uext = &i2c1;
|
||||
};
|
||||
|
||||
// this should normally go to Zephyr repo
|
||||
soc {
|
||||
timers3: timers@40000400 {
|
||||
compatible = "st,stm32-timers";
|
||||
reg = <0x40000400 0x400>;
|
||||
clocks = <&rcc STM32_CLOCK_BUS_APB1 0x00000002>;
|
||||
status = "okay";
|
||||
label = "TIMERS_3";
|
||||
|
||||
pwm3: pwm {
|
||||
compatible = "st,stm32-pwm";
|
||||
status = "okay";
|
||||
st,prescaler = <10000>;
|
||||
label = "PWM_3";
|
||||
#pwm-cells = <3>;
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
&clk_hsi {
|
||||
@@ -188,6 +169,7 @@
|
||||
|
||||
&usart1 {
|
||||
pinctrl-0 = <&usart1_tx_pa9 &usart1_rx_pa10>;
|
||||
pinctrl-names = "default";
|
||||
current-speed = <115200>;
|
||||
status = "okay";
|
||||
};
|
||||
@@ -199,6 +181,7 @@
|
||||
|
||||
&usart2 {
|
||||
pinctrl-0 = <&usart2_tx_pa2 &usart2_rx_pa3>;
|
||||
pinctrl-names = "default";
|
||||
current-speed = <115200>;
|
||||
status = "okay";
|
||||
};
|
||||
@@ -209,12 +192,14 @@
|
||||
|
||||
&i2c1 {
|
||||
pinctrl-0 = <&i2c1_scl_pb6 &i2c1_sda_pb7>;
|
||||
pinctrl-names = "default";
|
||||
status = "okay";
|
||||
clock-frequency = <I2C_BITRATE_FAST>;
|
||||
};
|
||||
|
||||
&spi1 {
|
||||
pinctrl-0 = <&spi1_sck_pb3 &spi1_miso_pa11 &spi1_mosi_pa12>;
|
||||
pinctrl-names = "default";
|
||||
cs-gpios = <&gpioa 15 GPIO_ACTIVE_LOW>;
|
||||
status = "okay";
|
||||
};
|
||||
@@ -225,9 +210,11 @@
|
||||
|
||||
&timers3 {
|
||||
status = "okay";
|
||||
st,prescaler = <10000>;
|
||||
pwm3: pwm {
|
||||
status = "okay";
|
||||
pinctrl-0 = <&tim3_ch4_pb1>;
|
||||
pinctrl-names = "default";
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
@@ -3,11 +3,9 @@
|
||||
CONFIG_SOC_SERIES_STM32L0X=y
|
||||
CONFIG_SOC_STM32L072XX=y
|
||||
|
||||
#CONFIG_ARM_MPU=y
|
||||
|
||||
CONFIG_CLOCK_CONTROL=y
|
||||
|
||||
CONFIG_PINMUX=y
|
||||
CONFIG_PINCTRL=y
|
||||
|
||||
CONFIG_GPIO=y
|
||||
|
||||
|
||||
@@ -5,24 +5,15 @@ description: Half bridge, consisting of two coupled PWM outputs
|
||||
|
||||
compatible: "half-bridge"
|
||||
|
||||
include: base.yaml
|
||||
include: [base.yaml, pinctrl-device.yaml]
|
||||
|
||||
properties:
|
||||
frequency:
|
||||
type: int
|
||||
required: true
|
||||
description: PWM frequency in Hz
|
||||
frequency:
|
||||
type: int
|
||||
required: true
|
||||
description: PWM frequency in Hz
|
||||
|
||||
deadtime:
|
||||
type: int
|
||||
required: true
|
||||
description: Dead time for synchronous PWM generation in nanoseconds
|
||||
|
||||
pinctrl-0:
|
||||
type: phandles
|
||||
required: false
|
||||
description: |
|
||||
GPIO pin configuration for PWM signal/s. We expect that the phandles
|
||||
will reference pinctrl nodes, e.g.
|
||||
|
||||
pinctrl-0 = <&tim1_ch1_pwm_pa8 &tim1_ch2_pwm_pa9>;
|
||||
deadtime:
|
||||
type: int
|
||||
required: true
|
||||
description: Dead time for synchronous PWM generation in nanoseconds
|
||||
|
||||
@@ -137,7 +137,7 @@
|
||||
timers1: timers1 {
|
||||
status = "okay";
|
||||
|
||||
halfbridge {
|
||||
halfbridge: halfbridge {
|
||||
compatible = "half-bridge";
|
||||
frequency = <70000>;
|
||||
deadtime = <300>;
|
||||
|
||||
Reference in New Issue
Block a user