Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,9 @@ hw_drv_onchip.i2c0:
kconfig:
- CONFIG_BSP_USING_I2C0=y
- CONFIG_BSP_I2C0_SCL_PIN=22
- CONFIG_BSP_I2C0_SDA_PIN=23
- CONFIG_BSP_I2C0_SDA_PIN=23
hw_drv_onchip.i2c1:
kconfig:
- CONFIG_BSP_USING_HW_I2C=y
- CONFIG_BSP_USING_HW_I2C1=y
- CONFIG_BSP_HW_I2C1_CLOCK_SPEED=400000
2 changes: 1 addition & 1 deletion bsp/gd32/arm/gd32e230-lckfb/.config
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@
# CONFIG_RT_UTEST_TC_USING_KLIBC is not set
# end of klibc options

CONFIG_RT_NAME_MAX=8
CONFIG_RT_NAME_MAX=20
# CONFIG_RT_USING_ARCH_DATA_TYPE is not set
# CONFIG_RT_USING_NANO is not set
# CONFIG_RT_USING_SMART is not set
Expand Down
11 changes: 10 additions & 1 deletion bsp/gd32/arm/gd32e230-lckfb/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,18 @@
| :--- | :---: | :--- |
| GPIO | 支持 | PAx, PBx... |
| UART | 支持 | USART0, USART1 |
| I2C | 支持 | I2C0, I2C1 硬件I2C |
| **扩展模块** | **支持情况** | **备注** |
| 暂无 | 暂不支持 | 暂不支持 |

### 补充说明

I2C 引脚分配:
- **I2C0**: SCL(PB6), SDA(PB7)
- **I2C1**: SCL(PB10), SDA(PB11)
默认速率400KHz,可以配置调整。


## 使用说明

使用说明分为如下两个章节:
Expand Down Expand Up @@ -95,7 +104,7 @@ pyocd flash -t gd32e230c8t6 rtthread.bin
4. 输入 `scons -j12` 编译。

## 注意事项
1. GD32E230资源受限,虽然通过调整参数极限运行msh,但是意义不大,建议关闭。
1. GD32E230资源受限,虽然通过调整参数可以运行msh,但是意义不大,建议关闭。
2. **GPIOA-13** 和 **GPIOA-14** 默认用于 SWD 调试下载功能,建议不要配置为其它功能,否则将可能导致无法正常下载和调试。

## 联系人信息
Expand Down
26 changes: 24 additions & 2 deletions bsp/gd32/arm/gd32e230-lckfb/board/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -146,13 +146,35 @@ menu "On-chip Peripheral Drivers"
select RT_USING_I2C
default n
if BSP_USING_HW_I2C
config BSP_USING_I2C0
config BSP_USING_HW_I2C0
bool "Enable I2C0"
default y

config BSP_USING_I2C1
config BSP_HW_I2C0_CLOCK_SPEED
int "I2C0 Clock Speed (Hz)"
depends on BSP_USING_HW_I2C0
range 100000 1000000
default 400000
help
Set the I2C0 clock speed in Hz.
Standard mode: 100000 (100KHz)
Fast mode: 400000 (400KHz)
Fast mode plus: 1000000 (1MHz)

config BSP_USING_HW_I2C1
bool "Enable I2C1"
default n

config BSP_HW_I2C1_CLOCK_SPEED
int "I2C1 Clock Speed (Hz)"
depends on BSP_USING_HW_I2C1
range 100000 1000000
default 400000
help
Set the I2C1 clock speed in Hz.
Standard mode: 100000 (100KHz)
Fast mode: 400000 (400KHz)
Fast mode plus: 1000000 (1MHz)
endif
menuconfig BSP_USING_I2C0
bool "Enable I2C0 BUS (software simulation)"
Expand Down
4 changes: 0 additions & 4 deletions bsp/gd32/arm/gd32e230-lckfb/board/linker_scripts/link.ld
Original file line number Diff line number Diff line change
Expand Up @@ -129,10 +129,6 @@ SECTIONS

/* Discard all debugging and comment sections using the correct wildcard syntax */
*(.comment)
*(.debug*)
*(.line)
*(.stab)
*(.stabstr)
*(.note.gnu.build-id)
*(.ARM.attributes)
}
Expand Down
2 changes: 1 addition & 1 deletion bsp/gd32/arm/gd32e230-lckfb/rtconfig.h
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@

/* end of rt_strnlen options */
/* end of klibc options */
#define RT_NAME_MAX 8
#define RT_NAME_MAX 20
#define RT_CPUS_NR 1
#define RT_ALIGN_SIZE 8
#define RT_THREAD_PRIORITY_32
Expand Down
2 changes: 1 addition & 1 deletion bsp/gd32/arm/gd32e230-lckfb/rtconfig.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
if os.getenv('RTT_EXEC_PATH'):
EXEC_PATH = os.getenv('RTT_EXEC_PATH')

BUILD = 'release'
BUILD = 'debug'

if PLATFORM == 'gcc':
# toolchains
Expand Down
5 changes: 5 additions & 0 deletions bsp/gd32/arm/libraries/gd32_drivers/SConscript
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,11 @@ if GetDepend(['RT_USING_SERIAL']):
if GetDepend(['RT_USING_I2C', 'RT_USING_I2C_BITOPS']):
if GetDepend('BSP_USING_I2C0') or GetDepend('BSP_USING_I2C1') or GetDepend('BSP_USING_I2C2') or GetDepend('BSP_USING_I2C3'):
src += ['drv_soft_i2c.c']

# add i2c hard drivers.
if GetDepend(['RT_USING_I2C']):
if GetDepend('BSP_USING_HW_I2C0') or GetDepend('BSP_USING_HW_I2C1'):
src += ['drv_hw_i2c.c']

# add spi drivers.
if GetDepend('RT_USING_SPI'):
Expand Down
Loading