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.

Tiva Launchpad SSI Issue Need Help Please

Other Parts Discussed in Thread: TM4C123GH6PM, EK-TM4C123GXL

I am trying to run the code below in Code Composer Studio using the Tiva Launchpad. The following are the errors that I am receiving: #20 identifier "GPIO_PA2_SSI0CLK" is undefined, #20 identifier "GPIO_PA3_SSI0FSS" is undefined, and #20 identifier "GPIO_PA5_SSI0TX" is undefined. Does anyone know what I am doing wrong? Thanks.

#include <stdint.h>
#include <stdbool.h>
#include "inc/hw_memmap.h"
#include "inc/hw_ssi.h"
#include "inc/hw_types.h"
#include "driverlib/ssi.h"
#include "driverlib/gpio.h"
#include "driverlib/pin_map.h"
#include "driverlib/sysctl.h"

int main(void)
{
SysCtlClockSet(SYSCTL_SYSDIV_4|SYSCTL_USE_PLL|SYSCTL_XTAL_16MHZ|SYSCTL_OSC_MAIN);
SysCtlPeripheralEnable(SYSCTL_PERIPH_SSI0);
SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOA);

GPIOPinConfigure(GPIO_PA2_SSI0CLK);
GPIOPinConfigure(GPIO_PA3_SSI0FSS);
GPIOPinConfigure(GPIO_PA5_SSI0TX);
GPIOPinTypeSSI(GPIO_PORTA_BASE,GPIO_PIN_5|GPIO_PIN_3|GPIO_PIN_2);

SSIConfigSetExpClk(SSI0_BASE, SysCtlClockGet(), SSI_FRF_MOTO_MODE_0, SSI_MODE_MASTER, 10000, 16);
SSIEnable(SSI0_BASE);
}

  • Hi Carlos,

         Those defines are can be found at pin_map.h and are dependent on a preprocessor define. If you are using the LM4F120 launchpad, set pre-defines "PART_LM4F120H5QR" at project options. If you are using the TIVA launchpad, set pre-defines "PART_TM4C123GH6PM" at project options.

    -kel

  • Thank you! This fixed my issue.

  • Hi

    I am getting these kind of errors when i build the soft i2c example code given for the tiva c series launch pad.

    please any one help me out for the same.

    identifier "GPIO_PA0_U0RX" is undefined

     identifier "GPIO_PA1_U0TX" is undefined

     identifier "INT_TIMER0A_" is undefined

  • Hi Manju,

    Please be aware that the examples in the C:\ti\TivaWare_C_Series-x.x.x.xxxxx\examples\peripherals directory are not complete examples as explained by the readme in that directory:

    The examples in this directory demonstrate how to program various peripherals available on Tiva microcontrollers. These examples are meant to be used as guides to follow for your own application. They will not directly run on Tiva evaluation or reference design kits (EK, RDK) without modification. These are not ready-to-run projects but rather code that you add to your own project.

    For examples that are meant to run directly on kit board, please see the examples/boards subdirectory.

    You may want to start with one of the examples in the C:\ti\TivaWare_C_Series-2.0.1.11577\examples\boards\ek-tm4c123gxl directory and add in the code from the soft_i2c example.  You may have better luck getting it to compile correctly.

    Regards,

    Sue

  • Hi Sue,

    Thanks a lot. i will try with the suggestion.

  • Hi Sui,

    I Am Writing a small I2C application code  where i am writing 1 byte to the EEPROM CAT24C128 which is having slave address 0x50. i am trying to write 0x55 to location 0x0001 and i am reading it back but it is waiting in the statement       

    while(I2CMasterBusy(I2C0_BASE))
    {
    }

    of the first byte transmission(msb of address location)

    I am pasting my source code here.

    //*****************************************************************************
    #include <stdint.h>
    #include <stdbool.h>
    #include "inc/hw_memmap.h"
    #include "inc/hw_types.h"
    #include "driverlib/debug.h"
    #include "driverlib/fpu.h"
    #include "driverlib/gpio.h"
    #include "driverlib/pin_map.h"
    #include "driverlib/rom.h"
    #include "driverlib/sysctl.h"
    #include "driverlib/uart.h"
    #include "utils/uartstdio.h"
    #include "driverlib/timer.h"
    #include "inc/hw_i2c.h"
    #include "driverlib/i2c.h"
    #include "inc/hw_ints.h"

    // Number of I2C data packets to send

    #define NUM_I2C_DATA 3

    // Set the address

    #define SLAVE_ADDRESS 0x50


    int
    main(void)
    {
    uint32_t pui32DataTx[NUM_I2C_DATA];
    uint32_t pui32DataRx[NUM_I2C_DATA];
    uint32_t ui32Index;

    SysCtlClockSet(SYSCTL_SYSDIV_1 | SYSCTL_USE_OSC | SYSCTL_OSC_MAIN |
    SYSCTL_XTAL_16MHZ);

    SysCtlPeripheralEnable(SYSCTL_PERIPH_I2C0);

    SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOB);

    GPIOPinTypeI2CSCL(GPIO_PORTB_BASE, GPIO_PIN_2);
    GPIOPinTypeI2C(GPIO_PORTB_BASE, GPIO_PIN_3);
    GPIOPinConfigure(GPIO_PB2_I2C0SCL);
    GPIOPinConfigure(GPIO_PB3_I2C0SDA);

    I2CMasterInitExpClk(I2C0_BASE, SysCtlClockGet(), false);

    I2CMasterSlaveAddrSet(I2C0_BASE, SLAVE_ADDRESS, false);

    //
    // Initalize the data to send.
    //
    pui32DataTx[0] = 0x00; //address of the location 8 MSB bit address
    pui32DataTx[1] = 0x01; //address of the location 8 LSB bit address(16 bit location address)
    pui32DataTx[2] = 0x55; //data to be stored on to the eeprom at location 0x0001

    //
    // Initalize the receive buffer.
    //
    for(ui32Index = 0; ui32Index < NUM_I2C_DATA; ui32Index++)
    {
    pui32DataRx[ui32Index] = 0;
    }

    // Send location address (0x00) on the eeprom the master to the slave.

    I2CMasterDataPut(I2C0_BASE, pui32DataTx[0]);

    I2CMasterControl(I2C0_BASE, I2C_MASTER_CMD_BURST_SEND_START);

    while(I2CMasterBusy(I2C0_BASE))
    {
    }

    // Send the location address(0x01)LSB on the eeprom the master to the slave.

    I2CMasterDataPut(I2C0_BASE, pui32DataTx[1]);

    I2CMasterControl(I2C0_BASE, I2C_MASTER_CMD_BURST_SEND_CONT);

    while(I2CMasterBusy(I2C0_BASE))
    {
    }

    // Send the data to the location address(0x0001) on the eeprom the master to the slave.

    I2CMasterDataPut(I2C0_BASE, pui32DataTx[2]);

    I2CMasterControl(I2C0_BASE, I2C_MASTER_CMD_BURST_SEND_FINISH);

    while(I2CMasterBusy(I2C0_BASE))
    {
    }
    //receiving operation starts

    I2CMasterSlaveAddrSet(I2C0_BASE, SLAVE_ADDRESS, false);

    pui32DataTx[0] = 0x00; //address of the location 8 MSB bit address
    pui32DataTx[1] = 0x01; //address of the location 8 LSB bit address(16 bit location address)

    I2CMasterDataPut(I2C0_BASE, pui32DataTx[0]);

    I2CMasterControl(I2C0_BASE, I2C_MASTER_CMD_BURST_SEND_CONT);

    while(I2CMasterBusy(I2C0_BASE))
    {
    }


    I2CMasterDataPut(I2C0_BASE, pui32DataTx[1]);

    I2CMasterControl(I2C0_BASE, I2C_MASTER_CMD_SINGLE_SEND);

    while(I2CMasterBusy(I2C0_BASE))
    {
    }

    //
    // Modifiy the data direction to true, so that seeing the address will
    // indicate that the I2C Master is initiating a read from the slave.
    //

    I2CMasterSlaveAddrSet(I2C0_BASE, SLAVE_ADDRESS, true);


    //
    // Read the data from the master.
    //


    I2CMasterControl(I2C0_BASE, I2C_MASTER_CMD_SINGLE_RECEIVE);

    while(I2CMasterBusy(I2C0_BASE))
    {
    }

    pui32DataRx[0] = I2CMasterDataGet(I2C0_BASE);

    return(0);
    }

    Please any one help me. 

    Thanks and regards 

    manju patil

     

  • Hi,

    This fixes my issue also...

    Thanks alott.....