Giga can't start DAC on A13

Hi, I'm trying to use both DACs on the arduino Giga but whenever I try to start dac1 the program seems to get stuck. I am then also unable to upload any new sketches to the arduino unless I use the bootloader(double tapping the reset button). I've tried using only one dac, but the issue happens whenever I try to use the DAC on A13. Could there be some conflict with the giga display, lvgl or I2C?

#include "Arduino_H7_Video.h"
#include "Arduino_GigaDisplayTouch.h"
#include <Arduino_GigaDisplay.h>
#include "lvgl.h"
#include "ui.h"
#include <Wire.h>
#include <TEA5767Radio.h>
#include <Arduino_AdvancedAnalog.h>

AdvancedADC adc(A0);
AdvancedDAC dac0(A12);
AdvancedDAC dac1(A13);
uint64_t last_millis = 0;

TEA5767Radio radio = TEA5767Radio();
/* Insert resolution WxH according to your SquareLine studio project settings */
Arduino_H7_Video          Display(480, 800, GigaDisplayShield); 
Arduino_GigaDisplayTouch  Touch;
GigaDisplayBacklight backlight;
float volume = 0.30;

void event_FreqSlider(lv_event_t * e)
{
    float value;
    lv_obj_t * FreqSlider = lv_event_get_target_obj(e);

    /*Refresh the text*/
    value = float(lv_slider_get_value(ui_FreqSlider));
    value  = value/10;
    Serial.print(value);
    char str[32];
    sprintf(str, "%.1f", value);
    radio.setFrequency(value);
    lv_label_set_text(ui_Freq, str);
    //lv_obj_align_to(ui_Freq, ui_FreqSlider, LV_ALIGN_OUT_TOP_MID, 0, -15);    /*Align top of the slider*/
}

void setup() {
  delay(3000);
  Display.begin();
  backlight.begin();
  Touch.begin();
  Wire.begin();
  radio.setFrequency(102.1);
  backlight.set(70);
  ui_init();
  lv_obj_add_event_cb(ui_FreqSlider, event_FreqSlider, LV_EVENT_VALUE_CHANGED, NULL);

      // Resolution, sample rate, number of samples per channel, queue depth.
  if (!adc.begin(AN_RESOLUTION_12, 16000, 32, 128)) {
      Serial.println("Failed to start analog acquisition!");
      while (1);
  }
  while (!Serial) {
  }
  if (!dac0.begin(AN_RESOLUTION_12, 16000, 32, 128)) {
    Serial.println("Failed to start DAC0 !");
    while (1);
  }
  if (!dac1.begin(AN_RESOLUTION_12, 16000, 32, 128)) {
    Serial.println("Failed to start DAC1 !");
    while (1);
  }
}

The loop portion of the code isn't included, as dac1 isn't used there yet

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