Skip to content

Commit dc91b09

Browse files
committed
Fix Some Issues
1 parent 4eec035 commit dc91b09

3 files changed

Lines changed: 150 additions & 56 deletions

File tree

‎bsp/gd32/risc-v/gd32vw553h-eval/.ci/attachconfig/ci.attachconfig.yml‎

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,20 @@ scons.args: &scons
66
component.pwm:
77
kconfig:
88
- CONFIG_BSP_USING_PWM=y
9-
- CONFIG_BSP_USING_PWM0=y
9+
- CONFIG_BSP_USING_PWM0=y
10+
11+
# ------ devices ------
12+
devices.i2c:
13+
kconfig:
14+
- CONFIG_BSP_USING_HW_I2C=y
15+
- CONFIG_BSP_USING_HW_I2C0=y
16+
- CONFIG_BSP_HW_I2C0_PIN_PA2_PA3=y
17+
- CONFIG_BSP_HW_I2C0_CLK=100
18+
- CONFIG_BSP_USING_HW_I2C1=y
19+
- CONFIG_BSP_HW_I2C1_PIN_PB12_PB13=y
20+
- CONFIG_BSP_HW_I2C1_CLK=100
21+
22+
devices.spi:
23+
kconfig:
24+
- CONFIG_BSP_USING_SPI=y
25+
- CONFIG_BSP_USING_SPI0=y

‎bsp/gd32/risc-v/gd32vw553h-eval/board/Kconfig‎

Lines changed: 117 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -22,27 +22,6 @@ menu "On-chip Peripheral Drivers"
2222
select RT_USING_PIN
2323
default n
2424

25-
menuconfig BSP_USING_SPI
26-
bool "Enable SPI BUS"
27-
default n
28-
select RT_USING_SPI
29-
if BSP_USING_SPI
30-
config BSP_USING_SPI0
31-
bool "Enable SPI0 BUS"
32-
default n
33-
34-
config BSP_SPI0_TX_USING_DMA
35-
bool "Enable SPI0 TX DMA"
36-
depends on BSP_USING_SPI0
37-
default n
38-
39-
config BSP_SPI0_RX_USING_DMA
40-
bool "Enable SPI0 RX DMA"
41-
depends on BSP_USING_SPI0
42-
select BSP_SPI0_TX_USING_DMA
43-
default n
44-
endif
45-
4625
menuconfig BSP_USING_UART
4726
bool "Enable UART"
4827
default n
@@ -77,35 +56,138 @@ menu "On-chip Peripheral Drivers"
7756
depends on BSP_USING_UART2
7857
select RT_SERIAL_USING_DMA
7958
default n
59+
endif
60+
61+
menuconfig BSP_USING_PWM
62+
bool "Enable PWM"
63+
default n
64+
select RT_USING_PWM
65+
if BSP_USING_PWM
66+
config BSP_USING_PWM0
67+
bool "Enable PWM0"
68+
default y
69+
config BSP_USING_PWM1
70+
bool "Enable PWM1"
71+
default n
72+
config BSP_USING_PWM2
73+
bool "Enable PWM2"
74+
default n
75+
config BSP_USING_PWM15
76+
bool "Enable PWM15"
77+
default n
78+
config BSP_USING_PWM16
79+
bool "Enable PWM16"
80+
default n
81+
endif
82+
83+
menuconfig BSP_USING_HW_I2C
84+
bool "Enable Hardware I2C"
85+
default n
86+
select RT_USING_I2C
87+
if BSP_USING_HW_I2C
88+
config BSP_USING_HW_I2C0
89+
bool "Enable Hardware I2C0"
90+
default n
8091

81-
config BSP_USING_UART3
82-
bool "Enable UART3"
92+
# config i2c0 pins
93+
choice
94+
prompt "Select I2C0 pins"
95+
depends on BSP_USING_HW_I2C0
96+
config BSP_HW_I2C0_PIN_PA2_PA3
97+
bool "SCL=PA2, SDA=PA3"
98+
config BSP_HW_I2C0_PIN_PA15_PC8
99+
bool "SCL=PA15, SDA=PC8"
100+
config BSP_HW_I2C0_PIN_PB0_PB1
101+
bool "SCL=PB0, SDA=PB1"
102+
config BSP_HW_I2C0_PIN_PB15_PA8
103+
bool "SCL=PB15, SDA=PA8"
104+
endchoice
105+
106+
# config i2c0 clock
107+
config BSP_HW_I2C0_CLK
108+
int "I2C0 clock frequency(KHz)"
109+
default 100
110+
depends on BSP_USING_HW_I2C0
111+
range 10 1000
112+
113+
config BSP_USING_HW_I2C1
114+
bool "Enable Hardware I2C1"
83115
default n
84116

85-
config BSP_UART3_RX_USING_DMA
86-
bool "Enable UART3 RX DMA"
87-
depends on BSP_USING_UART3
88-
select RT_SERIAL_USING_DMA
117+
# config i2c1 pins
118+
choice
119+
prompt "Select I2C1 pins"
120+
depends on BSP_USING_HW_I2C1
121+
config BSP_HW_I2C1_PIN_PA6_PA7
122+
bool "SCL=PA6, SDA=PA7"
123+
config BSP_HW_I2C1_PIN_PA13_PA14
124+
bool "SCL=PA13, SDA=PA14"
125+
config BSP_HW_I2C1_PIN_PA15_PC8
126+
bool "SCL=PA15, SDA=PC8"
127+
config BSP_HW_I2C1_PIN_PB12_PB13
128+
bool "SCL=PB12, SDA=PB13"
129+
config BSP_HW_I2C1_PIN_PB15_PA8
130+
bool "SCL=PB15, SDA=PA8"
131+
endchoice
132+
133+
# config i2c1 clock
134+
config BSP_HW_I2C1_CLK
135+
int "I2C1 clock frequency(KHz)"
136+
default 100
137+
depends on BSP_USING_HW_I2C1
138+
range 10 1000
139+
endif
140+
141+
menuconfig BSP_USING_SPI
142+
bool "Enable SPI BUS"
143+
default n
144+
select RT_USING_SPI
145+
if BSP_USING_SPI
146+
config BSP_USING_SPI0
147+
bool "Enable SPI0 BUS"
89148
default n
90149

91-
config BSP_USING_UART4
92-
bool "Enable UART4"
150+
config BSP_SPI0_TX_USING_DMA
151+
bool "Enable SPI0 TX DMA"
152+
depends on BSP_USING_SPI0
93153
default n
94154

95-
config BSP_UART4_RX_USING_DMA
96-
bool "Enable UART4 RX DMA"
97-
depends on BSP_USING_UART4
98-
select RT_SERIAL_USING_DMA
155+
config BSP_SPI0_RX_USING_DMA
156+
bool "Enable SPI0 RX DMA"
157+
depends on BSP_USING_SPI0
158+
select BSP_SPI0_TX_USING_DMA
99159
default n
100160
endif
101161

102-
source "$(BSP_DIR)/libraries/gd32_drivers/Kconfig"
162+
source "$(BSP_DIR)/../libraries/gd32_drivers/Kconfig"
103163

104164
endmenu
105165

106166
menu "Board extended module Drivers"
107167

108-
endmenu
168+
menuconfig BSP_USING_AT24C02
169+
bool "Enable AT24C02 I2C0( SCL[PA2 : 2] SDA[PA3 : 3] )"
170+
default n
171+
select BSP_USING_HW_I2C
172+
select BSP_USING_HW_I2C0
173+
select PKG_USING_AT24CXX
174+
select PKG_AT24CXX_EE_TYPE_AT24C02
175+
176+
if BSP_USING_AT24C02
177+
178+
config BSP_USING_AT24C02_UTEST
179+
bool "Enable the utest of AT24C02"
180+
default n
181+
select RT_USING_UTEST
182+
select RT_USING_ULOG
183+
select ULOG_USING_ISR_LOG
184+
185+
config BSP_USING_AT24C02_INIT
186+
bool "Init the model and check it"
187+
default y
188+
189+
endif
109190

110191
endmenu
111192

193+
endmenu

‎bsp/gd32/risc-v/libraries/gd32_drivers/drv_spi.c‎

Lines changed: 16 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -296,26 +296,24 @@ static rt_uint32_t spixfer(struct rt_spi_device* device, struct rt_spi_message*
296296
}
297297

298298
#if defined (SOC_SERIES_GD32VW55x)
299-
// Todo: replace register read/write by gd32f4 lib
300-
//Wait until the transmit buffer is empty
299+
/* Wait until the transmit buffer is empty */
301300
while(RESET == spi_flag_get(SPI_FLAG_TBE));
302-
// Send the byte
301+
/* Send the byte */
303302
spi_data_transmit(data);
304303

305-
//Wait until a data is received
304+
/* Wait until a data is received */
306305
while(RESET == spi_flag_get(SPI_FLAG_RBNE));
307-
// Get the received data
306+
/* Get the received data */
308307
data = spi_data_receive();
309308
#else
310-
// Todo: replace register read/write by gd32f4 lib
311-
//Wait until the transmit buffer is empty
309+
/* Wait until the transmit buffer is empty */
312310
while(RESET == spi_i2s_flag_get(spi_periph, SPI_FLAG_TBE));
313-
// Send the byte
311+
/* Send the byte */
314312
spi_i2s_data_transmit(spi_periph, data);
315313

316-
//Wait until a data is received
314+
/* Wait until a data is received */
317315
while(RESET == spi_i2s_flag_get(spi_periph, SPI_FLAG_RBNE));
318-
// Get the received data
316+
/* Get the received data */
319317
data = spi_i2s_data_receive(spi_periph);
320318
#endif
321319

@@ -342,26 +340,24 @@ static rt_uint32_t spixfer(struct rt_spi_device* device, struct rt_spi_message*
342340
}
343341

344342
#if defined (SOC_SERIES_GD32VW55x)
345-
// Todo: replace register read/write by gd32f4 lib
346-
//Wait until the transmit buffer is empty
343+
/* Wait until the transmit buffer is empty */
347344
while(RESET == spi_flag_get(SPI_FLAG_TBE));
348-
// Send the byte
345+
/* Send the byte */
349346
spi_data_transmit(data);
350347

351-
//Wait until a data is received
348+
/* Wait until a data is received */
352349
while(RESET == spi_flag_get(SPI_FLAG_RBNE));
353-
// Get the received data
350+
/* Get the received data */
354351
data = spi_data_receive();
355352
#else
356-
// Todo: replace register read/write by gd32f4 lib
357-
//Wait until the transmit buffer is empty
353+
/* Wait until the transmit buffer is empty */
358354
while(RESET == spi_i2s_flag_get(spi_periph, SPI_FLAG_TBE));
359-
// Send the byte
355+
/* Send the byte */
360356
spi_i2s_data_transmit(spi_periph, data);
361357

362-
//Wait until a data is received
358+
/* Wait until a data is received */
363359
while(RESET == spi_i2s_flag_get(spi_periph, SPI_FLAG_RBNE));
364-
// Get the received data
360+
/* Get the received data */
365361
data = spi_i2s_data_receive(spi_periph);
366362
#endif
367363

0 commit comments

Comments
 (0)