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

SPI DMA & Async memcpy (IDFGH-9182) #10575

Closed
3 tasks done
enhany opened this issue Jan 19, 2023 · 1 comment
Closed
3 tasks done

SPI DMA & Async memcpy (IDFGH-9182) #10575

enhany opened this issue Jan 19, 2023 · 1 comment
Assignees
Labels
Resolution: Done Issue is done internally Status: Done Issue is done internally

Comments

@enhany
Copy link

enhany commented Jan 19, 2023

Answers checklist.

  • I have read the documentation ESP-IDF Programming Guide and the issue is not addressed there.
  • I have updated my IDF branch (master or release) to the latest version and checked that the issue is present there.
  • I have searched the issue tracker for a similar issue and not found a similar issue.

General issue report

Slave SPI DMA and async memcpy doesn't work together.

Device: ESP32-C3 (any devboard or chip)

How to reproduce:

  1. compile "spi_slave/receiver" example
  2. check it works fine
  3. add "esp_async_memcpy_install" code anywhere (before or after spi initialize) (see below)
  4. compile and see SPI doesn't work (send garbage to master)

Initialize async memcpy code:

async_memcpy_config_t config = ASYNC_MEMCPY_DEFAULT_CONFIG();
async_memcpy_t driver = NULL;
ESP_ERROR_CHECK(esp_async_memcpy_install(&config, &driver));
@espressif-bot espressif-bot added the Status: Opened Issue is new label Jan 19, 2023
@github-actions github-actions bot changed the title SPI DMA & Async memcpy SPI DMA & Async memcpy (IDFGH-9182) Jan 19, 2023
@espressif-bot espressif-bot added Status: In Progress Work is in progress and removed Status: Opened Issue is new labels Jan 20, 2023
@suda-morris
Copy link
Collaborator

suda-morris commented Jan 20, 2023

@enhany Thanks for reporting the issue. This seems like a hardware limitation that we can't workaround very well at the moment. The issue is that, the memory copy engine will occupy one of the DMA trigger ID that used by other peripherals. And by default, we set the trigger ID to zero for memory copy, however, this ID is also used by SPI2.

For now, you can just change them to 2, your SPI2 should work again.

In the future, we should make the user ID selectable from the menuconfig. But we can't change the situation that the memcpy takes another perpheral's DMA.

Edit: the hardware limitation is removed since ESP32C6.

@espressif-bot espressif-bot added Status: Reviewing Issue is being reviewed and removed Status: In Progress Work is in progress labels Jan 20, 2023
@espressif-bot espressif-bot added Resolution: NA Issue resolution is unavailable Status: Done Issue is done internally Resolution: Done Issue is done internally and removed Status: Reviewing Issue is being reviewed Resolution: NA Issue resolution is unavailable labels Jan 31, 2023
espressif-bot pushed a commit that referenced this issue Feb 5, 2023
1. add check in the gdma driver, to prevent multiple channels connecting
   to the same peripheral
2. memory copy DMA ID will occupy the peripheral's DMA ID on some ESP
   targets (e.g. esp32c3/s3). We should search for a free one when
install async memcpy driver.

Closes #10575
espressif-bot pushed a commit that referenced this issue Mar 4, 2023
1. add check in the gdma driver, to prevent multiple channels connecting
   to the same peripheral
2. memory copy DMA ID will occupy the peripheral's DMA ID on some ESP
   targets (e.g. esp32c3/s3). We should search for a free one when
install async memcpy driver.

Closes #10575
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Resolution: Done Issue is done internally Status: Done Issue is done internally
Projects
None yet
Development

No branches or pull requests

3 participants