Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

DMA driven DAC #11090

Unanswered
tomcombriat asked this question in Q&A
Discussion options

Board

ESP Dev Module WROOM-32D

Device Description

Plain development board

Hardware Configuration

GPIO25 connected to scope.

Version

v3.1.0

IDE Name

Arduino IDE

Operating System

Debian

Flash frequency

80MHz

PSRAM enabled

yes

Upload speed

921600

Description

I'm trying to port Mozzi to the latest version of the ESP32 library. I2S and timer establishment works well following https://docs.espressif.com/projects/esp-idf/en/v5.4/esp32/index.html but DMA driven DAC as per https://docs.espressif.com/projects/esp-idf/en/v5.4/esp32/api-reference/peripherals/dac.html does not.

Sketch

#include <driver/dac_continuous.h>
dac_continuous_handle_t dac_handle;
void setup() {
 dac_continuous_config_t dac_config = {
 .chan_mask = DAC_CHANNEL_MASK_ALL,
 .desc_num = 2,
 .buf_size = 4,
 .freq_hz = 30000,
 .offset = 120,
 .clk_src = DAC_DIGI_CLK_SRC_DEFAULT,
 .chan_mode = DAC_CHANNEL_MODE_SIMUL,
 };
 dac_continuous_new_channels(&dac_config, &dac_handle);
 dac_continuous_enable(dac_handle);
}
void loop() {
 size_t bytes_written;
 uint8_t tt = 120;
 dac_continuous_write(dac_handle, &tt, sizeof(uint8_t), &bytes_written, 0);
}

Debug Message

22:11:09.084 -> E (4590) dac_continuous: dac_continuous_write(618): Load data failed
22:11:09.084 -> E (4596) dac_continuous: s_dac_wait_to_load_dma_data(551): Get available descriptor timeout

Other Steps to Reproduce

No response

I have checked existing issues, online documentation and the Troubleshooting Guide

  • I confirm I have checked existing issues, online documentation and Troubleshooting guide.
You must be logged in to vote

Replies: 7 comments

Comment options

@P-R-O-C-H-Y, could you please take a look? Thanks!

You must be logged in to vote
0 replies
Comment options

Just a heads up that you are using documentation for IDF v5.4 while Arduino v3.1.0 uses IDF v5.3. Idk if there are significant changes but it might help.

You must be logged in to vote
0 replies
Comment options

@lucasssvaz Thanks for this! If I am correct, there is no significant differences for the DAC API.

Also, allow myself to add that I also tried to get this DAC to work using I2S (the old API allowed access of the native DAC using I2S), but also did not manage, which is why I turned to the dac_conti API.

You must be logged in to vote
0 replies
Comment options

Have you tried with more than one byte? Documentation states It is usually used to transport a long signal like an audio.

You must be logged in to vote
0 replies
Comment options

The IDF example uses a much larger buffer (2048). Try capturing the results from new_channels and enable. They probably will indicate an invalid parameter.

You must be logged in to vote
0 replies
Comment options

@lbernstone Increasing the buffer does not solve it. Also both new_channels and enable return ESP_OK.

@me-no-dev I tried sending a 1024 buffer but got exactly the same errors and symptoms.

Thanks for your help!

You must be logged in to vote
0 replies
Comment options

I can confirm that on IDF 5.4, I observed the same problem with the continuous DAC driver. Very often, the dac_continuous_write gets stuck forever. Changing the size of the buffer has no impact whatsoever. All calls to IDF functions are guarded with error checks, and none of them fails.

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
Area: ESP-IDF related ESP-IDF related issues Type: Question Only question Area: Peripherals API Relates to peripheral's APIs.
Converted from issue

This discussion was converted from issue #10851 on March 12, 2025 18:09.

AltStyle によって変換されたページ (->オリジナル) /