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.

CCS/MSP432P401R: Combining I@C and UART in a single program to control an ADC from computer

Part Number: MSP432P401R

Tool/software: Code Composer Studio

Hi,

I'd like to set an ADC Adafruit MCP4725 using my PC through MSP432 microcontroller.

I am able to connect the ADC with the microcontroller using the following example. dev.ti.... This example is under driverlib folder. after making some modifications, I am now able to set the voltage of the ADC.

To be able to control the ADC through my PC, I started working on the UART example. I found the example on the following link, dev.ti..., an easy start. This example is under TI driver category. After being able to successfully run this example, now I'd like to combine the two codes. While doing so, I am constantly facing difficulties. On including the driverlib.h header file in this example, I receive an error, "failed to match a default include file". I have included every file and library, however, I am unable to resolve this error.

I'd like to ask whether these two categories, TI driver and driverlib, compatible with each other? How can I resolve this issue? Else, could you recommend me how should I code so that I am able to set my DAC using UART?

Thanks in advance.

  • You can easily use Driverlib with the UART:

    "The DriverLib package contains a variety of different code examples that demonstrate the usage
    of the UART module. These code examples are accessible under the examples/ folder of the SDK
    release as well as through TI Resource Explorer if using Code Composer Studio. These code
    examples provide a comprehensive list of use cases as well as practical applications involving
    each module.
    Below is a very brief code example showing how to configure and enable the UART module. In the
    case of this example, we assume the MCLK is operating off of the DCO and the DCO is tuned to
    12MHz. This makes the configuration parameters so that the baud rate is 9600.
    Below is an example of the UART configuration parameter:
    /* UART Configuration Parameter. These are the configuration parameters to
    * make the eUSCI A UART module to operate with a 9600 baud rate. These
    * values were calculated using the online calculator that TI provides
    * at:
    *software-dl.ti.com/.../index.html
    */
    const eUSCI_UART_Config uartConfig =
    {
    EUSCI_A_UART_CLOCKSOURCE_SMCLK, // SMCLK Clock Source
    78, // BRDIV = 78
    2, // UCxBRF = 2
    0, // UCxBRS = 0
    EUSCI_A_UART_NO_PARITY, // No Parity
    EUSCI_A_UART_LSB_FIRST, // LSB First
    EUSCI_A_UART_ONE_STOP_BIT, // One stop bit
    EUSCI_A_UART_MODE, // UART mode
    EUSCI_A_UART_OVERSAMPLING_BAUDRATE_GENERATION // Oversampling
    };
    This code snippet is the actual configuration of the UART module using the DriverLib APIs:
    /* Configuring UART Module */
    MAP_UART_initModule(EUSCI_A0_BASE, &uartConfig);
    /* Enable UART module */
    MAP_UART_enableModule(EUSCI_A0_BASE);
    /* Enabling interrupts */
    MAP_UART_enableInterrupt(EUSCI_A0_BASE, EUSCI_A_UART_RECEIVE_INTERRUPT);
    MAP_Interrupt_enableInterrupt(INT_EUSCIA0);
    MAP_Interrupt_enableSleepOnIsrExit();
    MAP_Interrupt_enableMaster();"
  • TI Drivers is built upon driverLib. If you look at the source code of the TIDrivers you will find driverLib API calls. And yes the driverlib is typically not included at the application layer so you include files in the source as well as in the compiler settings would need to be updated. Alternatively, you can find a UART example in driverLib;
    dev.ti.com/.../

    or and I2C example in TIDrivers;
    dev.ti.com/.../

    Regards,
    Chris