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.

EK-LM4F120XL and TI-RTOS

Other Parts Discussed in Thread: TM4C1233H6PM

Hello,

I'm trying to compile a basic program with TI-RTOS. As template I used SYS/BIOS - TI Target Examples - Typical.

Device: ARM
Variant: Stellaris LM4F120H5QR
Connection: Stellaris In-Circuit Debug Interface

Products and Repositories:
- SYS/BIOS 6.35.4.50
- TI-RTOS 1.10.0.23

If I compile this code below I get this error message:
"C:/ti/tirtos_1_10_00_23/packages/ti/drivers/ENV.h", line 99: fatal error #35: #error directive: This platform is not supported by TI-RTOS currently.

My question now, where do I find the board.h definitions for the EK-LM4F120XL / LM4F120H5QR / TM4C1233H6PM?

/*
 *  ======== main.c ========
 */

#include <xdc/std.h>

#include <xdc/runtime/Error.h>
#include <xdc/runtime/System.h>

#include <ti/sysbios/BIOS.h>

#include <ti/sysbios/knl/Task.h>

#include "EKS_LM4F232.h"

// TI-RTOS Header files
#include <ti/drivers/GPIO.h>
#include <ti/drivers/I2C.h>

#include <string.h>

#define HYT221_ADDR 0x28
#define I2C0 0


I2C_Handle i2c;
double Humidity;
double Temperature;
UChar txBuffer[200];
UChar rxBuffer[200];

void waitI2C(UChar slaveAddress) {
	UChar txBuffer[1];
	I2C_Transaction i2cTransaction;

	// Wait for the I2C slave to be ready for the next read/write operation
	txBuffer[0] = 0x00;                         /* Some dummy value */
    i2cTransaction.slaveAddress = slaveAddress; /* 7-bit slave address */
    i2cTransaction.writeBuf = txBuffer;         /* txBuffer to be TX'd */
    i2cTransaction.writeCount = 1;              /* Number of bytes to be TX'd */
    i2cTransaction.readBuf = NULL;              /* rxBuffer to be RX'd */
    i2cTransaction.readCount = 0;               /* Number of bytes to be RX'd */
    /*
     * Perform I2C transfer until a good I2C has been ACK'd by the slave
     * indicating that the I2C slave is now ready for the next command
     */
    while (!I2C_transfer(i2c, &i2cTransaction)) {
    }
}
/*
 *  ======== taskFxn ========
 */
Void taskFxn(UArg a0, UArg a1)
{
    System_printf("enter taskFxn()\n");

    UInt transferOK;
    I2C_Params i2cParams;

    // Create I2C for usage
    I2C_Params_init(&i2cParams);
    i2cParams.bitRate = I2C_400kHz;
    i2c = I2C_open(I2C0, &i2cParams);
    if (i2c == NULL) {
    	System_abort("Error Initializing I2C\n");
    }
    else {
    	System_printf("I2C Initialized!\n");
    }

    txBuffer = 0x00;

    I2C_transaction i2cTransaction;
    i2cTransaction.slaveAddress = HYT221_ADDR;
    i2cTransaction.writeBuf = txBuffer;
    i2cTransaction.writeCount = 10;
    i2cTransaction.readBuf = rxBuffer;
    i2cTransaction.readCount = 20;
    transferOK = I2C_transfer(i2c, &i2cTransaction);
    if (!transferOK)
    	System_abort("Error in I2C Transfer\n");
    waitI2C(HYT221_ADDR);

    // Deinitialized I2C
    I2C_close(i2c);
    System_printf("I2C Deinitialized!\n");



    Task_sleep(10);

    System_printf("exit taskFxn()\n");
}
/*
 *  ======== main ========
 */
Int main()
{ 
	Board_initGeneral();
	Board_initGPIO();
	Board_initI2C();

    Task_Handle task;
    Error_Block eb;

    System_printf("enter main()\n");
    System_flush();

    // Turn on user LED
    GPIO_write(Board_LED, Board_LED_ON);

    Error_init(&eb);
    task = Task_create(taskFxn, NULL, &eb);
    if (task == NULL) {
        System_printf("Task_create() failed!\n");
        BIOS_exit(0);
    }

    BIOS_start();    /* does not return */
    return(0);
}

/*
 *  ======== app.cfg ========
 */
var Defaults = xdc.useModule('xdc.runtime.Defaults');
var Diags = xdc.useModule('xdc.runtime.Diags');
var Error = xdc.useModule('xdc.runtime.Error');
var Log = xdc.useModule('xdc.runtime.Log');
var LoggerBuf = xdc.useModule('xdc.runtime.LoggerBuf');
var Main = xdc.useModule('xdc.runtime.Main');
var Memory = xdc.useModule('xdc.runtime.Memory')
var SysMin = xdc.useModule('xdc.runtime.SysMin');
var System = xdc.useModule('xdc.runtime.System');
var Text = xdc.useModule('xdc.runtime.Text');

var BIOS = xdc.useModule('ti.sysbios.BIOS');
var Clock = xdc.useModule('ti.sysbios.knl.Clock');
var Swi = xdc.useModule('ti.sysbios.knl.Swi');
var Task = xdc.useModule('ti.sysbios.knl.Task');
var Semaphore = xdc.useModule('ti.sysbios.knl.Semaphore');
var Hwi = xdc.useModule('ti.sysbios.hal.Hwi');
var I2C = xdc.useModule('ti.drivers.I2C');
var GPIO = xdc.useModule('ti.drivers.GPIO');

/* 
 * Program.argSize sets the size of the .args section. 
 * The examples don't use command line args so argSize is set to 0.
 */
Program.argSize = 0x0;

/*
 * Uncomment this line to globally disable Asserts.
 * All modules inherit the default from the 'Defaults' module.  You
 * can override these defaults on a per-module basis using Module.common$. 
 * Disabling Asserts will save code space and improve runtime performance.
Defaults.common$.diags_ASSERT = Diags.ALWAYS_OFF;
 */

/*
 * Uncomment this line to keep module names from being loaded on the target.
 * The module name strings are placed in the .const section. Setting this
 * parameter to false will save space in the .const section.  Error and
 * Assert messages will contain an "unknown module" prefix instead
 * of the actual module name.
Defaults.common$.namedModule = false;
 */

/*
 * Minimize exit handler array in System.  The System module includes
 * an array of functions that are registered with System_atexit() to be
 * called by System_exit().
 */
System.maxAtexitHandlers = 4;       

/* 
 * Uncomment this line to disable the Error print function.  
 * We lose error information when this is disabled since the errors are
 * not printed.  Disabling the raiseHook will save some code space if
 * your app is not using System_printf() since the Error_print() function
 * calls System_printf().
Error.raiseHook = null;
 */

/* 
 * Uncomment this line to keep Error, Assert, and Log strings from being
 * loaded on the target.  These strings are placed in the .const section.
 * Setting this parameter to false will save space in the .const section.
 * Error, Assert and Log message will print raw ids and args instead of
 * a formatted message.
Text.isLoaded = false;
 */

/*
 * Uncomment this line to disable the output of characters by SysMin
 * when the program exits.  SysMin writes characters to a circular buffer.
 * This buffer can be viewed using the SysMin Output view in ROV.
SysMin.flushAtExit = false;
 */

/*
 * The BIOS module will create the default heap for the system.
 * Specify the size of this default heap.
 */
BIOS.heapSize = 0x1000;

/*
 * Build a custom SYS/BIOS library from sources.
 */
BIOS.libType = BIOS.LibType_Custom;

/* System stack size (used by ISRs and Swis) */
Program.stack = 0x2000;

/* Circular buffer size for System_printf() */
SysMin.bufSize = 0x200;

/* 
 * Create and install logger for the whole system
 */
var loggerBufParams = new LoggerBuf.Params();
loggerBufParams.numEntries = 16;
var logger0 = LoggerBuf.create(loggerBufParams);
Defaults.common$.logger = logger0;
Main.common$.diags_INFO = Diags.ALWAYS_ON;

System.SupportProxy = SysMin;

  • Thorsten,

    In the TI resource explorer, you should see TI-RTOS examples for the LM4F lauchpad. In regards to the compiler error: your application is missing a predefined symbol: TIVAWARE. I'd recommend to import a TI-RTOS example and add the missing I2C entries into the board files.

    See this thread on what to add to the board files to get I2C to work.

  • Hello Tom,

    thank you for your answer. I imported the GPIO Interrupt example project and replaced the gpiointerrupt.c and the gpiointerrupt.cfg with the stuff below

    /*
     * Copyright (c) 2013, Texas Instruments Incorporated
     * All rights reserved.
     *
     * Redistribution and use in source and binary forms, with or without
     * modification, are permitted provided that the following conditions
     * are met:
     *
     * *  Redistributions of source code must retain the above copyright
     *    notice, this list of conditions and the following disclaimer.
     *
     * *  Redistributions in binary form must reproduce the above copyright
     *    notice, this list of conditions and the following disclaimer in the
     *    documentation and/or other materials provided with the distribution.
     *
     * *  Neither the name of Texas Instruments Incorporated nor the names of
     *    its contributors may be used to endorse or promote products derived
     *    from this software without specific prior written permission.
     *
     * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
     * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
     * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
     * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
     * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
     * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
     * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
     * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
     * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
     * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
     * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
     */
    
    /*
     *  ======== gpiointerrupt.c ========
     */
    
    /* XDCtools Header files */
    #include <xdc/std.h>
    #include <xdc/cfg/global.h>
    #include <xdc/runtime/Error.h>
    #include <xdc/runtime/System.h>
    
    /* BIOS Header files */
    #include <ti/sysbios/BIOS.h>
    #include <ti/sysbios/knl/Task.h>
    
    /* TI-RTOS Header files */
    #include <ti/drivers/GPIO.h>
    #include <ti/drivers/I2C.h>
    
    /* Example/Board Header files */
    #include "Board.h"
    
    #include <string.h>
    
    #define HYT221_ADDR 0x28
    #define I2C0 0
    
    
    I2C_Handle i2c;
    double Humidity;
    double Temperature;
    UChar txBuffer[200];
    UChar rxBuffer[200];
    
    /*
     *  ======== waitI2C ========
     *
     */
    void waitI2C(UChar slaveAddress) {
        System_printf("enter waitI2c()\n");
        System_flush();
    	UChar txBuffer[1];
    	I2C_Transaction i2cTransaction;
    
    	// Wait for the I2C slave to be ready for the next read/write operation
    	txBuffer[0] = 0x00;                         /* Some dummy value */
        i2cTransaction.slaveAddress = slaveAddress; /* 7-bit slave address */
        i2cTransaction.writeBuf = txBuffer;         /* txBuffer to be TX'd */
        i2cTransaction.writeCount = 1;              /* Number of bytes to be TX'd */
        i2cTransaction.readBuf = NULL;              /* rxBuffer to be RX'd */
        i2cTransaction.readCount = 0;               /* Number of bytes to be RX'd */
        /*
         * Perform I2C transfer until a good I2C has been ACK'd by the slave
         * indicating that the I2C slave is now ready for the next command
         */
        System_printf("while loop waitI2c()\n");
        System_flush();
        while (!I2C_transfer(i2c, &i2cTransaction)) {
        }
        System_printf("after while loop waitI2c()\n");
        System_flush();
    }
    
    /*
     *  ======== taskFxn ========
     */
    Void i2cFxn(UArg a0, UArg a1)
    {
        System_printf("enter taskFxn()\n");
        System_flush();
        UInt transferOK;
        I2C_Params i2cParams;
    
        // Create I2C for usage
        I2C_Params_init(&i2cParams);
        i2cParams.bitRate = I2C_400kHz;
        i2c = I2C_open(Board_I2C1, &i2cParams);
        if (i2c == NULL) {
        	System_abort("Error Initializing I2C\n");
        	System_flush();
        }
        else {
        	System_printf("I2C Initialized!\n");
        	System_flush();
        }
    
        txBuffer[0] = 0x00;
    
        I2C_Transaction i2cTransaction;
        i2cTransaction.slaveAddress = HYT221_ADDR;
        i2cTransaction.writeBuf = txBuffer;
        i2cTransaction.writeCount = 10;
        i2cTransaction.readBuf = rxBuffer;
        i2cTransaction.readCount = 20;
        System_printf("before I2C_transfer\n");
        System_flush();
        transferOK = I2C_transfer(i2c, &i2cTransaction);
        System_printf("after I2C_transfer\n");
        System_flush();
        if (!transferOK) {
        	System_abort("Error in I2C Transfer\n");
        	System_flush();
        }
        System_printf("before waitI2C\n");
        System_flush();
        waitI2C(HYT221_ADDR);
        System_printf("after waitI2C\n");
        System_flush();
    
        // Deinitialized I2C
        I2C_close(i2c);
        System_printf("I2C Deinitialized!\n");
        System_flush();
    
    
    
        Task_sleep(10);
    
        System_printf("exit taskFxn()\n");
        System_flush();
        BIOS_exit(0);
    }
    
    /*
     *  ======== main ========
     */
    Int main(Void)
    {
        /* Call board init functions */
        Board_initGeneral();
        Board_initGPIO();
    	Board_initI2C();
    
        System_printf("Starting the GPIO Interrupt example\nSystem provider is set"
                      " to SysMin. Halt the target and use ROV to view output.\n");
        /* SysMin will only print to the console when you call flush or exit */
        System_flush();
    
        System_printf("enter main()\n");
        System_flush();
    
        /* Start BIOS */
        BIOS_start();
    
        return (0);
    }
    
    /*
     * Copyright (c) 2013, Texas Instruments Incorporated
     * All rights reserved.
     *
     * Redistribution and use in source and binary forms, with or without
     * modification, are permitted provided that the following conditions
     * are met:
     *
     * *  Redistributions of source code must retain the above copyright
     *    notice, this list of conditions and the following disclaimer.
     *
     * *  Redistributions in binary form must reproduce the above copyright
     *    notice, this list of conditions and the following disclaimer in the
     *    documentation and/or other materials provided with the distribution.
     *
     * *  Neither the name of Texas Instruments Incorporated nor the names of
     *    its contributors may be used to endorse or promote products derived
     *    from this software without specific prior written permission.
     *
     * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
     * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
     * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
     * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
     * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
     * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
     * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
     * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
     * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
     * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
     * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
     */
    
    /*
     *  ======== gpiointerrupt.cfg ========
     */
    
    /* ================ General configuration ================ */
    var Defaults = xdc.useModule('xdc.runtime.Defaults');
    var Diags = xdc.useModule('xdc.runtime.Diags');
    var Error = xdc.useModule('xdc.runtime.Error');
    var Log = xdc.useModule('xdc.runtime.Log');
    var Main = xdc.useModule('xdc.runtime.Main');
    var Memory = xdc.useModule('xdc.runtime.Memory');
    var System = xdc.useModule('xdc.runtime.System');
    var Text = xdc.useModule('xdc.runtime.Text');
    
    var BIOS = xdc.useModule('ti.sysbios.BIOS');
    var Clock = xdc.useModule('ti.sysbios.knl.Clock');
    var Hwi = xdc.useModule('ti.sysbios.hal.Hwi');
    var HeapMem = xdc.useModule('ti.sysbios.heaps.HeapMem');
    
    /* ================ System configuration ================ */
    var SysMin = xdc.useModule('xdc.runtime.SysMin');
    var Task = xdc.useModule('ti.sysbios.knl.Task');
    var Semaphore = xdc.useModule('ti.sysbios.knl.Semaphore');
    var I2C = xdc.useModule('ti.drivers.I2C');
    System.SupportProxy = SysMin;
    
    /* ================ Logging configuration ================ */
    var LoggingSetup = xdc.useModule('ti.uia.sysbios.LoggingSetup');
    
    /* Needed for TivaTM4C123GH6PM CQ#:SDOCM00099546. */
    var UIAMetaData = xdc.useModule('ti.uia.runtime.UIAMetaData');
    UIAMetaData.timestampFreq = BIOS.getCpuFrequency();
    
    /* ================ Driver configuration ================ */
    var TIRTOS = xdc.useModule('ti.tirtos.TIRTOS');
    
    var GPIO = xdc.useModule('ti.drivers.GPIO');
    var task0Params = new Task.Params();
    task0Params.instance.name = "i2cHandle";
    Program.global.i2cHandle = Task.create("&i2cFxn", task0Params);
    

    Board.h

    /*
     * Copyright (c) 2013, Texas Instruments Incorporated
     * All rights reserved.
     *
     * Redistribution and use in source and binary forms, with or without
     * modification, are permitted provided that the following conditions
     * are met:
     *
     * *  Redistributions of source code must retain the above copyright
     *    notice, this list of conditions and the following disclaimer.
     *
     * *  Redistributions in binary form must reproduce the above copyright
     *    notice, this list of conditions and the following disclaimer in the
     *    documentation and/or other materials provided with the distribution.
     *
     * *  Neither the name of Texas Instruments Incorporated nor the names of
     *    its contributors may be used to endorse or promote products derived
     *    from this software without specific prior written permission.
     *
     * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
     * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
     * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
     * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
     * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
     * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
     * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
     * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
     * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
     * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
     * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
     */
    
    #ifndef __BOARD_H
    #define __BOARD_H
    
    #ifdef __cplusplus
    extern "C" {
    #endif
    
    #include "EK_TM4C123GXL.h"
    
    #define Board_initDMA               EK_TM4C123GXL_initDMA
    #define Board_initGeneral           EK_TM4C123GXL_initGeneral
    #define Board_initGPIO              EK_TM4C123GXL_initGPIO
    #define Board_initI2C               EK_TM4C123GXL_initI2C
    #define Board_I2C                   EK_TM4C123GXL_I2C1
    #define Board_I2C1                  EK_TM4C123GXL_I2C3
    #define Board_initSPI               EK_TM4C123GXL_initSPI
    #define Board_initUART              EK_TM4C123GXL_initUART
    #define Board_initUSB               EK_TM4C123GXL_initUSB
    #define Board_initWatchdog          EK_TM4C123GXL_initWatchdog
    #define Board_initWiFi              EK_TM4C123GXL_initWiFi
    #define Board_LED                   EK_TM4C123GXL_LED_BLUE
    #define Board_LED2                  EK_TM4C123GXL_LED_RED
    #define Board_BUTTON                EK_TM4C123GXL_GPIO_SW1
    #define Board_BUTTON2               EK_TM4C123GXL_GPIO_SW2
    #define Board_LED_ON                EK_TM4C123GXL_LED_ON
    #define Board_LED_OFF               EK_TM4C123GXL_LED_OFF
    #define Board_SPI0                  EK_TM4C123GXL_SPI0
    #define Board_SPI1                  EK_TM4C123GXL_SPI3
    #define Board_SPI_CC3000            EK_TM4C123GXL_SPI2
    #define Board_USBDEVICE             EK_TM4C123GXL_USBDEVICE
    #define Board_UART                  EK_TM4C123GXL_UART0
    #define Board_WATCHDOG              EK_TM4C123GXL_WATCHDOG0
    #define Board_WIFI                  EK_TM4C123GXL_WIFI
    #define Board_gpioCallbacks         EK_TM4C123GXL_gpioPortFCallbacks
    
    #ifdef __cplusplus
    }
    #endif
    
    #endif /* __BOARD_H */
    

    EK_TM4C123GXL.c

    /*
     * Copyright (c) 2013, Texas Instruments Incorporated
     * All rights reserved.
     *
     * Redistribution and use in source and binary forms, with or without
     * modification, are permitted provided that the following conditions
     * are met:
     *
     * *  Redistributions of source code must retain the above copyright
     *    notice, this list of conditions and the following disclaimer.
     *
     * *  Redistributions in binary form must reproduce the above copyright
     *    notice, this list of conditions and the following disclaimer in the
     *    documentation and/or other materials provided with the distribution.
     *
     * *  Neither the name of Texas Instruments Incorporated nor the names of
     *    its contributors may be used to endorse or promote products derived
     *    from this software without specific prior written permission.
     *
     * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
     * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
     * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
     * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
     * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
     * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
     * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
     * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
     * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
     * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
     * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
     */
    
    /*
     *  ======== EK_TM4C123GXL.c ========
     *  This file is responsible for setting up the board specific items for the
     *  EK_TM4C123GXL board.
     *
     *  The following defines are used to determine which TI-RTOS peripheral drivers
     *  to include:
     *     TI_DRIVERS_GPIO_INCLUDED
     *     TI_DRIVERS_SPI_INCLUDED
     *     TI_DRIVERS_UART_INCLUDED
     *     TI_DRIVERS_WATCHDOG_INCLUDED
     *     TI_DRIVERS_WIFI_INCLUDED
     *  These defines are created when a useModule is done on the driver in the
     *  application's .cfg file. The actual #define is in the application
     *  generated header file that is brought in via the xdc/cfg/global.h.
     *  For example the following in the .cfg file
     *     var GPIO = xdc.useModule('ti.drivers.GPIO');
     *  Generates the following
     *     #define TI_DRIVERS_GPIO_INCLUDED 1
     *  If there is no useModule of ti.drivers.GPIO, the constant is set to 0.
     *
     *  Note: a useModule is generated in the .cfg file via the graphical
     *  configuration tool when the "Add xxx to my configuration" is checked
     *  or "Use xxx" is selected.
     */
    #include <stdint.h>
    #include <stdbool.h>
    #include <inc/hw_memmap.h>
    #include <inc/hw_types.h>
    #include <inc/hw_ints.h>
    #include <inc/hw_gpio.h>
    
    #include <driverlib/gpio.h>
    #include <driverlib/sysctl.h>
    #include <driverlib/ssi.h>
    #include <driverlib/udma.h>
    #include <driverlib/pin_map.h>
    
    #include <xdc/std.h>
    #include <xdc/cfg/global.h>
    #include <xdc/runtime/System.h>
    #include <ti/sysbios/hal/Hwi.h>
    
    #include "EK_TM4C123GXL.h"
    
    #pragma DATA_ALIGN(EK_TM4C123GXL_DMAControlTable, 1024)
    static tDMAControlTable EK_TM4C123GXL_DMAControlTable[32];
    static int DMA_count = -1;
    
    /*
     *  ======== EK_TM4C123GXL_errorDMAHwi ========
     */
    static Void EK_TM4C123GXL_errorDMAHwi(UArg arg)
    {
        System_printf("DMA error code: %d\n", uDMAErrorStatusGet());
        uDMAErrorStatusClear();
        System_abort("DMA error!!");
    }
    
    /*
     *  ======== EK_TM4C123GXL_initDMA ========
     */
    Void EK_TM4C123GXL_initDMA(Void)
    {
        if(DMA_count == -1){
            Hwi_Params  hwiParams;
            Hwi_Handle  hwi;
    
            Hwi_Params_init(&hwiParams);
            hwi = Hwi_create(INT_UDMAERR, EK_TM4C123GXL_errorDMAHwi, &hwiParams, NULL);
            if (!hwi) {
                System_abort("Couldn't create DMA error hwi");
            }
    
            SysCtlPeripheralEnable(SYSCTL_PERIPH_UDMA);
            uDMAEnable();
            uDMAControlBaseSet(EK_TM4C123GXL_DMAControlTable);
    	DMA_count++;
        }
    }
    
    /*
     *  ======== EK_TM4C123GXL_initGeneral ========
     */
    Void EK_TM4C123GXL_initGeneral(Void)
    {
        SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOA);
        SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOB);
        SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOC);
        SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOD);
        SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOE);
        SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOF);
    }
    
    #if TI_DRIVERS_GPIO_INCLUDED
    #include <ti/drivers/GPIO.h>
    
    /* Callback functions for the GPIO interrupt example. */
    Void gpioButtonFxn(Void);
    Void gpioButtonFxn2(Void);
    
    /* GPIO configuration structure */
    const GPIO_HWAttrs gpioHWAttrs[EK_TM4C123GXL_GPIOCOUNT] = {
        {GPIO_PORTF_BASE, GPIO_PIN_1, GPIO_OUTPUT}, /* EK_TM4C123GXL_LED_RED */
        {GPIO_PORTF_BASE, GPIO_PIN_2, GPIO_OUTPUT}, /* EK_TM4C123GXL_LED_BLUE */
        {GPIO_PORTF_BASE, GPIO_PIN_3, GPIO_OUTPUT}, /* EK_TM4C123GXL_LED_GREEN */
        {GPIO_PORTF_BASE, GPIO_PIN_4, GPIO_INPUT},  /* EK_TM4C123GXL_GPIO_SW1 */
        {GPIO_PORTF_BASE, GPIO_PIN_0, GPIO_INPUT},  /* EK_TM4C123GXL_GPIO_SW2 */
    };
    
    /* GPIO callback structure to set callbacks for GPIO interrupts */
    const GPIO_Callbacks EK_TM4C123GXL_gpioPortFCallbacks = {
        GPIO_PORTF_BASE, INT_GPIOF,
        {gpioButtonFxn2, NULL, NULL, NULL, gpioButtonFxn, NULL, NULL, NULL}
    };
    
    const GPIO_Config GPIO_config[] = {
        {&gpioHWAttrs[0]},
        {&gpioHWAttrs[1]},
        {&gpioHWAttrs[2]},
        {&gpioHWAttrs[3]},
        {&gpioHWAttrs[4]},
        {NULL},
    };
    
    /*
     *  ======== EK_TM4C123GXL_initGPIO ========
     */
    Void EK_TM4C123GXL_initGPIO(Void)
    {
        /* Setup the LED GPIO pins used */
        GPIOPinTypeGPIOOutput(GPIO_PORTF_BASE, GPIO_PIN_1); /* EK_TM4C123GXL_LED_RED */
        GPIOPinTypeGPIOOutput(GPIO_PORTF_BASE, GPIO_PIN_2); /* EK_TM4C123GXL_LED_GREEN */
        GPIOPinTypeGPIOOutput(GPIO_PORTF_BASE, GPIO_PIN_3); /* EK_TM4C123GXL_LED_BLUE */
    
        /* Setup the button GPIO pins used */
        GPIOPinTypeGPIOInput(GPIO_PORTF_BASE, GPIO_PIN_4);  /* EK_TM4C123GXL_GPIO_SW1 */
        GPIOPadConfigSet(GPIO_PORTF_BASE, GPIO_PIN_4, GPIO_STRENGTH_4MA, GPIO_PIN_TYPE_STD_WPU);
    
        /* PF0 requires unlocking before configuration */
        HWREG(GPIO_PORTF_BASE + GPIO_O_LOCK) = GPIO_LOCK_KEY;
        HWREG(GPIO_PORTF_BASE + GPIO_O_CR) |= GPIO_PIN_0;
        GPIOPinTypeGPIOInput(GPIO_PORTF_BASE, GPIO_PIN_0);  /* EK_TM4C123GXL_GPIO_SW2 */
        GPIOPadConfigSet(GPIO_PORTF_BASE, GPIO_PIN_0, GPIO_STRENGTH_4MA, GPIO_PIN_TYPE_STD_WPU);
        HWREG(GPIO_PORTF_BASE + GPIO_O_LOCK) = GPIO_LOCK_M;
    
    
        /* Once GPIO_init is called, GPIO_config cannot be changed */
        GPIO_init();
    
        GPIO_write(EK_TM4C123GXL_LED_RED, EK_TM4C123GXL_LED_OFF);
        GPIO_write(EK_TM4C123GXL_LED_GREEN, EK_TM4C123GXL_LED_OFF);
        GPIO_write(EK_TM4C123GXL_LED_BLUE, EK_TM4C123GXL_LED_OFF);
    }
    #endif /* TI_DRIVERS_GPIO_INCLUDED */
    
    #if TI_DRIVERS_I2C_INCLUDED
    #include <ti/drivers/I2C.h>
    #include <ti/drivers/i2c/I2CTiva.h>
    
    /* I2C objects */
    I2CTiva_Object i2cTivaObjects[EK_TM4C123GXL_I2CCOUNT];
    
    /* I2C configuration structure, describing which pins are to be used */
    const I2CTiva_HWAttrs i2cTivaHWAttrs[EK_TM4C123GXL_I2CCOUNT] = {
        {I2C1_BASE, INT_I2C1},
        {I2C3_BASE, INT_I2C3},
    };
    
    const I2C_Config I2C_config[] = {
        {&I2CTiva_fxnTable, &i2cTivaObjects[0], &i2cTivaHWAttrs[0]},
        {&I2CTiva_fxnTable, &i2cTivaObjects[1], &i2cTivaHWAttrs[1]},
        {NULL, NULL, NULL}
    };
    
    /*
     *  ======== LM4F120H5QR_initI2C ========
     */
    Void EK_TM4C123GXL_initI2C(Void)
    {
        /* I2C1 Init */
        /* Enable the peripheral */
        SysCtlPeripheralEnable(SYSCTL_PERIPH_I2C1);
    
        /* Configure the appropriate pins to be I2C instead of GPIO. */
        GPIOPinConfigure(GPIO_PA6_I2C1SCL);
        GPIOPinConfigure(GPIO_PA7_I2C1SDA);
        GPIOPinTypeI2CSCL(GPIO_PORTA_BASE, GPIO_PIN_6);
        GPIOPinTypeI2C(GPIO_PORTA_BASE, GPIO_PIN_7);
    
        /* I2C3 Init */
        /* Enable the peripheral */
        SysCtlPeripheralEnable(SYSCTL_PERIPH_I2C3);
    
        /* Configure the appropriate pins to be I2C instead of GPIO. */
        GPIOPinConfigure(GPIO_PD0_I2C3SCL);
        GPIOPinConfigure(GPIO_PD1_I2C3SDA);
        GPIOPinTypeI2CSCL(GPIO_PORTD_BASE, GPIO_PIN_0);
        GPIOPinTypeI2C(GPIO_PORTD_BASE, GPIO_PIN_1);
    
        /*
         * These GPIOs are connected to PD0 and PD1 and need to be brought into a
         * GPIO input state so they don't interfere with I2C communications.
         */
        GPIOPinTypeGPIOInput(GPIO_PORTB_BASE, GPIO_PIN_6);
        GPIOPinTypeGPIOInput(GPIO_PORTB_BASE, GPIO_PIN_7);
    
        I2C_init();
    }
    #endif /* TI_DRIVERS_I2C_INCLUDED */
    
    #if TI_DRIVERS_SPI_INCLUDED
    #include <ti/drivers/SPI.h>
    #include <ti/drivers/spi/SPITivaDMA.h>
    
    /* SPI objects */
    SPITivaDMA_Object spiTivaDMAobjects[EK_TM4C123GXL_SPICOUNT];
    
    /* SPI configuration structure, describing which pins are to be used */
    const SPITivaDMA_HWAttrs spiTivaDMAHWAttrs[EK_TM4C123GXL_SPICOUNT] = {
        {
            SSI0_BASE,
            INT_SSI0,
            UDMA_CHANNEL_SSI0RX,
            UDMA_CHANNEL_SSI0TX,
            uDMAChannelAssign,
            UDMA_CH10_SSI0RX,
            UDMA_CH11_SSI0TX
        },
        {
            SSI2_BASE,
            INT_SSI2,
            UDMA_SEC_CHANNEL_UART2RX_12,
            UDMA_SEC_CHANNEL_UART2TX_13,
            uDMAChannelAssign,
            UDMA_CH12_SSI2RX,
            UDMA_CH13_SSI2TX
        },
        {
            SSI3_BASE,
            INT_SSI3,
            UDMA_SEC_CHANNEL_TMR2A_14,
            UDMA_SEC_CHANNEL_TMR2B_15,
            uDMAChannelAssign,
            UDMA_CH14_SSI3RX,
            UDMA_CH15_SSI3TX
        }
    };
    
    const SPI_Config SPI_config[] = {
        {&SPITivaDMA_fxnTable, &spiTivaDMAobjects[0], &spiTivaDMAHWAttrs[0]},
        {&SPITivaDMA_fxnTable, &spiTivaDMAobjects[1], &spiTivaDMAHWAttrs[1]},
        {&SPITivaDMA_fxnTable, &spiTivaDMAobjects[2], &spiTivaDMAHWAttrs[2]},
        {NULL, NULL, NULL},
    };
    
    /*
     *  ======== EK_TM4C123GXL_initSPI ========
     */
    Void EK_TM4C123GXL_initSPI(Void)
    {
        /* SPI1 */
        SysCtlPeripheralEnable(SYSCTL_PERIPH_SSI0);
    
        /* Need to unlock PF0 */
        GPIOPinConfigure(GPIO_PA2_SSI0CLK);
        GPIOPinConfigure(GPIO_PA3_SSI0FSS);
        GPIOPinConfigure(GPIO_PA4_SSI0RX);
        GPIOPinConfigure(GPIO_PA5_SSI0TX);
    
        GPIOPinTypeSSI(GPIO_PORTA_BASE, GPIO_PIN_2 | GPIO_PIN_3 |
                                        GPIO_PIN_4 | GPIO_PIN_5);
    
        /* SSI2 */
        SysCtlPeripheralEnable(SYSCTL_PERIPH_SSI2);
    
        GPIOPinConfigure(GPIO_PB4_SSI2CLK);
        GPIOPinConfigure(GPIO_PB5_SSI2FSS);
        GPIOPinConfigure(GPIO_PB6_SSI2RX);
        GPIOPinConfigure(GPIO_PB7_SSI2TX);
    
        GPIOPinTypeSSI(GPIO_PORTB_BASE, GPIO_PIN_4 | GPIO_PIN_5 |
                                        GPIO_PIN_6 | GPIO_PIN_7);
    
        /* SSI3 */
        SysCtlPeripheralEnable(SYSCTL_PERIPH_SSI3);
    
        GPIOPinConfigure(GPIO_PD0_SSI3CLK);
        GPIOPinConfigure(GPIO_PD1_SSI3FSS);
        GPIOPinConfigure(GPIO_PD2_SSI3RX);
        GPIOPinConfigure(GPIO_PD3_SSI3TX);
    
        GPIOPinTypeSSI(GPIO_PORTD_BASE, GPIO_PIN_0 | GPIO_PIN_1 |
                                        GPIO_PIN_2 | GPIO_PIN_3);
    
        EK_TM4C123GXL_initDMA();
        SPI_init();
    }
    #endif /* TI_DRIVERS_SPI_INCLUDED */
    
    #if TI_DRIVERS_UART_INCLUDED
    #include <ti/drivers/UART.h>
    #include <ti/drivers/uart/UARTTiva.h>
    
    /* UART objects */
    UARTTiva_Object uartTivaObjects[EK_TM4C123GXL_UARTCOUNT];
    
    /* UART configuration structure */
    const UARTTiva_HWAttrs uartTivaHWAttrs[EK_TM4C123GXL_UARTCOUNT] = {
        {UART0_BASE, INT_UART0}, /* EK_TM4C123GXL_UART0 */
    };
    
    const UART_Config UART_config[] = {
        {
            &UARTTiva_fxnTable,
            &uartTivaObjects[0],
            &uartTivaHWAttrs[0]
        },
        {NULL, NULL, NULL}
    };
    
    /*
     *  ======== EK_TM4C123GXL_initUART ========
     */
    Void EK_TM4C123GXL_initUART()
    {
        /* Enable and configure the peripherals used by the uart. */
        SysCtlPeripheralEnable(SYSCTL_PERIPH_UART0);
        GPIOPinConfigure(GPIO_PA0_U0RX);
        GPIOPinConfigure(GPIO_PA1_U0TX);
        GPIOPinTypeUART(GPIO_PORTA_BASE, GPIO_PIN_0 | GPIO_PIN_1);
    
        /* Initialize the UART driver */
        UART_init();
    }
    #endif /* TI_DRIVERS_UART_INCLUDED */
    
    /*
     *  ======== EK_TM4C123GXL_initUSB ========
     *  This function just turns on the USB
     */
    Void EK_TM4C123GXL_initUSB(EK_TM4C123GXL_USBMode usbMode)
    {
        /* Enable the USB peripheral and PLL */
        SysCtlPeripheralEnable(SYSCTL_PERIPH_USB0);
        SysCtlUSBPLLEnable();
    
        /* Setup pins for USB operation */
        GPIOPinTypeUSBAnalog(GPIO_PORTD_BASE, GPIO_PIN_4 | GPIO_PIN_5);
    
        if (usbMode == EK_TM4C123GXL_USBHOST) {
            System_abort("USB host not supported\n");
        }
    }
    
    #if TI_DRIVERS_WATCHDOG_INCLUDED
    #include <ti/drivers/Watchdog.h>
    #include <ti/drivers/watchdog/WatchdogTiva.h>
    
    /* Watchdog objects */
    WatchdogTiva_Object watchdogTivaObjects[EK_TM4C123GXL_WATCHDOGCOUNT];
    
    /* Watchdog configuration structure */
    const WatchdogTiva_HWAttrs watchdogTivaHWAttrs[EK_TM4C123GXL_WATCHDOGCOUNT] = {
        /* EK_TM4C123GXL_WATCHDOG0 with 1 sec period at default CPU clock freq */
        {WATCHDOG0_BASE, INT_WATCHDOG, 80000000},
    };
    
    const Watchdog_Config Watchdog_config[] = {
        {&WatchdogTiva_fxnTable, &watchdogTivaObjects[0], &watchdogTivaHWAttrs[0]},
        {NULL, NULL, NULL},
    };
    
    /*
     *  ======== EK_TM4C123GXL_initWatchdog ========
     *
     * NOTE: To use the other watchdog timer with base address WATCHDOG1_BASE,
     *       an additional function call may need be made to enable PIOSC. Enabling
     *       WDOG1 does not do this. Enabling another peripheral that uses PIOSC
     *       such as ADC0 or SSI0, however, will do so. Example:
     *
     *       SysCtlPeripheralEnable(SYSCTL_PERIPH_ADC0);
     *       SysCtlPeripheralEnable(SYSCTL_PERIPH_WDOG1);
     *
     *       See the following forum post for more information:
     *       http://e2e.ti.com/support/microcontrollers/stellaris_arm_cortex-m3_microcontroller/f/471/p/176487/654390.aspx#654390
     */
    Void EK_TM4C123GXL_initWatchdog()
    {
        /* Enable peripherals used by Watchdog */
        SysCtlPeripheralEnable(SYSCTL_PERIPH_WDOG0);
    
        /* Initialize the Watchdog driver */
        Watchdog_init();
    }
    #endif /* TI_DRIVERS_WATCHDOG_INCLUDED */
    
    #if TI_DRIVERS_WIFI_INCLUDED
    #include <ti/drivers/WiFi.h>
    #include <ti/drivers/wifi/WiFiTivaCC3000.h>
    
    /* WiFi objects */
    WiFiTivaCC3000_Object wiFiTivaCC3000Objects[EK_TM4C123GXL_WIFICOUNT];
    
    /* WiFi configuration structure */
    const WiFiTivaCC3000_HWAttrs wiFiTivaCC3000HWAttrs[EK_TM4C123GXL_WIFICOUNT] = {
        { GPIO_PORTB_BASE, /* IRQ port */
          GPIO_PIN_2,      /* IRQ pin */
          INT_GPIOB,       /* IRQ port interrupt vector */
    
          GPIO_PORTE_BASE, /* CS port */
          GPIO_PIN_0,      /* CS pin */
    
          GPIO_PORTB_BASE, /* WLAN EN port */
          GPIO_PIN_5       /* WLAN EN pin */
        }
    };
    
    const WiFi_Config WiFi_config[] = {
        {&WiFiTivaCC3000_fxnTable,
         &wiFiTivaCC3000Objects[0],
         &wiFiTivaCC3000HWAttrs[0]},
        {NULL, NULL, NULL},
    };
    
    /*
     *  ======== EK_TM4C123GXL_initWiFi ========
     */
    Void EK_TM4C123GXL_initWiFi(Void)
    {
        /* Configure IRQ pin */
        GPIOPinTypeGPIOInput(GPIO_PORTB_BASE, GPIO_PIN_2);
    
        GPIOPadConfigSet(GPIO_PORTB_BASE, GPIO_PIN_2, GPIO_STRENGTH_2MA,
                                GPIO_PIN_TYPE_STD_WPU);
    
        /* Configure WLAN EN pin */
        GPIOPinTypeGPIOOutput(GPIO_PORTB_BASE, GPIO_PIN_5);
        GPIOPadConfigSet(GPIO_PORTB_BASE, GPIO_PIN_5, GPIO_STRENGTH_2MA,
                                GPIO_PIN_TYPE_STD_WPD);
        GPIOPinWrite(GPIO_PORTB_BASE, GPIO_PIN_5, 0);
    
        /* Configure CS pin */
        GPIOPinTypeGPIOOutput(GPIO_PORTE_BASE, GPIO_PIN_0);
        GPIOPadConfigSet(GPIO_PORTE_BASE, GPIO_PIN_0, GPIO_STRENGTH_2MA,
                                GPIO_PIN_TYPE_STD_WPU);
        GPIOPinWrite(GPIO_PORTE_BASE, GPIO_PIN_0, (~0));
    
        /* Configure SSI2 */
        SysCtlPeripheralEnable(SYSCTL_PERIPH_SSI2);
    
        GPIOPinConfigure(GPIO_PB4_SSI2CLK);
        GPIOPinConfigure(GPIO_PB6_SSI2RX);
        GPIOPinConfigure(GPIO_PB7_SSI2TX);
    
        GPIOPinTypeSSI(GPIO_PORTB_BASE, GPIO_PIN_4 | GPIO_PIN_6 | GPIO_PIN_7);
    
        /* Call necessary SPI init functions */
        SPI_init();
        EK_TM4C123GXL_initDMA();
    
        /* Initialize WiFi driver */
        WiFi_init();
    }
    #endif /* TI_DRIVERS_WIFI_INCLUDED */
    

    EK_TM4C123GXL.h

    /*
     * Copyright (c) 2013, Texas Instruments Incorporated
     * All rights reserved.
     *
     * Redistribution and use in source and binary forms, with or without
     * modification, are permitted provided that the following conditions
     * are met:
     *
     * *  Redistributions of source code must retain the above copyright
     *    notice, this list of conditions and the following disclaimer.
     *
     * *  Redistributions in binary form must reproduce the above copyright
     *    notice, this list of conditions and the following disclaimer in the
     *    documentation and/or other materials provided with the distribution.
     *
     * *  Neither the name of Texas Instruments Incorporated nor the names of
     *    its contributors may be used to endorse or promote products derived
     *    from this software without specific prior written permission.
     *
     * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
     * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
     * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
     * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
     * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
     * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
     * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
     * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
     * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
     * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
     * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
     */
    /** ============================================================================
     *  @file       EK_TM4C123GXL.h
     *
     *  @brief      EK_TM4C123GXL Board Specific APIs
     *
     *  The EK_TM4C123GXL header file should be included in an application as follows:
     *  @code
     *  #include <EK_TM4C123GXL.h>
     *  @endcode
     *
     *  ============================================================================
     */
    #ifndef __EKS_LM4F232_H
    #define __EKS_LM4F232_H
    
    #ifdef __cplusplus
    extern "C" {
    #endif
    
    #include <ti/drivers/GPIO.h>
    
    /* LEDs on EK_TM4C123GXL are active high. */
    #define EK_TM4C123GXL_LED_OFF (0)
    #define EK_TM4C123GXL_LED_ON  (~0)
    
    /* GPIO_Callbacks structure for GPIO interrupts */
    extern const GPIO_Callbacks EK_TM4C123GXL_gpioPortFCallbacks;
    
    /*!
     *  @def    EK_TM4C123GXL_GPIOName
     *  @brief  Enum of GPIO names on the EK_TM4C123GXL dev board
     */
    typedef enum EK_TM4C123GXL_GPIOName {
        EK_TM4C123GXL_LED_RED = 0,
        EK_TM4C123GXL_LED_BLUE,
        EK_TM4C123GXL_LED_GREEN,
        EK_TM4C123GXL_GPIO_SW1,
        EK_TM4C123GXL_GPIO_SW2,
    
        EK_TM4C123GXL_GPIOCOUNT
    } EK_TM4C123GXL_GPIOName;
    
    /*!
     *  @def    EK_TM4C123GXL_I2CName
     *  @brief  Enum of I2C names on the EK_TM4C123GXL dev board
     */
    typedef enum EK_TM4C123GXL_I2CName {
        EK_TM4C123GXL_I2C1 = 0,
        EK_TM4C123GXL_I2C3,
    
        EK_TM4C123GXL_I2CCOUNT
    } EK_TM4C123GXL_I2CName;
    
    /*!
     *  @def    EK_TM4C123GXL_SPIName
     *  @brief  Enum of SPI names on the EK_TM4C123GXL dev board
     */
    typedef enum EK_TM4C123GXL_SPIName {
        EK_TM4C123GXL_SPI0 = 0,
        EK_TM4C123GXL_SPI2,
        EK_TM4C123GXL_SPI3,
    
        EK_TM4C123GXL_SPICOUNT
    } EK_TM4C123GXL_SPIName;
    
    /*!
     *  @def    EK_TM4C123GXL_UARTName
     *  @brief  Enum of UARTs on the EK_TM4C123GXL dev board
     */
    typedef enum EK_TM4C123GXL_UARTName {
        EK_TM4C123GXL_UART0 = 0,
    
        EK_TM4C123GXL_UARTCOUNT
    } EK_TM4C123GXL_UARTName;
    
    /*!
     *  @def    EK_TM4C123GXL_USBMode
     *  @brief  Enum of USB setup function on the EK_TM4C123GXL dev board
     */
    typedef enum EK_TM4C123GXL_USBMode {
        EK_TM4C123GXL_USBDEVICE,
        EK_TM4C123GXL_USBHOST
    } EK_TM4C123GXL_USBMode;
    
    /*!
     *  @def    EK_TM4C123GXL_WatchdogName
     *  @brief  Enum of Watchdogs on the EK_TM4C123GXL dev board
     */
    typedef enum EK_TM4C123GXL_WatchdogName {
        EK_TM4C123GXL_WATCHDOG0 = 0,
    
        EK_TM4C123GXL_WATCHDOGCOUNT
    } EK_TM4C123GXL_WatchdogName;
    
    /*!
     *  @def    EK_TM4C123GXL_WiFiName
     *  @brief  Enum of WiFi names on the EK_TM4C123GXL dev board
     */
    typedef enum EK_TM4C123GXL_WiFiName {
        EK_TM4C123GXL_WIFI = 0,
    
        EK_TM4C123GXL_WIFICOUNT
    } EK_TM4C123GXL_WiFiName;
    
    /*!
     *  @brief  Initialize board specific DMA settings
     *
     *  This function creates a hwi in case the DMA controller creates an error
     *  interrrupt, enables the DMA and supplies it with a uDMA control table.
     */
    extern Void EK_TM4C123GXL_initDMA(Void);
    
    /*!
     *  @brief  Initialize the general board specific settings
     *
     *  This function initializes the general board specific settings. This include
     *     - Flash wait states based on the process
     *     - Disable clock source to watchdog module
     *     - Enable clock sources for peripherals
     */
    extern Void EK_TM4C123GXL_initGeneral(Void);
    
    /*!
     *  @brief  Initialize board specific GPIO settings
     *
     *  This function initializes the board specific GPIO settings and
     *  then calls the GPIO_init API to initialize the GPIO module.
     *
     *  The GPIOs controlled by the GPIO module are determined by the GPIO_config
     *  variable.
     */
    extern Void EK_TM4C123GXL_initGPIO(Void);
    
    /*!
     *  @brief  Initialize board specific I2C settings
     *
     *  This function initializes the board specific I2C settings and then calls
     *  the I2C_init API to initialize the I2C module.
     *
     *  The I2C peripherals controlled by the I2C module are determined by the
     *  I2C_config variable.
     */
    extern Void EK_TM4C123GXL_initI2C(Void);
    
    /*!
     *  @brief  Initialize board specific SPI settings
     *
     *  This function initializes the board specific SPI settings and then calls
     *  the SPI_init API to initialize the SPI module.
     *
     *  The SPI peripherals controlled by the SPI module are determined by the
     *  SPI_config variable.
     */
    extern Void EK_TM4C123GXL_initSPI(Void);
    
    /*!
     *  @brief  Initialize board specific UART settings
     *
     *  This function initializes the board specific UART settings and then calls
     *  the UART_init API to initialize the UART module.
     *
     *  The UART peripherals controlled by the UART module are determined by the
     *  UART_config variable.
     */
    extern Void EK_TM4C123GXL_initUART(Void);
    
    /*!
     *  @brief  Initialize board specific USB settings
     *
     *  This function initializes the board specific USB settings and pins based on
     *  the USB mode of operation.
     *
     *  @param      usbMode    USB mode of operation
     */
    extern Void EK_TM4C123GXL_initUSB(EK_TM4C123GXL_USBMode usbMode);
    
    /*!
     *  @brief  Initialize board specific Watchdog settings
     *
     *  This function initializes the board specific Watchdog settings and then
     *  calls the Watchdog_init API to initialize the Watchdog module.
     *
     *  The Watchdog peripherals controlled by the Watchdog module are determined
     *  by the Watchdog_config variable.
     */
    extern Void EK_TM4C123GXL_initWatchdog(Void);
    
    /*!
     *  @brief  Initialize board specific WiFi settings
     *
     *  This function initializes the board specific WiFi settings and then calls
     *  the WiFi_init API to initialize the WiFi module.
     *
     *  The hardware resources controlled by the WiFi module are determined by the
     *  WiFi_config variable.
     */
    extern Void EK_TM4C123GXL_initWiFi(Void);
    
    #ifdef __cplusplus
    }
    #endif
    
    #endif /* __EK_TM4C123GXL_BOARD_H */
    

    Now it compiles without any errors, but the output stucks at "before I2C_transfer". I connected +3.3V and GND to a HYT-221 Sensor, the SDA signal to PE5 and SCL to PD0.

    best regards

    Thorsten

  • Thorsten Gensler said:
    Now it compiles without any errors, but the output stucks at "before I2C_transfer". I connected +3.3V and GND to a HYT-221 Sensor, the SDA signal to PE5 and SCL to PD0.

    You need to update EK_TM4C123GXL_initI2C(Void)so that you're pin-muxing the correct I2C controller to pins PE5 and PD0. Then make sure that you're using that particular I2C controller (e.g. EK_TM4C123GXL_I2Cn) when you call I2C_open().