diff --git a/bsp/stm32/stm32f103-100ask-pro/board/ports/spi_flash_init.c b/bsp/stm32/stm32f103-100ask-pro/board/ports/spi_flash_init.c index 519080ae05f..90de7468f46 100644 --- a/bsp/stm32/stm32f103-100ask-pro/board/ports/spi_flash_init.c +++ b/bsp/stm32/stm32f103-100ask-pro/board/ports/spi_flash_init.c @@ -16,8 +16,9 @@ #if defined(BSP_USING_SPI_FLASH) static int rt_hw_spi_flash_init(void) { - __HAL_RCC_GPIOA_CLK_ENABLE(); - rt_hw_spi_device_attach("spi1", "spi10", GPIOA, GPIO_PIN_4); + struct rt_spi_configuration cfg; + cfg.cs_pin = GET_PIN(A, 4); + rt_hw_spi_device_attach("spi1", "spi10", &cfg); if (RT_NULL == rt_sfud_flash_probe("W25Q64", "spi10")) { diff --git a/bsp/stm32/stm32f103-atk-nano/board/ports/spi_flash_init.c b/bsp/stm32/stm32f103-atk-nano/board/ports/spi_flash_init.c index 78924894361..4660586256e 100644 --- a/bsp/stm32/stm32f103-atk-nano/board/ports/spi_flash_init.c +++ b/bsp/stm32/stm32f103-atk-nano/board/ports/spi_flash_init.c @@ -16,8 +16,9 @@ #if defined(BSP_USING_SPI_FLASH) static int rt_hw_spi_flash_init(void) { - __HAL_RCC_GPIOB_CLK_ENABLE(); - rt_hw_spi_device_attach("spi2", "spi20", GPIOB, GPIO_PIN_12); + struct rt_spi_configuration cfg; + cfg.cs_pin = GET_PIN(B, 12); + rt_hw_spi_device_attach("spi2", "spi20", &cfg); if (RT_NULL == rt_sfud_flash_probe("W25Q16", "spi20")) { diff --git a/bsp/stm32/stm32f103-dofly-M3S/applications/nrf24l01_init.c b/bsp/stm32/stm32f103-dofly-M3S/applications/nrf24l01_init.c index 695510d1aca..cc9cd62c67c 100644 --- a/bsp/stm32/stm32f103-dofly-M3S/applications/nrf24l01_init.c +++ b/bsp/stm32/stm32f103-dofly-M3S/applications/nrf24l01_init.c @@ -15,7 +15,9 @@ #include "drv_spi.h" static int rt_hw_nrf24l01_init(void) { - rt_hw_spi_device_attach("spi2", "spi20", GPIOG, GPIO_PIN_7); + struct rt_spi_configuration cfg; + cfg.cs_pin = GET_PIN(G, 7); + rt_hw_spi_device_attach("spi2", "spi20", &cfg); return RT_EOK; } INIT_COMPONENT_EXPORT(rt_hw_nrf24l01_init); diff --git a/bsp/stm32/stm32f103-dofly-M3S/board/ports/drv_sdcard.c b/bsp/stm32/stm32f103-dofly-M3S/board/ports/drv_sdcard.c index d717da27dd9..55842e79382 100644 --- a/bsp/stm32/stm32f103-dofly-M3S/board/ports/drv_sdcard.c +++ b/bsp/stm32/stm32f103-dofly-M3S/board/ports/drv_sdcard.c @@ -69,8 +69,10 @@ INIT_APP_EXPORT(stm32_sdcard_mount); #include "spi_msd.h" static int rt_hw_spi2_tfcard(void) { - __HAL_RCC_GPIOC_CLK_ENABLE(); - rt_hw_spi_device_attach("spi2", "spi20", GPIOD, GPIO_PIN_2); + struct rt_spi_configuration cfg; + cfg.cs_pin = GET_PIN(D, 2); + rt_hw_spi_device_attach("spi2", "spi20", &cfg); + return msd_init("sd0", "spi20"); } INIT_DEVICE_EXPORT(rt_hw_spi2_tfcard); diff --git a/bsp/stm32/stm32f103-dofly-M3S/board/ports/spi_flash_init.c b/bsp/stm32/stm32f103-dofly-M3S/board/ports/spi_flash_init.c index e22efac3c90..1d0c4c8c1e0 100644 --- a/bsp/stm32/stm32f103-dofly-M3S/board/ports/spi_flash_init.c +++ b/bsp/stm32/stm32f103-dofly-M3S/board/ports/spi_flash_init.c @@ -16,8 +16,9 @@ #if defined(BSP_USING_SPI_FLASH) static int rt_hw_spi_flash_init(void) { - __HAL_RCC_GPIOA_CLK_ENABLE(); - rt_hw_spi_device_attach("spi2", "spi20", GPIOB, GPIO_PIN_12); + struct rt_spi_configuration cfg; + cfg.cs_pin = GET_PIN(B, 12); + rt_hw_spi_device_attach("spi2", "spi20", &cfg); if (RT_NULL == rt_sfud_flash_probe("W25Q64", "spi20")) { diff --git a/bsp/stm32/stm32f103-fire-arbitrary/board/ports/spi_flash_init.c b/bsp/stm32/stm32f103-fire-arbitrary/board/ports/spi_flash_init.c index 519080ae05f..90de7468f46 100644 --- a/bsp/stm32/stm32f103-fire-arbitrary/board/ports/spi_flash_init.c +++ b/bsp/stm32/stm32f103-fire-arbitrary/board/ports/spi_flash_init.c @@ -16,8 +16,9 @@ #if defined(BSP_USING_SPI_FLASH) static int rt_hw_spi_flash_init(void) { - __HAL_RCC_GPIOA_CLK_ENABLE(); - rt_hw_spi_device_attach("spi1", "spi10", GPIOA, GPIO_PIN_4); + struct rt_spi_configuration cfg; + cfg.cs_pin = GET_PIN(A, 4); + rt_hw_spi_device_attach("spi1", "spi10", &cfg); if (RT_NULL == rt_sfud_flash_probe("W25Q64", "spi10")) { diff --git a/bsp/stm32/stm32f103-fire-arbitrary/board/ports/w5500_device.c b/bsp/stm32/stm32f103-fire-arbitrary/board/ports/w5500_device.c index 378d8f82740..e6fa605ffc8 100644 --- a/bsp/stm32/stm32f103-fire-arbitrary/board/ports/w5500_device.c +++ b/bsp/stm32/stm32f103-fire-arbitrary/board/ports/w5500_device.c @@ -12,7 +12,8 @@ int w5500_spi_device_init() { - __HAL_RCC_GPIOG_CLK_ENABLE(); - return rt_hw_spi_device_attach("spi2","spi20",GPIOG,GPIO_PIN_9); + struct rt_spi_configuration cfg; + cfg.cs_pin = GET_PIN(G, 9); + return rt_hw_spi_device_attach("spi2", "spi20", &cfg); } INIT_DEVICE_EXPORT(w5500_spi_device_init); diff --git a/bsp/stm32/stm32f103-hw100k-ibox/board/ports/w5500_device.c b/bsp/stm32/stm32f103-hw100k-ibox/board/ports/w5500_device.c index 59d139a8aca..0afe329ad1a 100644 --- a/bsp/stm32/stm32f103-hw100k-ibox/board/ports/w5500_device.c +++ b/bsp/stm32/stm32f103-hw100k-ibox/board/ports/w5500_device.c @@ -13,7 +13,8 @@ #include "drv_gpio.h" int w5500_spi_device_init() { - __HAL_RCC_GPIOB_CLK_ENABLE(); - return rt_hw_spi_device_attach("spi2","spi20",GPIOB,GPIO_PIN_12); + struct rt_spi_configuration cfg; + cfg.cs_pin = GET_PIN(B, 12); + return rt_hw_spi_device_attach("spi2", "spi20", &cfg); } INIT_DEVICE_EXPORT(w5500_spi_device_init); diff --git a/bsp/stm32/stm32f407-armfly-v5/board/ports/spi_flash_init.c b/bsp/stm32/stm32f407-armfly-v5/board/ports/spi_flash_init.c index 3f879fdfbc3..9ae6d1e016a 100644 --- a/bsp/stm32/stm32f407-armfly-v5/board/ports/spi_flash_init.c +++ b/bsp/stm32/stm32f407-armfly-v5/board/ports/spi_flash_init.c @@ -16,8 +16,9 @@ #if defined(BSP_USING_SPI_FLASH) static int rt_hw_spi_flash_init(void) { - __HAL_RCC_GPIOF_CLK_ENABLE(); - rt_hw_spi_device_attach("spi3", "spi30", GPIOF, GPIO_PIN_8); + struct rt_spi_configuration cfg; + cfg.cs_pin = GET_PIN(F, 8); + rt_hw_spi_device_attach("spi3", "spi30", &cfg); if (RT_NULL == rt_sfud_flash_probe("W25Q64", "spi30")) { diff --git a/bsp/stm32/stm32f407-atk-explorer/board/ports/spi_flash_init.c b/bsp/stm32/stm32f407-atk-explorer/board/ports/spi_flash_init.c index 4299f8fd48f..95754e83681 100644 --- a/bsp/stm32/stm32f407-atk-explorer/board/ports/spi_flash_init.c +++ b/bsp/stm32/stm32f407-atk-explorer/board/ports/spi_flash_init.c @@ -17,8 +17,9 @@ static int rt_hw_spi_flash_init(void) { - __HAL_RCC_GPIOB_CLK_ENABLE(); - rt_hw_spi_device_attach("spi1", "spi10", GPIOB, GPIO_PIN_14); + struct rt_spi_configuration cfg; + cfg.cs_pin = GET_PIN(B, 14); + rt_hw_spi_device_attach("spi1", "spi10", &cfg); if (RT_NULL == rt_sfud_flash_probe("W25Q128", "spi10")) { diff --git a/bsp/stm32/stm32f411-atk-nano/board/ports/spi_flash_init.c b/bsp/stm32/stm32f411-atk-nano/board/ports/spi_flash_init.c index 78924894361..4660586256e 100644 --- a/bsp/stm32/stm32f411-atk-nano/board/ports/spi_flash_init.c +++ b/bsp/stm32/stm32f411-atk-nano/board/ports/spi_flash_init.c @@ -16,8 +16,9 @@ #if defined(BSP_USING_SPI_FLASH) static int rt_hw_spi_flash_init(void) { - __HAL_RCC_GPIOB_CLK_ENABLE(); - rt_hw_spi_device_attach("spi2", "spi20", GPIOB, GPIO_PIN_12); + struct rt_spi_configuration cfg; + cfg.cs_pin = GET_PIN(B, 12); + rt_hw_spi_device_attach("spi2", "spi20", &cfg); if (RT_NULL == rt_sfud_flash_probe("W25Q16", "spi20")) { diff --git a/bsp/stm32/stm32f429-armfly-v6/board/ports/spi_flash_init.c b/bsp/stm32/stm32f429-armfly-v6/board/ports/spi_flash_init.c index ac58f66259f..458edddcc50 100644 --- a/bsp/stm32/stm32f429-armfly-v6/board/ports/spi_flash_init.c +++ b/bsp/stm32/stm32f429-armfly-v6/board/ports/spi_flash_init.c @@ -16,8 +16,9 @@ #if defined(BSP_USING_SPI_FLASH) static int rt_hw_spi_flash_init(void) { - __HAL_RCC_GPIOF_CLK_ENABLE(); - rt_hw_spi_device_attach("spi3", "spi30", GPIOD, GPIO_PIN_13); + struct rt_spi_configuration cfg; + cfg.cs_pin = GET_PIN(D, 13); + rt_hw_spi_device_attach("spi3", "spi30", &cfg); if (RT_NULL == rt_sfud_flash_probe("W25Q64", "spi30")) { diff --git a/bsp/stm32/stm32f429-atk-apollo/board/ports/spi_flash_init.c b/bsp/stm32/stm32f429-atk-apollo/board/ports/spi_flash_init.c index 7e35a36c864..e98a5972ff6 100644 --- a/bsp/stm32/stm32f429-atk-apollo/board/ports/spi_flash_init.c +++ b/bsp/stm32/stm32f429-atk-apollo/board/ports/spi_flash_init.c @@ -16,8 +16,9 @@ #if defined(BSP_USING_SPI_FLASH) static int rt_hw_spi_flash_init(void) { - __HAL_RCC_GPIOF_CLK_ENABLE(); - rt_hw_spi_device_attach("spi5", "spi50", GPIOF, GPIO_PIN_6); + struct rt_spi_configuration cfg; + cfg.cs_pin = GET_PIN(F, 6); + rt_hw_spi_device_attach("spi5", "spi50", &cfg); if (RT_NULL == rt_sfud_flash_probe("W25Q256", "spi50")) { diff --git a/bsp/stm32/stm32f429-fire-challenger/board/ports/spi_flash_init.c b/bsp/stm32/stm32f429-fire-challenger/board/ports/spi_flash_init.c index 94a550cf376..2a956543049 100644 --- a/bsp/stm32/stm32f429-fire-challenger/board/ports/spi_flash_init.c +++ b/bsp/stm32/stm32f429-fire-challenger/board/ports/spi_flash_init.c @@ -16,8 +16,9 @@ #if defined(BSP_USING_SPI_FLASH) static int rt_hw_spi_flash_init(void) { - __HAL_RCC_GPIOF_CLK_ENABLE(); - rt_hw_spi_device_attach("spi5", "spi50", GPIOF, GPIO_PIN_6); + struct rt_spi_configuration cfg; + cfg.cs_pin = GET_PIN(F, 6); + rt_hw_spi_device_attach("spi5", "spi50", &cfg); if (RT_NULL == rt_sfud_flash_probe("W25Q128", "spi50")) { diff --git a/bsp/stm32/stm32h750-artpi/board/port/drv_spi_ili9488.c b/bsp/stm32/stm32h750-artpi/board/port/drv_spi_ili9488.c index 9852102bf68..7c9373dd360 100644 --- a/bsp/stm32/stm32h750-artpi/board/port/drv_spi_ili9488.c +++ b/bsp/stm32/stm32h750-artpi/board/port/drv_spi_ili9488.c @@ -148,8 +148,10 @@ static void lcd_gpio_init(void) int rt_hw_spi_lcd_init(void) { - __HAL_RCC_GPIOI_CLK_ENABLE(); - rt_hw_spi_device_attach("spi2", "spi20", GPIOI, GPIO_PIN_0); + struct rt_spi_configuration cfg; + cfg.cs_pin = GET_PIN(I, 0); + rt_hw_spi_device_attach("spi2", "spi20", &cfg); + lcd_gpio_init(); rt_pin_write(LCD_RES_PIN, PIN_HIGH); diff --git a/bsp/stm32/stm32h750-artpi/board/port/spi_flash_init.c b/bsp/stm32/stm32h750-artpi/board/port/spi_flash_init.c index 94f3f92cbbb..6d2cdd3cd07 100644 --- a/bsp/stm32/stm32h750-artpi/board/port/spi_flash_init.c +++ b/bsp/stm32/stm32h750-artpi/board/port/spi_flash_init.c @@ -18,7 +18,9 @@ static int rt_flash_init(void) extern rt_spi_flash_device_t rt_sfud_flash_probe(const char *spi_flash_dev_name, const char *spi_dev_name); extern int fal_init(void); - rt_hw_spi_device_attach("spi1", "spi10", GPIOA, GPIO_PIN_4); + struct rt_spi_configuration cfg; + cfg.cs_pin = GET_PIN(A, 4); + rt_hw_spi_device_attach("spi1", "spi10", &cfg); /* initialize SPI Flash device */ rt_sfud_flash_probe("norflash0", "spi10"); diff --git a/bsp/stm32/stm32h750-weact-ministm32h7xx/board/port/drv_spi_flash.c b/bsp/stm32/stm32h750-weact-ministm32h7xx/board/port/drv_spi_flash.c index 5f419f97cb0..33b0575012e 100644 --- a/bsp/stm32/stm32h750-weact-ministm32h7xx/board/port/drv_spi_flash.c +++ b/bsp/stm32/stm32h750-weact-ministm32h7xx/board/port/drv_spi_flash.c @@ -27,7 +27,9 @@ static int rt_hw_spi_flash_with_sfud_init(void) { rt_err_t err = RT_EOK; - rt_hw_spi_device_attach("spi1", "spi10", SPI_CS_GPIO, SPI_CS_PIN); + struct rt_spi_configuration cfg; + cfg.cs_pin = GET_PIN(D, 6); + rt_hw_spi_device_attach("spi1", "spi10", &cfg); /* init W25Q16 , And register as a block device */ if (RT_NULL == rt_sfud_flash_probe(FAL_USING_NOR_FLASH_DEV_NAME, "spi10")) diff --git a/bsp/stm32/stm32l431-BearPi/board/ports/lcd/drv_lcd.c b/bsp/stm32/stm32l431-BearPi/board/ports/lcd/drv_lcd.c index 23f9c14cc1d..e2eb1e31312 100644 --- a/bsp/stm32/stm32l431-BearPi/board/ports/lcd/drv_lcd.c +++ b/bsp/stm32/stm32l431-BearPi/board/ports/lcd/drv_lcd.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2021, RT-Thread Development Team + * Copyright (c) 2006-2023, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * @@ -28,23 +28,6 @@ rt_uint16_t BACK_COLOR = WHITE, FORE_COLOR = BLACK; static struct rt_spi_device *spi_dev_lcd; -static int rt_hw_lcd_config(void) -{ - spi_dev_lcd = (struct rt_spi_device *)rt_device_find("lcd"); - - /* config spi */ - { - struct rt_spi_configuration cfg; - cfg.data_width = 8; - cfg.mode = RT_SPI_MASTER | RT_SPI_MODE_3 | RT_SPI_MSB; - cfg.max_hz = 42 * 1000 * 1000; /* 42M,SPI max 42MHz,lcd 4-wire spi */ - - rt_spi_configure(spi_dev_lcd, &cfg); - } - - return RT_EOK; -} - static rt_err_t lcd_write_cmd(const rt_uint8_t cmd) { rt_size_t len; @@ -106,8 +89,6 @@ static rt_err_t lcd_write_half_word(const rt_uint16_t da) static void lcd_gpio_init(void) { - rt_hw_lcd_config(); - rt_pin_mode(LCD_DC_PIN, PIN_MODE_OUTPUT); rt_pin_mode(LCD_RES_PIN, PIN_MODE_OUTPUT); @@ -122,7 +103,15 @@ static void lcd_gpio_init(void) static int rt_hw_lcd_init(void) { - rt_hw_spi_device_attach("spi2", "lcd", GPIOC, GPIO_PIN_3); + struct rt_spi_configuration cfg; + cfg.data_width = 8; + cfg.mode = RT_SPI_MASTER | RT_SPI_MODE_3 | RT_SPI_MSB; + cfg.max_hz = 42 * 1000 * 1000; /* 42M,SPI max 42MHz,lcd 4-wire spi */ + cfg.cs_pin = GET_PIN(C, 3); + rt_hw_spi_device_attach("spi2", "lcd", &cfg); + + spi_dev_lcd = (struct rt_spi_device *)rt_device_find("lcd"); + lcd_gpio_init(); /* Memory Data Access Control */ lcd_write_cmd(0x36); diff --git a/bsp/stm32/stm32l475-atk-pandora/applications/nrf24l01_init.c b/bsp/stm32/stm32l475-atk-pandora/applications/nrf24l01_init.c index e2911542331..ebd3326fe46 100644 --- a/bsp/stm32/stm32l475-atk-pandora/applications/nrf24l01_init.c +++ b/bsp/stm32/stm32l475-atk-pandora/applications/nrf24l01_init.c @@ -14,7 +14,10 @@ #include "drv_spi.h" static int rt_hw_nrf24l01_init(void) { - rt_hw_spi_device_attach("spi2", "spi20", GPIOD, GPIO_PIN_5); + struct rt_spi_configuration cfg; + cfg.cs_pin = GET_PIN(D, 5); + rt_hw_spi_device_attach("spi2", "spi20", &cfg); + return RT_EOK; } INIT_COMPONENT_EXPORT(rt_hw_nrf24l01_init); diff --git a/bsp/stm32/stm32l475-atk-pandora/board/ports/drv_filesystem.c b/bsp/stm32/stm32l475-atk-pandora/board/ports/drv_filesystem.c index 7f497b5848b..1df66ee271e 100644 --- a/bsp/stm32/stm32l475-atk-pandora/board/ports/drv_filesystem.c +++ b/bsp/stm32/stm32l475-atk-pandora/board/ports/drv_filesystem.c @@ -31,8 +31,10 @@ #include static int rt_hw_spi1_tfcard(void) { - __HAL_RCC_GPIOC_CLK_ENABLE(); - rt_hw_spi_device_attach("spi1", "spi10", GPIOC, GPIO_PIN_3); + struct rt_spi_configuration cfg; + cfg.cs_pin = GET_PIN(C, 3); + rt_hw_spi_device_attach("spi1", "spi10", &cfg); + return msd_init("sd0", "spi10"); } INIT_DEVICE_EXPORT(rt_hw_spi1_tfcard); diff --git a/bsp/stm32/stm32l475-atk-pandora/board/ports/lcd/drv_lcd.c b/bsp/stm32/stm32l475-atk-pandora/board/ports/lcd/drv_lcd.c index b9c19dc8f01..def3cef2a1f 100644 --- a/bsp/stm32/stm32l475-atk-pandora/board/ports/lcd/drv_lcd.c +++ b/bsp/stm32/stm32l475-atk-pandora/board/ports/lcd/drv_lcd.c @@ -128,9 +128,10 @@ static void lcd_gpio_init(void) static int rt_hw_lcd_init(void) { - __HAL_RCC_GPIOD_CLK_ENABLE(); + struct rt_spi_configuration cfg; + cfg.cs_pin = GET_PIN(D, 7); + rt_hw_spi_device_attach("spi3", "spi30", &cfg); - rt_hw_spi_device_attach("spi3", "spi30", GPIOD, GPIO_PIN_7); lcd_gpio_init(); /* Memory Data Access Control */ diff --git a/bsp/stm32/stm32l496-ali-developer/board/ports/drv_spi_lcd.c b/bsp/stm32/stm32l496-ali-developer/board/ports/drv_spi_lcd.c index be6c2a57447..76f50277210 100644 --- a/bsp/stm32/stm32l496-ali-developer/board/ports/drv_spi_lcd.c +++ b/bsp/stm32/stm32l496-ali-developer/board/ports/drv_spi_lcd.c @@ -18,7 +18,9 @@ static int rt_hw_spi_lcd_init(void) { - rt_hw_spi_device_attach("spi1", "spi10", GPIOA, GPIO_PIN_4); + struct rt_spi_configuration cfg; + cfg.cs_pin = GET_PIN(A, 4); + rt_hw_spi_device_attach("spi1", "spi10", &cfg); return RT_EOK; } diff --git a/bsp/stm32/stm32mp157a-st-discovery/board/ports/spi_sample.c b/bsp/stm32/stm32mp157a-st-discovery/board/ports/spi_sample.c index 36a441d62f1..ee702696ddb 100644 --- a/bsp/stm32/stm32mp157a-st-discovery/board/ports/spi_sample.c +++ b/bsp/stm32/stm32mp157a-st-discovery/board/ports/spi_sample.c @@ -21,7 +21,7 @@ static int rt_spi_device_init(void) { struct rt_spi_configuration cfg; - rt_hw_spi_device_attach("spi5", "spi50", NULL, NULL); + rt_hw_spi_device_attach("spi5", "spi50", RT_NULL); cfg.data_width = 8; cfg.mode = RT_SPI_MASTER | RT_SPI_MODE_0 | RT_SPI_MSB | RT_SPI_NO_CS; diff --git a/bsp/stm32/stm32mp157a-st-ev1/board/ports/spi_sample.c b/bsp/stm32/stm32mp157a-st-ev1/board/ports/spi_sample.c index 075476294b2..f1f23a7a8e0 100644 --- a/bsp/stm32/stm32mp157a-st-ev1/board/ports/spi_sample.c +++ b/bsp/stm32/stm32mp157a-st-ev1/board/ports/spi_sample.c @@ -22,7 +22,7 @@ static int rt_spi_device_init(void) { struct rt_spi_configuration cfg; - rt_hw_spi_device_attach(SPI_NAME, SPI_DEVICE_NAME, NULL, NULL); + rt_hw_spi_device_attach(SPI_NAME, SPI_DEVICE_NAME, RT_NULL); cfg.data_width = 8; cfg.mode = RT_SPI_MASTER | RT_SPI_MODE_0 | RT_SPI_MSB | RT_SPI_NO_CS; diff --git a/components/drivers/spi/spi_flash_sfud.c b/components/drivers/spi/spi_flash_sfud.c index 30bc77a57df..d166e271320 100644 --- a/components/drivers/spi/spi_flash_sfud.c +++ b/components/drivers/spi/spi_flash_sfud.c @@ -427,6 +427,8 @@ rt_spi_flash_device_t rt_sfud_flash_probe_ex(const char *spi_flash_dev_name, con rt_spi_flash_device_t rt_sfud_flash_probe(const char *spi_flash_dev_name, const char *spi_dev_name) { struct rt_spi_configuration cfg = RT_SFUD_DEFAULT_SPI_CFG; + cfg.cs_pin = ((struct rt_spi_device *)rt_device_find(spi_dev_name))->config.cs_pin; + #ifndef SFUD_USING_QSPI return rt_sfud_flash_probe_ex(spi_flash_dev_name, spi_dev_name, &cfg, RT_NULL); #else