Skip to content

Commit e483cf2

Browse files
committed
bsp: k230: add spi driver
Requirement: The BSP for the k230 platform in the RT-Thread repository does not yet have an spi driver. Solution: Provide spi driver for the k230 platform in the RT-Thread repository. - Supports SPI0(OSPI) controller with 1/2/4/8 data lines. - Supports SPI1(QSPI0) and SPI2(QSPI1) controllers with 1/2/4 data lines. - Implements DMA-based transfers for OSPI, QSPI, and DSPI modes. - Falls back to standard IRQ-driven transfers for legacy SPI mode (single line). - Updates documentation in bsp/README.md Signed-off-by: ChuanN-sudo <[email protected]>
1 parent 32d2cf1 commit e483cf2

File tree

10 files changed

+1208
-5
lines changed

10 files changed

+1208
-5
lines changed

bsp/README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -760,9 +760,9 @@ This document is based on the RT-Thread mainline repository and categorizes the
760760

761761
#### 🟢 K230 (RT-Smart)
762762

763-
| BSP Name | GPIO | UART | I2C | RTC | ADC | PWM | SDIO | HWTimer | WDT |
764-
|----------|------|------|-----|-----|-----|-----|------|---------|-----|
765-
| [k230](k230) ||||||||||
763+
| BSP Name | GPIO | UART | I2C | RTC | ADC | PWM | SDIO | HWTimer | WDT | SPI |
764+
|----------|------|------|-----|-----|-----|-----|------|---------|-----|-----|
765+
| [k230](k230) |||||||||||
766766

767767
#### 🟢 Xuantie (RT-Smart)
768768

bsp/k230/.ci/attachconfig/ci.attachconfig.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,12 @@
11
scons.args: &scons
22
scons_arg:
33
- '--strict'
4+
devices.spi:
5+
<<: *scons
6+
kconfig:
7+
- CONFIG_RT_USING_SPI=y
8+
- CONFIG_BSP_USING_SPI=y
9+
- CONFIG_BSP_USING_SPI0=y
410
devices.i2c:
511
<<: *scons
612
kconfig:

bsp/k230/.config

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -534,8 +534,6 @@ CONFIG_RT_USING_ADT_REF=y
534534
# CONFIG_RT_USING_RT_LINK is not set
535535
# end of Utilities
536536

537-
# CONFIG_RT_USING_VBUS is not set
538-
539537
#
540538
# Memory management
541539
#
@@ -943,6 +941,7 @@ CONFIG_RT_USING_VDSO=y
943941
# CONFIG_PKG_USING_R_RHEALSTONE is not set
944942
# CONFIG_PKG_USING_HEARTBEAT is not set
945943
# CONFIG_PKG_USING_MICRO_ROS_RTTHREAD_PACKAGE is not set
944+
# CONFIG_PKG_USING_CHERRYECAT is not set
946945
# end of system packages
947946

948947
#
@@ -1100,6 +1099,12 @@ CONFIG_RT_USING_VDSO=y
11001099
# CONFIG_PKG_USING_GD32_ARM_CMSIS_DRIVER is not set
11011100
# CONFIG_PKG_USING_GD32_ARM_SERIES_DRIVER is not set
11021101
# end of GD32 Drivers
1102+
1103+
#
1104+
# HPMicro SDK
1105+
#
1106+
# CONFIG_PKG_USING_HPM_SDK is not set
1107+
# end of HPMicro SDK
11031108
# end of HAL & SDK Drivers
11041109

11051110
#
@@ -1619,6 +1624,7 @@ CONFIG_PKG_ZLIB_VER="latest"
16191624
#
16201625
# Drivers Configuration
16211626
#
1627+
# CONFIG_BSP_USING_SPI is not set
16221628
# CONFIG_BSP_USING_I2C is not set
16231629
# CONFIG_BSP_USING_RTC is not set
16241630
# CONFIG_BSP_USING_ADC is not set

bsp/k230/board/Kconfig

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,31 @@
11
menu "Drivers Configuration"
2+
3+
menuconfig BSP_USING_SPI
4+
bool "Enable SPI"
5+
select RT_USING_SPI
6+
select RT_USING_QSPI
7+
default n
8+
9+
if BSP_USING_SPI
10+
config BSP_USING_SPI0
11+
bool "Enable SPI0"
12+
help
13+
Support 1, 2, 4 and 8 lines, Max clock frequency is 200 Mhz.
14+
default n
15+
16+
config BSP_USING_SPI1
17+
bool "Enable SPI1"
18+
help
19+
Support 1, 2, and 4 lines, Max clock frequency is 100 Mhz.
20+
default n
21+
22+
config BSP_USING_SPI2
23+
bool "Enable SPI2"
24+
help
25+
Support 1, 2, and 4 lines, Max clock frequency is 100 Mhz.
26+
default n
27+
endif
28+
229
menuconfig BSP_USING_I2C
330
bool "Enable I2C"
431
select RT_USING_I2C
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# RT-Thread building script for SPI component
2+
3+
from building import *
4+
5+
cwd = GetCurrentDir()
6+
src = Glob('*.c')
7+
CPPPATH = [cwd]
8+
9+
group = DefineGroup('SPI', src, depend = ['BSP_USING_SPI'], CPPPATH = CPPPATH)
10+
11+
Return('group')

0 commit comments

Comments
 (0)