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.

How to startup with I2C (where is appropriate library?)

Other Parts Discussed in Thread: EK-TM4C123GXL, EK-TM4C1294XL

Hi all,

I am beginner of TI environment. 

I use Tiva C Series Connected LaunchPad Workshop for motor control. I write a program and need information how to initialize a motor driver through the LuaunchPad board. I have found i2c.c and i2c.h from the site, so I try to use these files at first. I read document "TivaWare Peripheral Driver Library" which shows example program (16.3 Programming Example, page 347) using SysCtlPeripheralEnable(), SysCtlPeripheralReady() and so on.

I could not find where are there functions stored in library (I have seeked with file search but not found).

So, I would like to know under Tiva C Series Connected LaunchPad Workshop, what library is necessary to install for motor applications (or an I2C communication)? And please show me newest links for it.

Best Regards,

S.Takano

  • Hello Takano,
    I have moved your questions to the appropriate forum.
    -Francis Houde
  • If you have downloaded CCSv7, and the latest TivaWare, version 2.1.4.178, you may need to modify the include path and the linker library path of your project. Particularly if you have imported a project that was built using earlier versions of CCS or TivaWare.

    First setup the include paths by right clicking on the project name and selecting "Show Build Settings". Then add the directories you want the compiler to search for any #include files. In the example below are the paths for the compilers standard include files, for the TivaWare library header files, and for the header files specific to the EK-TM4C123GXL board.

    Next add the libraries for the linker to search. In this example you see the standard library "libc.a" included with the search path specified using a macro to identify the version of the compiler used "${CG_TOOL_ROOT}/lib". The location of the TivaWare library was explicitly entered as: "C:\ti\TivaWare_C_Series-2.1.4.178\driverlib\ccs\Debug\driverlib.lib"

    Examples imported from the latest version of TivaWare will have these paths already setup for you. The example "C:\ti\TivaWare_C_Series-2.1.4.178\examples\boards\ek-tm4c123gxl\project0" can be imported to start a new project that uses TivaWare and the EK-TM4C123GXL launch pad. Once imported, right click on the project name to rename it.

  • Hi all,
    Thank you very much for you replies. I have installed "SW-TM4C-2.1.4.178.exe" and have set include path (same as Bob's setting), however I still meet error causing missing of include path in a code.

    for example I want to use "SysCtlPeripheralEnable" function but not in there. How to solve this (where is that in a site)?
  • HI,

    One more question, function I2CMasterIntClearEx(uint32_t ui32Base, uint32_t ui32IntFlags) for example uses ui32Base, generally base address is base address without offset but I think this ui32Base should include the offset value, is this thought correct (because target slave I2C device must know register address)?

    Best Regards,
    Takano
  • Hi All,

    Error message is as follows;
    "../i2c_comm.c", line 30: warning #225-D: function "SysCtlPeripheralEnable" declared implicitly
    and SysCtlPeripheralEnable() is not in my PC, where is the library in this site?

    Best Regards,
    Takano
  • I have setup as follows;

    Include Option->Add dir #include search path;
    "${CG_TOOL_ROOT}/include"
    "C:\ti\TivaWare_C_Series-2.1.4.178"
    "C:\ti\TivaWare_C_Series-2.1.4.178\driverlib"
    "C:\ti\TivaWare_C_Series-2.1.4.178\examples\boards\ek-tm4c1294xl"

    ARM LInker->File Search Path
    INclude library file for command file as input
    "libc.a"
    "C:\ti\TivaWare_C_Series-2.1.4.178\driverlib\ccs\Debug\driverlib.lib"

    Add <dir> to library search path
    "${CG_TOOL_ROOT}/include"
    "${CG_TOOL_ROOT}/lib"

    Then I get following errors;
    "C:/ti/TivaWare_C_Series-2.1.4.178/driverlib/i2c.h", line 291: error #20: identifier "uint8_t" is undefined
    "C:/ti/TivaWare_C_Series-2.1.4.178/driverlib/i2c.h", line 305: error #20: identifier "bool" is undefined

    Why I got and How to solve it?

    Thanks and Regards,
    Takano
  • It looks like the file you are compiling is missing the standard "#include" files. Here are the includes that are used in the example project0:
    #include <stdint.h>
    #include <stdbool.h>
    #include "inc/hw_types.h"
    #include "inc/hw_memmap.h"
    #include "driverlib/sysctl.h"
    #include "driverlib/gpio.h"
  • Hi, Currently works, thank you.

    I setting up as follows;

    1) Build->ARM Compiler->Include Options

    a) Add dir to #include search path

    "${CG_TOOL_ROOT}/include"

    "C:\ti\TivaWare_C_Series-2.1.4.178"

    "C:\ti\TivaWare_C_Series-2.1.4.178\driverlib"

    "C:\ti\TivaWare_C_Series-2.1.4.178\examples\boards\ek-tm4c1294xl"

    maybe last line is option and might be unnecessary.

    b) Specify a preinclude files

    "C:\ti\ccsv7\tools\compiler\ti-cgt-arm_16.9.0.LTS\include\stdint.h"

    "C:\ti\ccsv7\tools\compiler\ti-cgt-arm_16.9.0.LTS\include\stdbool.h"

    2) Build->ARM Linker->File Search Path

    a) Include library file or command file as input

    "libc.a"

    C:\ti\TivaWare_C_Series-2.1.4.178\driverlib\ccs\Debug\driverlib.lib"

    b) Add <dir> library search path

    "${CG_TOOL_ROOT}/lib"

    "${CG_TOOL_ROOT}/include"

    Some environment variables are not set at install, so I used absolute path to specify.

    Now I would like to confirm environment variable "CG_TOOL_ROOT", while warning message does not addresses CG_TOOL_ROOT, so I hope the variable is set, but it is not set in my computer's environment variable, is it ok? and the what path should be placed on CG_TOOL_ROOT variable?

    Best Regards,

    Shigeyuki Takano

  • Takano,

    For almost ANYTHING that you find undefined during compilation attempt, good solutions are:

    - Open a demo project which you know has the undefined name (usually, any demo related to what you are doing, such as timers, pwm, etc...) - of course, a variable type definition like this case will appear in almost ALL examples.
    - Open a .c or .h file of the demo and find such name.
    - Hold CTRL key and left-click on the name, and CCS will open the file in which the thing is declared. For uint8_t, you would see it is "stdint.h".

    Other option:

    - Install a file seeker such as Agent Ransack, and use it to find the text, limiting your search scope to the TivaWare folders of your system to make life easier.
    - Look at the results. You might find several files inside project/demo folders, and will eventually find one or two inside libraries. Use your judgement to figure out the right one.

    As for the CG_ROOT story, I've just written on your other thread with a similar title...

    Cheers

    Bruno