Skip to content

Commit d77cfa2

Browse files
rosterlohhakehuang
authored andcommitted
boards: adafruit_feather_stm32f405: Add SPI flash
Added SPI flash definition on SPI1. Signed-off-by: Richard Osterloh <[email protected]>
1 parent a41d0e9 commit d77cfa2

File tree

6 files changed

+45
-0
lines changed

6 files changed

+45
-0
lines changed

boards/arm/adafruit_feather_stm32f405/Kconfig.defconfig

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,10 @@ config I2C_1
1616
default y
1717
depends on I2C
1818

19+
config SPI_1
20+
default y
21+
depends on SPI
22+
1923
config SPI_2
2024
default y
2125
depends on SPI

boards/arm/adafruit_feather_stm32f405/adafruit_feather_stm32f405.dts

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,23 @@
4242
clock-frequency = <I2C_BITRATE_FAST>;
4343
};
4444

45+
&spi1 {
46+
status = "okay";
47+
cs-gpios = <&gpioa 15 GPIO_ACTIVE_LOW>;
48+
gd25q16: gd25q16c@0 {
49+
compatible = "jedec,spi-nor";
50+
label = "GD25Q16C";
51+
reg = <0>;
52+
spi-max-frequency = <80000000>;
53+
size = <0x200000>;
54+
has-be32k;
55+
has-dpd;
56+
t-enter-dpd = <20000>;
57+
t-exit-dpd = <100000>;
58+
jedec-id = [c8 40 15];
59+
};
60+
};
61+
4562
&spi2 {
4663
status = "okay";
4764
};

boards/arm/adafruit_feather_stm32f405/doc/index.rst

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,9 @@ SPI Port
8888
The STM32F405 SPI2 peripheral is available on the SCK (PB13), MI
8989
(PB14) and MO (PB15) pins.
9090

91+
SPI1 uses SCK (PB3), MI (PB4), MO (PB5) and SS (PA15) pins and is
92+
dedicated to the 2 MB SPI Flash chip.
93+
9194
Programming and Debugging
9295
*************************
9396

boards/arm/adafruit_feather_stm32f405/pinmux.c

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,16 @@ static const struct pin_config pinconf[] = {
2222
{STM32_PIN_PB6, STM32F4_PINMUX_FUNC_PB6_I2C1_SCL},
2323
{STM32_PIN_PB7, STM32F4_PINMUX_FUNC_PB7_I2C1_SDA},
2424
#endif /* CONFIG_I2C_1 */
25+
#ifdef CONFIG_SPI_1
26+
#ifdef CONFIG_SPI_STM32_USE_HW_SS
27+
{STM32_PIN_PA15, STM32F4_PINMUX_FUNC_PA15_SPI1_NSS |
28+
STM32_OSPEEDR_VERY_HIGH_SPEED},
29+
#endif /* CONFIG_SPI_STM32_USE_HW_SS */
30+
{STM32_PIN_PB3, STM32F4_PINMUX_FUNC_PB3_SPI1_SCK |
31+
STM32_OSPEEDR_VERY_HIGH_SPEED},
32+
{STM32_PIN_PB4, STM32F4_PINMUX_FUNC_PA6_SPI1_MISO},
33+
{STM32_PIN_PB5, STM32F4_PINMUX_FUNC_PA7_SPI1_MOSI},
34+
#endif /* CONFIG_SPI_1 */
2535
#ifdef CONFIG_SPI_2
2636
{STM32_PIN_PB13, STM32F4_PINMUX_FUNC_PB13_SPI2_SCK},
2737
{STM32_PIN_PB14, STM32F4_PINMUX_FUNC_PB14_SPI2_MISO},
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
#
2+
# Copyright (c) 2020 Richard Osterloh <[email protected]>
3+
#
4+
# SPDX-License-Identifier: Apache-2.0
5+
#
6+
7+
CONFIG_SPI_NOR=y

samples/drivers/spi_flash/src/main.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,11 @@
2424
#error Unsupported flash driver
2525
#endif
2626

27+
#if defined(CONFIG_BOARD_ADAFRUIT_FEATHER_STM32F405)
28+
#define FLASH_TEST_REGION_OFFSET 0xf000
29+
#else
2730
#define FLASH_TEST_REGION_OFFSET 0xff000
31+
#endif
2832
#define FLASH_SECTOR_SIZE 4096
2933

3034
void main(void)

0 commit comments

Comments
 (0)