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.

Execution Graph Gaps due to Data Loss and Log Start Control

Other Parts Discussed in Thread: SYSBIOS

I am working on a TI-RTOS (1.21.00.09) project and am new to this tool chain.

I am trying to debug a problem using the Execution Graph tool but am having two major problems.  My situation is that I need to start my application then change over to terminal program and send a block of bytes into a COMM port on my launchpad.  The issues I am having are:

1.  The graph either only shows start-up events and does not record long enough to capture the events related to my serial data.

2.  I end up with "gap due to data loss" warnings and red "X"'s on the graph.  Again, I don't end up seeing anything relating to my area of concern.

I have read in the System Analyzer's User Guide (rev E) section 5.4.2  that I can turn the ANALYSIS logging ON or OFF in my code.  I did this but am still getting large gaps of NO data and the data loss warning.


Can anyone help me figure out how to setup this tool so I can use it?

  • Here is the last output of the Execution Graph:

  • Hi Stephen,

    I have a few questions so I understand your end goal:

    1. Which device are you on?

    2. Also are you using StopMode (default) or are you sending the Log events out the UART or USB?

    3. What events do you want? I'm assuming Task to see the context switches, but do you want Hwi and Swi also. Do you have Log statements in your code that you'd like to see?

    Todd

  • Sorry for leaving these details out...

    MCU is TM4C123 on the Launchpad.  I am configured using Stopmode.  I want to see tasks and Swi's but only at receipt of first character in my uart callback.  I would also like to see the callback routine activity as that seems to be where my problem is - in summary; my code works as expected for serial packets of 5 or less characters; when I send 6 or more it stops working correctly.  Correct execution is defined as the CLOCK module one-shot timer timing out (clk1) resulting in execution of the Swi clk0Fxn which then will post the rxMessageReady Semaphore.  I have tried XGCONF CLOCK timers, Timer module tic down counters, and dynamically generated CLOCK timers (as is the current state of the code).  I realize that my Timer module couter approach should have used HWI_Disable locks around the counters (I think this as I understand that the callback operates in the HWI context); however, the other approaches also have the same problem so I couldn't see this a root cause.

    Here is my code and CFG file.  Please ignore some of the scattered unused code as I have been struggling to find this problem for some time now and tried a lot of solutions to no affect.

    (see my previous post - http://e2e.ti.com/support/embedded/tirtos/f/355/p/315595/1099877.aspx)

    MAIN CODE:


    /******************************************************************************\
    * INCLUDE FILES
    \******************************************************************************/
    
    /* XDCtools Header files */
    #include <xdc/std.h>
    #include <xdc/cfg/global.h>
    #include <xdc/runtime/System.h>
    #include <xdc/runtime/Log.h>				//used for Log_info() calls
    #include <xdc/runtime/Diags.h>
    
    /* BIOS Header files */
    #include <ti/sysbios/BIOS.h>
    #include <ti/sysbios/hal/Hwi.h>
    #include <ti/sysbios/knl/Clock.h>
    
    /* TI-RTOS Header files */
    #include <ti/drivers/GPIO.h>
    #include <ti/drivers/UART.h>
    
    /* Board Header files */
    #include "Board.h"
    #include "INA226.H"
    #include "24AA256.H"
    #include "KSZ8895.H"
    #include "MCP3426.H"
    #include "SC16IS752.H"
    
    
    /******************************************************************************\
    * ROM CONSTANTS
    \******************************************************************************/
    /*
     * Menus and Prompts
     */
    const Char configMenu[] = 	"\f1. Exit\r\n"
    							"2. Select ACTIVE Command Port\r\n"
    							"3. Select ACTIVE Linked Port\r\n"
    							"4. Configure Reporting\r\n";
    const Char cmdPortSelectMenu[] = 	"0. Abort\r\n"
    									"1. UART0\r\n"
    									"2. UART1\r\n";
    const Char configPrompt[] = "MCB-Q1 Test CMD>\r\n";
    const Char cmdPortPrompt[] = "\nSelect ACTIVE command port";
    
    /******************************************************************************\
    * DEFINED CONSTANTS
    \******************************************************************************/
    #define UARTBUFSIZE		(256)
    #define NUMUARTS		(MCB_IO_UARTCOUNT + 2)	// Includes the SPI UARTS
    #define SPIUART0		(MCB_IO_UARTCOUNT)
    #define SPIUART1		(MCB_IO_UARTCOUNT+1)
    #define NUMTXBUFFS		(2)		// Maximum Simultaneous TX Processes
    
    /******************************************************************************\
    * MACROS
    \******************************************************************************/
    
    
    
    
    /******************************************************************************\
    * TYPE DEFINITIONS
    \******************************************************************************/
    // Configuration Modes
    typedef enum cmType {cmRun = 0, cmCommand} _cmType;
    // Comm-port Type
    typedef enum ctType {ctMcuCmd = 0, ctTpComm} _ctType;
    
    typedef struct portDCB {
    	bool			portOpened;		// TRUE if port is Opened
        UART_Handle		handle;			// Port access handle
        UART_Params 	params;			// Port configuration Parameters
        _ctType			uPorttype;		// Port Type
        bool			txMode;			// TRUE if in Transmit Mode
        MCB_IO_GPIOName	RTS_pin;		// RS-485 RTS GPIO Pin
        Char			rxInChar;		// Buffer for current RX'd byte
    	Char			rxBuff[UARTBUFSIZE];	// RX Buffer (TX Managed by commTxTask
    	void *			linkedPort;		// Pointer to uartDCB of the Linked Port
    	uint8_t			index;			// Pointer to Next Byte
    	uint8_t			count;			// Bytes RX'd or to TX
    	int		 		EOFCounter;		// RX End of Frame Counter (re:commFrameIsr)
    	int				RTSCounter;		// TX End of Frame Counter (re:commFrameIsr)
    	uint32_t		bytesRX;		// Total bytes received
    	uint32_t		lostBytesRx;	// Bytes discarded due to RX when INACTIVE
    	uint32_t		bytesTX;		// Total bytes transmitted
    } uartDCB;
    
    typedef struct portMap {
    	uartDCB			*portDCB;		// DCB of linked UART port
    } _portMap;
    
    
    // System Configuration
    typedef struct _config {
    	_cmType	mode;
    	void * 	activeCmdPort;			// Active Command Port (type ctMcuCmd)
    	void * 	activeTpPort;			// Active Third Party Port (type ctTpComm)
    	struct _report {
    		bool verbose;				// Report ALL data if TRUE
    		bool portBytes;				// Report Bytes TX and RX for Active Ports (All if Verbose True)
    		bool sfp0Data;				// Report SFP0 data
    		bool sfp1Data;				// Report SFP1 data
    		bool eeData;				// Simple access P/F
    		bool adData;				// 1.2 and 3.3V A/D data
    		bool inaData;				// System bus Voltage and Current
    	} report;
    } config;
    
    typedef struct sfpData {
    	Char		i2cPort;			// I2C Interface
    	Char		i2cAddress;			// I2C Address
    	bool		sfpDisabled;		// DIS pin (3) driven HIGH to Disable Module
    	bool		moduleDetected;		// Module Pin 6 (Pin Low = Module Present)
    	bool		txFault;			// Module Pin 2 (Pin Low = Normal Operation)
    	Char		vendorName[16];		// Vendor Name Register 20-35 (ASCII)
    	Char		vendorSN[16];		// Vendor Module S/N Register 68-83 (ASCII)
    	//
    	//
    	//  !!!  NEED TO KNOW WHAT OTHER REGISTERS NEED REPORTING  !!!
    	//  --- Don't have SFP MSA ---
    	//  --- SFF-8472 helpful but does not seem to have diagnostic specifics ---
    	//
    } _sfpData;
    
    typedef struct eeData {
    	Char		i2cPort;			// I2C Interface
    	Char		i2cAddress;			// I2C Address
    	Char		serialNo[4];		// 32-bit Electronic Serial Number
    } _eeData;
    
    typedef struct a2dData {
    	Char		i2cPort;			// I2C Interface
    	Char		i2cAddress;			// I2C Address
    	uint16_t	volts1_2;			// Voltage data for 1.2V P/S
    	uint16_t	volts3_3;			// Voltage data for 3.3V P/S
    } _a2dData;
    
    typedef struct	ina226 {
    	Char		i2cPort;			// I2C Interface
    	Char		i2cAddress;			// I2C Address
    	bool		calibrated;			// True if Device is Calibrate (Power OK to read)
    	uint16_t	busVolts;			// Bus Voltage A/D Raw Data
    	uint16_t	shuntVolts;			// Shunt Voltage A/D Raw Data
    	uint16_t	busAmps;			// Bus Current (Valid ONLY if calibrated)
    	uint16_t	power;				// Calculated Power (Valid ONLY if calibrated)
    } _ina226;
    
    /******************************************************************************\
    * GLOBAL VARIABLES
    \******************************************************************************/
    //
    // System Configuration Structure
    //
    config	sysConfig;
    
    _sfpData	sfp0Data;
    _sfpData	sfp1Data;
    _eeData		eepromtData;
    _a2dData	a2dData;
    _ina226		ina226Data;
    
    
    //
    // UART Control Structures
    //
    uartDCB	uart0DCB;
    uartDCB	uart1DCB;
    uartDCB	uart2DCB;
    uartDCB	uart3DCB;
    uartDCB	uart4DCB;
    uartDCB	uart5DCB;
    uartDCB	uart6DCB;
    uartDCB	uart7DCB;
    uartDCB	uartSb0DCB;
    uartDCB	uartSb1DCB;
    
    //
    // Array of pointers to link UARTS for message passing
    //
    _portMap	portData[NUMUARTS];
    
    Clock_Handle clk1;
    Clock_Handle clk2;
    Clock_Params clkParams;
    
    /******************************************************************************\
    * FUNCTION PROTOTYPES
    \******************************************************************************/
    void uart1readCallback(UART_Handle uHandle, Char *p_buffer, int size);
    void uart1writeCallback(UART_Handle uHandle, Char *p_buffer, int size);
    void uart2readCallback(UART_Handle uHandle, Char *p_buffer, int size);
    void uart2writeCallback(UART_Handle uHandle, Char *p_buffer, int size);
    
    Void clk0Fxn(UArg arg0);
    Void clk1Fxn(UArg arg0);
    
    
    /******************************************************************************\
    * RTOS OBJECTS
    \******************************************************************************/
    
    //////////////////////////////////////////////////////////////////////////////
    //////////////////////////////       HWI       ///////////////////////////////
    //////////////////////////////////////////////////////////////////////////////
    /*
     * commWatchIsrFxn
     */
    void commWatchIsrFxn(void)
    {
    	static UInt oldCharsRx = 0;
    	static UInt charsRx = 0;
    	static UInt state = 0;
    
    	switch (state)
    	{
    	case 0:
    		charsRx = UARTCharsAvail(Board_UART1);
    		if(charsRx) {}
    		break;
    
    	case 10:
    		break;
    	}
    
    }
    
    /*
     * commFrameIsr
     */
    void commFrameIsr(void)
    {
    	//UInt hwiKey;
    //	Log_info2("CFIsr-st: EOFCounter = [%u] RTSCounter = [%u]",uart1DCB.EOFCounter, uart1DCB.RTSCounter);
    
    	if(uart1DCB.EOFCounter > 0) uart1DCB.EOFCounter--;
    	else if(uart1DCB.EOFCounter != -1)
    	{
    		uart1DCB.EOFCounter = -1;
    //		Semaphore_post(u1MessageReady);
    		// Fire message processing SWI
    		Log_info1("CFIsr: Swi_post(u1RxDoneSwi) EOFCounter = [%u]",uart1DCB.EOFCounter);
    		Swi_post(u1RxDoneSwi);
    	}
    
    	if(uart1DCB.RTSCounter > 0) uart1DCB.RTSCounter--;
    	else if(uart1DCB.RTSCounter != -1)
    	{
    		uart1DCB.RTSCounter = -1;
    //		Semaphore_post(u1MessageReady);
    		// Fire message processing SWI
    		Log_info1("CFIsr: Swi_post(u1TxDoneSwi) EOFCounter = [%u]",uart1DCB.EOFCounter);
    		Swi_post(u1TxDoneSwi);
    	}
    
    //	Log_info2("CFIsr-en: EOFCounter = [%u] RTSCounter = [%u]",uart1DCB.EOFCounter, uart1DCB.RTSCounter);
    
    
    }
    
    /* =============================  READ CALLBACKS  ============================= */
    
    /*
     * UART1 - Read Callback
     */
    void uart1readCallback(UART_Handle handle, Char *p_buffer, int size)
    {
    //UInt hwiKey;
    uartDCB	*dcb;
    dcb = &uart1DCB;
    
    	Diags_setMask("ti.sysbios.knl.Tasks+Z");
    	Diags_setMask("ti.sysbios.knl.Swi+Z");
    
    	Log_info3("RXcb-st: Size=[%u] TXMode=[%u] count=[%u]",size, dcb->txMode,dcb->count);
        // Ignore zero byte calls
    	if(size > 0)
    	{
    		// Is port in Receive Mode
    		if(dcb->txMode)
    		{
    			dcb->lostBytesRx += 1;
    		} else {
    
    			// Re-Trigger the UART2 End of Message Detection Timer
    			Clock_stop(clk1);
    			Clock_setTimeout(clk1, 5);
    			Clock_start(clk1);
    
    			// Reload the End of Frame Counter
    	//		hwiKey = Hwi_disable();
    			dcb->EOFCounter = 2;
    	//		Hwi_restore(hwiKey);
    
    			// Arm Receiver for next callback
    			dcb->rxBuff[dcb->count++] = *p_buffer;
    			UART_read(handle,  &dcb->rxInChar, 1);
    		}
    	}
    //	Log_info2("RXcb-en: EOFCounter = [%u] RTSCounter = [%u]",dcb->EOFCounter, dcb->RTSCounter);
    }
    
    /*
     * UART2 - Read Callback
     */
    void uart2readCallback(UART_Handle handle, Char *p_buffer, int size)
    {
    //UInt hwiKey;
    uartDCB	*dcb;
    dcb = &uart2DCB;
    
    	Log_info3("RXcb-st: Size=[%u] TXMode=[%u] count=[%u]",size, dcb->txMode,dcb->count);
        // Ignore zero byte calls
    	if(size > 0)
    	{
    		// Is port in Receive Mode
    		if(dcb->txMode)
    		{
    			dcb->lostBytesRx += 1;
    		} else {
    
    			// Re-Trigger the UART2 End of Message Detection Timer
    			Clock_stop(clk1);
    			Clock_setTimeout(clk1, 5);
    			Clock_start(clk1);
    
    			// Reload the End of Frame Counter
    	//		hwiKey = Hwi_disable();
    			dcb->EOFCounter = 2;
    	//		Hwi_restore(hwiKey);
    
    			// Arm Receiver for next callback
    			dcb->rxBuff[dcb->count++] = *p_buffer;
    			UART_read(handle,  &dcb->rxInChar, 1);
    		}
    	}
    //	Log_info2("RXcb-en: EOFCounter = [%u] RTSCounter = [%u]",dcb->EOFCounter, dcb->RTSCounter);
    }
    
    /* =============================  WRITE CALLBACKS  ============================= */
    
    /*
     * UART1 - Write Callback
     */
    void uart1writeCallback(UART_Handle handle, Char *p_buffer, int size)
    {
    	uartDCB *dcb;
    	uartDCB *linkPort;
    	dcb = &uart1DCB;
    	linkPort = portData[Board_UART1].portDCB;
    
    	Log_info2("TXcb-st: EOFCounter = [%u] RTSCounter = [%u]",dcb->EOFCounter, dcb->RTSCounter);
    	if(linkPort->index < linkPort->count)
    	{
    		// Send next byte
    		// Start TX by sending the first byte
    		UART_write(dcb->handle, &(linkPort->rxBuff[(linkPort->index)++]), 1);
    		linkPort->RTSCounter = 2;
    		Clock_stop(clk2);
    		Clock_setTimeout(clk2, 5);
    		Clock_start(clk2);
    
    	}
    
    	if(linkPort->index >= linkPort->count)
    	{
    		// No more data to send - set delay for RTS / UART Mode change
    	//	Clock_setTimeout(u1TxOneShot, 5);
    	//	Clock_start(u1TxOneShot);
    	}
    	Log_info2("TXcb-en: EOFCounter = [%u] RTSCounter = [%u]",dcb->EOFCounter, dcb->RTSCounter);
    
    }
    
    /*
     * UART2 - Write Callback
     */
    void uart2writeCallback(UART_Handle handle, Char *p_buffer, int size)
    {
    	uartDCB *dcb;
    	uartDCB *linkPort;
    	dcb = &uart2DCB;
    	linkPort = portData[Board_UART2].portDCB;
    
    	Log_info2("TXcb-st: EOFCounter = [%u] RTSCounter = [%u]",dcb->EOFCounter, dcb->RTSCounter);
    	if(linkPort->index < linkPort->count)
    	{
    		// Send next byte
    		// Start TX by sending the first byte
    		UART_write(dcb->handle, &(linkPort->rxBuff[(linkPort->index)++]), 1);
    		linkPort->RTSCounter = 2;
    		Clock_stop(clk2);
    		Clock_setTimeout(clk2, 5);
    		Clock_start(clk2);
    
    	}
    
    	if(linkPort->index >= linkPort->count)
    	{
    		// No more data to send - set delay for RTS / UART Mode change
    	//	Clock_setTimeout(u1TxOneShot, 5);
    	//	Clock_start(u1TxOneShot);
    	}
    	Log_info2("TXcb-en: EOFCounter = [%u] RTSCounter = [%u]",dcb->EOFCounter, dcb->RTSCounter);
    
    }
    
    //////////////////////////////////////////////////////////////////////////////
    //////////////////////////////       SWI       ///////////////////////////////
    //////////////////////////////////////////////////////////////////////////////
    /*
     * Void clk0Fxn(UArg arg0);
     */
    Void clk0Fxn(UArg arg0)
    {
    	// Alert Communications Processor that a Message is ready for processing
    	Semaphore_post(rxMessageReady);
    }
    
    Void clk1Fxn(UArg arg0)
    {
    	// Alert Communications Processor that a Message is ready for processing
    	Semaphore_post(rxMessageReady);
    }
    
    /*
     * UART1 TX Last Character RTS Delay Timer Function
     */
    void u1RxFrameDetectFxn(UArg arg0)
    {
    //	Clock_stop(u1RxFrameDetect);
    	Swi_post(u1RxDoneSwi);
    }
    
    void u1TxRtsTimerFxn(UArg arg0)
    {
    //	Clock_stop(u1TxRtsTimer);
    	Swi_post(u1TxDoneSwi);
    }
    //void u1TxOneShotFxn(UArg arg0)
    //{
    //	// Transmit shift register operations should now be completed
    //	// Change driver RTS line for Receive mode
    //	GPIO_write(Board_U1_RTS, MCB_IO_485_RX);
    //
    //	// Reset DCB for Receive
    //	uart1DCB.count = 0;
    //	uart1DCB.index = 0;
    //	uart1DCB.txMode = FALSE;
    //
    //}
    
    
    /*
     * ======== u1RxDoneSwiFxn ========
     *
     */
    void u1RxDoneSwiFxn(UArg arg0)
    {
    	uartDCB *dcb;
    	uartDCB *linkPort;
    	dcb = &uart1DCB;
    	linkPort = portData[Board_UART1].portDCB;
    
    	// Update Port Bytes Received Count
    	dcb->bytesRX += dcb->count;
    
    	// Process buffer if a port is linked to this port
    	if(dcb->linkedPort != NULL)
    	{
    		// Linked - so let's pass RX Buffer to Linked Ports TX routine
    		// Set Link port to TX Mode
    		linkPort->txMode = TRUE;
    
    		// Set link port's RS-485 Driver for TX
    		GPIO_write(linkPort->RTS_pin, MCB_IO_485_TX);
    
    		//Prepare DCB for TX Operation
    		dcb->index = 0;
    
    		// Update Linked Port's stats
    		linkPort->bytesTX += dcb->count;
    
    		// Start TX by sending the first byte from RX Port Buffer to TX Port
    		UART_write(linkPort->handle, &(dcb->rxBuff[(dcb->index)++]), 1);
    
    		// Set RTS Timeout Timer
    		linkPort->RTSCounter = 2;
    	//	Clock_stop(u1TxRtsTimer);
    	//	Clock_setTimeout(u1TxRtsTimer, 5);
    	//	Clock_start(u1TxRtsTimer);
    
    	} else {
    		// Message received on INACTIVE port - DISCARD
    		dcb->count = 0;
    		dcb->index = 0;
    		dcb->txMode = FALSE;
    
    		// Log Discarded Message
    		dcb->lostBytesRx += dcb->count;
    	}
    }
    
    /*
     * ======== u1TxDoneSwiFxn ========
     *
     */
    void u1TxDoneSwiFxn(UArg arg0)
    {
    	// Reset DCB for Receive
    	uart1DCB.count = 0;
    	uart1DCB.index = 0;
    	uart1DCB.txMode = FALSE;
    
    	GPIO_write(Board_U1_RTS, MCB_IO_485_RX);
    
    	// Arm Receiver for next callback
        UART_read(uart1DCB.handle,  &uart1DCB.rxInChar, 1);
    }
    
    
    //////////////////////////////////////////////////////////////////////////////
    //////////////////////////////      TASK       ///////////////////////////////
    //////////////////////////////////////////////////////////////////////////////
    /*
     * KSZ8895 Ethernet Switch Control Task
     */
    void eNetSwitchCommandTaskFxn(void)
    {
    	static Int	theState = 0;
    
    	static bool taskRun = true;
    
    	while (taskRun) {
    
    		switch (theState) {
    		case 0:
    			break;
    
    		case 10:
    			break;
    		}
    
    	}	// while (taskRun)
    
    }
    
    /*
     * Communications Processor Task
     *
     * Select ACTIVE SFP interface
     * Select ACTIVE MCU Command Interface Port
     * Select ACTIVE Output Port.
     * Reset Report Counters
     * Exit Command Mode
     */
    void commProcessorTaskFxn(void)
    {
    
    	static Int	theState = 0;
    	uartDCB *inPort;
    	uartDCB *outPort;
    
    	static bool taskRun = true;
    
    	while (taskRun) {
    
    		switch (theState) {
    		case 0:
    			break;
    
    		case 10:
    			// Wait for signal that a message has been received and is ready to process
    			Semaphore_pend(rxMessageReady, BIOS_WAIT_FOREVER);
    
    			break;
    		}
    
    	}	// while (taskRun)
    
    
    }
    
    /*
     * Report Printing Task
     */
    void reportTaskFxn(void)
    {
    	static Int	theState = 0;
    
    	static bool taskRun = true;
    
    	while (taskRun) {
    
    		switch (theState) {
    		case 0:
    			break;
    
    		case 10:
    			break;
    		}
    
    	}	// while (taskRun)
    
    }
    
    /*
     * User Configuration Command Interface Task
     */
    void configurationTaskFxn(void)
    {
    	static Int	theState = 0;
    
    	static bool taskRun = true;
    
    	while (taskRun) {
    
    		switch (theState) {
    		case 0:
    			break;
    
    		case 10:
    			break;
    		}
    
    	}	// while (taskRun)
    }
    
    /*
     * IDLE Thread - System Data Collection Task
     */
    void dataCollectorTaskFxn(void)
    {
    	static Int	theState = 0;
    
    	switch (theState) {
    	case 0:
    		break;
    
    	case 10:
    		break;
    	}
    
    
    }
    
    /******************************************************************************\
    * FUNCTIONS
    \******************************************************************************/
    /*
     * UART Initialization Function
     */
    void uartDcbInit(void)
    {
    
    	portData[Board_UART0].portDCB = &uart0DCB;
    	portData[Board_UART1].portDCB = &uart1DCB;
    	portData[Board_UART2].portDCB = &uart2DCB;
    	portData[Board_UART3].portDCB = &uart3DCB;
    	portData[Board_UART4].portDCB = &uart4DCB;
    	portData[Board_UART5].portDCB = &uart5DCB;
    	portData[Board_UART6].portDCB = &uart6DCB;
    	portData[Board_UART7].portDCB = &uart7DCB;
    
    	/* UART 1 */
    	uart1DCB.portOpened = FALSE;
    	uart1DCB.uPorttype = ctMcuCmd;
        uart1DCB.txMode = FALSE;
        uart1DCB.RTS_pin = Board_U1_RTS;
        uart1DCB.linkedPort = NULL;
        uart1DCB.index = 0;
        uart1DCB.count = 0;
    	uart1DCB.EOFCounter = -1;
    	uart1DCB.RTSCounter = -1;
        uart1DCB.bytesRX = 0;
        uart1DCB.lostBytesRx = 0;
        uart1DCB.bytesTX = 0;
    
        UART_Params_init(&uart1DCB.params);
    	uart1DCB.params.readMode = UART_MODE_CALLBACK;
    	uart1DCB.params.readCallback = &uart1readCallback;
    	uart1DCB.params.writeMode = UART_MODE_CALLBACK;
    	uart1DCB.params.writeCallback = &uart1writeCallback;
    	uart1DCB.params.writeDataMode = UART_DATA_BINARY;
    	uart1DCB.params.readDataMode = UART_DATA_BINARY;
    	uart1DCB.params.readReturnMode = UART_RETURN_FULL;
    	uart1DCB.params.readEcho = UART_ECHO_OFF;
    	uart1DCB.params.baudRate = 9600;
    	uart1DCB.params.dataLength = UART_LEN_8;
    	uart1DCB.params.parityType = UART_PAR_NONE;
    	uart1DCB.params.stopBits = UART_STOP_ONE;
    
    	uart1DCB.handle = UART_open(Board_UART1, &uart1DCB.params);
        if (uart1DCB.handle != NULL) {
        	uart1DCB.portOpened = TRUE;
        	//  Arm UART for first byte
       	    UART_read(uart1DCB.handle,  &uart1DCB.rxInChar, 1);
        	System_printf("UART Port 1 Opened.\n");
        } else {
        	System_printf("**** ERROR ****   UART Port 1 FAILED to Open.\n");
        }
    	// Change driver RTS line for Receive mode
    	GPIO_write(Board_U1_RTS, MCB_IO_485_RX);
    
    	/* UART 2 */
    	uart2DCB.portOpened = FALSE;
    	uart2DCB.uPorttype = ctTpComm;
        uart2DCB.txMode = FALSE;
        uart2DCB.RTS_pin = Board_U2_RTS;
        uart2DCB.linkedPort = NULL;
        uart2DCB.index = 0;
        uart2DCB.count = 0;
    	uart2DCB.EOFCounter = -1;
    	uart2DCB.RTSCounter = -1;
        uart2DCB.bytesRX = 0;
        uart2DCB.lostBytesRx = 0;
        uart2DCB.bytesTX = 0;
    
        UART_Params_init(&uart2DCB.params);
    	uart2DCB.params.readMode = UART_MODE_CALLBACK;
    	uart2DCB.params.readCallback = &uart2readCallback;
    	uart2DCB.params.writeMode = UART_MODE_CALLBACK;
    	uart2DCB.params.writeCallback = &uart2writeCallback;
    	uart2DCB.params.writeDataMode = UART_DATA_BINARY;
    	uart2DCB.params.readDataMode = UART_DATA_BINARY;
    	uart2DCB.params.readReturnMode = UART_RETURN_FULL;
    	uart2DCB.params.readEcho = UART_ECHO_OFF;
    	uart2DCB.params.baudRate = 9600;
    	uart2DCB.params.dataLength = UART_LEN_8;
    	uart2DCB.params.parityType = UART_PAR_NONE;
    	uart2DCB.params.stopBits = UART_STOP_ONE;
    
    	uart2DCB.handle = UART_open(Board_UART2, &uart2DCB.params);
        if (uart2DCB.handle != NULL) {
        	uart2DCB.portOpened = TRUE;
        	//  Arm UART for first byte
       	    UART_read(uart2DCB.handle,  &uart2DCB.rxInChar, 1);
        	System_printf("UART Port 2 Opened.\n");
        } else {
        	System_printf("**** ERROR ****   UART Port 2 FAILED to Open.\n");
        }
    	// Change driver RTS line for Receive mode
    	GPIO_write(Board_U2_RTS, MCB_IO_485_RX);
    
        System_flush();
    
        //
        // !!!  TEMP SETUP FOR TESTING !!!
        //
        uart1DCB.linkedPort = &(uart2DCB);
        uart2DCB.linkedPort = &(uart1DCB);
    }
    
    
    
    /******************************************************************************\
    *                           M     A     I     N
    \******************************************************************************/
    Int main(Void)
    {
        /* Call board init functions */
        Board_initGeneral();
        Board_initGPIO();
        Board_initUART();
        uartDcbInit();
    
        Diags_setMask("ti.sysbios.knl.Main-Z");
        Diags_setMask("ti.sysbios.knl.Tasks-Z");
        Diags_setMask("ti.sysbios.knl.Swi-Z");
    
        // Setup default System Configuration
        sysConfig.activeCmdPort = &uart1DCB;
        sysConfig.activeTpPort = &uart2DCB;
        sysConfig.mode = cmRun;
        sysConfig.report.adData = TRUE;
        sysConfig.report.eeData = TRUE;
        sysConfig.report.inaData = TRUE;
        sysConfig.report.portBytes = TRUE;
        sysConfig.report.sfp0Data = TRUE;
        sysConfig.report.sfp1Data = TRUE;
        sysConfig.report.verbose = TRUE;
    
        /* Create an one-shot Clock Instance with timeout = 5 system time units */
        Clock_Params_init(&clkParams);
        clkParams.period = 0;
        clkParams.startFlag = FALSE;
        clk1 = Clock_create(clk0Fxn, 5, &clkParams, NULL);
        clk2 = Clock_create(clk1Fxn, 5, &clkParams, NULL);
    
        /* Start BIOS */
        BIOS_start();
    
        return (0);
    }
    

    CFG File

    /*
     * 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.
     */
    
    /*
     *  ======== uartecho.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 Task = xdc.useModule('ti.sysbios.knl.Task');
    var Hwi = xdc.useModule('ti.sysbios.hal.Hwi');
    var Swi = xdc.useModule('ti.sysbios.knl.Swi');
    var Semaphore = xdc.useModule('ti.sysbios.knl.Semaphore');
    var Timer = xdc.useModule('ti.sysbios.hal.Timer');
    var Clock = xdc.useModule('ti.sysbios.knl.Clock');
    var SPI = xdc.useModule('ti.drivers.SPI');
    
    /* System stack size (used by ISRs and Swis) */
    Program.stack = 0x300;
    
    /*
     * Comment this line to allow module names to be 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 = 2;
    
    /* ================ System configuration ================ */
    var SysMin = xdc.useModule('xdc.runtime.SysMin');
    System.SupportProxy = SysMin;
    SysMin.bufSize = 128;
    
    /* ================ BIOS configuration ================ */
    /*
     * Disable unused BIOS features to minimize footprint.
     * This example uses Tasks but not Swis or Clocks.
     */
    var BIOS = xdc.useModule('ti.sysbios.BIOS');
    BIOS.libType = BIOS.LibType_Custom;
    BIOS.swiEnabled = true;
    BIOS.logsEnabled = true;
    BIOS.assertsEnabled = true;
    
    /* No memory allocation occurs, so no heap is needed */
    BIOS.heapSize = 512;
    
    /* No runtime stack checking is performed */
    Task.checkStackFlag = false;
    Hwi.checkStackFlag = false;
    
    /* Reduce the number of task priorities */
    Task.numPriorities = 4;
    
    /* ================ Logging configuration ================ */
    var LoggingSetup = xdc.useModule('ti.uia.sysbios.LoggingSetup');
    LoggingSetup.loadLoggerSize = 512;
    LoggingSetup.mainLoggerSize = 1024;
    LoggingSetup.sysbiosLoggerSize = 1024;
    
    /* ================ Driver configuration ================ */
    var TIRTOS = xdc.useModule('ti.tirtos.TIRTOS');
    var GPIO = xdc.useModule('ti.drivers.GPIO');
    var UART = xdc.useModule('ti.drivers.UART');
    LoggingSetup.sysbiosSwiLogging = true;
    LoggingSetup.sysbiosHwiLogging = false;
    var semaphore0Params = new Semaphore.Params();
    semaphore0Params.instance.name = "rxMessageReady";
    semaphore0Params.mode = Semaphore.Mode_COUNTING;
    Program.global.rxMessageReady = Semaphore.create(null, semaphore0Params);
    var swi0Params = new Swi.Params();
    swi0Params.instance.name = "u1RxDoneSwi";
    swi0Params.priority = 1;
    Program.global.u1RxDoneSwi = Swi.create("&u1RxDoneSwiFxn", swi0Params);
    var swi1Params = new Swi.Params();
    swi1Params.instance.name = "u1TxDoneSwi";
    swi1Params.priority = 1;
    Program.global.u1TxDoneSwi = Swi.create("&u1TxDoneSwiFxn", swi1Params);
    var timer0Params = new Timer.Params();
    timer0Params.instance.name = "commWatchIsr";
    timer0Params.period = 10000;
    Program.global.commWatchIsr = Timer.create(2, "&commWatchIsrFxn", timer0Params);
    Clock.timerId = 3;
    var task0Params = new Task.Params();
    task0Params.instance.name = "dataCollectorTask";
    Program.global.dataCollectorTask = Task.create("&dataCollectorTaskFxn", task0Params);
    var task1Params = new Task.Params();
    task1Params.instance.name = "configurationTask";
    Program.global.configurationTask = Task.create("&configurationTaskFxn", task1Params);
    var task2Params = new Task.Params();
    task2Params.instance.name = "reportTask";
    Program.global.reportTask = Task.create("&reportTaskFxn", task2Params);
    var task3Params = new Task.Params();
    task3Params.instance.name = "commProcessorTask";
    Program.global.commProcessorTask = Task.create("&commProcessorTaskFxn", task3Params);
    var task4Params = new Task.Params();
    task4Params.instance.name = "eNetSwitchCommandTask";
    Program.global.eNetSwitchCommandTask = Task.create("&eNetSwitchCommandTaskFxn", task4Params);
    LoggingSetup.eventUploadMode = LoggingSetup.UploadMode_JTAGSTOPMODE;
    LoggingSetup.sysbiosSwiLoggingRuntimeControl = true;
    

    Board Config C file

    /*
     * 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.
     */
    
    /*
     *  ======== MCB_IO.c ========
     *  This file is responsible for setting up the board specific items for the
     *  MCB_IO board.
     *
     *  The following defines are used to determine which TI-RTOS peripheral drivers
     *  to include:
     *     TI_DRIVERS_GPIO_INCLUDED
     *     TI_DRIVERS_I2C_INCLUDED
     *     TI_DRIVERS_SDSPI_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/i2c.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/Error.h>
    #include <xdc/runtime/System.h>
    #include <ti/sysbios/family/arm/m3/Hwi.h>
    
    #include "MCB_IO.h"
    
    #if ccs
    #pragma DATA_ALIGN(MCB_IO_DMAControlTable, 1024)
    #elif ewarm
    #pragma data_alignment=1024
    #endif
    
    static tDMAControlTable MCB_IO_DMAControlTable[32];
    static Bool DMA_initialized = FALSE;
    
    /* Hwi_Struct used in the initDMA Hwi_construct call */
    static Hwi_Struct hwiStruct;
    
    /*
     *  ======== MCB_IO_errorDMAHwi ========
     */
    static Void MCB_IO_errorDMAHwi(UArg arg)
    {
        System_printf("DMA error code: %d\n", uDMAErrorStatusGet());
        uDMAErrorStatusClear();
        System_abort("DMA error!!");
    }
    
    /*
     *  ======== MCB_IO_initDMA ========
     */
    Void MCB_IO_initDMA(Void)
    {
        Error_Block eb;
        Hwi_Params  hwiParams;
    
        if(!DMA_initialized){
    
            Error_init(&eb);
    
            Hwi_Params_init(&hwiParams);
            Hwi_construct(&(hwiStruct), INT_UDMAERR, MCB_IO_errorDMAHwi,
                          &hwiParams, &eb);
            if (Error_check(&eb)) {
                System_abort("Couldn't create DMA error hwi");
            }
    
            SysCtlPeripheralEnable(SYSCTL_PERIPH_UDMA);
            uDMAEnable();
            uDMAControlBaseSet(MCB_IO_DMAControlTable);
    
            DMA_initialized = TRUE;
        }
    }
    
    /*
     *  ======== MCB_IO_initGeneral ========
     */
    Void MCB_IO_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);
        SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOG);
    
        SysCtlPeripheralEnable(SYSCTL_PERIPH_UART0);
        SysCtlPeripheralEnable(SYSCTL_PERIPH_UART1);
        SysCtlPeripheralEnable(SYSCTL_PERIPH_UART2);
        SysCtlPeripheralEnable(SYSCTL_PERIPH_UART3);
        SysCtlPeripheralEnable(SYSCTL_PERIPH_UART4);
        SysCtlPeripheralEnable(SYSCTL_PERIPH_UART5);
        SysCtlPeripheralEnable(SYSCTL_PERIPH_UART6);
        SysCtlPeripheralEnable(SYSCTL_PERIPH_UART7);
    
        SysCtlPeripheralEnable(SYSCTL_PERIPH_I2C0);
        SysCtlPeripheralEnable(SYSCTL_PERIPH_I2C1);
    
        SysCtlPeripheralEnable(SYSCTL_PERIPH_SSI0);
    }
    
    #if TI_DRIVERS_GPIO_INCLUDED
    #include <ti/drivers/GPIO.h>
    
    /* Callback functions for the GPIO interrupt example. */
    Void gpioButtonFxn0(Void);
    Void gpioButtonFxn1(Void);
    
    /* GPIO configuration structure */
    const GPIO_HWAttrs gpioHWAttrs[MCB_IO_GPIOCOUNT] = {
    //    {GPIO_PORTF_BASE, GPIO_PIN_1, GPIO_OUTPUT}, /* MCB_IO_LED_RED */
    //    {GPIO_PORTF_BASE, GPIO_PIN_2, GPIO_OUTPUT}, /* MCB_IO_LED_BLUE */
    //    {GPIO_PORTF_BASE, GPIO_PIN_3, GPIO_OUTPUT}, /* MCB_IO_LED_GREEN */
    //    {GPIO_PORTF_BASE, GPIO_PIN_4, GPIO_INPUT},  /* MCB_IO_GPIO_SW1 */
    //    {GPIO_PORTF_BASE, GPIO_PIN_0, GPIO_INPUT},  /* MCB_IO_GPIO_SW2 */
    	    {GPIO_PORTF_BASE, GPIO_PIN_3, GPIO_INPUT}, 	 /* MasterCommBoard_SFP0_DET */
    	    {GPIO_PORTF_BASE, GPIO_PIN_4, GPIO_INPUT}, 	 /* MasterCommBoard_SFP1_DET */
    	    {GPIO_PORTD_BASE, GPIO_PIN_3, GPIO_INPUT}, 	 /* MasterCommBoard_SPI2UART_IRQ */
    	    {GPIO_PORTF_BASE, GPIO_PIN_2, GPIO_OUTPUT},  /* MasterCommBoard_ENET_SW_CS */
    	    {GPIO_PORTD_BASE, GPIO_PIN_1, GPIO_OUTPUT},  /* MasterCommBoard_U0_RTS */
    	    {GPIO_PORTD_BASE, GPIO_PIN_0, GPIO_OUTPUT},  /* MasterCommBoard_U1_RTS */
    	    {GPIO_PORTF_BASE, GPIO_PIN_0, GPIO_OUTPUT},  /* MasterCommBoard_U2_RTS */
    	    {GPIO_PORTB_BASE, GPIO_PIN_7, GPIO_OUTPUT},  /* MasterCommBoard_U3_RTS */
    	    {GPIO_PORTD_BASE, GPIO_PIN_2, GPIO_OUTPUT},  /* MasterCommBoard_U4_RTS */
    	    {GPIO_PORTE_BASE, GPIO_PIN_3, GPIO_OUTPUT},  /* MasterCommBoard_U5_RTS */
    	    {GPIO_PORTF_BASE, GPIO_PIN_1, GPIO_OUTPUT},  /* MasterCommBoard_U6_RTS */
    	    {GPIO_PORTE_BASE, GPIO_PIN_2, GPIO_OUTPUT},  /* MasterCommBoard_U7_RTS */
    };
    
    /* Memory for the GPIO module to construct a Hwi */
    Hwi_Struct callbackHwi;
    
    /* GPIO callback structure to set callbacks for GPIO interrupts */
    const GPIO_Callbacks MCB_IO_gpioPortFCallbacks = {
        GPIO_PORTF_BASE, INT_GPIOF, &callbackHwi,
        {gpioButtonFxn1, NULL, NULL, NULL, gpioButtonFxn0, NULL, NULL, NULL}
    };
    
    const GPIO_Config GPIO_config[] = {
        {&gpioHWAttrs[0]},
        {&gpioHWAttrs[1]},
        {&gpioHWAttrs[2]},
        {&gpioHWAttrs[3]},
        {&gpioHWAttrs[4]},
        {&gpioHWAttrs[5]},
        {&gpioHWAttrs[6]},
        {&gpioHWAttrs[7]},
        {&gpioHWAttrs[8]},
        {&gpioHWAttrs[9]},
        {&gpioHWAttrs[10]},
        {&gpioHWAttrs[11]},
        {NULL},
    };
    
    /*
     *  ======== MCB_IO_initGPIO ========
     */
    Void MCB_IO_initGPIO(Void)
    {
    //    /* Setup the LED GPIO pins used */
    //    GPIOPinTypeGPIOOutput(GPIO_PORTF_BASE, GPIO_PIN_1); /* MCB_IO_LED_RED */
    //    GPIOPinTypeGPIOOutput(GPIO_PORTF_BASE, GPIO_PIN_2); /* MCB_IO_LED_GREEN */
    //    GPIOPinTypeGPIOOutput(GPIO_PORTF_BASE, GPIO_PIN_3); /* MCB_IO_LED_BLUE */
    //
    //    /* Setup the button GPIO pins used */
    //    GPIOPinTypeGPIOInput(GPIO_PORTF_BASE, GPIO_PIN_4);  /* MCB_IO_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);  /* MCB_IO_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;
    
        /* MCB U0.RTS: Enable pin PD1 for GPIOOutput */
        GPIOPinTypeGPIOOutput(GPIO_PORTD_BASE, GPIO_PIN_1);
    
        /* MCB U1.RTS: Enable pin PD0 for GPIOOutput */
        GPIOPinTypeGPIOOutput(GPIO_PORTD_BASE, GPIO_PIN_0);
    
        /* MCB U2.RTS: Enable pin PF0 for GPIOOutput */
        /*First open the lock and select the bits we want to modify in the GPIO commit register. */
        HWREG(GPIO_PORTF_BASE + GPIO_O_LOCK) = GPIO_LOCK_KEY;
        HWREG(GPIO_PORTF_BASE + GPIO_O_CR) = 0x1;
        /*Now modify the configuration of the pins that we unlocked. */
        GPIOPinTypeGPIOOutput(GPIO_PORTF_BASE, GPIO_PIN_0);
    
        /* MCB U3.RTS: Enable pin PB7 for GPIOOutput */
        GPIOPinTypeGPIOOutput(GPIO_PORTB_BASE, GPIO_PIN_7);
    
        /* MCB U4.RTS: Enable pin PD2 for GPIOOutput */
        GPIOPinTypeGPIOOutput(GPIO_PORTD_BASE, GPIO_PIN_2);
    
        /* MCB U5.RTS: Enable pin PE3 for GPIOOutput */
        GPIOPinTypeGPIOOutput(GPIO_PORTE_BASE, GPIO_PIN_3);
    
        /* MCB U6.RTS: Enable pin PF1 for GPIOOutput */
        GPIOPinTypeGPIOOutput(GPIO_PORTF_BASE, GPIO_PIN_1);
    
        /* MCB U7.RTS: Enable pin PE2 for GPIOOutput */
        GPIOPinTypeGPIOOutput(GPIO_PORTE_BASE, GPIO_PIN_2);
    
        /* MCB ENET_SW_CS: Enable pin PF2 for GPIOOutput */
        GPIOPinTypeGPIOOutput(GPIO_PORTF_BASE, GPIO_PIN_2);
    
        /* MCB SPI2UART.IRQ: Enable pin PD3 for GPIOInput */
        GPIOPinTypeGPIOInput(GPIO_PORTD_BASE, GPIO_PIN_3);
    
        /* MCB SFP0_DET: Enable pin PF3 for GPIOInput */
        GPIOPinTypeGPIOInput(GPIO_PORTF_BASE, GPIO_PIN_3);
    
        /* MCB SFP1_DET: Enable pin PF4 for GPIOInput */
        GPIOPinTypeGPIOInput(GPIO_PORTF_BASE, GPIO_PIN_4);
    
    //    /* MCB SFP0_DIS: Enable pin PG2 for GPIOInput */
    //    GPIOPinTypeGPIOInput(GPIO_PORTG_BASE, GPIO_PIN_2);
    //
    //    /* MCB SFP1_DIS: Enable pin PG3 for GPIOInput */
    //    GPIOPinTypeGPIOInput(GPIO_PORTG_BASE, GPIO_PIN_3);
    //
    //    /* MCB TXERR0: Enable pin PG4 for GPIOInput */
    //    GPIOPinTypeGPIOInput(GPIO_PORTG_BASE, GPIO_PIN_4);
    //
    //    /* MCB TXERR1: Enable pin PG5 for GPIOInput */
    //    GPIOPinTypeGPIOInput(GPIO_PORTG_BASE, GPIO_PIN_5);
    //
    //    /* MCB GPIO.0: Enable pin PG1 for GPIOInput */
    //    GPIOPinTypeGPIOInput(GPIO_PORTG_BASE, GPIO_PIN_1);
    //
    //    /* MCB GPIO.1: Enable pin PG0 for GPIOInput */
    //    GPIOPinTypeGPIOInput(GPIO_PORTG_BASE, GPIO_PIN_0);
    
        /* MCB GPIO.2: Enable pin PB6 for GPIOInput */
        GPIOPinTypeGPIOInput(GPIO_PORTB_BASE, GPIO_PIN_6);
    
        /* MCB GPIO.3: Enable pin PB4 for GPIOInput */
        GPIOPinTypeGPIOInput(GPIO_PORTB_BASE, GPIO_PIN_4);
    
    	/* MCB GPIO.4: Enable pin PB5 for GPIOInput */
        GPIOPinTypeGPIOInput(GPIO_PORTB_BASE, GPIO_PIN_5);
    
        /* Once GPIO_init is called, GPIO_config cannot be changed */
        GPIO_init();
    
    //    GPIO_write(MCB_IO_LED_RED, MCB_IO_LED_OFF);
    //    GPIO_write(MCB_IO_LED_GREEN, MCB_IO_LED_OFF);
    //    GPIO_write(MCB_IO_LED_BLUE, MCB_IO_LED_OFF);
    
        GPIO_write(MCB_IO_ENET_SW_CS, MCB_IO_CS_FALSE);
     	GPIO_write(MCB_IO_U0_RTS, MCB_IO_485_RX);
     	GPIO_write(MCB_IO_U1_RTS, MCB_IO_485_RX);
     	GPIO_write(MCB_IO_U2_RTS, MCB_IO_485_RX);
     	GPIO_write(MCB_IO_U3_RTS, MCB_IO_485_RX);
     	GPIO_write(MCB_IO_U4_RTS, MCB_IO_485_RX);
     	GPIO_write(MCB_IO_U5_RTS, MCB_IO_485_RX);
     	GPIO_write(MCB_IO_U6_RTS, MCB_IO_485_RX);
     	GPIO_write(MCB_IO_U7_RTS, MCB_IO_485_RX);
    
    }
    #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[MCB_IO_I2CCOUNT];
    
    /* I2C configuration structure, describing which pins are to be used */
    const I2CTiva_HWAttrs i2cTivaHWAttrs[MCB_IO_I2CCOUNT] = {
        {I2C1_BASE, INT_I2C0},
        {I2C3_BASE, INT_I2C1},
    };
    
    const I2C_Config I2C_config[] = {
        {&I2CTiva_fxnTable, &i2cTivaObjects[0], &i2cTivaHWAttrs[0]},
        {&I2CTiva_fxnTable, &i2cTivaObjects[1], &i2cTivaHWAttrs[1]},
        {NULL, NULL, NULL}
    };
    
    /*
     *  ======== MCB_IO_initI2C ========
     */
    Void MCB_IO_initI2C(Void)
    {
    
    	/* I2C0 Init */
        /* Enable the peripheral */
        SysCtlPeripheralEnable(SYSCTL_PERIPH_I2C0);
    
        //
    	// Enable pin PB2 for I2C0 I2C0SCL
    	//
    	GPIOPinConfigure(GPIO_PB2_I2C0SCL);
    	GPIOPinTypeI2CSCL(GPIO_PORTB_BASE, GPIO_PIN_2);
    
    	//
    	// Enable pin PB3 for I2C0 I2C0SDA
    	//
    	GPIOPinConfigure(GPIO_PB3_I2C0SDA);
    	GPIOPinTypeI2C(GPIO_PORTB_BASE, GPIO_PIN_3);
    
    	/* I2C1 Init */
        /* Enable the peripheral */
        SysCtlPeripheralEnable(SYSCTL_PERIPH_I2C1);
    
    	//
    	// Enable pin PA6 for I2C1 I2C1SCL
    	//
    	GPIOPinConfigure(GPIO_PA6_I2C1SCL);
    	GPIOPinTypeI2CSCL(GPIO_PORTA_BASE, GPIO_PIN_6);
    
    	//
    	// Enable pin PA7 for I2C1 I2C1SDA
    	//
    	GPIOPinConfigure(GPIO_PA7_I2C1SDA);
    	GPIOPinTypeI2C(GPIO_PORTA_BASE, GPIO_PIN_7);
    
        I2C_init();
    }
    #endif /* TI_DRIVERS_I2C_INCLUDED */
    
    #if TI_DRIVERS_SDSPI_INCLUDED
    #include <ti/drivers/SDSPI.h>
    #include <ti/drivers/sdspi/SDSPITiva.h>
    
    /* SDSPI objects */
    SDSPITiva_Object sdspiTivaobjects[MCB_IO_SDSPICOUNT];
    
    /* SDSPI configuration structure, describing which pins are to be used */
    const SDSPITiva_HWAttrs sdspiTivaHWattrs[MCB_IO_SDSPICOUNT] = {
        {
            SSI2_BASE,          /* SPI base address */
    
            GPIO_PORTB_BASE,    /* The GPIO port used for the SPI pins */
            GPIO_PIN_4,         /* SCK */
            GPIO_PIN_6,         /* MISO */
            GPIO_PIN_7,         /* MOSI */
    
            GPIO_PORTA_BASE,    /* Chip select port */
            GPIO_PIN_5,         /* Chip select pin */
    
            GPIO_PORTB_BASE,    /* GPIO TX port */
            GPIO_PIN_7,         /* GPIO TX pin */
        }
    };
    
    const SDSPI_Config SDSPI_config[] = {
        {&SDSPITiva_fxnTable, &sdspiTivaobjects[0], &sdspiTivaHWattrs[0]},
        {NULL, NULL, NULL}
    };
    
    /*
     *  ======== MCB_IO_initSDSPI ========
     */
    Void MCB_IO_initSDSPI(Void)
    {
        /* Enable the peripherals used by the SD Card */
        SysCtlPeripheralEnable(SYSCTL_PERIPH_SSI2);
    
        /* Configure pad settings */
        GPIOPadConfigSet(GPIO_PORTB_BASE,
                GPIO_PIN_4 | GPIO_PIN_7,
                GPIO_STRENGTH_4MA, GPIO_PIN_TYPE_STD);
    
        GPIOPadConfigSet(GPIO_PORTB_BASE,
                GPIO_PIN_6,
                GPIO_STRENGTH_4MA, GPIO_PIN_TYPE_STD_WPU);
    
        GPIOPadConfigSet(GPIO_PORTA_BASE,
                GPIO_PIN_5,
                GPIO_STRENGTH_4MA, GPIO_PIN_TYPE_STD);
    
        GPIOPinConfigure(GPIO_PB4_SSI2CLK);
        GPIOPinConfigure(GPIO_PB6_SSI2RX);
        GPIOPinConfigure(GPIO_PB7_SSI2TX);
    
        /*
         * These GPIOs are connected to PB6 and PB7 and need to be brought into a
         * GPIO input state so they don't interfere with SPI communications.
         */
        GPIOPinTypeGPIOInput(GPIO_PORTD_BASE, GPIO_PIN_0);
        GPIOPinTypeGPIOInput(GPIO_PORTD_BASE, GPIO_PIN_1);
    
        SDSPI_init();
    }
    #endif /* TI_DRIVERS_SDSPI_INCLUDED */
    
    #if TI_DRIVERS_SPI_INCLUDED
    #include <ti/drivers/SPI.h>
    #include <ti/drivers/spi/SPITivaDMA.h>
    
    /* SPI objects */
    SPITivaDMA_Object spiTivaDMAobjects[MCB_IO_SPICOUNT];
    
    /* SPI configuration structure, describing which pins are to be used */
    const SPITivaDMA_HWAttrs spiTivaDMAHWAttrs[MCB_IO_SPICOUNT] = {
        {
            SSI0_BASE,
            INT_SSI0,
            UDMA_CHANNEL_SSI0RX,
            UDMA_CHANNEL_SSI0TX,
            uDMAChannelAssign,
            UDMA_CH10_SSI0RX,
            UDMA_CH11_SSI0TX
        }
    };
    
    const SPI_Config SPI_config[] = {
        {&SPITivaDMA_fxnTable, &spiTivaDMAobjects[0], &spiTivaDMAHWAttrs[0]},
        {NULL, NULL, NULL},
    };
    
    /*
     *  ======== MCB_IO_initSPI ========
     */
    Void MCB_IO_initSPI(Void)
    {
        /* SPI0 */
        SysCtlPeripheralEnable(SYSCTL_PERIPH_SSI0);
    
        //
        // Enable pin PA5 for SSI0 SSI0TX
        //
        GPIOPinConfigure(GPIO_PA5_SSI0TX);
        GPIOPinTypeSSI(GPIO_PORTA_BASE, GPIO_PIN_5);
    
        //
        // Enable pin PA4 for SSI0 SSI0RX
        //
        GPIOPinConfigure(GPIO_PA4_SSI0RX);
        GPIOPinTypeSSI(GPIO_PORTA_BASE, GPIO_PIN_4);
    
        //
        // Enable pin PA2 for SSI0 SSI0CLK
        //
        GPIOPinConfigure(GPIO_PA2_SSI0CLK);
        GPIOPinTypeSSI(GPIO_PORTA_BASE, GPIO_PIN_2);
    
        //
        // Enable pin PA3 for SSI0 SSI0FSS
        //
        GPIOPinConfigure(GPIO_PA3_SSI0FSS);
        GPIOPinTypeSSI(GPIO_PORTA_BASE, GPIO_PIN_3);
    
    
        MCB_IO_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[MCB_IO_UARTCOUNT];
    
    /* UART configuration structure */
    const UARTTiva_HWAttrs uartTivaHWAttrs[MCB_IO_UARTCOUNT] = {
    	    {UART0_BASE, INT_UART0}, /* MCB_IO_UART0 */
    	    {UART1_BASE, INT_UART1}, /* MCB_IO_UART1 */
    	    {UART2_BASE, INT_UART2}, /* MCB_IO_UART2 */
    	    {UART3_BASE, INT_UART3}, /* MCB_IO_UART3 */
    	    {UART4_BASE, INT_UART4}, /* MCB_IO_UART4 */
    	    {UART5_BASE, INT_UART5}, /* MCB_IO_UART5 */
    	    {UART6_BASE, INT_UART6}, /* MCB_IO_UART6 */
    	    {UART7_BASE, INT_UART7}, /* MCB_IO_UART7 */
    };
    
    const UART_Config UART_config[] = {
    	    { &UARTTiva_fxnTable, &uartTivaObjects[0], &uartTivaHWAttrs[0] },
    	    { &UARTTiva_fxnTable, &uartTivaObjects[1], &uartTivaHWAttrs[1] },
    	    { &UARTTiva_fxnTable, &uartTivaObjects[2], &uartTivaHWAttrs[2] },
    	    { &UARTTiva_fxnTable, &uartTivaObjects[3], &uartTivaHWAttrs[3] },
    	    { &UARTTiva_fxnTable, &uartTivaObjects[4], &uartTivaHWAttrs[4] },
    	    { &UARTTiva_fxnTable, &uartTivaObjects[5], &uartTivaHWAttrs[5] },
    	    { &UARTTiva_fxnTable, &uartTivaObjects[6], &uartTivaHWAttrs[6] },
    	    { &UARTTiva_fxnTable, &uartTivaObjects[7], &uartTivaHWAttrs[7] },
    	    {NULL, NULL, NULL}
    };
    
    /*
     *  ======== MCB_IO_initUART ========
     */
    Void MCB_IO_initUART()
    {
        /* Enable and configure the peripherals used by UART0. */
        SysCtlPeripheralEnable(SYSCTL_PERIPH_UART0);
        GPIOPinConfigure(GPIO_PA0_U0RX);
        GPIOPinConfigure(GPIO_PA1_U0TX);
        GPIOPinTypeUART(GPIO_PORTA_BASE, GPIO_PIN_0 | GPIO_PIN_1);
    
        /* Enable and configure the peripherals used by UART1. */
        GPIOPinConfigure(GPIO_PB1_U1TX);
        GPIOPinConfigure(GPIO_PB0_U1RX);
        GPIOPinTypeUART(GPIO_PORTB_BASE, GPIO_PIN_0 | GPIO_PIN_1);
    
        /* Enable and configure the peripherals used by UART2. */
        GPIOPinConfigure(GPIO_PD6_U2RX);
        GPIOPinTypeUART(GPIO_PORTD_BASE, GPIO_PIN_6);
        // First open the lock and select the bits we want to modify in the GPIO commit register.
        HWREG(GPIO_PORTD_BASE + GPIO_O_LOCK) = GPIO_LOCK_KEY;
        HWREG(GPIO_PORTD_BASE + GPIO_O_CR) = 0x80;
        // Now modify the configuration of the pins that we unlocked.
        GPIOPinConfigure(GPIO_PD7_U2TX);
        GPIOPinTypeUART(GPIO_PORTD_BASE, GPIO_PIN_7);
    
        /* Enable and configure the peripherals used by UART3. */
        GPIOPinConfigure(GPIO_PC7_U3TX);
        GPIOPinConfigure(GPIO_PC6_U3RX);
        GPIOPinTypeUART(GPIO_PORTC_BASE, GPIO_PIN_6 | GPIO_PIN_7);
    
        /* Enable and configure the peripherals used by UART4. */
        GPIOPinConfigure(GPIO_PC5_U4TX);
        GPIOPinConfigure(GPIO_PC4_U4RX);
        GPIOPinTypeUART(GPIO_PORTC_BASE, GPIO_PIN_4 | GPIO_PIN_5);
    
        /* Enable and configure the peripherals used by UART5. */
        GPIOPinConfigure(GPIO_PE5_U5TX);
        GPIOPinConfigure(GPIO_PE4_U5RX);
        GPIOPinTypeUART(GPIO_PORTE_BASE, GPIO_PIN_4 | GPIO_PIN_5);
    
        /* Enable and configure the peripherals used by UART6. */
        GPIOPinConfigure(GPIO_PD4_U6RX);
        GPIOPinConfigure(GPIO_PD5_U6TX);
        GPIOPinTypeUART(GPIO_PORTD_BASE, GPIO_PIN_4 | GPIO_PIN_5);
    
        /* Enable and configure the peripherals used by UART7. */
        GPIOPinConfigure(GPIO_PE1_U7TX);
        GPIOPinConfigure(GPIO_PE0_U7RX);
        GPIOPinTypeUART(GPIO_PORTE_BASE, GPIO_PIN_0 | GPIO_PIN_1);
    
        /* Initialize the UART driver */
        UART_init();
    }
    #endif /* TI_DRIVERS_UART_INCLUDED */
    
    /*
     *  ======== MCB_IO_initUSB ========
     *  This function just turns on the USB
     */
    Void MCB_IO_initUSB(MCB_IO_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 == MCB_IO_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[MCB_IO_WATCHDOGCOUNT];
    
    /* Watchdog configuration structure */
    const WatchdogTiva_HWAttrs watchdogTivaHWAttrs[MCB_IO_WATCHDOGCOUNT] = {
        /* MCB_IO_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},
    };
    
    /*
     *  ======== MCB_IO_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 MCB_IO_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[MCB_IO_WIFICOUNT];
    
    /* WiFi configuration structure */
    const WiFiTivaCC3000_HWAttrs wiFiTivaCC3000HWAttrs[MCB_IO_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},
    };
    
    /*
     *  ======== MCB_IO_initWiFi ========
     */
    Void MCB_IO_initWiFi(Void)
    {
        /* 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();
        MCB_IO_initDMA();
    
        /* Initialize WiFi driver */
        WiFi_init();
    }
    #endif /* TI_DRIVERS_WIFI_INCLUDED */
    

    Board Config H file

    /*
     * 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       MCB_IO.h
     *
     *  @brief      MCB_IO Board Specific APIs
     *
     *  The MCB_IO header file should be included in an application as follows:
     *  @code
     *  #include <MCB_IO.h>
     *  @endcode
     *
     *  ============================================================================
     */
    #ifndef __MCB_IO_H
    #define __MCB_IO_H
    
    #ifdef __cplusplus
    extern "C" {
    #endif
    
    #include <ti/drivers/GPIO.h>
    
    /* Control Macros for MCB_IO. */
    #define MCB_IO_485_TX 		(1)
    #define MCB_IO_485_RX  		(0)
    #define MCB_IO_CS_TRUE		(0)
    #define MCB_IO_CS_FALSE		(1)
    
    /* GPIO_Callbacks structure for GPIO interrupts */
    extern const GPIO_Callbacks MCB_IO_gpioPortFCallbacks;
    
    /*!
     *  @def    MCB_IO_GPIOName
     *  @brief  Enum of GPIO names on the MCB_IO dev board
     */
    typedef enum MCB_IO_GPIOName {
    //    MCB_IO_LED_RED = 0,
    //    MCB_IO_LED_BLUE,
    //    MCB_IO_LED_GREEN,
    //    MCB_IO_SW1,
    //    MCB_IO_SW2,
        MCB_IO_SFP0_DET = 0,
        MCB_IO_SFP1_DET,
        MCB_IO_SPI2UART_IRQ,
        MCB_IO_ENET_SW_CS,
        MCB_IO_U0_RTS,
        MCB_IO_U1_RTS,
        MCB_IO_U2_RTS,
        MCB_IO_U3_RTS,
        MCB_IO_U4_RTS,
        MCB_IO_U5_RTS,
        MCB_IO_U6_RTS,
        MCB_IO_U7_RTS,
    
        MCB_IO_GPIOCOUNT
    } MCB_IO_GPIOName;
    
    /*!
     *  @def    MCB_IO_I2CName
     *  @brief  Enum of I2C names on the MCB_IO dev board
     */
    typedef enum MCB_IO_I2CName {
        MCB_IO_I2C0 = 0,
        MCB_IO_I2C1,
    
        MCB_IO_I2CCOUNT
    } MCB_IO_I2CName;
    
    /*!
     *  @def    MCB_IO_SDSPIName
     *  @brief  Enum of SDSPI names on the MCB_IO dev board
     */
    typedef enum MCB_IO_SDSPIName {
        MCB_IO_SDSPI0 = 0,
    
        MCB_IO_SDSPICOUNT
    } MCB_IO_SDSPIName;
    
    /*!
     *  @def    MCB_IO_SPIName
     *  @brief  Enum of SPI names on the MCB_IO dev board
     */
    typedef enum MCB_IO_SPIName {
        MCB_IO_SPI0 = 0,
    
        MCB_IO_SPICOUNT
    } MCB_IO_SPIName;
    
    /*!
     *  @def    MCB_IO_UARTName
     *  @brief  Enum of UARTs on the MCB_IO dev board
     */
    typedef enum MCB_IO_UARTName {
    	   MCB_IO_UART0 = 0,
    	   MCB_IO_UART1 = 1,
    	   MCB_IO_UART2 = 2,
    	   MCB_IO_UART3 = 3,
    	   MCB_IO_UART4 = 4,
    	   MCB_IO_UART5 = 5,
    	   MCB_IO_UART6 = 6,
    	   MCB_IO_UART7 = 7,
    
        MCB_IO_UARTCOUNT
    } MCB_IO_UARTName;
    
    /*!
     *  @def    MCB_IO_USBMode
     *  @brief  Enum of USB setup function on the MCB_IO dev board
     */
    typedef enum MCB_IO_USBMode {
        MCB_IO_USBDEVICE,
        MCB_IO_USBHOST
    } MCB_IO_USBMode;
    
    /*!
     *  @def    MCB_IO_WatchdogName
     *  @brief  Enum of Watchdogs on the MCB_IO dev board
     */
    typedef enum MCB_IO_WatchdogName {
        MCB_IO_WATCHDOG0 = 0,
    
        MCB_IO_WATCHDOGCOUNT
    } MCB_IO_WatchdogName;
    
    /*!
     *  @def    MCB_IO_WiFiName
     *  @brief  Enum of WiFi names on the MCB_IO dev board
     */
    typedef enum MCB_IO_WiFiName {
        MCB_IO_WIFI = 0,
    
        MCB_IO_WIFICOUNT
    } MCB_IO_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 MCB_IO_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 MCB_IO_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 MCB_IO_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 MCB_IO_initI2C(Void);
    
    /*!
     *  @brief  Initialize board specific SDSPI settings
     *
     *  This function initializes the board specific SDSPI settings and then calls
     *  the SDSPI_init API to initialize the SDSPI module.
     *
     *  The SDSPI peripherals controlled by the SDSPI module are determined by the
     *  SDSPI_config variable.
     */
    extern Void MCB_IO_initSDSPI(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 MCB_IO_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 MCB_IO_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 MCB_IO_initUSB(MCB_IO_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 MCB_IO_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 MCB_IO_initWiFi(Void);
    
    #ifdef __cplusplus
    }
    #endif
    
    #endif /* __MCB_IO_H */
    


    Board.H file

    /*
     * 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 "MCB_IO.h"
    
    #define Board_initDMA               MCB_IO_initDMA
    #define Board_initGeneral           MCB_IO_initGeneral
    #define Board_initGPIO              MCB_IO_initGPIO
    #define Board_initI2C				MCB_IO_initI2C
    //#define Board_initSDSPI             MCB_IO_initSDSPI
    #define Board_initSPI               MCB_IO_initSPI
    #define Board_initUART              MCB_IO_initUART
    //#define Board_initUSB               MCB_IO_initUSB
    //#define Board_initWatchdog          MCB_IO_initWatchdog
    //#define Board_initWiFi              MCB_IO_initWiFi
    
    //#define Board_LED_ON                MCB_IO_LED_ON
    //#define Board_LED_OFF               MCB_IO_LED_OFF
    //#define Board_LED0                  MCB_IO_LED_BLUE
    //#define Board_LED1                  MCB_IO_LED_GREEN
    //#define Board_LED2                  MCB_IO_LED_RED
    //#define Board_BUTTON0               MCB_IO_SW1
    //#define Board_BUTTON1               MCB_IO_SW2
    
    #define Board_U0_RTS				MCB_IO_U0_RTS
    #define Board_U1_RTS				MCB_IO_U1_RTS
    #define Board_U2_RTS				MCB_IO_U2_RTS
    #define Board_U3_RTS				MCB_IO_U3_RTS
    #define Board_U4_RTS				MCB_IO_U4_RTS
    #define Board_U5_RTS				MCB_IO_U5_RTS
    #define Board_U6_RTS				MCB_IO_U6_RTS
    #define Board_U7_RTS				MCB_IO_U7_RTS
    #define Board_Ethernet_CS			MCB_IO_ENET_SW_CS
    
    
    #define Board_I2C0					MCB_IO_I2C0
    #define Board_I2C1					MCB_IO_I2C1
    //#define Board_I2C_TMP               MCB_IO_I2C3
    //#define Board_I2C_NFC               MCB_IO_I2C3
    //#define Board_I2C_TPL0401           MCB_IO_I2C3
    
    //#define Board_SDSPI0                MCB_IO_SDSPI0
    
    #define Board_SPI0                  MCB_IO_SPI0
    //#define Board_SPI1                  MCB_IO_SPI3
    //#define Board_SPI_CC3000            MCB_IO_SPI2
    //#define Board_SPI_AT45DB
    //#define Board_SPI_AT45CS
    
    //#define Board_USBDEVICE             MCB_IO_USBDEVICE
    
    #define Board_UART0                 MCB_IO_UART0
    #define Board_UART1                 MCB_IO_UART1
    #define Board_UART2                 MCB_IO_UART2
    #define Board_UART3                 MCB_IO_UART3
    #define Board_UART4                 MCB_IO_UART4
    #define Board_UART5                 MCB_IO_UART5
    #define Board_UART6                 MCB_IO_UART6
    #define Board_UART7                 MCB_IO_UART7
    
    //#define Board_WATCHDOG0             MCB_IO_WATCHDOG0
    
    //#define Board_WIFI                  MCB_IO_WIFI
    
    #define Board_gpioCallbacks0        MCB_IO_gpioPortFCallbacks
    #define Board_gpioCallbacks1        MCB_IO_gpioPortFCallbacks
    
    #ifdef __cplusplus
    }
    #endif
    
    #endif /* __BOARD_H */
    

  • Hi Stephen,

    you're using the logger in JTAGStoppedMode, which means that your target needs to be halted in order for you to retrieve the Logs. If you have some time critical process going on, you probably will need to simply increase "mainLoggerSize".

    Incidently, I just crunched some numbers in your setup. Your one-stop clock function triggers after 5ticks, which by default equals to 5ms. If you send 5 bytes (10-bits per byte) via UART @ 9600, it roughly equates to 5.2ms. I think if you can try increasing your one-time clock function timeout period, your setup might work with more data.

  • I understand that I have to pause execution to download the data.  I have been doing that.  The problem is that since I have enabled logging SWIs and they execute from code start until I can hit the send button on my terminal emulator program any buffer size I have tried is insufficient to capture the event as the buffer is full of SWI events.


    What I want to do is TURN OFF logging until the first character of my transmission from the terminal emulator is detected in the callback routine so that the log will ONLY have events from that point forward.

    With respect to the 5ms issue - I was afraid that this might be the case.  The intent of my code was that I can start a timer when the first character is received and then on each successive character STOP the timer, reset it back to initial value (5 tics), and restart it.  Theoretically, this would allow receipt of an entire buffer's worth of characters before the timer timed out and fired the SWI.  Is this functionality possible in SYSBIOS?

  • Stephen,

    2 things regarding your setup.

    1. You need to enable logging for Swis. By default, it's turned off because of all the noise it generates.

    LoggingSetup.sysbiosSwiLogging = true;
    LoggingSetup.sysbiosSwiLoggingRuntimeControl = true;

    2. The runtime controls to enable the diag masks isn't quite right. The documentation is a pretty confusing in figuring out what masks should be enabled. Take a look at the SYS/BIOS API reference documentation. You'll find some documentation on how to enable the masks Diags_setMask(). Note Diags_Mask USER1 and USER2. If you were to look at the Task and Swi documentation, you will find (after some hunting) that Diags_USER1 and Diags_USER2 are used to generate Task and Swi logs.

     



    Try using the following syntax:

    //Enable Task and Swi logging
    Diags_setMask("ti.sysbios.knl.Tasks+12");
    Diags_setMask("ti.sysbios.knl.Swi+12");
    
    //Disable Task and Swi logging
    Diags_setMask("ti.sysbios.knl.Tasks-12");
    Diags_setMask("ti.sysbios.knl.Swi-12");

    Stephen Killingsworth said:
    The intent of my code was that I can start a timer when the first character is received and then on each successive character STOP the timer, reset it back to initial value (5 tics), and restart it.  Theoretically, this would allow receipt of an entire buffer's worth of characters before the timer timed out and fired the SWI.  Is this functionality possible in SYSBIOS?

    I think I know what you're trying to do, so I'd suggest to add this into your .cfg file:

    Clock.tickMode = Clock.TickMode_PERIODIC;

    This prevent the Clock module from be "smart" as to when to actually call your clock function. Looking at the clock APIs, I don't see why not it shouldn't work.