-
Notifications
You must be signed in to change notification settings - Fork 16
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
feature(esp_tinyusb): Added mode configuration for dcd_dwc2 layer #88
base: master
Are you sure you want to change the base?
Conversation
06dc14d
to
6984304
Compare
6984304
to
2da7516
Compare
@tore-espressif @peter-marcisovsky This is the configuration changes that should be done to enable DMA on S2/S3 and P4. So, basically, we are almost there. So the steps will be:
PTAL and share your thoughts. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thx for the update. LGTM.
@@ -1,7 +1,7 @@ | |||
## IDF Component Manager Manifest File | |||
description: Espressif's additions to TinyUSB | |||
documentation: "https://docs.espressif.com/projects/esp-idf/en/latest/esp32s2/api-reference/peripherals/usb_device.html" | |||
version: "1.4.5" | |||
version: "1.5.0" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think relase 1.5.0 should be tight to TinyUSB upgrade to v0.17.0~0.
The cache sync and DMA will not work with older versions anyways
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There are two ways:
- We can publish this changes and they will work with current version based on v0.15, but only in a Single IRQ mode.
- After tinyusb will be published, it will start to use DMA
@@ -1,3 +1,7 @@ | |||
## 1.5.0 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's keep us 'Unreleased' for now
# define CFG_TUD_MEM_DCACHE_ENABLE 1 | ||
#define CFG_TUD_MEM_DCACHE_LINE_SIZE CONFIG_CACHE_L1_CACHE_LINE_SIZE // TODO: return back after #2884 | ||
// NOTE: starting with esp-idf v5.3 there is specific attribute present: DRAM_DMA_ALIGNED_ATTR | ||
# define CFG_TUSB_MEM_SECTION __attribute__((aligned(CONFIG_CACHE_L1_CACHE_LINE_SIZE))) DRAM_ATTR |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
On P4 it does not have to be in DRAM, does it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I took it from DRAM_DMA_ALIGNED_ATTR
.
So, it does.
// ------------------------------------------------------------------------ | ||
#ifdef CONFIG_TINYUSB_MODE_DMA | ||
// DMA Mode has a priority over Single/IRQ mode and will be used if hardware supports it | ||
#define CFG_TUD_DWC2_DMA_ENABLE 1 // Enable DMA |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we have CFG_TUD_DWC2_SLAVE_ENABLE
and CFG_TUD_DWC2_DMA_ENABLE
enabled at the same time?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, we can.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If (by any reason) hardware isn't support DMA (arch != GHWCFG2_ARCH_INTERNAL_DMA) then the Single/IRQ mode will be used, as it will be selected dynamically.
Which is, IMHO, preferable way.
But (what I don't like) there will be no obvious messages about mode in the debug or any other output. Which could be tricky.
2da7516
to
516f80a
Compare
esp_tinyusb component, v1.5.0
Description
DMA support for TinyUSB device stack.
DMA (Buffer mode) is a default mode for device, meanwhile there is an option to change the mode to Single/IRQ by disabling DMA mode via menuconfig.
If (by any reason) hardware isn't support DMA (
arch != GHWCFG2_ARCH_INTERNAL_DMA
) then the Single/IRQ mode will be used.Related
Testing
This PR is already compatible with the branch: https://github.com/espressif/tinyusb/tree/release/v0.17
Measurements
Measurements were made on
tusb_msc
example (read-write operations benchmark, SDMMC target).ESP32S3
ESP32P4
*Benchmark results provided
Checklist
Before submitting a Pull Request, please ensure the following: