RT-Thread / RT-Thread/rt-thread

[Feature] gd32 arm系列芯片drv_spi_flash初始化问题

Open
#10,707 1 comment 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
C
Stars
12.2k
Forks
5.4k
Avg merge
4d 12h
Merged PRs (30d)
40

Description

Describe problem solved by the proposed feature

如果用户使能了RT_USING_SFUD,并且板级使能多个SPI接口,那么都会调用rt_sfud_flash_probe接口挂在spi flash,实际上并不合理,可能有的SPI接口是用作其他功能,比如OLED、WIFI模块,这样导致其他设备初始化异常。

Describe your preferred solution

其实,只有用户清楚SPI FLASH连接到哪个SPI接口,当然不排除芯片的几个SPI接口都是连接SPI FLASH芯片的可能,所以,我认为,这部分更应该交给用户实现,而不是集成到gd32_drivers驱动。

Describe possible alternatives

在板级配置SPI FLASH连接至哪个SPI接口,drv_spi_flash.c按照该宏定义初始化flash_configs结构体,即可实现,当然,也可能存在一个SPI接口连接多个SPI FLASH芯片,还是无可避免修改drv_spi_flash.c的实现,还不如一开始就交给用户实现。

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the GD32 driver implementation in drv_spi_flash.c and inspect how board configuration currently builds the flash_configs structure and calls rt_sfud_flash_probe. Define how a board selects one or more SPI flash interfaces, then verify that unrelated SPI devices are not probed while selected flash devices still initialize correctly.

Written by the indexing model from the issue text.

Assessment

Tech stack
c
Domain
embedded-iot
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.