Skip to content

Commit

Permalink
boards/stm32-based: allow SPI signals routed on multiple alternate fu…
Browse files Browse the repository at this point in the history
…nctions

There is no hardware limitation for custom boards based on STM32 to uses
SPI bus with signals coming from different PORT and alternate functions.

This patch allow alternate's function definition per pin basis, thus enable
the support of SPI bus signals routed on differents PORT.

Signed-off-by: Yannick Gicquel <[email protected]>
  • Loading branch information
Yanok35 committed Oct 25, 2019
1 parent 0946605 commit d37adee
Show file tree
Hide file tree
Showing 50 changed files with 283 additions and 76 deletions.
10 changes: 8 additions & 2 deletions boards/b-l072z-lrwan1/include/periph_conf.h
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,10 @@ static const spi_conf_t spi_config[] = {
.miso_pin = GPIO_PIN(PORT_B, 14),
.sclk_pin = GPIO_PIN(PORT_B, 13),
.cs_pin = GPIO_UNDEF,
.af = GPIO_AF0,
.mosi_af = GPIO_AF0,
.miso_af = GPIO_AF0,
.sclk_af = GPIO_AF0,
.cs_af = GPIO_AF0,
.rccmask = RCC_APB1ENR_SPI2EN,
.apbbus = APB1,
#ifdef MODULE_PERIPH_DMA
Expand All @@ -143,7 +146,10 @@ static const spi_conf_t spi_config[] = {
.miso_pin = GPIO_PIN(PORT_A, 6),
.sclk_pin = GPIO_PIN(PORT_B, 3),
.cs_pin = GPIO_UNDEF,
.af = GPIO_AF0,
.mosi_af = GPIO_AF0,
.miso_af = GPIO_AF0,
.sclk_af = GPIO_AF0,
.cs_af = GPIO_AF0,
.rccmask = RCC_APB2ENR_SPI1EN,
.apbbus = APB2,
#ifdef MODULE_PERIPH_DMA
Expand Down
5 changes: 4 additions & 1 deletion boards/b-l475e-iot01a/include/periph_conf.h
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,10 @@ static const spi_conf_t spi_config[] = {
.miso_pin = GPIO_PIN(PORT_A, 6),
.sclk_pin = GPIO_PIN(PORT_A, 5),
.cs_pin = GPIO_UNDEF,
.af = GPIO_AF5,
.mosi_af = GPIO_AF5,
.miso_af = GPIO_AF5,
.sclk_af = GPIO_AF5,
.cs_af = GPIO_AF5,
.rccmask = RCC_APB2ENR_SPI1EN,
.apbbus = APB2,
#ifdef MODULE_PERIPH_DMA
Expand Down
5 changes: 4 additions & 1 deletion boards/i-nucleo-lrwan1/include/periph_conf.h
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,10 @@ static const spi_conf_t spi_config[] = {
.miso_pin = GPIO_PIN(PORT_B, 4),
.sclk_pin = GPIO_PIN(PORT_B, 3),
.cs_pin = GPIO_PIN(PORT_A, 15),
.af = GPIO_AF0,
.mosi_af = GPIO_AF0,
.miso_af = GPIO_AF0,
.sclk_af = GPIO_AF0,
.cs_af = GPIO_AF0,
.rccmask = RCC_APB2ENR_SPI1EN,
.apbbus = APB2,
},
Expand Down
10 changes: 8 additions & 2 deletions boards/limifrog-v1/include/periph_conf.h
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,10 @@ static const spi_conf_t spi_config[] = {
.miso_pin = GPIO_PIN(PORT_A, 6),
.sclk_pin = GPIO_PIN(PORT_A, 5),
.cs_pin = GPIO_UNDEF,
.af = GPIO_AF5,
.mosi_af = GPIO_AF5,
.miso_af = GPIO_AF5,
.sclk_af = GPIO_AF5,
.cs_af = GPIO_AF5,
.rccmask = RCC_APB2ENR_SPI1EN,
.apbbus = APB2
},
Expand All @@ -142,7 +145,10 @@ static const spi_conf_t spi_config[] = {
.miso_pin = GPIO_PIN(PORT_B, 4),
.sclk_pin = GPIO_PIN(PORT_B, 3),
.cs_pin = GPIO_UNDEF,
.af = GPIO_AF6,
.mosi_af = GPIO_AF6,
.miso_af = GPIO_AF6,
.sclk_af = GPIO_AF6,
.cs_af = GPIO_AF6,
.rccmask = RCC_APB1ENR_SPI3EN,
.apbbus = APB1
}
Expand Down
10 changes: 8 additions & 2 deletions boards/lobaro-lorabox/include/periph_conf.h
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,10 @@ static const spi_conf_t spi_config[] = {
.miso_pin = GPIO_PIN(PORT_A, 6),
.sclk_pin = GPIO_PIN(PORT_A, 5),
.cs_pin = GPIO_PIN(PORT_B, 0),
.af = GPIO_AF5,
.mosi_af = GPIO_AF5,
.miso_af = GPIO_AF5,
.sclk_af = GPIO_AF5,
.cs_af = GPIO_AF5,
.rccmask = RCC_APB2ENR_SPI1EN,
.apbbus = APB2
},
Expand All @@ -152,7 +155,10 @@ static const spi_conf_t spi_config[] = {
.miso_pin = GPIO_PIN(PORT_B, 15),
.sclk_pin = GPIO_PIN(PORT_B, 13),
.cs_pin = GPIO_PIN(PORT_B, 12),
.af = GPIO_AF5,
.mosi_af = GPIO_AF5,
.miso_af = GPIO_AF5,
.sclk_af = GPIO_AF5,
.cs_af = GPIO_AF5,
.rccmask = RCC_APB1ENR_SPI2EN,
.apbbus = APB1
}
Expand Down
5 changes: 4 additions & 1 deletion boards/lsn50/include/periph_conf.h
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,10 @@ static const spi_conf_t spi_config[] = {
.miso_pin = GPIO_PIN(PORT_A, 6),
.sclk_pin = GPIO_PIN(PORT_A, 5),
.cs_pin = GPIO_UNDEF,
.af = GPIO_AF0,
.mosi_af = GPIO_AF0,
.miso_af = GPIO_AF0,
.sclk_af = GPIO_AF0,
.cs_af = GPIO_AF0,
.rccmask = RCC_APB2ENR_SPI1EN,
.apbbus = APB2,
#ifdef MODULE_PERIPH_DMA
Expand Down
5 changes: 4 additions & 1 deletion boards/msbiot/include/periph_conf.h
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,10 @@ static const spi_conf_t spi_config[] = {
.miso_pin = GPIO_PIN(PORT_A, 6),
.sclk_pin = GPIO_PIN(PORT_A, 5),
.cs_pin = GPIO_PIN(PORT_A, 4),
.af = GPIO_AF5,
.mosi_af = GPIO_AF5,
.miso_af = GPIO_AF5,
.sclk_af = GPIO_AF5,
.cs_af = GPIO_AF5,
.rccmask = RCC_APB2ENR_SPI1EN,
.apbbus = APB2
}
Expand Down
10 changes: 8 additions & 2 deletions boards/nucleo-f030r8/include/periph_conf.h
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,10 @@ static const spi_conf_t spi_config[] = {
.miso_pin = GPIO_PIN(PORT_A, 6),
.sclk_pin = GPIO_PIN(PORT_A, 5),
.cs_pin = GPIO_PIN(PORT_A, 4),
.af = GPIO_AF0,
.mosi_af = GPIO_AF0,
.miso_af = GPIO_AF0,
.sclk_af = GPIO_AF0,
.cs_af = GPIO_AF0,
.rccmask = RCC_APB2ENR_SPI1EN,
.apbbus = APB2
},
Expand All @@ -178,7 +181,10 @@ static const spi_conf_t spi_config[] = {
.miso_pin = GPIO_PIN(PORT_B, 14),
.sclk_pin = GPIO_PIN(PORT_B, 13),
.cs_pin = GPIO_PIN(PORT_B, 12),
.af = GPIO_AF0,
.mosi_af = GPIO_AF0,
.miso_af = GPIO_AF0,
.sclk_af = GPIO_AF0,
.cs_af = GPIO_AF0,
.rccmask = RCC_APB1ENR_SPI2EN,
.apbbus = APB1
},
Expand Down
5 changes: 4 additions & 1 deletion boards/nucleo-f031k6/include/periph_conf.h
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,10 @@ static const spi_conf_t spi_config[] = {
.miso_pin = GPIO_PIN(PORT_B, 4),
.sclk_pin = GPIO_PIN(PORT_B, 3),
.cs_pin = GPIO_UNDEF,
.af = GPIO_AF0,
.mosi_af = GPIO_AF0,
.miso_af = GPIO_AF0,
.sclk_af = GPIO_AF0,
.cs_af = GPIO_AF0,
.rccmask = RCC_APB2ENR_SPI1EN,
.apbbus = APB2
}
Expand Down
5 changes: 4 additions & 1 deletion boards/nucleo-f042k6/include/periph_conf.h
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,10 @@ static const spi_conf_t spi_config[] = {
.miso_pin = GPIO_PIN(PORT_B, 4),
.sclk_pin = GPIO_PIN(PORT_B, 3),
.cs_pin = GPIO_UNDEF,
.af = GPIO_AF0,
.mosi_af = GPIO_AF0,
.miso_af = GPIO_AF0,
.sclk_af = GPIO_AF0,
.cs_af = GPIO_AF0,
.rccmask = RCC_APB2ENR_SPI1EN,
.apbbus = APB2
}
Expand Down
10 changes: 8 additions & 2 deletions boards/nucleo-f072rb/include/periph_conf.h
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,10 @@ static const spi_conf_t spi_config[] = {
.miso_pin = GPIO_PIN(PORT_A, 6),
.sclk_pin = GPIO_PIN(PORT_A, 5),
.cs_pin = GPIO_PIN(PORT_A, 4),
.af = GPIO_AF0,
.mosi_af = GPIO_AF0,
.miso_af = GPIO_AF0,
.sclk_af = GPIO_AF0,
.cs_af = GPIO_AF0,
.rccmask = RCC_APB2ENR_SPI1EN,
.apbbus = APB2
},
Expand All @@ -199,7 +202,10 @@ static const spi_conf_t spi_config[] = {
.miso_pin = GPIO_PIN(PORT_B, 14),
.sclk_pin = GPIO_PIN(PORT_B, 13),
.cs_pin = GPIO_PIN(PORT_B, 12),
.af = GPIO_AF0,
.mosi_af = GPIO_AF0,
.miso_af = GPIO_AF0,
.sclk_af = GPIO_AF0,
.cs_af = GPIO_AF0,
.rccmask = RCC_APB1ENR_SPI2EN,
.apbbus = APB1
},
Expand Down
5 changes: 4 additions & 1 deletion boards/nucleo-f091rc/include/periph_conf.h
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,10 @@ static const spi_conf_t spi_config[] = {
.miso_pin = GPIO_PIN(PORT_A, 6),
.sclk_pin = GPIO_PIN(PORT_A, 5),
.cs_pin = GPIO_PIN(PORT_B, 6),
.af = GPIO_AF0,
.mosi_af = GPIO_AF0,
.miso_af = GPIO_AF0,
.sclk_af = GPIO_AF0,
.cs_af = GPIO_AF0,
.rccmask = RCC_APB2ENR_SPI1EN,
.apbbus = APB2,
#ifdef MODULE_PERIPH_DMA
Expand Down
10 changes: 8 additions & 2 deletions boards/nucleo-f207zg/include/periph_conf.h
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,10 @@ static const spi_conf_t spi_config[] = {
.miso_pin = GPIO_PIN(PORT_A, 6),
.sclk_pin = GPIO_PIN(PORT_A, 5),
.cs_pin = GPIO_PIN(PORT_A, 4),
.af = GPIO_AF5,
.mosi_af = GPIO_AF5,
.miso_af = GPIO_AF5,
.sclk_af = GPIO_AF5,
.cs_af = GPIO_AF5,
.rccmask = RCC_APB2ENR_SPI1EN,
.apbbus = APB2,
#ifdef MODULE_PERIPH_DMA
Expand All @@ -214,7 +217,10 @@ static const spi_conf_t spi_config[] = {
.miso_pin = GPIO_PIN(PORT_C, 2),
.sclk_pin = GPIO_PIN(PORT_B, 13),
.cs_pin = GPIO_PIN(PORT_B, 12),
.af = GPIO_AF5,
.mosi_af = GPIO_AF5,
.miso_af = GPIO_AF5,
.sclk_af = GPIO_AF5,
.cs_af = GPIO_AF5,
.rccmask = RCC_APB1ENR_SPI2EN,
.apbbus = APB1,
#ifdef MODULE_PERIPH_DMA
Expand Down
5 changes: 4 additions & 1 deletion boards/nucleo-f302r8/include/periph_conf.h
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,10 @@ static const spi_conf_t spi_config[] = {
.miso_pin = GPIO_PIN(PORT_B, 14),
.sclk_pin = GPIO_PIN(PORT_B, 13),
.cs_pin = GPIO_PIN(PORT_B, 12),
.af = GPIO_AF5,
.mosi_af = GPIO_AF5,
.miso_af = GPIO_AF5,
.sclk_af = GPIO_AF5,
.cs_af = GPIO_AF5,
.rccmask = RCC_APB1ENR_SPI2EN,
.apbbus = APB1
}
Expand Down
5 changes: 4 additions & 1 deletion boards/nucleo-f303k8/include/periph_conf.h
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,10 @@ static const spi_conf_t spi_config[] = {
.miso_pin = GPIO_PIN(PORT_B, 4),
.sclk_pin = GPIO_PIN(PORT_B, 3),
.cs_pin = GPIO_UNDEF,
.af = GPIO_AF0,
.mosi_af = GPIO_AF0,
.miso_af = GPIO_AF0,
.sclk_af = GPIO_AF0,
.cs_af = GPIO_AF0,
.rccmask = RCC_APB2ENR_SPI1EN,
.apbbus = APB2
}
Expand Down
15 changes: 12 additions & 3 deletions boards/nucleo-f303re/include/periph_conf.h
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,10 @@ static const spi_conf_t spi_config[] = {
.miso_pin = GPIO_PIN(PORT_A, 6),
.sclk_pin = GPIO_PIN(PORT_A, 5),
.cs_pin = GPIO_PIN(PORT_A, 4),
.af = GPIO_AF5,
.mosi_af = GPIO_AF5,
.miso_af = GPIO_AF5,
.sclk_af = GPIO_AF5,
.cs_af = GPIO_AF5,
.rccmask = RCC_APB2ENR_SPI1EN,
.apbbus = APB2
},
Expand All @@ -162,7 +165,10 @@ static const spi_conf_t spi_config[] = {
.miso_pin = GPIO_PIN(PORT_B, 14),
.sclk_pin = GPIO_PIN(PORT_B, 13),
.cs_pin = GPIO_PIN(PORT_B, 12),
.af = GPIO_AF5,
.mosi_af = GPIO_AF5,
.miso_af = GPIO_AF5,
.sclk_af = GPIO_AF5,
.cs_af = GPIO_AF5,
.rccmask = RCC_APB1ENR_SPI2EN,
.apbbus = APB1
},
Expand All @@ -172,7 +178,10 @@ static const spi_conf_t spi_config[] = {
.miso_pin = GPIO_PIN(PORT_C, 11),
.sclk_pin = GPIO_PIN(PORT_C, 10),
.cs_pin = GPIO_UNDEF,
.af = GPIO_AF6,
.mosi_af = GPIO_AF6,
.miso_af = GPIO_AF6,
.sclk_af = GPIO_AF6,
.cs_af = GPIO_AF6,
.rccmask = RCC_APB1ENR_SPI3EN,
.apbbus = APB1
}
Expand Down
5 changes: 4 additions & 1 deletion boards/nucleo-f303ze/include/periph_conf.h
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,10 @@ static const spi_conf_t spi_config[] = {
.miso_pin = GPIO_PIN(PORT_A, 6),
.sclk_pin = GPIO_PIN(PORT_A, 5),
.cs_pin = GPIO_UNDEF,
.af = GPIO_AF5,
.mosi_af = GPIO_AF5,
.miso_af = GPIO_AF5,
.sclk_af = GPIO_AF5,
.cs_af = GPIO_AF5,
.rccmask = RCC_APB2ENR_SPI1EN,
.apbbus = APB2
}
Expand Down
5 changes: 4 additions & 1 deletion boards/nucleo-f334r8/include/periph_conf.h
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,10 @@ static const spi_conf_t spi_config[] = {
.miso_pin = GPIO_PIN(PORT_A, 6),
.sclk_pin = GPIO_PIN(PORT_A, 5),
.cs_pin = GPIO_UNDEF,
.af = GPIO_AF5,
.mosi_af = GPIO_AF5,
.miso_af = GPIO_AF5,
.sclk_af = GPIO_AF5,
.cs_af = GPIO_AF5,
.rccmask = RCC_APB2ENR_SPI1EN,
.apbbus = APB2
}
Expand Down
15 changes: 12 additions & 3 deletions boards/nucleo-f401re/include/periph_conf.h
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,10 @@ static const spi_conf_t spi_config[] = {
.miso_pin = GPIO_PIN(PORT_A, 6),
.sclk_pin = GPIO_PIN(PORT_A, 5),
.cs_pin = GPIO_PIN(PORT_A, 4),
.af = GPIO_AF5,
.mosi_af = GPIO_AF5,
.miso_af = GPIO_AF5,
.sclk_af = GPIO_AF5,
.cs_af = GPIO_AF5,
.rccmask = RCC_APB2ENR_SPI1EN,
.apbbus = APB2
},
Expand All @@ -181,7 +184,10 @@ static const spi_conf_t spi_config[] = {
.miso_pin = GPIO_PIN(PORT_B, 14),
.sclk_pin = GPIO_PIN(PORT_B, 13),
.cs_pin = GPIO_PIN(PORT_B, 12),
.af = GPIO_AF5,
.mosi_af = GPIO_AF5,
.miso_af = GPIO_AF5,
.sclk_af = GPIO_AF5,
.cs_af = GPIO_AF5,
.rccmask = RCC_APB1ENR_SPI2EN,
.apbbus = APB1
},
Expand All @@ -191,7 +197,10 @@ static const spi_conf_t spi_config[] = {
.miso_pin = GPIO_PIN(PORT_C, 11),
.sclk_pin = GPIO_PIN(PORT_C, 10),
.cs_pin = GPIO_UNDEF,
.af = GPIO_AF6,
.mosi_af = GPIO_AF6,
.miso_af = GPIO_AF6,
.sclk_af = GPIO_AF6,
.cs_af = GPIO_AF6,
.rccmask = RCC_APB1ENR_SPI3EN,
.apbbus = APB1
}
Expand Down
5 changes: 4 additions & 1 deletion boards/nucleo-f410rb/include/periph_conf.h
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,10 @@ static const spi_conf_t spi_config[] = {
.miso_pin = GPIO_PIN(PORT_A, 6),
.sclk_pin = GPIO_PIN(PORT_A, 5),
.cs_pin = GPIO_PIN(PORT_A, 4),
.af = GPIO_AF5,
.mosi_af = GPIO_AF5,
.miso_af = GPIO_AF5,
.sclk_af = GPIO_AF5,
.cs_af = GPIO_AF5,
.rccmask = RCC_APB2ENR_SPI1EN,
.apbbus = APB2
}
Expand Down
5 changes: 4 additions & 1 deletion boards/nucleo-f411re/include/periph_conf.h
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,10 @@ static const spi_conf_t spi_config[] = {
.miso_pin = GPIO_PIN(PORT_A, 6),
.sclk_pin = GPIO_PIN(PORT_A, 5),
.cs_pin = GPIO_PIN(PORT_A, 4),
.af = GPIO_AF5,
.mosi_af = GPIO_AF5,
.miso_af = GPIO_AF5,
.sclk_af = GPIO_AF5,
.cs_af = GPIO_AF5,
.rccmask = RCC_APB2ENR_SPI1EN,
.apbbus = APB2
}
Expand Down
5 changes: 4 additions & 1 deletion boards/nucleo-f412zg/include/periph_conf.h
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,10 @@ static const spi_conf_t spi_config[] = {
.miso_pin = GPIO_PIN(PORT_A, 6),
.sclk_pin = GPIO_PIN(PORT_A, 5),
.cs_pin = GPIO_PIN(PORT_A, 4),
.af = GPIO_AF5,
.mosi_af = GPIO_AF5,
.miso_af = GPIO_AF5,
.sclk_af = GPIO_AF5,
.cs_af = GPIO_AF5,
.rccmask = RCC_APB2ENR_SPI1EN,
.apbbus = APB2
}
Expand Down
5 changes: 4 additions & 1 deletion boards/nucleo-f413zh/include/periph_conf.h
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,10 @@ static const spi_conf_t spi_config[] = {
.miso_pin = GPIO_PIN(PORT_A, 6),
.sclk_pin = GPIO_PIN(PORT_A, 5),
.cs_pin = GPIO_PIN(PORT_A, 4),
.af = GPIO_AF5,
.mosi_af = GPIO_AF5,
.miso_af = GPIO_AF5,
.sclk_af = GPIO_AF5,
.cs_af = GPIO_AF5,
.rccmask = RCC_APB2ENR_SPI1EN,
.apbbus = APB2,
#ifdef MODULE_PERIPH_DMA
Expand Down
Loading

0 comments on commit d37adee

Please sign in to comment.