How to setup a fast dacc on arduino due

So, I'm trying to get the samplerate of my dacc as high as possible. I've read into the registers and got it working on the adc of my arduino due. Now I tried to do it similar on the dacc.

void dac_setup ()

  PMC->PMC_PCER1 = PMC_PCER1_PID38;     // DACC power ON
  DACC->DACC_CR = 0x1 ;       // Reset DACC
  DACC->DACC_MR =0x01200100; //DACC Mode Register

  DACC->DACC_IER |= 0b0010; //DACC Interrupt Enable Register

  NVIC_EnableIRQ(DACC_IRQn);               // Enable DACC interrupt
  DACC->DACC_WPMR|=0x0; //Disables write-protect for DAC
  DACC->DACC_CHDR=0x3; //Disable all channels
  DACC->DACC_CHER = 0x2;      // enable channel 1 = DAC1
void setup(){
void loop() {
  while((DACC->DACC_ISR&0b0)==0); //Wait for DACC to be ready
  DACC->DACC_CDR = 0x0;

This is the dacc-part of my code so far. Problem is, that I can't read any voltage between DAC1 (or DAC0) and ground.
Thank you in advance

Hello, it's me again. While the question was online, I managed to fix it myself. Hope, I can help someone with the same problem. This is my slightly altered code:

void dac_setup ()
  PMC->PMC_PCER1|= PMC_PCER1_PID38; //DACC power on
  DACC->DACC_CR = DACC_CR_SWRST;       // Reset DACC
  //DACC->DACC_WPMR=0x44414300; //Disables write-protect for DAC -> enable, disable, mode, analog current register,
  //DACC->DACC_CHDR=0x3; //Disable all channels
  //DACC->DACC_MR =0xA220810; //DACC Mode Register
   DACC->DACC_MR = DACC_MR_TRGEN_DIS                   // Free running mode
                  | DACC_MR_USER_SEL_CHANNEL1         // select channel 1
                  | DACC_MR_REFRESH (1)
                  | DACC_MR_STARTUP_8
                  | DACC_MR_MAXS;

  DACC->DACC_CHER = DACC_CHER_CH1;      // enable channel 1 = DAC1
void loop(){
  DACC->DACC_CDR = 2047;
  DACC->DACC_CDR = 1023;

Managed to get a samplerate of about 1 MHz.

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.