Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

boards/gd32v: improve board definitions #19249

Merged

Conversation

gschorcht
Copy link
Contributor

@gschorcht gschorcht commented Feb 6, 2023

Contribution description

This PR provides some small improvements of the existing board definitions for GD32VF103 boards for more flexibel default configurations and documentation of the board peripherals:

  • Allow the remapping of SPI0 pins in SPI configuration (ae984b0)
  • More flexible I2C configuration (0c33758)
    The default I2C device configuration allows to define up to two I2C devices I2C_DEV(0) and I2C_DEV(1). I2C_DEV(0) is always defined if the I2C peripheral is enabled by the module periph_spi. The second I2C device I2C_DEV(1) is only defined if I2C_DEV_1_USED is defined by the board. This allows to use the default configuration with one or two I2C devices depending on whether other peripherals are enabled that would collide with the I2C devices.
  • More flexible SPI configuration (edbf59e)
    The default SPI device configuration allows to define up to two SPI devices SPI_DEV(0) and SPI_DEV(1). SPI_DEV(0) is always defined if the SPI peripheral is enabled by the module periph_spi. The second SPI device SPI_DEV(1) is only defined if SPI_DEV_1_USED is defined by the board. This allows to use the default configuration with one or two SPI devices depending on whether other peripherals are enabled that would collide with the SPI devices.
    Furthermore, the CS signal in the SPI configuration is given by a define that can be overriden with another pin if
    the default CS signal is connected to an unused hardware.
  • Improve ADC config for Sipeed-Longan-Nano (c9c587e)
    The ADC configuration was too complex. It was hard to follow when certain ADC lines are available. Furthermore, the order of ADC lines did depend on the use of other peripherals. Now, either the TFT display is not connected and all ADC lines are available or the TFT display is connected and the second SPI device is used so that only the first 4 ADC lines are available.
  • Improve Kconfig for Sipeed-Longan-Nano (025f4fd)
    Board-specific configuration not shown any longer directly in the top level menu but within a submenu.
  • Improve peripherals documentation (7f0d560, e24abe4)
    Available peripherals for the board are now documented in two tables ordered by RIOT peripheral names and by pins.

Although the different changes are small and mostly related to the documentation, I could split the PR if necessary.

Testing

Green CI

Issues/PRs references

@github-actions github-actions bot added Area: boards Area: Board ports Area: cpu Area: CPU/MCU ports Area: doc Area: Documentation Area: Kconfig Area: Kconfig integration labels Feb 6, 2023
@gschorcht gschorcht force-pushed the boards/gd32v/improve_board_definitions branch from 6a4828e to b46ffdb Compare February 6, 2023 06:46
@gschorcht gschorcht added Type: enhancement The issue suggests enhanceable parts / The PR enhances parts of the codebase / documentation CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR Platform: RISC-V Platform: This PR/issue effects RISC-V-based platforms labels Feb 6, 2023
The default I2C device configuration allows to define up to two I2C devices `I2C_DEV(0)` and `I2C_DEV(1)`. `I2C_DEV(0)` is always defined if the I2C peripheral is enabled by the module `periph_spi`. The second I2C device `I2C_DEV(1)` is only defined if `I2C_DEV_1_USED` is defined by the board. This allows to use the default configuration with one or two I2C devices depending on whether other peripherals are enabled that would collide with the I2C devices.
The default SPI device configuration allows to define up to two SPI devices `SPI_DEV(0)` and `SPI_DEV(1)`. `SPI_DEV(0)` is always defined if the SPI peripheral is enabled by the module `periph_spi`. The second SPI device `SPI_DEV(1)` is only defined if `SPI_DEV_1_USED` is defined by the board. This allows to use the default configuration with one or two SPI devices depending on whether other peripherals are enabled that would collide with the SPI devices.
Furthermore, the CS signal in the SPI configuration is given by a define that can be overriden with another pin if
the default CS signal is connected to an unused hardware.
The ADC configuration was too complex. It was hard to follow when certain ADC lines are available. Furthermore, the order of ADC lines did depend on the use of other peripherals. Now, either the TFT display is not connected and all ADC lines are available or the TFT display is connected and the second SPI device is used so that only the first 4 ADC lines are available.
Board-specific configuration not shown any longer directly in the top level menu but within a submenu.
Available peripherals for the board are now shown ordered by RIOT peripheral names and by pins.
Available peripherals for the board are now shown ordered by RIOT peripheral names and by pins.
@riot-ci
Copy link

riot-ci commented Feb 6, 2023

Murdock results

✔️ PASSED

e24abe4 boards/seeedstudio-gd32: improve peripherals doc

Success Failures Total Runtime
6850 0 6851 10m:10s

Artifacts

@gschorcht gschorcht force-pushed the boards/gd32v/improve_board_definitions branch from b46ffdb to e24abe4 Compare February 6, 2023 07:04
@github-actions github-actions bot removed the Platform: RISC-V Platform: This PR/issue effects RISC-V-based platforms label Feb 6, 2023
@@ -35,6 +35,8 @@
#define CONFIG_CLOCK_HXTAL MHZ(8) /**< HXTAL frequency */
#endif

#define SPI_DEV_1_USED /**< Enable SPI_DEV(1) for the connected flash */
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When I hear connected SPI flash I see an opportunity to add an MTD device :D

Copy link
Contributor Author

@gschorcht gschorcht Feb 6, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Of course, but we don't have a driver for SPI flash like the W25Q64 yet with the exception of ESP32.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is it not just a standard SPI-NOR flash that's supported by mtd_spi_nor?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah ok, mtd_spi_nor is already doing that job. I will try.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When I hear connected SPI flash I see an opportunity to add an MTD device :D

Too bad, this is the Seeedstudio GD32 RISC-V board, which I don't have and can't order anywhere at the moment. So I can't try it out.

@benpicco
Copy link
Contributor

benpicco commented Feb 6, 2023

bors merge

bors bot added a commit that referenced this pull request Feb 6, 2023
19249: boards/gd32v: improve board definitions r=benpicco a=gschorcht

### Contribution description

This PR provides some small improvements of the existing board definitions for GD32VF103 boards for more flexibel default configurations and documentation of the board peripherals:

- Allow the remapping of SPI0 pins in SPI configuration (ae984b0)
- More flexible I2C configuration (0c33758)
  The default I2C device configuration allows to define up to two I2C devices `I2C_DEV(0)` and `I2C_DEV(1)`. `I2C_DEV(0)` is always defined if the I2C peripheral is enabled by the module `periph_spi`. The second I2C device `I2C_DEV(1)` is only defined if `I2C_DEV_1_USED` is defined by the board. This allows to use the default configuration with one or two I2C devices depending on whether other peripherals are enabled that would collide with the I2C devices.
- More flexible SPI configuration (edbf59e)
  The default SPI device configuration allows to define up to two SPI devices `SPI_DEV(0)` and `SPI_DEV(1)`. `SPI_DEV(0)` is always defined if the SPI peripheral is enabled by the module `periph_spi`. The second SPI device `SPI_DEV(1)` is only defined if `SPI_DEV_1_USED` is defined by the board. This allows to use the default configuration with one or two SPI devices depending on whether other peripherals are enabled that would collide with the SPI devices.
Furthermore, the CS signal in the SPI configuration is given by a define that can be overriden with another pin if
the default CS signal is connected to an unused hardware.
- Improve ADC config for Sipeed-Longan-Nano (c9c587e)
  The ADC configuration was too complex. It was hard to follow when certain ADC lines are available. Furthermore, the order of ADC lines did depend on the use of other peripherals. Now, either the TFT display is not connected and all ADC lines are available or the TFT display is connected and the second SPI device is used so that only the first 4 ADC lines are available.
- Improve Kconfig for Sipeed-Longan-Nano (025f4fd)
  Board-specific configuration not shown any longer directly in the top level menu but within a submenu.
- Improve peripherals documentation (7f0d560, e24abe4)
 Available peripherals for the board are now documented in two tables ordered by RIOT peripheral names and by pins.

Although the different changes are small and mostly related to the documentation, I could split the PR if necessary.

### Testing

Green CI

### Issues/PRs references



Co-authored-by: Gunar Schorcht <gunar@schorcht.net>
bors bot added a commit that referenced this pull request Feb 6, 2023
19249: boards/gd32v: improve board definitions r=benpicco a=gschorcht

### Contribution description

This PR provides some small improvements of the existing board definitions for GD32VF103 boards for more flexibel default configurations and documentation of the board peripherals:

- Allow the remapping of SPI0 pins in SPI configuration (ae984b0)
- More flexible I2C configuration (0c33758)
  The default I2C device configuration allows to define up to two I2C devices `I2C_DEV(0)` and `I2C_DEV(1)`. `I2C_DEV(0)` is always defined if the I2C peripheral is enabled by the module `periph_spi`. The second I2C device `I2C_DEV(1)` is only defined if `I2C_DEV_1_USED` is defined by the board. This allows to use the default configuration with one or two I2C devices depending on whether other peripherals are enabled that would collide with the I2C devices.
- More flexible SPI configuration (edbf59e)
  The default SPI device configuration allows to define up to two SPI devices `SPI_DEV(0)` and `SPI_DEV(1)`. `SPI_DEV(0)` is always defined if the SPI peripheral is enabled by the module `periph_spi`. The second SPI device `SPI_DEV(1)` is only defined if `SPI_DEV_1_USED` is defined by the board. This allows to use the default configuration with one or two SPI devices depending on whether other peripherals are enabled that would collide with the SPI devices.
Furthermore, the CS signal in the SPI configuration is given by a define that can be overriden with another pin if
the default CS signal is connected to an unused hardware.
- Improve ADC config for Sipeed-Longan-Nano (c9c587e)
  The ADC configuration was too complex. It was hard to follow when certain ADC lines are available. Furthermore, the order of ADC lines did depend on the use of other peripherals. Now, either the TFT display is not connected and all ADC lines are available or the TFT display is connected and the second SPI device is used so that only the first 4 ADC lines are available.
- Improve Kconfig for Sipeed-Longan-Nano (025f4fd)
  Board-specific configuration not shown any longer directly in the top level menu but within a submenu.
- Improve peripherals documentation (7f0d560, e24abe4)
 Available peripherals for the board are now documented in two tables ordered by RIOT peripheral names and by pins.

Although the different changes are small and mostly related to the documentation, I could split the PR if necessary.

### Testing

Green CI

### Issues/PRs references



Co-authored-by: Gunar Schorcht <gunar@schorcht.net>
@kaspar030
Copy link
Contributor

bors retry

@bors
Copy link
Contributor

bors bot commented Feb 7, 2023

Build succeeded:

@bors bors bot merged commit 304245b into RIOT-OS:master Feb 7, 2023
@gschorcht
Copy link
Contributor Author

Thanks.

@gschorcht gschorcht deleted the boards/gd32v/improve_board_definitions branch February 7, 2023 13:52
@MrKevinWeiss MrKevinWeiss added this to the Release 2023.04 milestone Apr 25, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area: boards Area: Board ports Area: cpu Area: CPU/MCU ports Area: doc Area: Documentation Area: Kconfig Area: Kconfig integration CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR Type: enhancement The issue suggests enhanceable parts / The PR enhances parts of the codebase / documentation
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants