Update peripheral pins in board.dts and pinmux.c

This commit is contained in:
Martin Jäger
2020-05-06 12:53:26 +02:00
parent 8dd576e40e
commit 4a70293375
13 changed files with 25 additions and 151 deletions
-14
View File
@@ -7,20 +7,6 @@
#ifndef MPPT_1210_HUS_H
#define MPPT_1210_HUS_H
#define PIN_UEXT_TX PA_2
#define PIN_UEXT_RX PA_3
#define PIN_UEXT_SCL PB_6
#define PIN_UEXT_SDA PB_7
#define PIN_UEXT_MISO PB_4
#define PIN_UEXT_MOSI PB_5
#define PIN_UEXT_SCK PB_3
#define PIN_UEXT_SSEL PA_15
#define PIN_SWD_TX PA_9
#define PIN_SWD_RX PA_10
#define PIN_REF_I_DCDC PA_4
enum pin_state_t { PIN_HIGH, PIN_LOW, PIN_FLOAT };
// assignment LED numbers on PCB to their meaning
+3 -2
View File
@@ -75,7 +75,7 @@
aliases {
uart-dbg = &usart1;
uext-uart = &usart2;
uart-uext = &usart2;
spi-uext = &spi1;
i2c-uext = &i2c1;
};
@@ -92,11 +92,12 @@
};
&i2c1 {
status = "okay";
clock-frequency = <I2C_BITRATE_FAST>;
status = "okay";
};
&spi1 {
cs-gpios = <&gpioa 15 GPIO_ACTIVE_LOW>;
status = "okay";
};
-11
View File
@@ -12,17 +12,6 @@
#include <pinmux/stm32/pinmux_stm32.h>
// preliminary fix until PR for pinmux_stm32l0.h got accepted and merged to Zephyr master branch,
// see also here: https://github.com/zephyrproject-rtos/zephyr/pull/20997
#ifndef STM32L0_PINMUX_FUNC_PB6_I2C1_SCL
#define STM32L0_PINMUX_FUNC_PB6_I2C1_SCL \
(STM32_PINMUX_ALT_FUNC_1 | STM32_OPENDRAIN_PULLUP)
#endif
#ifndef STM32L0_PINMUX_FUNC_PB7_I2C1_SDA
#define STM32L0_PINMUX_FUNC_PB7_I2C1_SDA \
(STM32_PINMUX_ALT_FUNC_1 | STM32_OPENDRAIN_PULLUP)
#endif
/* pin assignments for NUCLEO-L073RZ board */
static const struct pin_config pinconf[] = {
#ifdef CONFIG_UART_1
-17
View File
@@ -9,23 +9,6 @@
#include <zephyr.h>
#define PIN_UEXT_TX PA_2
#define PIN_UEXT_RX PA_3
#define PIN_UEXT_SCL PB_6
#define PIN_UEXT_SDA PB_7
#define PIN_UEXT_MISO PB_4
#define PIN_UEXT_MOSI PB_5
#define PIN_UEXT_SCK PB_3
#define PIN_UEXT_SSEL PA_15
#define PIN_SWD_TX PA_9
#define PIN_SWD_RX PA_10
#define PIN_LOAD_EN PC_13
#define PIN_USB_PWR_EN PB_12
#define PIN_REF_I_DCDC PA_4
enum pin_state_t { PIN_HIGH, PIN_LOW, PIN_FLOAT };
// assignment LED numbers on PCB to their meaning
+2 -1
View File
@@ -65,7 +65,7 @@
aliases {
uart-dbg = &usart1;
uext-uart = &usart3;
uart-uext = &usart3;
spi-uext = &spi1;
i2c-uext = &i2c1;
};
@@ -86,6 +86,7 @@
};
&spi1 {
cs-gpios = <&gpiod 2 GPIO_ACTIVE_LOW>;
status = "okay";
};
+4 -33
View File
@@ -23,7 +23,7 @@ static const struct pin_config pinconf[] = {
#ifdef CONFIG_UART_3
{STM32_PIN_PC10, STM32G4X_PINMUX_FUNC_PC10_USART3_TX},
{STM32_PIN_PC11, STM32G4X_PINMUX_FUNC_PC11_USART3_RX},
#endif /* CONFIG_UART_2 */
#endif /* CONFIG_UART_3 */
#ifdef CONFIG_I2C_1
{STM32_PIN_PA15, STM32G4X_PINMUX_FUNC_PA15_I2C1_SCL},
{STM32_PIN_PB7, STM32G4X_PINMUX_FUNC_PB7_I2C1_SDA},
@@ -31,10 +31,7 @@ static const struct pin_config pinconf[] = {
#ifdef CONFIG_I2C_3
{STM32_PIN_PC8, STM32G4X_PINMUX_FUNC_PC8_I2C3_SCL},
{STM32_PIN_PC9, STM32G4X_PINMUX_FUNC_PC9_I2C3_SDA},
#endif /* CONFIG_I2C_1 */
#ifdef CONFIG_PWM_STM32_2
{STM32_PIN_PA5, STM32G4X_PINMUX_FUNC_PA5_PWM2_CH1},
#endif /* CONFIG_PWM_STM32_2 */
#endif /* CONFIG_I2C_3 */
#ifdef CONFIG_PWM_STM32_3
{STM32_PIN_PC6, STM32G4X_PINMUX_FUNC_PC6_PWM3_CH1},
#endif /* CONFIG_PWM_STM32_3 */
@@ -42,40 +39,14 @@ static const struct pin_config pinconf[] = {
{STM32_PIN_PC6, STM32G4X_PINMUX_FUNC_PC6_PWM8_CH1},
#endif /* CONFIG_PWM_STM32_8 */
#ifdef CONFIG_SPI_1
/* SPI1 on the Arduino connectors pins A2, D3, D11, D12 */
#ifdef CONFIG_SPI_STM32_USE_HW_SS
{STM32_PIN_PA4, STM32G4X_PINMUX_FUNC_PA4_SPI1_NSS},
#endif /* CONFIG_SPI_STM32_USE_HW_SS */
/* SPI1_SCK should output on PA5, but is used for LD2 */
{STM32_PIN_PB3, STM32G4X_PINMUX_FUNC_PB3_SPI1_SCK},
{STM32_PIN_PA6, STM32G4X_PINMUX_FUNC_PA6_SPI1_MISO},
{STM32_PIN_PA7, STM32G4X_PINMUX_FUNC_PA7_SPI1_MOSI},
{STM32_PIN_PB4, STM32G4X_PINMUX_FUNC_PB4_SPI1_MISO},
{STM32_PIN_PB5, STM32G4X_PINMUX_FUNC_PB5_SPI1_MOSI},
#endif /* CONFIG_SPI_1 */
#ifdef CONFIG_SPI_2
/* SPI2 on the ST Morpho Connector CN10 pins 16, 30, 28, 26*/
#ifdef CONFIG_SPI_STM32_USE_HW_SS
{STM32_PIN_PB12, STM32G4X_PINMUX_FUNC_PB12_SPI2_NSS},
#endif /* CONFIG_SPI_STM32_USE_HW_SS */
{STM32_PIN_PB13, STM32G4X_PINMUX_FUNC_PB13_SPI2_SCK},
{STM32_PIN_PB14, STM32G4X_PINMUX_FUNC_PB14_SPI2_MISO},
{STM32_PIN_PB15, STM32G4X_PINMUX_FUNC_PB15_SPI2_MOSI},
#endif /* CONFIG_SPI_1 */
#ifdef CONFIG_SPI_3
/* SPI3 on the ST Morpho Connector CN7 pins 17, 1, 2, 3*/
#ifdef CONFIG_SPI_STM32_USE_HW_SS
{STM32_PIN_PA15, STM32G4X_PINMUX_FUNC_PA15_SPI3_NSS},
#endif /* CONFIG_SPI_STM32_USE_HW_SS */
{STM32_PIN_PC10, STM32G4X_PINMUX_FUNC_PC10_SPI3_SCK},
{STM32_PIN_PC11, STM32G4X_PINMUX_FUNC_PC11_SPI3_MISO},
{STM32_PIN_PC12, STM32G4X_PINMUX_FUNC_PC12_SPI3_MOSI},
#endif /* CONFIG_SPI_3 */
#ifdef CONFIG_USB_DC_STM32
{STM32_PIN_PA11, STM32G4X_PINMUX_FUNC_PA11_USB_DM},
{STM32_PIN_PA12, STM32G4X_PINMUX_FUNC_PA12_USB_DP},
#endif /* CONFIG_USB_DC_STM32 */
#ifdef CONFIG_ADC_2
{STM32_PIN_PA4, STM32G4X_PINMUX_FUNC_PA4_ADC2_IN17},
#endif /* CONFIG_ADC_2 */
};
static int pinmux_stm32_init(struct device *port)
-31
View File
@@ -7,37 +7,6 @@
#ifndef MPPT_2420_LC_H
#define MPPT_2420_LC_H
#define PIN_UEXT_DIS PC_14 // starting from rev. 0.10
#define PIN_UEXT_TX PA_2
#define PIN_UEXT_RX PA_3
#define PIN_UEXT_SCL PB_6
#define PIN_UEXT_SDA PB_7
#define PIN_UEXT_MISO PB_4
#define PIN_UEXT_MOSI PB_5
#define PIN_UEXT_SCK PB_3
#define PIN_UEXT_SSEL PC_13 // PCB rev 0.6: PA_0
#define PIN_SWD_TX PA_9
#define PIN_SWD_RX PA_10
/*
#define PIN_LED_PWR PB_14
#define PIN_LED_LOAD PB_15
*/
#define PIN_LOAD_DIS PB_2
//#define PIN_5V_OUT_EN PB_12
#define PIN_USB_PWR_EN PB_12 // normally should be named 5V_OUT_EN, as no USB is existing here
//#define PIN_USB_PWR_FLG PC_14
#define PIN_CAN_RX PB_8
#define PIN_CAN_TX PB_9
#define PIN_CAN_STB PA_15
#define PIN_V_BUS_DIS PC_15 // bus power supply disable, starting from rev. 0.10
#define PIN_REF_I_DCDC PA_4
#define PIN_EEPROM_SCL PB_10
#define PIN_EEPROM_SDA PB_11
#define EEPROM_24AA32
#define CONFIG_CAN 1
enum pin_state_t { PIN_HIGH, PIN_LOW, PIN_FLOAT };
+10 -1
View File
@@ -63,11 +63,19 @@
label = "CAN disable / standby";
gpios = <&gpioa 15 GPIO_ACTIVE_LOW>;
};
aux_en {
label = "5V output enable";
gpios = <&gpiob 12 GPIO_ACTIVE_HIGH>;
};
vbus_en {
label = "CAN bus power supply enable";
gpios = <&gpioc 15 GPIO_ACTIVE_LOW>;
};
};
aliases {
uart-dbg = &usart1;
uext-uart = &usart2;
uart-uext = &usart2;
spi-uext = &spi1;
i2c-uext = &i2c1;
};
@@ -108,6 +116,7 @@
};
&spi1 {
cs-gpios = <&gpioc 13 GPIO_ACTIVE_LOW>;
status = "okay";
};
-6
View File
@@ -44,12 +44,6 @@ static const struct pin_config pinconf[] = {
{STM32_PIN_PB4, STM32F0_PINMUX_FUNC_PB4_SPI1_MISO},
{STM32_PIN_PB5, STM32F0_PINMUX_FUNC_PB5_SPI1_MOSI},
#endif /* CONFIG_SPI_1 */
#ifdef CONFIG_ADC_1
{STM32_PIN_PA0, STM32F0_PINMUX_FUNC_PA0_ADC_IN0},
#endif /* CONFIG_ADC_1 */
#ifdef CONFIG_DAC_1
{STM32_PIN_PA4, STM32F0_PINMUX_FUNC_PA4_DAC_OUT1},
#endif /* CONFIG_ADC_1 */
#ifdef CONFIG_CAN_1
{STM32_PIN_PB8, STM32F0_PINMUX_FUNC_PB8_CAN_RX},
{STM32_PIN_PB9, STM32F0_PINMUX_FUNC_PB9_CAN_TX},
-21
View File
@@ -7,30 +7,9 @@
#ifndef PWM_2420_LUS_H
#define PWM_2420_LUS_H
#define PIN_UEXT_TX PA_2
#define PIN_UEXT_RX PA_3
#define PIN_UEXT_SCL PB_6
#define PIN_UEXT_SDA PB_7
#define PIN_UEXT_MISO PA_11
#define PIN_UEXT_MOSI PA_12
#define PIN_UEXT_SCK PB_3
#define PIN_UEXT_SSEL PA_15
#define PIN_SWD_TX PA_9
#define PIN_SWD_RX PA_10
#define PIN_LOAD_DIS PB_2
#define PIN_USB_PWR_DIS PB_5
#define PIN_I_LOAD_COMP PB_4
#define PIN_EXT_BTN PB_12
#define PIN_BOOT0_EN PB_12
#define PIN_REF_I_DCDC PA_4
// Internal NTC temperature currently ignored by firmware as it is similar to MCU temperature and
// does not reflect external battery temperature. Feature will be removed in future HW revisions.
#define PIN_TEMP_INT_PD PA_8
enum pin_state_t { PIN_HIGH, PIN_LOW, PIN_FLOAT };
+3 -13
View File
@@ -12,13 +12,6 @@
#include <pinmux/stm32/pinmux_stm32.h>
// preliminary fix until PR for pinmux_stm32l0.h got accepted and merged to Zephyr master branch,
// see also here: https://github.com/zephyrproject-rtos/zephyr/pull/20997
#define STM32L0_PINMUX_FUNC_PB6_I2C1_SCL \
(STM32_PINMUX_ALT_FUNC_1 | STM32_OPENDRAIN_PULLUP)
#define STM32L0_PINMUX_FUNC_PB7_I2C1_SDA \
(STM32_PINMUX_ALT_FUNC_1 | STM32_OPENDRAIN_PULLUP)
/* pin assignments for NUCLEO-L073RZ board */
static const struct pin_config pinconf[] = {
#ifdef CONFIG_UART_1
@@ -34,13 +27,10 @@ static const struct pin_config pinconf[] = {
{STM32_PIN_PB7, STM32L0_PINMUX_FUNC_PB7_I2C1_SDA},
#endif /* CONFIG_I2C_1 */
#ifdef CONFIG_SPI_1
{STM32_PIN_PA5, STM32L0_PINMUX_FUNC_PA5_SPI1_SCK},
{STM32_PIN_PA6, STM32L0_PINMUX_FUNC_PA6_SPI1_MISO},
{STM32_PIN_PA7, STM32L0_PINMUX_FUNC_PA7_SPI1_MOSI},
{STM32_PIN_PB3, STM32L0_PINMUX_FUNC_PB3_SPI1_SCK},
{STM32_PIN_PA11, STM32L0_PINMUX_FUNC_PA11_SPI1_MISO},
{STM32_PIN_PA12, STM32L0_PINMUX_FUNC_PA12_SPI1_MOSI},
#endif /* CONFIG_SPI_1 */
#ifdef CONFIG_ADC_1
{STM32_PIN_PA0, STM32L0_PINMUX_FUNC_PA0_ADC_IN0},
#endif /* CONFIG_ADC_1 */
};
static int pinmux_stm32_init(struct device *port)
+2 -1
View File
@@ -77,7 +77,7 @@
aliases {
uart-dbg = &usart1;
uext-uart = &usart2;
uart-uext = &usart2;
spi-uext = &spi1;
i2c-uext = &i2c1;
};
@@ -118,6 +118,7 @@
};
&spi1 {
cs-gpios = <&gpioa 15 GPIO_ACTIVE_LOW>;
status = "okay";
};
+1
View File
@@ -100,6 +100,7 @@ static void vref_setup()
static void dac_setup()
{
#if defined(CONFIG_SOC_SERIES_STM32F0X) || defined(CONFIG_SOC_SERIES_STM32L0X)
/* DAC1 at PA4 for load and DC/DC / PWM switch current measurement * VCC */
LL_APB1_GRP1_EnableClock(LL_APB1_GRP1_PERIPH_DAC1);
LL_DAC_SetOutputBuffer(DAC1, LL_DAC_CHANNEL_1, LL_DAC_OUTPUT_BUFFER_ENABLE);
LL_DAC_Enable(DAC1, LL_DAC_CHANNEL_1);