diff --git a/demo/stm32/usb_host/stm32f429igt6/Core/Inc/usb_config.h b/demo/stm32/usb_host/stm32f429igt6/Core/Inc/usb_config.h
index c36ee8e9..9a428ac1 100644
--- a/demo/stm32/usb_host/stm32f429igt6/Core/Inc/usb_config.h
+++ b/demo/stm32/usb_host/stm32f429igt6/Core/Inc/usb_config.h
@@ -38,9 +38,23 @@
#define CONFIG_USBHOST_PSC_PRIO 4
#endif
#ifndef CONFIG_USBHOST_PSC_STACKSIZE
-#define CONFIG_USBHOST_PSC_STACKSIZE 2048
+#define CONFIG_USBHOST_PSC_STACKSIZE 4096
+#endif
+
+#ifndef CONFIG_USBHOST_DEV_NAMELEN
+#define CONFIG_USBHOST_DEV_NAMELEN 16
#endif
#define CONFIG_USBHOST_ASYNCH
+//#define CONFIG_USBHOST_GET_STRING_DESC
+
+/* EHCI Configuration */
+#define CONFIG_USB_EHCI_HCCR_BASE (0x20072000)
+#define CONFIG_USB_EHCI_HCOR_BASE (0x20072000 + 0x10)
+#define CONFIG_USB_EHCI_QH_NUM (10)
+#define CONFIG_USB_EHCI_QTD_NUM (10)
+// #define CONFIG_USB_EHCI_INFO_ENABLE
+// #define CONFIG_USB_ECHI_HCOR_RESERVED
+// #define CONFIG_USB_EHCI_CONFIGFLAG
#endif
\ No newline at end of file
diff --git a/demo/stm32/usb_host/stm32f429igt6/MDK-ARM/stm32f429igt6.uvoptx b/demo/stm32/usb_host/stm32f429igt6/MDK-ARM/stm32f429igt6.uvoptx
index ccc628ce..e62fcb1f 100644
--- a/demo/stm32/usb_host/stm32f429igt6/MDK-ARM/stm32f429igt6.uvoptx
+++ b/demo/stm32/usb_host/stm32f429igt6/MDK-ARM/stm32f429igt6.uvoptx
@@ -294,7 +294,7 @@
Application/User/Core
- 1
+ 0
0
0
0
@@ -346,17 +346,29 @@
0
0
+
+ 2
+ 6
+ 1
+ 0
+ 0
+ 0
+ ..\..\..\..\usb_host.c
+ usb_host.c
+ 0
+ 0
+
Drivers/STM32F4xx_HAL_Driver
- 1
+ 0
0
0
0
3
- 6
+ 7
1
0
0
@@ -368,7 +380,7 @@
3
- 7
+ 8
1
0
0
@@ -380,7 +392,7 @@
3
- 8
+ 9
1
0
0
@@ -392,7 +404,7 @@
3
- 9
+ 10
1
0
0
@@ -404,7 +416,7 @@
3
- 10
+ 11
1
0
0
@@ -416,7 +428,7 @@
3
- 11
+ 12
1
0
0
@@ -428,7 +440,7 @@
3
- 12
+ 13
1
0
0
@@ -440,7 +452,7 @@
3
- 13
+ 14
1
0
0
@@ -452,7 +464,7 @@
3
- 14
+ 15
1
0
0
@@ -464,7 +476,7 @@
3
- 15
+ 16
1
0
0
@@ -476,7 +488,7 @@
3
- 16
+ 17
1
0
0
@@ -488,7 +500,7 @@
3
- 17
+ 18
1
0
0
@@ -500,7 +512,7 @@
3
- 18
+ 19
1
0
0
@@ -512,7 +524,7 @@
3
- 19
+ 20
1
0
0
@@ -524,7 +536,7 @@
3
- 20
+ 21
1
0
0
@@ -536,7 +548,7 @@
3
- 21
+ 22
1
0
0
@@ -548,7 +560,7 @@
3
- 22
+ 23
1
0
0
@@ -560,7 +572,7 @@
3
- 23
+ 24
1
0
0
@@ -580,7 +592,7 @@
0
4
- 24
+ 25
1
0
0
@@ -594,13 +606,13 @@
FreeRTOS
- 1
+ 0
0
0
0
5
- 25
+ 26
1
0
0
@@ -612,7 +624,7 @@
5
- 26
+ 27
1
0
0
@@ -624,7 +636,7 @@
5
- 27
+ 28
1
0
0
@@ -636,7 +648,7 @@
5
- 28
+ 29
1
0
0
@@ -648,7 +660,7 @@
5
- 29
+ 30
1
0
0
@@ -660,7 +672,7 @@
5
- 30
+ 31
1
0
0
@@ -672,7 +684,7 @@
5
- 31
+ 32
1
0
0
@@ -684,7 +696,7 @@
5
- 32
+ 33
1
0
0
@@ -697,14 +709,14 @@
- usb_stack
- 1
+ CherryUSB
+ 0
0
0
0
6
- 33
+ 34
1
0
0
@@ -716,7 +728,7 @@
6
- 34
+ 35
1
0
0
@@ -728,7 +740,7 @@
6
- 35
+ 36
1
0
0
@@ -740,7 +752,7 @@
6
- 36
+ 37
1
0
0
@@ -752,7 +764,7 @@
6
- 37
+ 38
1
0
0
@@ -764,7 +776,7 @@
6
- 38
+ 39
1
0
0
@@ -776,7 +788,7 @@
6
- 39
+ 40
1
0
0
@@ -788,7 +800,7 @@
6
- 40
+ 41
1
0
0
@@ -800,6 +812,74 @@
+
+ fatfs
+ 0
+ 0
+ 0
+ 0
+
+ 7
+ 42
+ 1
+ 0
+ 0
+ 0
+ ..\..\..\..\..\third_party\fatfs-0.14\source\diskio.c
+ diskio.c
+ 0
+ 0
+
+
+ 7
+ 43
+ 1
+ 0
+ 0
+ 0
+ ..\..\..\..\..\third_party\fatfs-0.14\source\ff.c
+ ff.c
+ 0
+ 0
+
+
+ 7
+ 44
+ 1
+ 0
+ 0
+ 0
+ ..\..\..\..\..\third_party\fatfs-0.14\source\ffsystem.c
+ ffsystem.c
+ 0
+ 0
+
+
+ 7
+ 45
+ 1
+ 0
+ 0
+ 0
+ ..\..\..\..\..\third_party\fatfs-0.14\source\ffunicode.c
+ ffunicode.c
+ 0
+ 0
+
+
+ 7
+ 46
+ 1
+ 0
+ 0
+ 0
+ ..\..\..\..\..\third_party\fatfs-0.14\source\port\fatfs_usbh.c
+ fatfs_usbh.c
+ 0
+ 0
+
+
+
::CMSIS
0
diff --git a/demo/stm32/usb_host/stm32f429igt6/MDK-ARM/stm32f429igt6.uvprojx b/demo/stm32/usb_host/stm32f429igt6/MDK-ARM/stm32f429igt6.uvprojx
index ffd30c43..b3a47206 100644
--- a/demo/stm32/usb_host/stm32f429igt6/MDK-ARM/stm32f429igt6.uvprojx
+++ b/demo/stm32/usb_host/stm32f429igt6/MDK-ARM/stm32f429igt6.uvprojx
@@ -340,7 +340,7 @@
USE_HAL_DRIVER,STM32F429xx,CONFIG_USB_HS_IN_FULL,CONFIG_USBHOST_HUB
- ../Core/Inc;../Drivers/STM32F4xx_HAL_Driver/Inc;../Drivers/STM32F4xx_HAL_Driver/Inc/Legacy;../Drivers/CMSIS/Device/ST/STM32F4xx/Include;../Drivers/CMSIS/Include;..\..\..\..\..\common;..\..\..\..\..\core;..\..\..\..\..\class\cdc;..\..\..\..\..\class\hub;..\..\..\..\..\class\hid;..\..\..\..\..\class\msc;..\..\..\..\..\osal;..\..\..\..\..\third_party\FreeRTOS-10.4\include;..\..\..\..\..\third_party\FreeRTOS-10.4\portable\GCC\ARM_CM4F
+ ../Core/Inc;../Drivers/STM32F4xx_HAL_Driver/Inc;../Drivers/STM32F4xx_HAL_Driver/Inc/Legacy;../Drivers/CMSIS/Device/ST/STM32F4xx/Include;../Drivers/CMSIS/Include;..\..\..\..\..\common;..\..\..\..\..\core;..\..\..\..\..\class\cdc;..\..\..\..\..\class\hub;..\..\..\..\..\class\hid;..\..\..\..\..\class\msc;..\..\..\..\..\osal;..\..\..\..\..\third_party\FreeRTOS-10.4\include;..\..\..\..\..\third_party\FreeRTOS-10.4\portable\GCC\ARM_CM4F;..\..\..\..\..\third_party\fatfs-0.14\source
@@ -414,6 +414,11 @@
1
../Core/Src/stm32f4xx_hal_msp.c
+
+ usb_host.c
+ 1
+ ..\..\..\..\usb_host.c
+
@@ -567,7 +572,7 @@
- usb_stack
+ CherryUSB
usbh_core.c
@@ -611,6 +616,36 @@
+
+ fatfs
+
+
+ diskio.c
+ 1
+ ..\..\..\..\..\third_party\fatfs-0.14\source\diskio.c
+
+
+ ff.c
+ 1
+ ..\..\..\..\..\third_party\fatfs-0.14\source\ff.c
+
+
+ ffsystem.c
+ 1
+ ..\..\..\..\..\third_party\fatfs-0.14\source\ffsystem.c
+
+
+ ffunicode.c
+ 1
+ ..\..\..\..\..\third_party\fatfs-0.14\source\ffunicode.c
+
+
+ fatfs_usbh.c
+ 1
+ ..\..\..\..\..\third_party\fatfs-0.14\source\port\fatfs_usbh.c
+
+
+
::CMSIS
diff --git a/third_party/fatfs-0.14/source/diskio.c b/third_party/fatfs-0.14/source/diskio.c
index 179e387a..0d0b28fa 100644
--- a/third_party/fatfs-0.14/source/diskio.c
+++ b/third_party/fatfs-0.14/source/diskio.c
@@ -15,7 +15,11 @@
#define DEV_MMC 1 /* Example: Map MMC/SD card to physical drive 1 */
#define DEV_USB 2 /* Example: Map USB MSD to physical drive 2 */
-
+int USB_disk_status(void);
+int USB_disk_initialize(void);
+int USB_disk_read(BYTE *buff, LBA_t sector, UINT count);
+int USB_disk_write(const BYTE *buff, LBA_t sector, UINT count);
+int USB_disk_ioctl(BYTE cmd, void *buff);
/*-----------------------------------------------------------------------*/
/* Get Drive Status */
/*-----------------------------------------------------------------------*/
@@ -29,14 +33,14 @@ DSTATUS disk_status (
switch (pdrv) {
case DEV_RAM :
- result = RAM_disk_status();
+ //result = RAM_disk_status();
// translate the reslut code here
return stat;
case DEV_MMC :
- result = MMC_disk_status();
+ //result = MMC_disk_status();
// translate the reslut code here
@@ -67,14 +71,14 @@ DSTATUS disk_initialize (
switch (pdrv) {
case DEV_RAM :
- result = RAM_disk_initialize();
+ //result = RAM_disk_initialize();
// translate the reslut code here
return stat;
case DEV_MMC :
- result = MMC_disk_initialize();
+ //result = MMC_disk_initialize();
// translate the reslut code here
@@ -110,7 +114,7 @@ DRESULT disk_read (
case DEV_RAM :
// translate the arguments here
- result = RAM_disk_read(buff, sector, count);
+ //result = RAM_disk_read(buff, sector, count);
// translate the reslut code here
@@ -119,7 +123,7 @@ DRESULT disk_read (
case DEV_MMC :
// translate the arguments here
- result = MMC_disk_read(buff, sector, count);
+ //result = MMC_disk_read(buff, sector, count);
// translate the reslut code here
@@ -160,7 +164,7 @@ DRESULT disk_write (
case DEV_RAM :
// translate the arguments here
- result = RAM_disk_write(buff, sector, count);
+ //result = RAM_disk_write(buff, sector, count);
// translate the reslut code here
@@ -169,7 +173,7 @@ DRESULT disk_write (
case DEV_MMC :
// translate the arguments here
- result = MMC_disk_write(buff, sector, count);
+ //result = MMC_disk_write(buff, sector, count);
// translate the reslut code here
@@ -220,7 +224,7 @@ DRESULT disk_ioctl (
case DEV_USB :
// Process of the command the USB drive
-
+ USB_disk_ioctl(cmd,buff);
return res;
}
diff --git a/third_party/fatfs-0.14/source/ffconf.h b/third_party/fatfs-0.14/source/ffconf.h
index ca17485e..16c12748 100644
--- a/third_party/fatfs-0.14/source/ffconf.h
+++ b/third_party/fatfs-0.14/source/ffconf.h
@@ -237,7 +237,7 @@
/ Note that enabling exFAT discards ANSI C (C89) compatibility. */
-#define FF_FS_NORTC 0
+#define FF_FS_NORTC 1
#define FF_NORTC_MON 1
#define FF_NORTC_MDAY 1
#define FF_NORTC_YEAR 2020
diff --git a/third_party/fatfs-0.14/source/port/fatfs_usbh.c b/third_party/fatfs-0.14/source/port/fatfs_usbh.c
index b3104b6e..f8d521ae 100644
--- a/third_party/fatfs-0.14/source/port/fatfs_usbh.c
+++ b/third_party/fatfs-0.14/source/port/fatfs_usbh.c
@@ -1,3 +1,4 @@
+#include "ff.h"
#include "diskio.h"
#include "usbh_core.h"
#include "usbh_msc.h"