This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

TMS320F28379D: TMS320F28379D

Part Number: TMS320F28379D

Tool/software:

HI team, i am facing issue with DAC peripheral ..I am planning to generate a sine wave for that i took example code from TI library..

I am also providing the code which i have with me now..

void main(void)
{

// Initialize device clock and peripherals
Device_init();
Device_initGPIO();

// Initialize Debug LED
GPIO_setPadConfig(DEVICE_GPIO_PIN_LED2, GPIO_PIN_TYPE_STD);
GPIO_setDirectionMode(DEVICE_GPIO_PIN_LED2, GPIO_DIR_MODE_OUT);

// Configure GPIO pins to act as DAC outputs
//GPIO_setPinConfig(GPIO_41_DACAOUT); // Route DACA to GPIO 41
//GPIO_setPinConfig(GPIO_42_DACBOUT); // Route DACB to GPIO 42
//GPIO_setPinConfig(GPIO_43_DACCOUT); // Route DACC to GPIO 43

// Initialize PIE and configure interrupts
Interrupt_initModule();
Interrupt_initVectorTable();
DAC_enableOutput(DACA_BASE);
DAC_enableOutput(DACB_BASE);

// Generate the Sine Wave Lookup Table

// Enable Global Interrupts
EINT;
ERTM;

// Configure DAC and CPU Timer
configureDAC();
configureCPUTimer();

// Infinite loop (DAC updates happen in ISR)
while (1)
{

}
}

// Configure DACs
void configureDAC(void)
{
EALLOW;

// Set reference voltage to VREFHI (3.3V)
DAC_setReferenceVoltage(DACA_BASE, DAC_REF_ADC_VREFHI);
DAC_setReferenceVoltage(DACB_BASE, DAC_REF_ADC_VREFHI);

// Enable DAC outputs
DAC_enableOutput(DACA_BASE);
DAC_enableOutput(DACB_BASE);

/*EALLOW;
HWREG(GPIOCTRL_BASE + GPIO_O_GPBMUX1) |= (1U << 18); // Set GPIO41 to DAC mode
HWREG(GPIOCTRL_BASE + GPIO_O_GPBMUX1) |= (1U << 20); // Set GPIO42 to DAC mode
HWREG(GPIOCTRL_BASE + GPIO_O_GPBMUX1) |= (1U << 22); // Set GPIO43 to DAC mode
EDIS;*/


// Set the DAC shadow output to mid-scale initially
DAC_setShadowValue(DACA_BASE, sineWave[0]);
// DAC_setShadowValue(DACB_BASE, sineWave[SAMPLES_PER_CYCLE / 4]); // 90-degree phase shift

// Delay for DAC power-up
DEVICE_DELAY_US(10);
EDIS;
}

// Configure CPU Timer for DAC Updates
void configureCPUTimer(void)
{
CPUTimer_setPeriod(CPUTIMER0_BASE, TIMER_PERIOD);
CPUTimer_setPreScaler(CPUTIMER0_BASE, 0);
CPUTimer_stopTimer(CPUTIMER0_BASE);
CPUTimer_reloadTimerCounter(CPUTIMER0_BASE);

CPUTimer_enableInterrupt(CPUTIMER0_BASE);
// Register Timer ISR
Interrupt_register(INT_TIMER0, &cpuTimerISR);
Interrupt_enable(INT_TIMER0);

// Start Timer
CPUTimer_startTimer(CPUTIMER0_BASE);
}

// CPU Timer ISR - Updates DAC outputs
__interrupt void cpuTimerISR(void)
{

GPIO_togglePin(DEVICE_GPIO_PIN_LED2);
// Update DAC-A with sine wave


DAC_setShadowValue(DACA_BASE, sineWave[indexA]);


// Update DAC-B with 90-degree phase shift
DAC_setShadowValue(DACB_BASE, sineWave[indexB]);

// Increment indices and wrap around
indexA = (indexA + 1) % SAMPLES_PER_CYCLE;
// indexB = (indexB + 1) % SAMPLES_PER_CYCLE;

// Acknowledge the interrupt
Interrupt_clearACKGroup(INTERRUPT_ACK_GROUP1);
}

But , i am not seeing any output from DAC pin , please help to solve this issue..

Regards,

Geethanjali PInnu.