This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

CCS/TM4C123GH6PM: TM4C123GH6PM

Part Number: TM4C123GH6PM
Other Parts Discussed in Thread: EK-TM4C123GXL, TMS320F28335, TM4C1294NCPDT, , TM4C123GH6PZ

Tool/software: Code Composer Studio

Dear Team

As per suggestions from TI silicon vendors, we have selected this part for one of our fast track project. To our dismay, none of the library functions are working !!!

We have been trying for I2C, External Event counter on Timer, GPIO  interrupt, SPI interrupt. CAN, On-chip USB  functions and we are highly disappointed by the example codes provided as none of them give a way to single step and verify any of the registers. We are draining our man power in reinventing the wheel. TI is just promoting new controllers without proper support

As we didn't want to try on our new target board, we have procured the EV board as per suggestion and following are the details

Controller used : TM4c123g
EV board : TIVA C series TM4c123G launch pad evaluation kit


Examples codes referred from  TIVAWARE-C-series-2.1.4.178 folder after installing the relevant software files

Request you to provide proper software for all these on-chip peripherals and interrupt configuration steps and functions. If we are left without any support, we will definitely hesitate to deploy TI devices for any of our products

We expect a quick response on this as we are stuck with our work

Kindly help us out

regards

ratna

 

 

  • Sorry to hear you are having problems. You seem to be off to a bad start. First let's verify what tools you have. You have the EK-TM4C123GXL launchpad, and TivaWare version 2.1.4.178. Did you install Code Composer Studio, or are you using some other emulator?

    Here is a link to a short video that introduces Code Composer Studio: https://youtu.be/11lsNYW7zkw

    Code composer studio allows you to connect to your target board, program your code into flash, single step C or assembly instructions and examine CPU or peripheral registers. It also supports watchpoints and breakpoints.

    A simple way to get started is to use Code Composer and import one of the example projects from TivaWare. Once Code Composer is started use "File" -> "Import", "Code Composer Studio", "CCS Projects", NEXT. Then Browse to the TivaWare examples. If you chose the standard installation location for TivaWare, you will find examples for the EK-TM4C123GXL board in: "C:\ti\TivaWare_C_Series-2.1.4.178\examples\boards\ek-tm4c123gxl". Blinky and Hello are two very basic examples.

  • Good Morning Mr. Bob Crosby

     

    Thank you for your reply. Sorry that I didn't mention that we are very familiar with TI controllers and we are using them for more than 5 years now! We have used Concerto, Delfino and Picolo controllers and are working fine !! and are very familiar with CCS 5.

     

    Now we have introduced Tiva Controllers and are using CCS 7

     

    So we have already designed our target board taking care of all design guidelines.

     

    Unfortunately we are having lot of teething issues with this controller and there are no TI application engineers who are accessible here in Bangalore to come and check with the target board

     

    Because of this we have rolled back to testing with EV board from TI and facing same issues. We have installed and used all the example codes but it is not of any help

     

    Request you to share the codes so that the project will step forward

     

    thanks and regards

     

    ratna

     

     

  • I am sorry that I misunderstood. What code are you requesting that I share with you? Do you have any specific questions concerning these parts?

  • Morning !

    Yes I need you to share codes (complete project) for the following

    a. I2C interface for driving RTC and Keyboard controller (proper working driver files with init, read, write and interrupt ISR)

    b. Event counter on Timer 1 (A) where the counting should happen with a pulse input at port pin

    c. SPI driver file for initialization,reading writing and interrupt ISR

    d. CAN functions 

    e. External interrupt configuration and ISR (in general)

    f. ePWM capture / compare function for pulse width measurement

    g. On-chip USB function to provide device / host on-the-fly

    Pl note we have done all the above (except point g) for Delfino TMS320F28335 and they are all working perfectly. But in this controller we are facing issue in every step. Kindly support us so that the time and effort what we have already placed on this particular development will be fruitful

    Anxiously waiting for your support

    thanks and regards

    ratna

  • I missed out to give the code that we are trying for timer event counter to work on ISR

    Though we are able to see the counting, interrupt ISR is not getting hit

    Kindly let us know where we are going wrong

    thanks 

    ratna

  • I would like to assist you but let me explain what we do and do not do through the TI forum. I can answer specific questions on operation of the TM4C devices and the TivaWare library. I can provide examples that I have. We do not write code for customer applications. While you may provide source code posted on the forum or by private message to help clarify a question, we do not do formal code reviews. We cannot provide technical answers about non-TI parts.

    Here are some more example projects. Use the Code Composer "File" -> "Import" feature to add these projects to your workspace.

    /cfs-file/__key/communityserver-discussions-components-files/908/7367.CAN.zip

    /cfs-file/__key/communityserver-discussions-components-files/908/I2C.zip

    /cfs-file/__key/communityserver-discussions-components-files/908/6266.spi.zip

    /cfs-file/__key/communityserver-discussions-components-files/908/timer1Cap.zip

    If you are having specific issues implementing your code, please let me know.

  • I have not heard back from you so I assume you have resolved your issues. If not, please respond to this thread or open a new related thread.
  • Morning !!

    Sorry didn't reply as we were trying out different codes. The problem is not solved. With the code attd herewith we were able to see  pluses on both clock and data lines but still it was returning 0xFF from RTC. Pl check the attd code and do let us know where we have gone wrong

    rgd

    ratna

    /*
     * main.c
     */
    #define DEBUG true
    //#include <tm4c123gh6pz.h>
    #include <TM4C1294NCPDT.h>
    #include <stdint.h>
    #include <stdbool.h>
    #include <hw_memmap.h>
    #include <sysctl.h>
    #include <hw_types.h>
    #include <interrupt.h>
    #include "hw_i2c.h"
    //#include <hw_ints.h>
    #include <pin_map.h>
    #include <debug.h>
    #include <gpio.h>
    #include <timer.h>
    #include <adc.h>
    #include <i2c.h>
    //#include <uart.h>
    #include <ssi.h>
    #include <fpu.h>
    #include <rom.h>
    #include <hw_gpio.h>
    //#include "uart.h"
    //#include <softi2c.h>
    //#include "uartstdio.h"
    
    /////////mdfd ratna
    
    #define     SLAVE_ADDRESS      0xDE
    //////////////////
    
    #define INTENSITY_CNTRL GPIO_PIN_6  //PA6
    void InitConsole(void);
    unsigned char rtc_sec = 0;
    #define TFT_INTENSITY_CNTRL GPIOPinWrite(GPIO_PORTA_BASE,INTENSITY_CNTRL,0xFF)
    //#include "main.h"
    unsigned int bcd2bin(unsigned int BCD);
    uint32_t ui32SysClkFreq = 0;
    void mcu_clock_init(void);
    void delay_ms(uint32_t time);
    void delay_us(uint32_t time);
    void rtc_init(void);
    void display_init(void);
    
    extern void Init_Timer0(void);
    extern void ISR_Timer0(void);
    
    extern void Init_Timer1(void);
    extern void ISR_Timer1(void);
    extern void Init_SSI1(void);
    extern void ssi1_test(void);
    extern void Init_ADC(void);
    extern void adc_test(void);
    extern void Init_UART0(void);
    extern void uart_test(void);
    extern void Init_I2C2(void);
    extern void rtc_test(void);
    void  TFT_screen_display_func();
    uint8_t rx_data = 0;
    uint8_t vale = 0;
    extern void write_data(void);
    extern unsigned long start_add;
    extern unsigned int height_loop,width_loop;
    extern unsigned char red_data, green_data, blue_data;
    extern void TFT_Init(void);
    extern void TFT_SCREEN_CLEAR_FUNC(void);
    extern void write_address_1(unsigned long start_address);
    extern void TFT_IMAGE_WRITE(unsigned long image_x_start_pos,unsigned long image_y_start_pos,unsigned int image_width,unsigned int image_height,unsigned char colour);
    
    ////////////////mdfd ratna
    unsigned    char    date=0,day =0, month = 0, year =0, sec= 0, min = 0, hour = 0;
    
    ///////////////////////////////
    
    extern void rtc_run(void);
    extern void ReadRtcTime(void);
    unsigned char bin2bcd(unsigned char temp_data);
    unsigned char temp_char[5]= {0};
    extern const unsigned char *string;
    void ISR_I2C_2(void);
    
    void main(void)
    {
    unsigned char hex_val = 0x0a;
    
        mcu_clock_init();
    
    //    InitConsole();
    //    delay_ms(10000);
    //    display_init();
    //    delay_ms(1000);
    //
    //    TFT_Init();
    //
    //    TFT_SCREEN_CLEAR_FUNC();
    
        rtc_init();
    //    while(1)
    //    {
    //
    //        rtc_run();
    //        //ReadRtcTime();
    //         temp_char[1]=bin2bcd(rtc_sec);
    //         background_colour();
    //
    //         temp_char[0] = (rtc_sec >> 4);
    //         if(temp_char[0] >= 0 || temp_char[0] <= 9)
    //         {
    //             temp_char[0] = temp_char[0] + 0x30;
    //         }
    //         else
    //         {
    //             temp_char[0] = temp_char[0] + 0x37;
    //         }
    //
    //        temp_char[1] = (rtc_sec & 0x0F);
    //        if(temp_char[1] >= 0 || temp_char[1] <= 9)
    //        {
    //          temp_char[1] = temp_char[1] + 0x30;
    //        }
    //        else
    //        {
    //          temp_char[1] = temp_char[1] + 0x37;
    //        }
    //
    ////         temp_char[0] = '0';
    ////         temp_char[1] = '1';
    //
    //         temp_char[2] = '\0';
    //
    //
    //         string = &temp_char;                    //WATER
    //         TFT_STRING_WRITE(4,103,3,1);
    ////         UARTprintf("%c",hex_val);
    ////         UARTprintf("        AJAX        ");
    ////         UARTprintf("%c",hex_val);
    ////         UARTprintf(" ");
    ////         UARTprintf("   CONCRETE BATCH   \n");
    ////         UARTprintf("%c",hex_val);
    ////         UARTprintf(" ");
    ////         UARTprintf(" CONTROLLER  v1.3.1 \n");
    ////         UARTprintf("%c",hex_val);
    ////         UARTprintf(" ");
    //
    //         //
    //         //TFT_screen_display_func();
    ////         //while(1);
    //    }
    
    
    }
    
    void delay_ms(uint32_t time)
    {
        SysCtlDelay(SysCtlClockGet() / (1000 * time));
    }
    
    void delay_us(uint32_t time)
    {
        SysCtlDelay(SysCtlClockGet() / (time));
    }
    
    
    void display_init(void)
    {
        SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOG);
        while(!SysCtlPeripheralReady(SYSCTL_PERIPH_GPIOG));
        delay_ms(100);
    
        SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOK);
        while(!SysCtlPeripheralReady(SYSCTL_PERIPH_GPIOK));
        delay_ms(100);
    
        SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOA);
        while(!SysCtlPeripheralReady(SYSCTL_PERIPH_GPIOA));
        delay_ms(100);
    
        GPIOPinTypeGPIOInput(GPIO_PORTA_BASE,GPIO_PIN_7);// TE
        delay_ms(100);
    
        GPIOPinTypeGPIOOutput(GPIO_PORTG_BASE,0xFF);  //Data pins
        delay_ms(100);
    
        GPIOPinTypeGPIOOutput(GPIO_PORTK_BASE,GPIO_PIN_0);  //WR
        delay_ms(100);
        GPIOPinTypeGPIOOutput(GPIO_PORTK_BASE,GPIO_PIN_1);  //RD
        delay_ms(100);
        GPIOPinTypeGPIOOutput(GPIO_PORTK_BASE,GPIO_PIN_2);  //D/C
        delay_ms(100);
        GPIOPinTypeGPIOOutput(GPIO_PORTK_BASE,GPIO_PIN_3);  //TFT_CS
        delay_ms(100);
    
        GPIOPinTypeGPIOOutput(GPIO_PORTA_BASE,GPIO_PIN_6);  //INTENSITY
        delay_ms(100);
    
        GPIOPinWrite(GPIO_PORTA_BASE,0x40,0x00);
        GPIOPinWrite(GPIO_PORTG_BASE,0xFF,0x00);
        GPIOPinWrite(GPIO_PORTK_BASE,0x0F,0x0F);
    
        TFT_INTENSITY_CNTRL;
    }
    
    void rtc_init(void)
    {
    
        /////////////////////
           // SysCtlClockSet(SYSCTL_SYSDIV_1 | SYSCTL_USE_OSC | SYSCTL_OSC_MAIN | SYSCTL_XTAL_8MHZ);          ////mdfd ratna
        ///////////////////
    
    //       SysCtlPeripheralEnable(SYSCTL_PERIPH_I2C0);
    
           //
           // For this example I2C0 is used with PortB[3:2] and I2C2 with PortL[0:1]
    //       SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOB);
           SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOL);
           while(!SysCtlPeripheralReady(SYSCTL_PERIPH_GPIOL));
    
    ///////////////////////
    //       SysTickPeriodSet(SysCtlClockGet());              /////mdfd ratna
    //       SysTickEnable();
    ////////////////////////////
           GPIOPinConfigure(GPIO_PL1_I2C2SCL);  // i2c2 slave module not used
    
           GPIOPinTypeI2CSCL(GPIO_PORTL_BASE,GPIO_PIN_1); //commented due to non usage
           GPIOPinConfigure(GPIO_PL0_I2C2SDA); // i2c2 slave module not used
           GPIOPinTypeI2C(GPIO_PORTL_BASE,GPIO_PIN_0);  //commented due to non usage
    
           // Configure the pin muxing for I2C2 functions on port E4 and E5.
    
           SysCtlPeripheralEnable(SYSCTL_PERIPH_I2C2);
           while(!SysCtlPeripheralReady(SYSCTL_PERIPH_I2C2));
    
           ///////////////mdfd ratna     I2CMasterInitExpClk(I2C2_BASE, ui32SysClkFreq, true);
    
           I2CMasterInitExpClk(I2C2_BASE, SysCtlClockGet(), false);
    
           I2CIntRegister(I2C2_BASE,ISR_I2C_2);
           SysCtlPeripheralReset(SYSCTL_SRI2C_R2);
    
           IntMasterEnable();
           I2CMasterEnable(I2C2_BASE);
    
           I2CMasterSlaveAddrSet(I2C2_BASE,SLAVE_ADDRESS , false);
           I2CMasterDataPut(I2C2_BASE,0);
           I2CMasterControl(I2C2_BASE,I2C_MASTER_CMD_BURST_SEND_START);
           while(I2CMasterBusy(I2C2_BASE));
    
           I2CMasterDataPut(I2C2_BASE,30);      /////dec2bcd(sec));
           I2CMasterControl(I2C2_BASE, I2C_MASTER_CMD_BURST_SEND_CONT);
           while(I2CMasterBusy(I2C2_BASE));
    
           I2CMasterDataPut(I2C2_BASE, 15);        ////dec2bcd(min));
           I2CMasterControl(I2C2_BASE, I2C_MASTER_CMD_BURST_SEND_CONT);
           while(I2CMasterBusy(I2C2_BASE));
    
           I2CMasterDataPut(I2C2_BASE, 2);     ////dec2bcd(hour));
           I2CMasterControl(I2C2_BASE, I2C_MASTER_CMD_BURST_SEND_CONT);
           while(I2CMasterBusy(I2C2_BASE));
    
          /* I2CMasterDataPut(I2C0_BASE, dec2bcd(day));
           I2CMasterControl(I2C0_BASE, I2C_MASTER_CMD_BURST_SEND_CONT);
           while(I2CMasterBusy(I2C0_BASE));*/
    
           I2CMasterDataPut(I2C2_BASE,22);               ////dec2bcd(date));
           I2CMasterControl(I2C2_BASE, I2C_MASTER_CMD_BURST_SEND_CONT);
           while(I2CMasterBusy(I2C2_BASE));
    
           I2CMasterDataPut(I2C2_BASE, 05);  /////dec2bcd(month));
           I2CMasterControl(I2C2_BASE, I2C_MASTER_CMD_BURST_SEND_CONT);
           while(I2CMasterBusy(I2C2_BASE));
    
           I2CMasterDataPut(I2C2_BASE, 19);         ////dec2bcd(year));
           I2CMasterControl(I2C2_BASE, I2C_MASTER_CMD_BURST_SEND_FINISH);
           while(I2CMasterBusy(I2C2_BASE));
    
           while(1)
           {
    
           I2CMasterSlaveAddrSet(I2C2_BASE, SLAVE_ADDRESS , false);
           I2CMasterControl(I2C2_BASE,I2C_MASTER_CMD_BURST_SEND_START);
    
           I2CMasterDataPut(I2C2_BASE,0x00);
           I2CMasterControl(I2C2_BASE,I2C_MASTER_CMD_BURST_SEND_FINISH);
           while(I2CMasterBusy(I2C2_BASE));
    
           I2CMasterSlaveAddrSet(I2C2_BASE, SLAVE_ADDRESS , true);
           I2CMasterControl(I2C2_BASE,I2C_MASTER_CMD_BURST_RECEIVE_START);
           while(I2CMasterBusy(I2C2_BASE));
           sec = I2CMasterDataGet(I2C2_BASE);
    
           I2CMasterControl(I2C2_BASE, I2C_MASTER_CMD_BURST_RECEIVE_CONT);
           while(I2CMasterBusy(I2C2_BASE));
           min = I2CMasterDataGet(I2C2_BASE);
    
           I2CMasterControl(I2C2_BASE, I2C_MASTER_CMD_BURST_RECEIVE_CONT);
           while(I2CMasterBusy(I2C2_BASE));
           hour = I2CMasterDataGet(I2C2_BASE);
    
           I2CMasterControl(I2C2_BASE, I2C_MASTER_CMD_BURST_RECEIVE_CONT);
           while(I2CMasterBusy(I2C2_BASE));
           day = I2CMasterDataGet(I2C2_BASE);
    
           I2CMasterControl(I2C2_BASE, I2C_MASTER_CMD_BURST_RECEIVE_CONT);
           while(I2CMasterBusy(I2C2_BASE));
           date = I2CMasterDataGet(I2C2_BASE);
    
           I2CMasterControl(I2C2_BASE, I2C_MASTER_CMD_BURST_RECEIVE_CONT);
           while(I2CMasterBusy(I2C2_BASE));
           month = I2CMasterDataGet(I2C2_BASE);
    
           I2CMasterControl(I2C2_BASE, I2C_MASTER_CMD_BURST_RECEIVE_CONT);
           while(I2CMasterBusy(I2C2_BASE));
           year = I2CMasterDataGet(I2C2_BASE);
    
           I2CMasterControl(I2C2_BASE, I2C_MASTER_CMD_BURST_RECEIVE_FINISH);
           while(I2CMasterBusy(I2C2_BASE));
    
          /* tsec = bcd2dec(sec)&0x7f;
           tmin = bcd2dec(min);
           thour = bcd2dec(hour)&0x3f;
           tday = bcd2dec(day);
           tdate = bcd2dec(date);
           tmonth = bcd2dec(month);
           tyear = bcd2dec(year);*/
    
           //rtc_run();
           }/////mdfd ratna for testing
    
           //}
    
    
        /////////////////////mdfd ratna till here///////////////
    
    
    ////////////////////////////////////////////
    
    
       ////mdfd ratna       I2CMasterTimeoutSet(I2C2_BASE, 2u);
    
    
           // HWREG(I2C0_BASE + I2C_O_FIFOCTL) = 80008000;
               // InitConsole();// for uart
    
    }
    
    
    unsigned int bcd2bin(unsigned int BCD)
    {
       return (((BCD>>4)*10) + (BCD & 0xF));
    }
    
    
    
    unsigned char bin2bcd(unsigned char temp_data)
    {
        unsigned int bcd_result = 0;
        unsigned int shift = 0;
    
        while(temp_data>0)
         {
                bcd_result |= (temp_data % 10) <<(shift++ << 2);
                temp_data /=10;
    
         }
               return(bcd_result+(0x30));
     }
    
    //void InitConsole(void)
    //{
    //
    //    // Enable GPIO port A which is used for UART0 pins.
    //    // TODO: change this to whichever GPIO port you are using.
    //    //
    //    SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOA);
    //
    //    //
    //    // Configure the pin muxing for UART0 functions on port A0 and A1.
    //    // This step is not necessary if your part does not support pin muxing.
    //    // TODO: change this to select the port/pin you are using.
    //    //
    //    GPIOPinConfigure(GPIO_PA0_U0RX);
    //    GPIOPinConfigure(GPIO_PA1_U0TX);
    //
    //    //
    //    // Enable UART0 so that we can configure the clock.
    //    //
    //    SysCtlPeripheralEnable(SYSCTL_PERIPH_UART0);
    //
    //    //
    //    // Use the internal 16MHz oscillator as the UART clock source.
    //    //
    //  //  UARTClockSourceSet(UART0_BASE,UART_CLOCK_PIOSC);
    //
    //
    //    // Select the alternate (UART) function for these pins.
    //    // TODO: change this to select the port/pin you are using.
    //    //
    //    GPIOPinTypeUART(GPIO_PORTA_BASE, GPIO_PIN_0 | GPIO_PIN_1);
    //
    //    //
    //    // Initialize the UART for console I/O.
    //    //
    //    //UARTStdioConfig(0, 9600, 16000000);
    //}
    void ISR_I2C_2(void)
    {
        //
        // Clear the I2C0 interrupt flag.
        //
        I2CSlaveIntClear(I2C2_BASE);
        //
        // Read the data from the slave.
        //
        //g_ui32DataRx = I2CSlaveDataGet(I2C2_BASE);
    
        //
        // Set a flag to indicate that the interrupt occurred.
        //
       // g_bIntFlag = true;
    }
    void mcu_clock_init(void)
    {
    
      //SysCtlClockSet(SYSCTL_SYSDIV_8 | SYSCTL_USE_PLL | SYSCTL_XTAL_8MHZ |SYSCTL_OSC_MAIN);
    
        SysCtlClockSet(SYSCTL_SYSDIV_1 | SYSCTL_USE_PLL | SYSCTL_USE_OSC | SYSCTL_OSC_INT);
    
        ui32SysClkFreq = SysCtlClockGet();
    
    }
    

  • Which RTC chip are you using? Also, please verify that you are using the TM4C123GH6PM? The file 8272.main.c has the include for TM4C123GH6PZ commented out and the include for TM4C1294NCPDT active.
  • We are using RTC ISL1208 (intersil make)

    This device has already been interfaced with Delfino TMS320F28335 and no issues are seen

    Same device is now interfaced with Tiva series controller

    The files shared have been checked with both TM4C129 as well as TM4C123 EV Boards

    Both are not working

    Hence I have shared the code to see whether any mistake has happened in the sequence

    Pl do let us know on the same

    regards

    ratna

  • One think I see is that the function I2CMasterSlaveAddrSet() is expecting a 7-bit slave address, so it is not supposed to include the read/write bit. It is expecting 0x6F instead of 0xDE. I will keep looking, but it is hard for me to debug as I do not have the same hardware. Do you have access to a logic analyzer that has an I2C bus interpreter?
  • I have not heard back from you. Did that help? If not, just respond to this thread or open a related thread.