Loading...
Searching...
No Matches
periph_conf.h File Reference

Peripheral MCU configuration for the STM32L496G-DISCO board. More...

Detailed Description

Peripheral MCU configuration for the STM32L496G-DISCO board.

Author
Alexandre Abadie alexa.nosp@m.ndre.nosp@m..abad.nosp@m.ie@i.nosp@m.nria..nosp@m.fr
Gunar Schorcht gunar.nosp@m.@sch.nosp@m.orcht.nosp@m..net

Definition in file periph_conf.h.

#include "periph_cpu.h"
#include "clk_conf.h"
#include "cfg_rtt_default.h"
#include "cfg_usb_otg_fs.h"
#include "lcd_fmc.h"
+ Include dependency graph for periph_conf.h:

Go to the source code of this file.

#define CONFIG_BOARD_HAS_LSE   1
 

DMA streams configuration

#define DMA_0_ISR   isr_dma1_channel2
 
#define DMA_1_ISR   isr_dma1_channel3
 
#define DMA_2_ISR   isr_dma1_channel4
 
#define DMA_3_ISR   isr_dma1_channel5
 
#define DMA_4_ISR   isr_dma1_channel7
 
#define DMA_5_ISR   isr_dma2_channel6
 
#define DMA_6_ISR   isr_dma2_channel4
 
#define DMA_NUMOF   ARRAY_SIZE(dma_config)
 
static const dma_conf_t dma_config []
 

ADC configuration

Note that we do not configure all ADC channels, and not in the STM32L496AG order.

Instead, we define 6 ADC channels for the Arduino header pins A0-A5, one channel for V_REFINT and one channel that is used for the STMod+ header pin STMOD+_ADC or the DAC1 output if periph_dac is used.

The pin assignment can be found in board's user manual in Table 15, page 26 (Arduino compatible connectors) and Table 26, page 35 (32L496GDISCOVERY Discovery board I/O assignment). These tables are showing pin assignments and information about ADC - a text similar to ADC[X]_IN[Y], where:
[X] - describes used device - indexed from 0, for example ADC3_IN13 is device 2,
[Y] - describes used channel - indexed from 1, for example ADC3_IN13 is channel 13

Channels shared by multiple ADCs are referred to as ADC[XXX]_IN[Y]. ADC12_IN13 means for example that channel 13 can be used either with ADC1 or with ADC2.

Output from internal reference voltage V_REFINT is connected to ADC1 channel 0.

The V_REF+ pin is not connected to an external reference voltage on the board by default. Instead the the VREFBUF must be used (VREFBUF_ENABLE=1). The output voltage of VREF is around 2.048 V in this case.

If an external reference voltage is used as V_REF+, either by soldering R18 to use V_DDA as reference voltage or by using the AVVD pin of the Arduino connector by closing the solder bridge SB2, the VREFBUF must not be enabled by defining VREFBUF_ENABLE=0.

#define ADC_NUMOF   ARRAY_SIZE(adc_config)
 Number of ADC devices.
 
#define VBAT_ADC   ADC_LINE(7)
 V_BAT ADC line.
 
#define VREFINT_ADC   ADC_LINE(6)
 V_REFINT ADC line.
 
#define VREFBUF_ENABLE   (1)
 Enable VREFBUF as V_REF+.
 
static const adc_conf_t adc_config []
 

DAC configuration

The V_REF+ pin is not connected to an external reference voltage on the board by default.

Instead the the VREFBUF must be used (VREFBUF_ENABLE=1). The output voltage of VREF is around 2.048 V in this case.

#define DAC_NUMOF   ARRAY_SIZE(dac_config)
 Number of DACs.
 
static const dac_conf_t dac_config []
 

FMC configuration

#define FMC_BANK_NUMOF   ARRAY_SIZE(fmc_bank_config)
 Number of configured FMC banks.
 
#define LCD_FMC_NUMOF   1
 Number of LCDs using FMC banks.
 
static const fmc_conf_t fmc_config
 FMC controller configuration.
 
static const fmc_bank_conf_t fmc_bank_config []
 FMC Bank configuration.
 
static const lcd_fmc_desc_t lcd_fmc_desc []
 Descriptors of FMC banks used for LCDs.
 

I2C configuration

I2C1 is exposed at Arduino Connector D14/D15 (SDA/SCL) and STmod+ connector I2C2 is used for MFX (Multi Function eXpander)

#define I2C_0_ISR   isr_i2c1_er
 
#define I2C_1_ISR   isr_i2c2_er
 
#define I2C_NUMOF   ARRAY_SIZE(i2c_config)
 
static const i2c_conf_t i2c_config []
 

PWM configuration

Four PWM channels are defined for the Arduino header pins D3, D5, D6 and D9, and one for the STMod+ header pin STMOD+_PWM.

The pin assignment can be found in board's user manual in Table 15, page 26 (Arduino compatible connectors) and Table 26, page 35 (32L496GDISCOVERY Discovery board I/O assignment).

#define PWM_NUMOF   ARRAY_SIZE(pwm_config)
 
static const pwm_conf_t pwm_config []
 

SDIO/SDMMC configuration

#define SDMMC_CONFIG_NUMOF   1
 Number of configured SDIO/SDMMC peripherals.
 
static const sdmmc_conf_t sdmmc_config []
 SDIO/SDMMC static configuration struct.
 

SPI configuration

Note
By default, solder bridges SB6, SB7, SB8 are closed and USART1 is connected to the Pmod/STMmod+ connector. To use SPI2 on the Pmod/STMmod+ connector, these jumpers have to be opened and solder bridges SB4, SB5 and SB9 have to be closed instead. Use the periph_spi_stmod module to use this configuration, disable USART1 and enable SPI2. Otherwise SPI2 is not available.
#define SPI_NUMOF   ARRAY_SIZE(spi_config)
 
static const spi_conf_t spi_config []
 

Timer configuration

#define TIMER_0_ISR   isr_tim2
 
#define TIMER_1_ISR   isr_tim3
 
#define TIMER_NUMOF   ARRAY_SIZE(timer_config)
 
static const timer_conf_t timer_config []
 

UART configuration

Note
By default, solder bridges SB6, SB7, SB8 are closed and USART1 is connected to the Pmod/STMmod+ connector. In this case the hardware flow control for USART1 is used. If these solder bridges are open and solder bridges SB4, SB5 and SB9 are closed instead, SPI2 is connected to the Pmod/STMmod+ connector and USART1 is not available.
#define UART_0_ISR   (isr_usart2)
 
#define UART_1_ISR   (isr_lpuart1)
 
#define UART_2_ISR   (isr_usart1)
 
#define UART_NUMOF   ARRAY_SIZE(uart_config)
 
static const uart_conf_t uart_config []
 

Macro Definition Documentation

◆ ADC_NUMOF

#define ADC_NUMOF   ARRAY_SIZE(adc_config)

Number of ADC devices.

Definition at line 119 of file periph_conf.h.

◆ CONFIG_BOARD_HAS_LSE

#define CONFIG_BOARD_HAS_LSE   1

Definition at line 26 of file periph_conf.h.

◆ DAC_NUMOF

#define DAC_NUMOF   ARRAY_SIZE(dac_config)

Number of DACs.

Definition at line 164 of file periph_conf.h.

◆ DMA_0_ISR

#define DMA_0_ISR   isr_dma1_channel2

Definition at line 53 of file periph_conf.h.

◆ DMA_1_ISR

#define DMA_1_ISR   isr_dma1_channel3

Definition at line 54 of file periph_conf.h.

◆ DMA_2_ISR

#define DMA_2_ISR   isr_dma1_channel4

Definition at line 55 of file periph_conf.h.

◆ DMA_3_ISR

#define DMA_3_ISR   isr_dma1_channel5

Definition at line 56 of file periph_conf.h.

◆ DMA_4_ISR

#define DMA_4_ISR   isr_dma1_channel7

Definition at line 57 of file periph_conf.h.

◆ DMA_5_ISR

#define DMA_5_ISR   isr_dma2_channel6

Definition at line 58 of file periph_conf.h.

◆ DMA_6_ISR

#define DMA_6_ISR   isr_dma2_channel4

Definition at line 59 of file periph_conf.h.

◆ DMA_NUMOF

#define DMA_NUMOF   ARRAY_SIZE(dma_config)

Definition at line 61 of file periph_conf.h.

◆ FMC_BANK_NUMOF

#define FMC_BANK_NUMOF   ARRAY_SIZE(fmc_bank_config)

Number of configured FMC banks.

Definition at line 285 of file periph_conf.h.

◆ I2C_0_ISR

#define I2C_0_ISR   isr_i2c1_er

Definition at line 346 of file periph_conf.h.

◆ I2C_1_ISR

#define I2C_1_ISR   isr_i2c2_er

Definition at line 347 of file periph_conf.h.

◆ I2C_NUMOF

#define I2C_NUMOF   ARRAY_SIZE(i2c_config)

Definition at line 349 of file periph_conf.h.

◆ LCD_FMC_NUMOF

#define LCD_FMC_NUMOF   1

Number of LCDs using FMC banks.

Because it is used by the preprocessor it has to be a number. The ARRAY_SIZE can't be used here.

Definition at line 304 of file periph_conf.h.

◆ PWM_NUMOF

#define PWM_NUMOF   ARRAY_SIZE(pwm_config)

Definition at line 397 of file periph_conf.h.

◆ SDMMC_CONFIG_NUMOF

#define SDMMC_CONFIG_NUMOF   1

Number of configured SDIO/SDMMC peripherals.

Definition at line 431 of file periph_conf.h.

◆ SPI_NUMOF

#define SPI_NUMOF   ARRAY_SIZE(spi_config)

Definition at line 490 of file periph_conf.h.

◆ TIMER_0_ISR

#define TIMER_0_ISR   isr_tim2

Definition at line 514 of file periph_conf.h.

◆ TIMER_1_ISR

#define TIMER_1_ISR   isr_tim3

Definition at line 515 of file periph_conf.h.

◆ TIMER_NUMOF

#define TIMER_NUMOF   ARRAY_SIZE(timer_config)

Definition at line 517 of file periph_conf.h.

◆ UART_0_ISR

#define UART_0_ISR   (isr_usart2)

Definition at line 599 of file periph_conf.h.

◆ UART_1_ISR

#define UART_1_ISR   (isr_lpuart1)

Definition at line 600 of file periph_conf.h.

◆ UART_2_ISR

#define UART_2_ISR   (isr_usart1)

Definition at line 601 of file periph_conf.h.

◆ UART_NUMOF

#define UART_NUMOF   ARRAY_SIZE(uart_config)

Definition at line 603 of file periph_conf.h.

◆ VBAT_ADC

#define VBAT_ADC   ADC_LINE(7)

V_BAT ADC line.

Definition at line 124 of file periph_conf.h.

◆ VREFBUF_ENABLE

#define VREFBUF_ENABLE   (1)

Enable VREFBUF as V_REF+.

If an external reference voltage is used as V_REF+, either by soldering R18 to use V_DDA as reference voltage or by using the AVVD pin of the Arduino connector by closing the solder bridge SB2, the VREFBUF must not be enabled by defining VREFBUF_ENABLE=0.

Definition at line 140 of file periph_conf.h.

◆ VREFINT_ADC

#define VREFINT_ADC   ADC_LINE(6)

V_REFINT ADC line.

Definition at line 129 of file periph_conf.h.

Variable Documentation

◆ adc_config

const adc_conf_t adc_config[]
static
Initial value:
= {
{ .pin = GPIO_PIN(PORT_C, 4), .dev = 0, .chan = 13 },
{ .pin = GPIO_PIN(PORT_C, 1), .dev = 0, .chan = 2 },
{ .pin = GPIO_PIN(PORT_C, 3), .dev = 0, .chan = 4 },
{ .pin = GPIO_PIN(PORT_F, 10), .dev = 2, .chan = 13 },
{ .pin = GPIO_PIN(PORT_A, 1), .dev = 0, .chan = 6 },
{ .pin = GPIO_PIN(PORT_C, 0), .dev = 1, .chan = 13 },
{ .pin = GPIO_UNDEF, .dev = 0, .chan = 0 },
{ .pin = GPIO_UNDEF, .dev = 0, .chan = 18 },
{ .pin = GPIO_PIN(PORT_A, 4), .dev = 0, .chan = 9 },
}
@ PORT_C
port C
Definition periph_cpu.h:49
@ PORT_F
port F
Definition periph_cpu.h:52
@ PORT_A
port A
Definition periph_cpu.h:47
#define GPIO_PIN(x, y)
Define a CPU specific GPIO pin generator macro.
Definition periph_cpu.h:46
#define GPIO_UNDEF
Definition of a fitting UNDEF value.

Definition at line 100 of file periph_conf.h.

◆ dac_config

const dac_conf_t dac_config[]
static
Initial value:
= {
{ GPIO_PIN(PORT_A, 4), .chan = 0 },
{ GPIO_PIN(PORT_A, 5), .chan = 1 },
}

Definition at line 154 of file periph_conf.h.

◆ dma_config

const dma_conf_t dma_config[]
static
Initial value:
= {
{ .stream = 1 },
{ .stream = 2 },
{ .stream = 3 },
{ .stream = 4 },
{ .stream = 6 },
{ .stream = 13 },
{ .stream = 11 },
}

Definition at line 43 of file periph_conf.h.

◆ fmc_bank_config

const fmc_bank_conf_t fmc_bank_config[]
static

FMC Bank configuration.

The board has a PSRAM IS66WV51216EBLL-70BLI with 8 MBit on-board. It is organized in 512K x 16 bits and connected to bank 1, subbank 2 at address 0x64000000.

The LCD display of the board is connected to bank 1, subbank1 at address 0x60000000.

Definition at line 239 of file periph_conf.h.

◆ fmc_config

const fmc_conf_t fmc_config
static

FMC controller configuration.

Definition at line 175 of file periph_conf.h.

◆ i2c_config

const i2c_conf_t i2c_config[]
static
Initial value:
= {
{
.dev = I2C1,
.speed = I2C_SPEED_NORMAL,
.scl_pin = GPIO_PIN(PORT_B, 8),
.sda_pin = GPIO_PIN(PORT_B, 7),
.scl_af = GPIO_AF4,
.sda_af = GPIO_AF4,
.bus = APB1,
.rcc_mask = RCC_APB1ENR1_I2C1EN,
.rcc_sw_mask = RCC_CCIPR_I2C1SEL_1,
.irqn = I2C1_ER_IRQn,
},
{
.dev = I2C2,
.speed = I2C_SPEED_NORMAL,
.scl_pin = GPIO_PIN(PORT_H, 4),
.sda_pin = GPIO_PIN(PORT_B, 14),
.scl_af = GPIO_AF4,
.sda_af = GPIO_AF4,
.bus = APB1,
.rcc_mask = RCC_APB1ENR1_I2C2EN,
.rcc_sw_mask = RCC_CCIPR_I2C2SEL_1,
.irqn = I2C2_ER_IRQn,
},
}
@ PORT_B
port B
Definition periph_cpu.h:48
@ PORT_H
port H
Definition periph_cpu.h:52
@ I2C_SPEED_NORMAL
normal mode: ~100 kbit/s
Definition periph_cpu.h:278
@ GPIO_AF4
use alternate function 4
Definition cpu_gpio.h:106
@ APB1
Advanced Peripheral Bus 1
Definition periph_cpu.h:79

Definition at line 315 of file periph_conf.h.

◆ lcd_fmc_desc

const lcd_fmc_desc_t lcd_fmc_desc[]
static
Initial value:
= {
{
.bank = FMC_BANK_CONFIG(1),
.cmd_offset = 0x0,
.data_offset = 0x80000,
}
}
#define FMC_BANK_CONFIG(n)
Gives the configuration of n-th bank.
Definition cpu_fmc.h:75

Descriptors of FMC banks used for LCDs.

Definition at line 290 of file periph_conf.h.

◆ pwm_config

const pwm_conf_t pwm_config[]
static

Definition at line 364 of file periph_conf.h.

◆ sdmmc_config

const sdmmc_conf_t sdmmc_config[]
static
Initial value:
= {
{
.dev = SDMMC1,
.bus = APB2,
.rcc_mask = RCC_APB2ENR_SDMMC1EN,
.cd = GPIO_UNDEF,
.clk = { GPIO_PIN(PORT_C, 12), GPIO_AF12 },
.cmd = { GPIO_PIN(PORT_D, 2), GPIO_AF12 },
.dat0 = { GPIO_PIN(PORT_C, 8), GPIO_AF12 },
.dat1 = { GPIO_PIN(PORT_C, 9), GPIO_AF12 },
.dat2 = { GPIO_PIN(PORT_C, 10), GPIO_AF12 },
.dat3 = { GPIO_PIN(PORT_C, 11), GPIO_AF12 },
.irqn = SDMMC1_IRQn
},
}
@ PORT_D
port D
Definition periph_cpu.h:50
@ GPIO_AF12
use alternate function 12
Definition cpu_gpio.h:115
@ APB2
Advanced Peripheral Bus 2
Definition periph_cpu.h:80

SDIO/SDMMC static configuration struct.

Definition at line 408 of file periph_conf.h.

◆ spi_config

const spi_conf_t spi_config[]
static

Definition at line 447 of file periph_conf.h.

◆ timer_config

const timer_conf_t timer_config[]
static
Initial value:
= {
{
.dev = TIM2,
.max = 0xffffffff,
.rcc_mask = RCC_APB1ENR1_TIM2EN,
.bus = APB1,
.irqn = TIM2_IRQn
},
{
.dev = TIM3,
.max = 0xffffffff,
.rcc_mask = RCC_APB1ENR1_TIM3EN,
.bus = APB1,
.irqn = TIM3_IRQn
},
}

Definition at line 497 of file periph_conf.h.

◆ uart_config

const uart_conf_t uart_config[]
static

Definition at line 531 of file periph_conf.h.