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.

TMS320F28027: RTC BQ32000 interface with TMS320F28027 via I2C.

Part Number: TMS320F28027
Other Parts Discussed in Thread: BQ32000, , C2000WARE, CONTROLSUITE

Hi,

I designed a circuit with RTC BQ32000 interface with TMS320F28027 via I2C. To test the I2C function, I used the  " Example_2802xI2C_eeprom.c" from the example project and run. I am getting below errors.

Description Resource Path Location Type
unresolved symbols remain 11072017 38pinprocessorRTC write C/C++ Problem
unresolved symbol _InitPieCtrl, first referenced in ./Example_2802xI2C_eeprom.obj 11072017 38pinprocessorRTC write C/C++ Problem
unresolved symbol _InitPieVectTable, first referenced in ./Example_2802xI2C_eeprom.obj 11072017 38pinprocessorRTC write C/C++ Problem
unresolved symbol _InitI2CGpio, first referenced in ./Example_2802xI2C_eeprom.obj 11072017 38pinprocessorRTC write C/C++ Problem
errors encountered during linking; "Example_F2802xSci_Echoback.out" not 11072017 38pinprocessorRTC write C/C++ Problem

Please support me to resolve this issue.

Regards,

Mahesh K.R.

  • Hello Mahesh K. R.,

    Did you pull the Example_2802xI2C_eeprom.c example program directly from C2000ware? And did you alter the program at all or are you getting these errors when attempting to build the project in its original state?

    The "unresolved symbols" errors generally occur when you are missing certain headers/libraries or are not properly including them in your code. If pulling from the most updated C2000ware, your project should already include all that you need and have no issues building it.

    Please read processors.wiki.ti.com/.../Include_paths_and_options for more information on proper linking and include procedure.

    Hope this helps,
    Kevin
  • Hi Kevin,

       I copied the Example_2802xI2C_eeprom.c file to my project. I didn't alter the program. Yes, I am getting the error when attempting to build the project in its original state.
    Yes, I am missing certain headers/libraries or are not properly including them in my code.
    I don't know the headers/libraries including   InitPieCtrl,  InitPieVectTable,  and InitI2CGpio, 
    Please let me know the headers/libraries including   InitPieCtrl,  InitPieVectTable,  and InitI2CGpio,
    Regards,
    Mahesh K.R.
  • Hi Mahesh K. R.,

    Before going into your project and adding all the necessary headers/libraries and include directories, I would suggest making sure you imported your project correctly since it would set up all of this for you. I would remove the project you have from your CCS workspace and start fresh.

    Read the "Importing an existing project" section of this wiki page processors.wiki.ti.com/.../Importing_Projects_into_CCS.

    If you do this and still get errors when trying to build your project you will need to add the following directories to the #include path by going into the properties of your project.

    C:\ti\ccsv7\tools\compiler\ti-cgt-c2000_16.9.3.LTS\include

    C:\ti\c2000\C2000Ware_1_00_01_00\device_support\f2802x\headers\include

    C:\ti\c2000\C2000Ware_1_00_01_00\device_support\f2802x

    C:\ti\c2000\C2000Ware_1_00_01_00\device_support\f2802x\common\include

    C:\ti\c2000\C2000Ware_1_00_01_00\libraries\math\IQmath\c28\include

    Also you should have the following files under your projects tab within the workspace.

    Best,

    Kevin

  • Hi Kevin,

      I followed both importing project from example "Example_2802xI2C_eeprom.c". Try to build, I was getting below error. Then I includes all the above mentioned includes no improvement. I am getting below error messages.

    Description Resource Path Location Type
    Invalid project path: Include path not found (C:\ti\libs\math\IQmath\v15c\include). Example_F2802xI2C_eeprom pathentry Path Entry Problem
    Invalid project path: Include path not found (\packages\ti\xdais). Example_F2802xI2C_eeprom pathentry Path Entry Problem
    Invalid project path: Include path not found (C:\ti\ccsv7\tools\compiler\ti-cgt-c2000_16.9.3.LTS\include). Example_F2802xI2C_eeprom pathentry Path Entry Problem
    This project was created using a version of compiler that is not currently installed: 6.1.0 [C2000]. Another version of the compiler will be used during build: 6.2.5. Please go to <a href="liveaction:OpenAppCenter">CCS App Center</a> to install the compiler of the required version, or migrate the project to one of the available compiler versions by adjusting project properties. Example_F2802xI2C_eeprom properties Problems
    Build variable 'XDAIS_CG_ROOT' cannot be resolved. Example_F2802xI2C_eeprom properties Problems
    unresolved symbol _InitI2CGpio, first referenced in ./Example_2802xI2C_eeprom.obj Example_F2802xI2C_eeprom C/C++ Problem
    unresolved symbol _InitPieCtrl, first referenced in ./Example_2802xI2C_eeprom.obj Example_F2802xI2C_eeprom C/C++ Problem
    unresolved symbol >>, first referenced in Compilation Example_F2802xI2C_eeprom C/C++ Problem
    unresolved symbol _I2caRegs, first referenced in ./Example_2802xI2C_eeprom.obj Example_F2802xI2C_eeprom C/C++ Problem
    unresolved symbol _PieCtrlRegs, first referenced in ./Example_2802xI2C_eeprom.obj Example_F2802xI2C_eeprom C/C++ Problem
    unresolved symbol _PieVectTable, first referenced in ./Example_2802xI2C_eeprom.obj Example_F2802xI2C_eeprom C/C++ Problem
    unresolved symbol _InitPieVectTable, first referenced in ./Example_2802xI2C_eeprom.obj Example_F2802xI2C_eeprom C/C++ Problem
    unresolved symbol _InitSysCtrl, first referenced in ./Example_2802xI2C_eeprom.obj Example_F2802xI2C_eeprom C/C++ Problem
    entry-point symbol "code_start" undefined Example_F2802xI2C_eeprom C/C++ Problem
    errors encountered during linking; "Example_F2802xI2C_eeprom.out" not Example_F2802xI2C_eeprom C/C++ Problem
    unresolved symbol code_start Example_F2802xI2C_eeprom C/C++ Problem
    unresolved symbols remain Example_F2802xI2C_eeprom C/C++ Problem

    Regards,

    Mahesh K.R.

  • Mahesh K.R.,

    It seems like CCS is not finding the include directory your added. Can you find the C:\ti\libs\math\IQmath\v15c\include and C:\ti\ccsv7\tools\compiler\ti-cgt-c2000_16.9.3.LTS\include directories when using the file explorer outside of CCS? They should be physically saved to your computer.

    It also might help me understand what you're missing if you take a screenshot of your includes and the workspace of your project. You should have all the files that were in my previous screenshot within your workspace.

    Best,
    Kevin
  • Hi Kevin,

     Sorry for the delay. Below given the screenshot.

    Regards,

    Mahesh K.R.

  • Mahesh K.R.,

    It looks like you have all the correct directories within the includes of your workspace, but maybe they are not linking correctly.

    Could you check your linked resources within the properties of your project? (Compare with picture below)

    Also, you can check your path variables.

    After looking into these, index your headers by right clicking your project and choose Index ==> Rebuild.

    Hope this helps,

    Kevin

  • Hi Kevin,

       it is the same. Same no. of errors. 

    Regards,

    Mahesh K.R.

  • Mahesh K.R.,

    I think you should try importing a fresh copy of this example again. If you do this correctly with the most updated C2000ware code examples, the program should build/run without any changes being made. Please follow the steps below...

    1. Delete the example program from your workspace, selecting "Delete Project contents on disk" to completely remove it. Then close out of CCS.

    2. Update C2000ware on your computer to the latest version with the most updated example code.

    3. Re-open CCS. Select Project ==> Import CCS Projects...

    4. Browse to your desired program example folder within C2000ware and select the folder. Make sure that you see the project folder selected in the Discovered projects window.

    5. Check the "Copy Projects into workspace" box then select "Finish"

    This should import the ready to build/run example program into your workspace.

    Hope this helps,

    Kevin

  • Hi Kevin,

      Example_F2802xI2C_eeprom  project is not seen in the C2000ware. Example_F2802xI2C_eeprom project is seen in the Project - example. I am not able to import the project. Now I am struck. 

    My requirement is via I2C, I have to set date and time in a RTC BQ32000 and then read the time via I2C when ever required. I want to know, how to initialize I2C, Write to BQ32000, Read 32000. If you have any working example, Please support me.

  • Hi Mahesh K.R.,

    The eeprom example code is located in the following directory of C2000ware:

    C:\ti\c2000\C2000Ware_1_00_01_00\device_support\f2802x\examples\structs\i2c_eeprom

    This example seems to have all the functions you need to set up I2C and read/write data to your device, but it's interrupt driven and may be a little confusing to someone who is new to I2C. Ideally you do want to utilize interrupts with I2C peripherals so that the SCL/SDA lines are not constantly being used. However, this isn't necessarily the best way to learn or initially test your device by itself.

    Browsing C2000ware and ControlSuite I do not see another example that we provide, but I can point you to the important functions within it. Also, you may gain something from reviewing this previous forum post about using I2C:

    e2e.ti.com/.../221249

    Important Functions from Example_2802xI2C_eeprom :

    InitI2CGpio();        // For setting up your SDA/SCL lines
    
    I2CA_Init();          // Initializing I2C devices, You will need to change parameters within this to meet your specific device
    
    I2CA_WriteData(struct I2CMSG *msg);      // Write Data/Commands to your device (slave)
    
    I2CA_ReadData(struct I2CMSG *msg);       // Read Data from your device
    

    You will need to reference your specific device's data sheet for addressing / registers so that you can properly send and receive data. www.ti.com/.../bq32000.pdf

    Hope this helps,

    Kevin

  • Hi Kevin,
    If I import project from "struct", The default configuration is "Debug". I want Flash. How do I change the configuration in general from Debug to Flash? That is why I am not able to write to the target.

    I see, If I import project from " drivers", The default conficuration is " Flash / RAM".

    Regards,
    Mahesh K.R.
  • Mahesh K.R.,

    The Example_2802xI2C_eeprom example program is set to run from RAM upon import via the F2802x_generic_ram.cmd.

    If you are wanting to run your program from flash you will have to make changes to this .cmd file or replace the file. Please review the following for more info on running an application from flash:

    http://www.ti.com/lit/an/spra958l/spra958l.pdf

    You can replace the .cmd file with F2802x_generic_flash.cmd or F28027.cmd (I'd suggest this one for your specific device) from the following C2000ware directory:

    C:\ti\c2000\C2000Ware_1_00_01_00\device_support\f2802x\common\cmd

    Hope this helps,

    Kevin

  • Hi Kevin,

       I did as you explained in the e-mail. No better. What I am looking for is as given below Active-Flash than Active -debug. I think this has to be done with the project setting. Please give your thoughts.

    Regards,

    Mahesh K.R.

  • Mahesh K.R.,

    I am confused about what you are trying to accomplish. What you are pointing at is the active "build configuration", that is the build options that are saved for [Active - Debug] configuration. CCS will always open a debug session whether you're programming to RAM or Flash.

    Read the following for more information on "build configurations" : http://processors.wiki.ti.com/index.php/Project_Build_Configurations

    Looking at your project workspace for the eeprom example you are missing a command linker file, your project will not build because the compiler does not know where your program should go (either RAM or FLASH). You need either F2802x_generic_ram.cmd or F28027.cmd copied to your project.

    Best,

    Kevin

  • Mahesh K.R.,

    I am confused about what you are trying to accomplish. What you are pointing at is the active "build configuration", that is the build options that are saved for [Active - Debug] configuration. CCS will always open a debug session whether you're programming to RAM or Flash.

    Read the following for more information on "build configurations" : processors.wiki.ti.com/.../Project_Build_Configurations

    Looking at your project workspace for the eeprom example you are missing a command linker file, your project will not build because the compiler does not know where your program should go (either RAM or FLASH). You need either F2802x_generic_ram.cmd or F28027.cmd copied to your project.

    Best,

    Kevin

    Hi Kevin,
    I am replaying to your above e-mail.

    What I want to accomplish is set I2C chanal, Initialize, Write and read from the device connected to it. I was going in the wrong direction. If you have any working code for I2C chanal, Initialize, Write and read. Please support me.

    Regards,
    Mahesh K.R.
  • Mahesh K.R.,

    The eeprom program is the only I2C example code available. I previously mentioned the functions from it that will be of use to you. You will have to look through them and learn how to utilize them. I would suggest referencing the 2802x I2C Reference Guide to help you understand how these functions work and how the I2C protocol works.

    http://www.ti.com/lit/ug/sprufz9d/sprufz9d.pdf

    Useful Functions within Example_2802xI2C_eeprom.c:

    InitI2CGpio();        // For setting up your SDA/SCL lines
    
    I2CA_Init();          // Initializing I2C devices, You will need to change parameters within this to meet your specific device
    
    I2CA_WriteData(struct I2CMSG *msg);      // Write Data/Commands to your device (slave)
    
    I2CA_ReadData(struct I2CMSG *msg);       // Read Data from your device

    Hope this helps,

    Kevin

  • Hi Kevin,

      Thank you very much for your support. I am able to initialize the I2C and get pulses through SCLA and see the write date through SDAA. The  codes I used are given below.

    GPIOInit();

    {

    EALLOW;

    GpioCtrlRegs.GPAPUD.bit.GPIO28 = 0; // Enable pull-up for GPIO28 (SDAA)
    GpioCtrlRegs.GPAPUD.bit.GPIO29 = 0; // Enable pull-up for GPIO29 (SCLA)

    GpioCtrlRegs.GPAQSEL2.bit.GPIO28 = 3; // Asynch input GPIO28 (SDAA)
    GpioCtrlRegs.GPAQSEL2.bit.GPIO29 = 3; // Asynch input GPIO29 (SCLA)

    GpioCtrlRegs.GPAMUX2.bit.GPIO28 = 2; // Configure GPIO28 for SDAA
    GpioCtrlRegs.GPAMUX2.bit.GPIO29 = 2; // Configure GPIO29 for SCLA

    EDIS;

    }

    void I2CA_Init()
    {
    EALLOW;

    I2caRegs.I2CMDR.bit.IRS = 0;
    SysCtrlRegs.PCLKCR0.bit.I2CAENCLK = 1; // I2C
    // Initialize I2C
    I2caRegs.I2CSAR = 0x68; // Slave address - EEPROM control code

    // I2CCLK = SYSCLK/(I2CPSC+1)
    #if (CPU_FRQ_40MHZ||CPU_FRQ_50MHZ)
    I2caRegs.I2CPSC.all = 4; // Prescaler - need 7-12 Mhz on module clk
    #endif

    #if (CPU_FRQ_60MHZ)
    I2caRegs.I2CPSC.all = 6; // Prescaler - need 7-12 Mhz on module clk
    #endif

    I2caRegs.I2CCLKL = 125; // NOTE: must be non zero
    I2caRegs.I2CCLKH = 125; // NOTE: must be non zero
    I2caRegs.I2CIER.all = 0x24; // Enable SCD & ARDY interrupts

    I2caRegs.I2CMDR.all = 0x0020; // Take I2C out of reset
    // Stop I2C when suspended

    I2caRegs.I2CFFTX.all = 0x6000; // Enable FIFO mode and TXFIFO
    I2caRegs.I2CFFRX.all = 0x2040; // Enable RXFIFO, clear RXFFINT,
    I2caRegs.I2CMDR.bit.IRS = 1;
    I2caRegs.I2CMDR.bit.STP = 0;

    EDIS;
    }

    void I2CA_WriteData()
    {
    I2caRegs.I2CMDR.bit.MST = 1; // Send start as master
    I2caRegs.I2CMDR.bit.TRX = 1; // Send start as transmitter

    // Wait until the STP bit is cleared from any previous master communication.
    // Clearing of this bit by the module is delayed until after the SCD bit is
    // set. If this bit is not checked prior to initiating a new message, the
    // I2C could get confused.
    if (I2caRegs.I2CMDR.bit.STP == 1)
    {

    }


    // Check if bus busy
    if (I2caRegs.I2CSTR.bit.BB == 1)
    {

    }

    // Setup slave address
    I2caRegs.I2CSAR = 0x68;

    // Setup number of bytes to send
    // MsgBuffer + Address
    I2caRegs.I2CCNT = 0x03;
    I2caRegs.I2CMDR.bit.STT = 1;

    // Setup data to send

    //while(I2caRegs.I2CSTR.bit.XRDY == 0){};

    I2caRegs.I2CDXR = 0x55;

    // while(I2caRegs.I2CSTR.bit.NACK == 1){};

    // while(I2caRegs.I2CSTR.bit.XRDY == 0){};

    I2caRegs.I2CDXR = 0x55;

    // while(I2caRegs.I2CSTR.bit.NACK == 1){};

    // while(I2caRegs.I2CSTR.bit.XRDY == 0){};

    I2caRegs.I2CDXR = 0x55;

    // while(I2caRegs.I2CSTR.bit.NACK == 1){};

    I2caRegs.I2CMDR.bit.STP = 1;

    I2caRegs.I2CMDR.bit.STP = 0;

    }

    Regards,

    Mahesh K.R.