esp32-s2-usb-host-cdc icon indicating copy to clipboard operation
esp32-s2-usb-host-cdc copied to clipboard

build error with esp-idf master branch

Open lightsalt2011 opened this issue 2 years ago • 11 comments

../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

lightsalt2011 avatar Jul 20 '21 05:07 lightsalt2011

Thats possible. I didnt update files in components folder for some time, and esp-idf has been updated and API changed a bit about 3 weeks ago.

chegewara avatar Jul 20 '21 13:07 chegewara

I updated usb component, now should be ok.

chegewara avatar Jul 20 '21 13:07 chegewara

https://www.esp32.com/viewtopic.php?f=35&t=21933&p=80536#p80536

still build error, help to check

lightsalt2011 avatar Jul 21 '21 13:07 lightsalt2011

Please check now. I pushed code that i modified few weeks ago and is building, but im not sure how functional is it. espressif changed recently code from urp to urb, which requires a lot modifications, so i will no longer update code in this repo.

chegewara avatar Jul 21 '21 13:07 chegewara

thanks for ur reply, I am poor about usb refs, so can you show the commit id of The esp-idf repo thas you have build pass and test pass at one time, in this way , I can use esp32-s2-usb-host-cdc repo to my projects, thanks

lightsalt2011 avatar Jul 22 '21 02:07 lightsalt2011

I tested with current master branch and it is building without issue.

chegewara avatar Jul 22 '21 05:07 chegewara

can you show your idf version with "idf.py --version" thanks

lightsalt2011 avatar Jul 22 '21 10:07 lightsalt2011

ESP-IDF v4.4-dev-2184-g166c30e7b2-dirty

commit 166c30e7b2ed1dcaae56179329540a862915208a (HEAD -> master, origin/master, origin/HEAD)
Merge: 2058e89448 7cd4c4d542
Author: Ivan Grokhotkov <[email protected]>
Date:   Sun Jul 18 09:42:36 2021 +0000

chegewara avatar Jul 22 '21 10:07 chegewara

thanks for ur reply, build pass when I checkout to this commit 166c30e7b2ed1dcaae56179329540a862915208a. when I connect the Cat.1 device , log as below printed ` ELF file SHA256: dcc3410f45f40ecf

Rebooting... ESP-ROM:esp32s2-rc4-20191025 Build:Oct 25 2019 rst:0xc (RTC_SW_CPU_RST),boot:0x8 (SPI_FAST_FLASH_BOOT) Saved PC:0x40023168 0x40023168: esp_restart_noos at /Users/lvfeng/trunk/esp-refs/esp-idf-repo/esp-idf/components/esp_system/port/soc/esp32s2/system_internal.c:112 (discriminator 1)

SPIWP:0xee mode:DIO, clock div:1 load:0x3ffe6100,len:0x1664 load:0x4004c000,len:0xa60 load:0x40050000,len:0x2afc entry 0x4004c210 I (24) boot: ESP-IDF v4.4-dev-2184-g166c30e7b 2nd stage bootloader I (24) boot: compile time 09:52:08 I (24) boot: chip revision: 0 I (28) boot.esp32s2: SPI Speed : 80MHz I (32) boot.esp32s2: SPI Mode : DIO I (37) boot.esp32s2: SPI Flash Size : 2MB I (42) boot: Enabling RNG early entropy source... I (47) boot: Partition Table: I (51) boot: ## Label Usage Type ST Offset Length I (58) boot: 0 nvs WiFi data 01 02 00009000 00006000 I (66) boot: 1 phy_init RF data 01 01 0000f000 00001000 I (73) boot: 2 factory factory app 00 00 00010000 00100000 I (81) boot: End of partition table I (85) esp_image: segment 0: paddr=00010020 vaddr=3f000020 size=085d8h ( 34264) map I (100) esp_image: segment 1: paddr=00018600 vaddr=3ffbce50 size=01cc8h ( 7368) load I (103) esp_image: segment 2: paddr=0001a2d0 vaddr=40022000 size=05d48h ( 23880) load I (116) esp_image: segment 3: paddr=00020020 vaddr=40080020 size=19b4ch (105292) map I (140) esp_image: segment 4: paddr=00039b74 vaddr=40027d48 size=05108h ( 20744) load I (145) esp_image: segment 5: paddr=0003ec84 vaddr=50000000 size=00010h ( 16) load I (151) boot: Loaded app from partition at offset 0x10000 I (151) boot: Disabling RNG early entropy source... I (168) cache: Instruction cache : size 8KB, 4Ways, cache line size 32Byte I (168) cpu_start: Pro cpu up. I (180) cpu_start: Pro cpu start user code I (180) cpu_start: cpu freq: 160000000 I (180) cpu_start: Application information: I (185) cpu_start: Project name: hello-world-usb-host I (191) cpu_start: App version: 8265897 I (196) cpu_start: Compile time: Jul 23 2021 09:51:53 I (202) cpu_start: ELF file SHA256: dcc3410f45f40ecf... I (208) cpu_start: ESP-IDF: v4.4-dev-2184-g166c30e7b I (214) heap_init: Initializing. RAM available for dynamic allocation: I (221) heap_init: At 3FF9E000 len 00002000 (8 KiB): RTCRAM I (228) heap_init: At 3FFBF3C0 len 0003CC40 (243 KiB): DRAM I (234) heap_init: At 3FFFC000 len 00003A10 (14 KiB): DRAM I (240) spi_flash: detected chip: generic I (245) spi_flash: flash io: dio W (249) spi_flash: Detected size(4096k) larger than the size in the binary image header(2048k). Using the size in the binary image header. I (262) cpu_start: Starting scheduler on PRO CPU. start pipe event task start pipe event task Hello world USB host! I (327) : USB host setup properly I (327) : Port is power ON now I (337) : port event: 1 I (587) : HCD_PORT_EVENT_CONNECTION I (587) : HCD_PORT_STATE_DISABLED I (647) : USB device reset I (647) : HCD_PORT_STATE_ENABLED I (647) : Creating default pipe

I (647) : Creating new IRP, free memory: 240088 I (647) DEVICE descriptor: 12 01 00 02 00 00 00 40 cc 2e 10 30 00 01 01 02 W (647) : port handle: 0x0, 0x3ff9ffac I (657) DEVICE descriptor: 03 01

Device descriptor: Length: 18 Descriptor type: 1 USB version: 2.00 Device class: 0x00 (>ifc) Device subclass: 0x00 Device protocol: 0x00 EP0 max packet size: 64 VID: 0x2ecc PID: 0x3010 Revision number: 1.00 Manufacturer id: 1 Product id: 2 Serial id: 3 Configurations num: 1 I (687) : Creating new IRP, free memory: 240012 I (697) : Creating new IRP, free memory: 239700 I (697) : Creating new IRP, free memory: 239388 I (707) : Creating new IRP, free memory: 239068 I (707) : Dequeue and delete IRP, free memory: 239080 I (717) STRING CB: [4] strings: I (717) : Dequeue and delete IRP, free memory: 239392 I (727) STRING CB: [4] strings: I (727) : Dequeue and delete IRP, free memory: 239704 I (737) STRING CB: [4] strings: I (737) : Dequeue and delete IRP, free memory: 240024 I (747) ADDRESS: 1 I (747) : Creating new IRP, free memory: 240024 I (757) : Dequeue and delete IRP, free memory: 240028 W (4797) ERROR: 00 09 01 00 00 00 00 00 W (4797) : XFER error: 1 I (4797) : Dequeue and delete IRP, free memory: 240088`

can this log show enum device pass?

by the way, how can I use ur esp32-s2-usb-host-cdc project to send data from host to device ?

lightsalt2011 avatar Jul 23 '21 03:07 lightsalt2011

0x00,        // bmRequestType: Dir: H2D, Type: Standard, Recipient: Device
0x09,        // bRequest (Set Config)
0x01, 0x00,  // wValue Config Num: 1
0x00, 0x00,  // wIndex = 0x00
0x00, 0x00,  // wLength = 0

https://github.com/chegewara/esp32-s2-usb-host-cdc/blob/master/main/main.c#L108 Try to change value to 0 maybe.

Here is example to send data to device: https://github.com/chegewara/esp32-s2-usb-host-cdc/blob/master/main/main.c#L67

but ytou have to solve that XFER error when set configuration first.

chegewara avatar Jul 23 '21 03:07 chegewara

thanks for ur reply, I will try it

lightsalt2011 avatar Jul 23 '21 03:07 lightsalt2011