Skip to content

Commit 3a46b46

Browse files
committed
[bsp][renesas][stm32]Fix some bsp probelm in 5.1.x.
1 parent 1bb06ab commit 3a46b46

File tree

6 files changed

+104
-18
lines changed

6 files changed

+104
-18
lines changed

bsp/renesas/ra8d1-vision-board/board/Kconfig

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -599,36 +599,35 @@ menu "Hardware Drivers Config"
599599
bool "Enable RW007"
600600
default n
601601
select PKG_USING_RW007
602-
select BSP_USING_SCI
603-
select BSP_USING_SCI2
604-
select BSP_USING_SCI2_SPI
602+
select BSP_USING_SPI
603+
select BSP_USING_SPI1
605604
select RT_USING_MEMPOOL
606605
select RW007_NOT_USE_EXAMPLE_DRIVERS
607606

608607
if BSP_USING_RW007
609608
config RA_RW007_SPI_BUS_NAME
610609
string "RW007 BUS NAME"
611-
default "sci2s"
610+
default "spi1"
612611

613612
config RA_RW007_CS_PIN
614613
hex "(HEX)CS pin index"
615-
default 0x060C
614+
default 0x040D
616615

617616
config RA_RW007_BOOT0_PIN
618617
hex "(HEX)BOOT0 pin index (same as spi clk pin)"
619-
default 0x060B
618+
default 0x040C
620619

621620
config RA_RW007_BOOT1_PIN
622621
hex "(HEX)BOOT1 pin index (same as spi cs pin)"
623-
default 0x060C
622+
default 0x040D
624623

625624
config RA_RW007_INT_BUSY_PIN
626625
hex "(HEX)INT/BUSY pin index"
627-
default 0x0006
626+
default 0x0800
628627

629628
config RA_RW007_RST_PIN
630629
hex "(HEX)RESET pin index"
631-
default 0x0A08
630+
default 0x0504
632631
endif
633632

634633
endmenu
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
2+
from building import *
3+
import rtconfig
4+
5+
cwd = GetCurrentDir()
6+
7+
src = []
8+
9+
if GetDepend(['BSP_USING_RW007']):
10+
src += Glob('drv_rw007.c')
11+
12+
CPPPATH = [cwd]
13+
LOCAL_CFLAGS = ''
14+
15+
if rtconfig.PLATFORM in ['gcc', 'armclang']:
16+
LOCAL_CFLAGS += ' -std=c99'
17+
elif rtconfig.PLATFORM in ['armcc']:
18+
LOCAL_CFLAGS += ' --c99'
19+
20+
group = DefineGroup('Drivers', src, depend = [], CPPPATH = CPPPATH, LOCAL_CFLAGS = LOCAL_CFLAGS)
21+
22+
Return('group')
Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
#include <rtthread.h>
2+
#include <rtdbg.h>
3+
#ifdef BSP_USING_RW007
4+
#include <rtdevice.h>
5+
#include <drv_spi.h>
6+
#include <board.h>
7+
#include <spi_wifi_rw007.h>
8+
9+
extern void spi_wifi_isr(int vector);
10+
11+
static void rw007_gpio_init(void)
12+
{
13+
/* Configure IO */
14+
rt_pin_mode(RA_RW007_RST_PIN, PIN_MODE_OUTPUT);
15+
rt_pin_mode(RA_RW007_INT_BUSY_PIN, PIN_MODE_INPUT_PULLDOWN);
16+
17+
/* Reset rw007 and config mode */
18+
rt_pin_write(RA_RW007_RST_PIN, PIN_LOW);
19+
rt_thread_delay(rt_tick_from_millisecond(100));
20+
rt_pin_write(RA_RW007_RST_PIN, PIN_HIGH);
21+
22+
/* Wait rw007 ready(exit busy stat) */
23+
while (!rt_pin_read(RA_RW007_INT_BUSY_PIN))
24+
{
25+
rt_thread_delay(5);
26+
}
27+
28+
rt_thread_delay(rt_tick_from_millisecond(200));
29+
rt_pin_mode(RA_RW007_INT_BUSY_PIN, PIN_MODE_INPUT_PULLUP);
30+
}
31+
32+
int wifi_spi_device_init(void)
33+
{
34+
char sn_version[32];
35+
uint32_t cs_pin = RA_RW007_CS_PIN;
36+
37+
rw007_gpio_init();
38+
rt_hw_spi_device_attach(RA_RW007_SPI_BUS_NAME, "wspi", cs_pin);
39+
rt_hw_wifi_init("wspi");
40+
41+
rt_wlan_set_mode(RT_WLAN_DEVICE_STA_NAME, RT_WLAN_STATION);
42+
rt_wlan_set_mode(RT_WLAN_DEVICE_AP_NAME, RT_WLAN_AP);
43+
44+
rw007_sn_get(sn_version);
45+
rt_kprintf("\nrw007 sn: [%s]\n", sn_version);
46+
rw007_version_get(sn_version);
47+
rt_kprintf("rw007 ver: [%s]\n\n", sn_version);
48+
49+
return 0;
50+
}
51+
INIT_APP_EXPORT(wifi_spi_device_init);
52+
53+
static void int_wifi_irq(void *p)
54+
{
55+
((void)p);
56+
spi_wifi_isr(0);
57+
}
58+
59+
void spi_wifi_hw_init(void)
60+
{
61+
rt_pin_attach_irq(RA_RW007_INT_BUSY_PIN, PIN_IRQ_MODE_FALLING, int_wifi_irq, 0);
62+
rt_pin_irq_enable(RA_RW007_INT_BUSY_PIN, RT_TRUE);
63+
}
64+
65+
#endif /* BSP_USING_RW007 */

bsp/stm32/stm32f407-rt-spark/board/ports/drv_filesystem.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
#ifdef BSP_USING_SDCARD_FATFS
3131
static int onboard_sdcard_mount(void)
3232
{
33-
if (dfs_mount("sd0", "/sdcard", "elm", 0, 0) == RT_EOK)
33+
if (dfs_mount("sd", "/sdcard", "elm", 0, 0) == RT_EOK)
3434
{
3535
LOG_I("SD card mount to '/sdcard'");
3636
}

bsp/stm32/stm32h750-artpi/board/port/filesystem.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232
#define DBG_LVL DBG_INFO
3333
#include <rtdbg.h>
3434

35-
35+
#ifdef RT_USING_DFS_ROMFS
3636
#include "dfs_romfs.h"
3737

3838
#ifdef RT_USING_DFS_ELMFAT
@@ -54,7 +54,7 @@ const struct romfs_dirent romfs_root =
5454
{
5555
ROMFS_DIRENT_DIR, "/", (rt_uint8_t *)_romfs_root, sizeof(_romfs_root) / sizeof(_romfs_root[0])
5656
};
57-
57+
#endif
5858

5959
#ifdef BSP_USING_SDCARD_FS
6060

@@ -65,19 +65,19 @@ static void _sdcard_mount(void)
6565
{
6666
rt_device_t device;
6767

68-
device = rt_device_find("sd0");
68+
device = rt_device_find("sd");
6969

7070
if (device == NULL)
7171
{
7272
mmcsd_wait_cd_changed(0);
7373
sdcard_change();
7474
mmcsd_wait_cd_changed(RT_WAITING_FOREVER);
75-
device = rt_device_find("sd0");
75+
device = rt_device_find("sd");
7676
}
7777

7878
if (device != RT_NULL)
7979
{
80-
if (dfs_mount("sd0", "/sdcard", "elm", 0, 0) == RT_EOK)
80+
if (dfs_mount("sd", "/sdcard", "elm", 0, 0) == RT_EOK)
8181
{
8282
LOG_I("sd card mount to '/sdcard'");
8383
}

bsp/stm32/stm32h7s7-st-disco/board/port/filesystem.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -65,19 +65,19 @@ static void _sdcard_mount(void)
6565
{
6666
rt_device_t device;
6767

68-
device = rt_device_find("sd0");
68+
device = rt_device_find("sd");
6969

7070
if (device == NULL)
7171
{
7272
mmcsd_wait_cd_changed(0);
7373
sdcard_change();
7474
mmcsd_wait_cd_changed(RT_WAITING_FOREVER);
75-
device = rt_device_find("sd0");
75+
device = rt_device_find("sd");
7676
}
7777

7878
if (device != RT_NULL)
7979
{
80-
if (dfs_mount("sd0", "/sdcard", "elm", 0, 0) == RT_EOK)
80+
if (dfs_mount("sd", "/sdcard", "elm", 0, 0) == RT_EOK)
8181
{
8282
LOG_I("sd card mount to '/sdcard'");
8383
}

0 commit comments

Comments
 (0)