ESP32-S2 USB Host CDC问题

Moderator: ESP_Bob

orangerj24
Posts: 8
Joined: Thu Jul 08, 2021 1:28 am

ESP32-S2 USB Host CDC问题

Postby orangerj24 » Thu Jul 08, 2021 1:31 am

请问有ESP32-S2作为USB host来驱动CDC类型设备或者RNDIS设备的例程吗?急需,万分感谢!

ESP_Bob
Posts: 80
Joined: Fri Nov 27, 2020 12:52 pm

Re: ESP32-S2 USB Host CDC问题

Postby ESP_Bob » Fri Jul 09, 2021 12:54 pm

USB Host CDC 驱动 4G Cat.1 示例代码下周会同步到:https://github.com/espressif/esp-iot-so ... onents/usb

chegewara
Posts: 2378
Joined: Wed Jun 14, 2017 9:00 pm

Re: ESP32-S2 USB Host CDC问题

Postby chegewara » Sat Jul 10, 2021 3:09 pm


orangerj24
Posts: 8
Joined: Thu Jul 08, 2021 1:28 am

Re: ESP32-S2 USB Host CDC问题

Postby orangerj24 » Tue Jul 13, 2021 12:20 am

qljz1993 wrote:
Fri Jul 09, 2021 12:54 pm
USB Host CDC 驱动 4G Cat.1 示例代码下周会同步到:https://github.com/espressif/esp-iot-so ... onents/usb
收到,非常非常感谢。
另外请问在介绍ESP32-S2的视频里面,通过USB驱动的4G网卡,这个USB 4G网卡是通用的RNDIS协议吗?

orangerj24
Posts: 8
Joined: Thu Jul 08, 2021 1:28 am

Re: ESP32-S2 USB Host CDC问题

Postby orangerj24 » Tue Jul 13, 2021 12:20 am

收到,非常非常感谢!

lightsaltsign
Posts: 9
Joined: Wed Jul 14, 2021 3:21 am

Re: ESP32-S2 USB Host CDC问题

Postby lightsaltsign » Fri Jul 16, 2021 12:40 pm

build error when I put project esp32-s2-usb-host-cdc into "\Users\admin\Desktop\esp-idf-2\examples\peripherals\usb\", esp-idf 4.3 with Windows 10

Code: Select all

pare -ggdb -Og -fstrict-volatile-bitfields -Wno-error=unused-but-set-variable -std=gnu99 -Wno-old-style-declaration -D_GNU_SOURCE -DIDF_VER=\"v4.3\" -DESP_PLATFORM -MD -MT esp-idf/main/CMakeFiles/__idf_main.dir/main.c.obj -MF esp-idf\main\CMakeFiles\__idf_main.dir\main.c.obj.d -o esp-idf/main/CMakeFiles/__idf_main.dir/main.c.obj   -c ../main/main.c
../main/main.c:19:10: fatal error: hal/usbh_ll.h: No such file or directory
 #include "hal/usbh_ll.h"
          ^~~~~~~~~~~~~~~
compilation terminated.
ninja: build stopped: subcommand failed.
ninja failed with exit code 1
can you help me , thanks

lightsaltsign
Posts: 9
Joined: Wed Jul 14, 2021 3:21 am

Re: ESP32-S2 USB Host CDC问题

Postby lightsaltsign » Fri Jul 16, 2021 12:43 pm

qljz1993 wrote:
Fri Jul 09, 2021 12:54 pm
USB Host CDC 驱动 4G Cat.1 示例代码下周会同步到:https://github.com/espressif/esp-iot-so ... onents/usb
请问什么时候可以同步代码,谢谢

chegewara
Posts: 2378
Joined: Wed Jun 14, 2017 9:00 pm

Re: ESP32-S2 USB Host CDC问题

Postby chegewara » Fri Jul 16, 2021 4:51 pm

lightsaltsign wrote:
Fri Jul 16, 2021 12:40 pm
build error when I put project esp32-s2-usb-host-cdc into "\Users\admin\Desktop\esp-idf-2\examples\peripherals\usb\", esp-idf 4.3 with Windows 10

Code: Select all

pare -ggdb -Og -fstrict-volatile-bitfields -Wno-error=unused-but-set-variable -std=gnu99 -Wno-old-style-declaration -D_GNU_SOURCE -DIDF_VER=\"v4.3\" -DESP_PLATFORM -MD -MT esp-idf/main/CMakeFiles/__idf_main.dir/main.c.obj -MF esp-idf\main\CMakeFiles\__idf_main.dir\main.c.obj.d -o esp-idf/main/CMakeFiles/__idf_main.dir/main.c.obj   -c ../main/main.c
../main/main.c:19:10: fatal error: hal/usbh_ll.h: No such file or directory
 #include "hal/usbh_ll.h"
          ^~~~~~~~~~~~~~~
compilation terminated.
ninja: build stopped: subcommand failed.
ninja failed with exit code 1
can you help me , thanks
Update esp-idf with submodules to latest master.

lightsaltsign
Posts: 9
Joined: Wed Jul 14, 2021 3:21 am

Re: ESP32-S2 USB Host CDC问题

Postby lightsaltsign » Mon Jul 19, 2021 6:36 am

chegewara wrote:
Fri Jul 16, 2021 4:51 pm
lightsaltsign wrote:
Fri Jul 16, 2021 12:40 pm
build error when I put project esp32-s2-usb-host-cdc into "\Users\admin\Desktop\esp-idf-2\examples\peripherals\usb\", esp-idf 4.3 with Windows 10

Code: Select all

pare -ggdb -Og -fstrict-volatile-bitfields -Wno-error=unused-but-set-variable -std=gnu99 -Wno-old-style-declaration -D_GNU_SOURCE -DIDF_VER=\"v4.3\" -DESP_PLATFORM -MD -MT esp-idf/main/CMakeFiles/__idf_main.dir/main.c.obj -MF esp-idf\main\CMakeFiles\__idf_main.dir\main.c.obj.d -o esp-idf/main/CMakeFiles/__idf_main.dir/main.c.obj   -c ../main/main.c
../main/main.c:19:10: fatal error: hal/usbh_ll.h: No such file or directory
 #include "hal/usbh_ll.h"
          ^~~~~~~~~~~~~~~
compilation terminated.
ninja: build stopped: subcommand failed.
ninja failed with exit code 1
can you help me , thanks
Update esp-idf with submodules to latest master.


Hi chegewara,

I have update esp-idf with submodules to latest master,
steps as below:
1. git checkmaster, git submodule update --init --recursive
2. put project esp32-s2-usb-host-cdc into "\Users\admin\Desktop\esp-idf-2\examples\peripherals\usb\
3. idf.py set-target esp32s2
4. idf.py build

Code: Select all

admin@DESKTOP-4HNA0MD MINGW64 ~/Desktop/esp-idf-2 (master)
$ git branch -v
* master f45b60b28 Merge branch 'bugfix/esp_prov_default_pop' into 'master'
a new build error comes up,

Code: Select all

../components/usb/hcd.c: In function '_intr_hdlr_chan':
../components/usb/hcd.c:637:14: error: 'USBH_HAL_CHAN_EVENT_SLOT_DONE' undeclared (first use in this function); did you mean 'USBH_HAL_CHAN_EVENT_NONE'?
         case USBH_HAL_CHAN_EVENT_SLOT_DONE: {
              ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
              USBH_HAL_CHAN_EVENT_NONE
../components/usb/hcd.c:637:14: note: each undeclared identifier is reported only once for each function it appears in
../components/usb/hcd.c:662:17: error: too few arguments to function 'usbh_hal_chan_activate'
                 usbh_hal_chan_activate(chan_obj, 0);  //Start with the first descriptor
                 ^~~~~~~~~~~~~~~~~~~~~~
In file included from ../components/usb/hcd.c:25:
C:/Users/admin/Desktop/esp-idf-2/components/hal/include/hal/usbh_hal.h:660:6: note: declared here
 void usbh_hal_chan_activate(usbh_hal_chan_t *chan_obj, void *xfer_desc_list, int desc_list_len, int start_idx);

lightsaltsign
Posts: 9
Joined: Wed Jul 14, 2021 3:21 am

Re: ESP32-S2 USB Host CDC问题

Postby lightsaltsign » Mon Jul 19, 2021 7:09 am

lightsaltsign wrote:
Mon Jul 19, 2021 6:36 am
chegewara wrote:
Fri Jul 16, 2021 4:51 pm
lightsaltsign wrote:
Fri Jul 16, 2021 12:40 pm
build error when I put project esp32-s2-usb-host-cdc into "\Users\admin\Desktop\esp-idf-2\examples\peripherals\usb\", esp-idf 4.3 with Windows 10

Code: Select all

pare -ggdb -Og -fstrict-volatile-bitfields -Wno-error=unused-but-set-variable -std=gnu99 -Wno-old-style-declaration -D_GNU_SOURCE -DIDF_VER=\"v4.3\" -DESP_PLATFORM -MD -MT esp-idf/main/CMakeFiles/__idf_main.dir/main.c.obj -MF esp-idf\main\CMakeFiles\__idf_main.dir\main.c.obj.d -o esp-idf/main/CMakeFiles/__idf_main.dir/main.c.obj   -c ../main/main.c
../main/main.c:19:10: fatal error: hal/usbh_ll.h: No such file or directory
 #include "hal/usbh_ll.h"
          ^~~~~~~~~~~~~~~
compilation terminated.
ninja: build stopped: subcommand failed.
ninja failed with exit code 1
can you help me , thanks
Update esp-idf with submodules to latest master.


Hi chegewara,

I have update esp-idf with submodules to latest master,
steps as below:
1. git checkmaster, git submodule update --init --recursive
2. put project esp32-s2-usb-host-cdc into "\Users\admin\Desktop\esp-idf-2\examples\peripherals\usb\
3. idf.py set-target esp32s2
4. idf.py build

Code: Select all

admin@DESKTOP-4HNA0MD MINGW64 ~/Desktop/esp-idf-2 (master)
$ git branch -v
* master f45b60b28 Merge branch 'bugfix/esp_prov_default_pop' into 'master'
a new build error comes up,

Code: Select all

../components/usb/hcd.c: In function '_intr_hdlr_chan':
../components/usb/hcd.c:637:14: error: 'USBH_HAL_CHAN_EVENT_SLOT_DONE' undeclared (first use in this function); did you mean 'USBH_HAL_CHAN_EVENT_NONE'?
         case USBH_HAL_CHAN_EVENT_SLOT_DONE: {
              ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
              USBH_HAL_CHAN_EVENT_NONE
../components/usb/hcd.c:637:14: note: each undeclared identifier is reported only once for each function it appears in
../components/usb/hcd.c:662:17: error: too few arguments to function 'usbh_hal_chan_activate'
                 usbh_hal_chan_activate(chan_obj, 0);  //Start with the first descriptor
                 ^~~~~~~~~~~~~~~~~~~~~~
In file included from ../components/usb/hcd.c:25:
C:/Users/admin/Desktop/esp-idf-2/components/hal/include/hal/usbh_hal.h:660:6: note: declared here
 void usbh_hal_chan_activate(usbh_hal_chan_t *chan_obj, void *xfer_desc_list, int desc_list_len, int start_idx);

test with dev-4.4 tag again

Code: Select all

obj.d -o esp-idf/main/CMakeFiles/__idf_main.dir/cdc_class.c.obj   -c ../main/cdc_class.c
In file included from ../components/usb/private_include/hcd.h:25,
                 from ../main/common.h:15,
                 from ../main/cdc_class.c:3:
../components/usb/private_include/usb.h:45:5: error: redeclaration of enumerator 'USB_SPEED_LOW'
     USB_SPEED_LOW = 0,                  /**< USB Low Speed (1.5 Mbit/s) */
     ^~~~~~~~~~~~~
In file included from ../../../../../components/hal/esp32s2/include/hal/usbh_ll.h:25,
                 from ../main/common.h:14,
                 from ../main/cdc_class.c:3:
../../../../../components/hal/include/hal/usb_types.h:55:5: note: previous definition of 'USB_SPEED_LOW' was here
     USB_SPEED_LOW = 0,          /**< USB Low Speed (1.5 Mbit/s) */
     ^~~~~~~~~~~~~
In file included from ../components/usb/private_include/hcd.h:25,
                 from ../main/common.h:15,
                 from ../main/cdc_class.c:3:
../components/usb/private_include/usb.h:46:5: error: redeclaration of enumerator 'USB_SPEED_FULL'
     USB_SPEED_FULL,                     /**< USB Full Speed (12 Mbit/s) */

Who is online

Users browsing this forum: No registered users and 15 guests