Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update tinyusb port to work with current master tinyusb (IDFGH-3381) #5355

Closed
wants to merge 11 commits into from
Closed

Conversation

chegewara
Copy link
Contributor

@chegewara chegewara commented May 27, 2020

Update tinyusb port to work with current master tinyusb, add MSC example, add CDC example, add webUSB example.

  • tested with descriptor example
  • tested with msc example
  • tested with CDC example
  • tested with webUSB example (windows 10 does not recognize driver, known windows issue)

@CLAassistant
Copy link

CLAassistant commented May 27, 2020

CLA assistant check
All committers have signed the CLA.

@github-actions github-actions bot changed the title Update tinyusb port to work with current master tinyusb Update tinyusb port to work with current master tinyusb (IDFGH-3381) May 27, 2020
Copy link

@hathach hathach left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

config value/number must be starting from 1 ( note config index in the callback is value - 1 )

components/tinyusb/port/common/src/descriptors_control.c Outdated Show resolved Hide resolved
@Alvin1Zhang
Copy link
Collaborator

@chegewara Thanks for your contribution.

@chegewara
Copy link
Contributor Author

chegewara commented May 27, 2020

@hathach I am doing something wrong, because even with MSC example that seems to work, windows can enumerate devices and install driver, it takes ages (5-10 minutes) to install disk volume and i cant access it, because it soooo slow. Any advice or help?

PS linux cant see disk and BIOS on PC restart just stuck

@chegewara
Copy link
Contributor Author

Here is some log:

I (587) TUSB:descriptors_control: Setting of a descriptor: 
.bDeviceClass       = 239
.bDeviceSubClass    = 2,
.bDeviceProtocol    = 1,
.bMaxPacketSize0    = 64,
.idVendor           = 0x0000303a,
.idProduct          = 0x00003000,
.bcdDevice          = 0x00000100,
.iManufacturer      = 0x01,
.iProduct           = 0x02,
.iSerialNumber      = 0x03,
.bNumConfigurations = 0x01

I (622) example: USB initialization DONE
I (626) example: USB task started
I (2285) tud_msc_inquiry_cb: 
I (2288) tud_msc_test_unit_ready_cb: 
I (2290) tud_msc_capacity_cb: 
I (2338) tud_msc_test_unit_ready_cb: 
I (2340) tud_msc_scsi_cb: 
I (2342) tud_msc_test_unit_ready_cb: 
I (2344) tud_msc_capacity_cb: 
I (2353) tud_msc_read10_cb: 
I (33830) tud_msc_read10_cb: 

@hathach
Copy link

hathach commented May 27, 2020

@hathach I am doing something wrong, because even with MSC example that seems to work, windows can enumerate devices and install driver, it takes ages (5-10 minutes) to install disk volume and i cant access it, because it soooo slow. Any advice or help?

PS linux cant see disk and BIOS on PC restart just stuck

I am afraid, I don't know enough of IDF to help you. I could take a look, if you could reproduce it with my example https://github.com/hathach/tinyusb/tree/master/examples/device/cdc_msc_freertos

@chegewara
Copy link
Contributor Author

Funny thing is i couldnt compile with your example, thats why i am preparing this PR.
Maybe now with my updates it will build. Thanks.

@chegewara
Copy link
Contributor Author

@igrr is this a typo?
https://github.com/espressif/esp-idf/blob/master/components/tinyusb/port/esp32s2/src/tinyusb.c#L41-L42

Shouldnt be:

gpio_set_drive_capability(USBPHY_DM_NUM, GPIO_DRIVE_CAP_3);
gpio_set_drive_capability(USBPHY_DP_NUM, GPIO_DRIVE_CAP_3);

@igrr
Copy link
Member

igrr commented May 27, 2020

@chegewara Yes, looks like it is, one of them should be DM!

@chegewara
Copy link
Contributor Author

This PR fixes included source file to use new one prepared by @hathach
c507ed2

This fixes problems with msc example, and S2 can be mounted like a pendrive.

@chegewara
Copy link
Contributor Author

Fixed all problems with MSC model. All included examples should work now.

@an-dr
Copy link
Contributor

an-dr commented Jun 22, 2020

@chegewara thanks for the PR. I'm finishing our internal work that is doing in parallel with your PR and after this will take a look at your PR and and what we could use from it on top of our work. Thank you for the patience :)

@chegewara chegewara closed this Jun 8, 2021
@espressif-bot espressif-bot added Resolution: Won't Do This will not be worked on Status: Done Issue is done internally Status: In Progress Work is in progress and removed Resolution: Won't Do This will not be worked on labels Jul 12, 2021
@espressif-bot espressif-bot removed the Status: Done Issue is done internally label Jul 12, 2021
@espressif-bot espressif-bot added Resolution: Won't Do This will not be worked on Status: Done Issue is done internally and removed Status: In Progress Work is in progress labels Jul 29, 2021
@jcard0na
Copy link

@chegewara Do you know why this PR was not accepted? I believe this is the only working example of an MSC device in esp-idf, which could be very useful to others (...or at least to me ;)

cc: @Alvin1Zhang @igrr

@chegewara
Copy link
Contributor Author

Im guessing its because my programming style is not good enough for espressif.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Resolution: Won't Do This will not be worked on Status: Done Issue is done internally
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

8 participants