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.

DAC53608EVM: How to program the DAC53608EVM connected to BOOSTXL-DAC-PORT from Code Composer Studio connected to XD110 of the MSP-EXP432E401Y Launchpad?

Part Number: DAC53608EVM
Other Parts Discussed in Thread: BOOSTXL-DAC-PORT, DAC53608, MSP-EXP432E401Y

I am trying to develop a code in CCS that allows me to control the DAC53608EVM from the XDS110 but I have not had any favorable results.

I have tried to program it using the I2C protocol using the PN4 and PN5 ports corresponding to the I2C2 register of the microcontroller. Unfortunately, observing the signals from these two ports using an oscilloscope, you do not have a coherent response to the I2C protocol, only noise is displayed. As a final result of the code, we want to obtain 1V at the output of channel A of the DAC.

The code that I have modified is the following:

/ * DriverLib Includes * /
#include <ti / devices / msp432e4 / driverlib / driverlib.h>

/ * Standard Includes * /
#include <stdint.h>
#include <stdbool.h>

//
// Definition of the I2C bus parameters
//
#define SLAVE_ADD 0x4A

//
// Variables for I2C data
//
uint16_t data = 0x0000;
uint16_t data2 = 0x0668;

int main (void) {

    uint32_t ui32SysClock;
    //
    // Setup System Clock for 120MHz
    //
    ui32SysClock = SysCtlClockFreqSet ((SYSCTL_OSC_MAIN | SYSCTL_USE_PLL | SYSCTL_XTAL_25MHZ |
    SYSCTL_CFG_VCO_480), 120000000);

    //
    // Pause the Clock, Reset it and enable the I2C module in the Master function
    //
    SysCtlPeripheralDisable (SYSCTL_PERIPH_I2C2);
    SysCtlPeripheralReset (SYSCTL_PERIPH_I2C2);

    //
    // Enable I2C peripheral
    //
    SysCtlPeripheralEnable (SYSCTL_PERIPH_I2C2);
    SysCtlPeripheralEnable (SYSCTL_PERIPH_GPION);
    GPIOPinConfigure (GPIO_PN5_I2C2SCL);
    GPIOPinConfigure (GPIO_PN4_I2C2SDA);
    GPIOPinTypeI2CSCL (GPIO_PORTN_BASE, GPIO_PIN_5);
    GPIOPinTypeI2C (GPIO_PORTN_BASE, GPIO_PIN_4);

    //
    // Enable Pull-Up Resistors
    //
    GPION-> PUR | = (GPIO_PIN_4 | GPIO_PIN_5);

    //
    // Wait for the I2C module to be ready
    //
    while (! SysCtlPeripheralReady (SYSCTL_PERIPH_GPION))
    {
    }

    // I2CMasterSlaveAddrSet (I2C2_BASE, SLAVE_ADD, false); is when you want to write and
    // I2CMasterSlaveAddrSet (I2C2_BASE, SLAVE_ADD, true); is when you want to read from I2C bus

    //
    // Initialization of Master and Slave
    //
    I2CMasterInitExpClk (I2C2_BASE, ui32SysClock, true);

    //
    // Specify the slave address
    //
    I2CMasterSlaveAddrSet (I2C2_BASE, SLAVE_ADD, false);

    while (1)
    {
        // register to be read
        I2CMasterDataPut (I2C2_BASE, 0x01);

        // send control byte and register address byte to slave device
        I2CMasterControl (I2C2_BASE, I2C_MASTER_CMD_BURST_SEND_START);

        // wait for MCU to finish transaction
        while (I2CMasterBusy (I2C2_BASE));

        I2CMasterSlaveAddrSet (I2C2_BASE, SLAVE_ADD, true);

        // specify data to be written to the above mentioned device_register
        I2CMasterDataPut (I2C2_BASE, data);

        // wait while checking for MCU to complete the transaction
        I2CMasterControl (I2C2_BASE, I2C_MASTER_CMD_BURST_SEND_CONT);

        // wait for MCU & device to complete transaction
        while (I2CMasterBusy (I2C2_BASE));

        //////////////////////////////////////////////////// /////////////////////////

        // register to be read
        I2CMasterDataPut (I2C2_BASE, 0x08);

        // send control byte and register address byte to slave device
        I2CMasterControl (I2C2_BASE, I2C_MASTER_CMD_BURST_SEND_START);

        // wait for MCU to finish transaction
        while (I2CMasterBusy (I2C2_BASE));

        I2CMasterSlaveAddrSet (I2C2_BASE, SLAVE_ADD, true);

        // specify data to be written to the above mentioned device_register
        I2CMasterDataPut (I2C2_BASE, data2);

        // wait while checking for MCU to complete the transaction
        I2CMasterControl (I2C2_BASE, I2C_MASTER_CMD_BURST_SEND_CONT);

        // wait for MCU & device to complete transaction
        while (I2CMasterBusy (I2C2_BASE));
    }
}

  • Hi,

    I can see from your code, I2C_ADD is 0x4A

    If you are using EVM, I2C address is 0x48 since A0 pin is grounded. Did you make changes on the board, where A0 is connected to SDA?

    Finally can you share scope shots of the I2C frames at the device pins?

    Regards,

    AK

  • Hello,

    I did a test changing the SLAVE_ADD from 0x4A to 0x48 as you suggested. But, I didn't get any response as with the other address. I don't really understand the "A0 pin is grounded" part.

    For a better visualization of the assembly I have of the DAC53608, BOOSTXL-DAC-PORT and the XDS110 of the MSP-EXP432E401Y Launchpad, I attach the image below:

    It should be noted that what I am looking for is to program the DAC channels from the code that I previously attached using Code Composer Studio. To do this, I have relied on the following datasheets:

    https://www.ti.com/lit/ug/slau790a/slau790a.pdf?ts=1620231172328&ref_url=https%253A%252F%252Fwww.ti.com%252Ftool%252FDAC53608EVM

    https://www.ti.com/lit/ds/slaseq4a/slaseq4a.pdf?ts=1620231173702&ref_url=https%253A%252F%252Fwww.ti.com%252Ftool%252FDAC53608EVM

    Regards,
    Leandro Rojas

  • Hi,

    Can you outline the registers you wrote to get the DAC outputs?

    By default all DAC outputs will be in powered down state.  You need to write into DEVICE_CONFIG ( address 0x01h) register first to enable the DAC outputs.

    Then write into DAC_DATA register to get the desired outputs.

    Regards,

    AK

  • Hi,

    These are a few lines of code from the main code that I appended earlier.

    #define SLAVE_ADD 0x48 //Here I define my slave address
    
    //Here I define the data that I will send.
    uint16_t data=0x0000; //data for DEVICE_CONFIG
    uint16_t data2=0x0668; //data for DACA_DATA
    //
    // Initialization of Master and Slave
    //
    I2CMasterInitExpClk (I2C2_BASE, ui32SysClock, true);
    
    //
    // Specify the slave address
    //
    I2CMasterSlaveAddrSet (I2C2_BASE, SLAVE_ADD, false);
    
    while (1)
    {
    //Register to be read DEVICE_CONFIG
    I2CMasterDataPut (I2C2_BASE, 0x01);
    
    //Send control byte and register address byte to slave device
    I2CMasterControl (I2C2_BASE, I2C_MASTER_CMD_BURST_SEND_START);
    
    //Wait for MCU to finish transaction
    while (I2CMasterBusy (I2C2_BASE));
    
    I2CMasterSlaveAddrSet (I2C2_BASE, SLAVE_ADD, true);
    
    //Specify data to be written in DEVICE_CONFIG
    I2CMasterDataPut (I2C2_BASE, data);
    
    //Wait while checking for MCU to complete the transaction
    I2CMasterControl (I2C2_BASE, I2C_MASTER_CMD_BURST_SEND_CONT);
    
    // wait for MCU & device to complete transaction
    while (I2CMasterBusy (I2C2_BASE));
    
    //////////////////////////////////////////////////// /////////////////////////
    
    //Register to be read DACA_DATA
    I2CMasterDataPut (I2C2_BASE, 0x08);
    
    //Send control byte and register address byte to slave device
    I2CMasterControl (I2C2_BASE, I2C_MASTER_CMD_BURST_SEND_START);
    
    //Wait for MCU to finish transaction
    while (I2CMasterBusy (I2C2_BASE));
    
    I2CMasterSlaveAddrSet (I2C2_BASE, SLAVE_ADD, true);
    
    //Specify data to be written in DACA_DATA
    I2CMasterDataPut (I2C2_BASE, data2);
    
    //Wait while checking for MCU to complete the transaction
    I2CMasterControl (I2C2_BASE, I2C_MASTER_CMD_BURST_SEND_CONT);
    
    //Wait for MCU & device to complete transaction
    while (I2CMasterBusy (I2C2_BASE));
    }

    Regards,

    Leandro Rojas

  • Hi,

    As I can see from your code , you are sending 0x0000 to DEVICE_CONFIG which is correct.

    Are you able to work with our GUI software? Can you read back the DEVICE_CONFIG register before you write and after?

    Please probe on the A0 pin on the EVM to check whether that pin is logic high or low, based on that device address will change.

    Lastly, please share the I2C frames while you are sending the DAC_DATA and DEVICE_CONFIG.

    Please probe on the device side.

    Regards,

    AK

  • Hello,
    We have already worked with the IT GUI software and indeed DEVICE_CONFIG is at 0x0000 before and after writing.
    On the other hand, the A0 pin of the EVM is in low logic and making some modifications to the original code, the A0 pin was connected to the SDA, obtaining as SLAVE_ADD 0x4A.

    In the I2C frames shown below, it can be seen that the blue signal (SCL) is at 100kHz. The yellow signal corresponds to the SDA but only the slave address SLAVE_ADD 0x4A (1001010) is being sent. I don't understand why the rest of the frame that corresponds in 8-bit segment is not sent to:
    DEVICE_CONFIG: 0x01 0x00 0x00
    DACA_DATA: 0x08 0x06 0x34



    In this other image, you can see the yellow signal that corresponds to the PN4 pin of the Launchpad configured as SDA and the blue signal corresponds to the SDA pin of the EVM, checking that the BOOSTXL-DAC-PORT connects the DAC53608EVM correctly with the Launchpad.

    I attach the new code with which the results previously shown were obtained.

    / * DriverLib Includes * /
    #include <ti / devices / msp432e4 / driverlib / driverlib.h>
    
    / * Standard Includes * /
    #include <stdint.h>
    #include <stdbool.h>
    
    //
    // Definition of the I2C bus parameters
    //
    #define SLAVE_ADD 0x4A
    
    //
    // Variables for I2C data
    //
    uint16_t data = 0x0000;
    uint16_t data2 = 0x0668;
    
     int main (void) {
    
        uint32_t ui32SysClock;
        //
        // Setup System Clock for 120MHz
        //
        ui32SysClock = SysCtlClockFreqSet ((SYSCTL_OSC_MAIN | SYSCTL_USE_PLL | SYSCTL_XTAL_25MHZ |
        SYSCTL_CFG_VCO_480), 120000000);
    
        //
        // Pause the Clock, Reset it and enable the I2C module in the Master function
        //
        SysCtlPeripheralDisable (SYSCTL_PERIPH_I2C2);
        SysCtlPeripheralReset (SYSCTL_PERIPH_I2C2);
    
        //
        // Enable I2C peripheral
        //
        SysCtlPeripheralEnable (SYSCTL_PERIPH_I2C2);
        SysCtlPeripheralEnable (SYSCTL_PERIPH_GPION);
        GPIOPinConfigure (GPIO_PN5_I2C2SCL);
        GPIOPinConfigure (GPIO_PN4_I2C2SDA);
        GPIOPinTypeI2CSCL (GPIO_PORTN_BASE, GPIO_PIN_5);
        GPIOPinTypeI2C (GPIO_PORTN_BASE, GPIO_PIN_4);
    
        //
        // Enable Pull-Up Resistors
        //
        // GPION-> PUR | = (GPIO_PIN_4 | GPIO_PIN_5);
        GPIOPadConfigSet (GPIO_PORTN_BASE, GPIO_PIN_4, GPIO_STRENGTH_8MA, GPIO_PIN_TYPE_STD_WPU);
        GPIOPadConfigSet (GPIO_PORTN_BASE, GPIO_PIN_5, GPIO_STRENGTH_8MA, GPIO_PIN_TYPE_STD_WPU);
    
        //
        // Wait for the I2C module to be ready
        //
        while (! SysCtlPeripheralReady (SYSCTL_PERIPH_GPION))
        {
        }
    
        // I2CMasterSlaveAddrSet (I2C2_BASE, SLAVE_ADD, false); is when you want to write and
        // I2CMasterSlaveAddrSet (I2C2_BASE, SLAVE_ADD, true); is when you want to read from I2C bus
    
        //
        // Initialization of Master and Slave
        //
        I2CMasterInitExpClk (I2C2_BASE, ui32SysClock, false);
    
        while (1)
        {
            //
            // Specify the slave address
            //
            I2CMasterSlaveAddrSet (I2C2_BASE, SLAVE_ADD, false);
    
            I2CMasterDataPut (I2C2_BASE, 0x01);
            I2CMasterControl (I2C2_BASE, I2C_MASTER_CMD_BURST_SEND_START);
            while (I2CMasterBusy (I2C2_BASE));
    
            //
    
            // I2CMasterSlaveAddrSet (I2C2_BASE, SLAVE_ADD, true);
    
            I2CMasterDataPut (I2C2_BASE, 0x00);
            I2CMasterControl (I2C2_BASE, I2C_MASTER_CMD_BURST_SEND_CONT);
            while (I2CMasterBusy (I2C2_BASE));
    
            //
    
            I2CMasterDataPut (I2C2_BASE, 0x00);
            I2CMasterControl (I2C2_BASE, I2C_MASTER_CMD_BURST_SEND_FINISH);
            while (I2CMasterBusy (I2C2_BASE));
    
            //////////////////////////////////////////////////// /////////////////////////
    
            I2CMasterDataPut (I2C2_BASE, 0x08);
            I2CMasterControl (I2C2_BASE, I2C_MASTER_CMD_BURST_SEND_START);
            while (I2CMasterBusy (I2C2_BASE));
    
            //
    
            // I2CMasterSlaveAddrSet (I2C2_BASE, SLAVE_ADD, true);
    
            I2CMasterDataPut (I2C2_BASE, 0x06);
            I2CMasterControl (I2C2_BASE, I2C_MASTER_CMD_BURST_SEND_CONT);
            while (I2CMasterBusy (I2C2_BASE));
    
            //
    
            I2CMasterDataPut (I2C2_BASE, 0x34);
            I2CMasterControl (I2C2_BASE, I2C_MASTER_CMD_BURST_SEND_FINISH);
            while (I2CMasterBusy (I2C2_BASE));
        }
    }

    Regads,
    Leandro

  • Hi,

    I am not a software expert to look at the code you have written.

    Whatever register write you are doing is correct as per the code. Did you verify the EVM functionality using our software not the custom code you have written?

    Why you have made A0 pin connecting to SDA using software change. leave the A0 as is for debug and work with i2c address 0x48.

    Regards,

    AK

  • Hello,

    I have already managed to fix the problems related to the I2C protocol.


    The main drawback is that it was not activating interrupts after establishing Master / Slave communication.
    The above is solved by adding the following line of code:


    IntEnable (INT_I2C2);

    I attach the images with the expected results for the application that I am developing. Thanks in the same way for the advice given.
    Note: A0 connected to AGND with 0x48 as slave address.

    DEVICE_CONFIG configuration

    DEVICE_CONFIG configuration

    Data sent to the channel A output of the DAC.

    Expected 1V reading at DAC channel A output.

    //Protocolo I2C para comunicación con el DAC53068EVM
    //Autores: Jairo Andrés Camacho Guerrero-tatez0000@gmail.com
    //         Leandro Sebasthyan Rojas Rodriguez-leomix60@gmail.com
    
    
    //Declaracion de librerias
    #include <stdint.h>
    #include <stdbool.h>
    #include <stdarg.h>
    #include <ti/devices/msp432e4/driverlib/driverlib.h>
    
    //Declaración de Variables
    uint32_t ui32SysClock;
    uint8_t Device_reg1;
    uint8_t Device_reg2;
    uint8_t Device_reg3;
    
    //Registros de configuracion DAC53608EMV
    //{0x01, 0x00, 0x00}  //Registros de configuracion DEVICE_CONFIG
    //{0x08, 0x06, 0x34}  //Registros de configuracion DAC_A (Vout = 1V)
    
    //inicio del algoritmo
    
    void InitI2C2(void){
        SysCtlPeripheralEnable(SYSCTL_PERIPH_GPION); //Puerto N
        // Espera a que el puerto este listo para programarse
        while(!SysCtlPeripheralReady(SYSCTL_PERIPH_GPION)){}
        // Configurar los Pins para la interfaz I2C_2 Master
        GPIOPinConfigure(GPIO_PN5_I2C2SCL);
        GPIOPinConfigure(GPIO_PN4_I2C2SDA);
        GPIOPinTypeI2C(GPIO_PORTN_BASE, GPIO_PIN_4);
        GPIOPinTypeI2CSCL(GPIO_PORTN_BASE, GPIO_PIN_5);
        //Habilitar Resistencias Pull-Up PuertoN -> Pin4_5
        GPIOPadConfigSet(GPIO_PORTN_BASE, GPIO_PIN_4, GPIO_STRENGTH_4MA, GPIO_PIN_TYPE_STD_WPU);
        GPIOPadConfigSet(GPIO_PORTN_BASE, GPIO_PIN_5, GPIO_STRENGTH_4MA, GPIO_PIN_TYPE_STD_WPU);
        //Reset al modulo I2C2
        SysCtlPeripheralDisable(SYSCTL_PERIPH_I2C2);
        SysCtlPeripheralReset(SYSCTL_PERIPH_I2C2);
        //Activar los puertos GPIO
        SysCtlPeripheralEnable(SYSCTL_PERIPH_I2C2);  //I2C2
        while(!SysCtlPeripheralReady(SYSCTL_PERIPH_I2C2)){}
    
        // Inicializar y configurar el modulo Maestro
        I2CMasterInitExpClk(I2C2_BASE, ui32SysClock, false); //100Kbps-400Kbps
        IntEnable(INT_I2C2);
        //Declaracion de la direccion del esclavo
        I2CMasterSlaveAddrSet(I2C2_BASE, 0x48, false);
    }
    
    void I2C2Send(uint8_t reg_1, uint8_t reg_2, uint8_t reg_3){
        //Envio del primer registro
        I2CMasterDataPut(I2C2_BASE, reg_1);
        I2CMasterControl(I2C2_BASE, I2C_MASTER_CMD_BURST_SEND_START);
        SysCtlDelay(2000);
        while(I2CMasterBusy(I2C2_BASE));
        //Envio del segundo registro
        I2CMasterDataPut(I2C2_BASE, reg_2);
        I2CMasterControl(I2C2_BASE, I2C_MASTER_CMD_BURST_SEND_CONT);
        SysCtlDelay(2000);
        while(I2CMasterBusy(I2C2_BASE));
        //Envio del tercer registro
        I2CMasterDataPut(I2C2_BASE, reg_3);
        I2CMasterControl(I2C2_BASE, I2C_MASTER_CMD_BURST_SEND_FINISH);
        SysCtlDelay(2000);
        while(I2CMasterBusy(I2C2_BASE));
    }
    
    int main(void)
    {
        // Ajuste del reloj del sistema a 120MHz
        ui32SysClock = SysCtlClockFreqSet((SYSCTL_OSC_MAIN | SYSCTL_USE_PLL |
                SYSCTL_XTAL_25MHZ | SYSCTL_CFG_VCO_480), 120000000);
        //Inicia I2C2
        InitI2C2();
        //Envia DEVICE_CONFIG
        I2C2Send(0x01, 0x00, 0x00);
        SysCtlDelay(2000);
        //Envia DAC_A_DATA
    
        while(1){
            I2C2Send(0x08, 0x06, 0x68);
            SysCtlDelay(2000);
        }
    }
    

  • Hi,

    Glad that your problem got solved  by adding a simple line of code Slight smile

    Regards,

    AK