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.

[EVM K2H] Basic I2C, SPI, UART, GPIO implementation



Hi,

I'm trying to use EVM K2H to read data from some sensors via I2C, SPI, UART, interrupts from GPIO, and output PWM signals on GPIO.

I am new to the Keystone II platform and I am a little confused with the various tools available such as MCSDK, SYS/BIOS, TI-RTOS, Processor SDK, etc. I intend to run it on baremetal. However, I am open to using RTOS if the LLD libraries require it.

In addition, I often times encounter errors with the linker as I cannot find the proper library file paths. The examples provided are also rather limited in that they only cover initialisation. Are there any I2C_read(handle, data) functions supplied?

Thank you in advance for your help!

Regards,
tuckging

  • Welcome to the TI E2E forum. I hope you will find many good answers here and in the TI.com documents and in the TI Wiki Pages (for processor issues). Be sure to search those for helpful information and to browse for the questions others may have asked on similar topics (e2e.ti.com). Please read all the links below my signature.

    We will get back to you on the above query shortly. Thank you for your patience.

    Thank you.

    Note: We strongly recommend you to create new e2e thread for your queries instead of following up on an old/closed e2e thread, new threads gets more attention than old threads and can provide link of old threads or information on the new post for clarity and faster response.

  •  

    I am new to the Keystone II platform and I am a little confused with the various tools available such as MCSDK, SYS/BIOS, TI-RTOS, Processor SDK, etc. I intend to run it on baremetal. However, I am open to using RTOS if the LLD libraries require it.

    In addition, I often times encounter errors with the linker as I cannot find the proper library file paths. The examples provided are also rather limited in that they only cover initialisation. Are there any I2C_read(handle, data) functions supplied?

    We recommend you to use latest Processor SDK(find download link below my signature) and CCSv6.1.2. You can use the PDK script to generate examples for I2C, SPI, UART. Refer below link to generate the examples.

    Please get back to us if you have any issues in running the examples.

    Thank you.

  • Thank you Raja for the prompt reply. I have generated the examples successfully.

    However, is there further documentation on how to proceed from the example? For instance, I wish to use the SPI2 port on the 120-pin connector of the EVMK2H. Do I change the code from

    /* Open SPI driver */
    flashHandle = N25Q_open(TEST_SPI_PORT, &spiParams);

    to

    /* Open SPI driver */
    flashHandle = N25Q_open(2U, &spiParams);

    since TEST_SPI_PORT is #defined as (0U)?

    Also, how do I specify the Chip Selects and is it possible to enable more than one chip at a time? I am using a 2-to-4 demux with CS1 and CS3 connected to the address selects, and CS0 is the multiplexed signal.

    Also, if I wish to develop in bare metal, do I add a #define BARE_METAL in the main .c file? I tried that and it caused linker issues.

    Thanks again for your help!

    Regards,
    tuckging
  • Dear tuckging,


    /* Open SPI driver */
    flashHandle = N25Q_open(TEST_SPI_PORT, &spiParams);

    to

    /* Open SPI driver */
    flashHandle = N25Q_open(2U, &spiParams);

    since TEST_SPI_PORT is #defined as (0U)?

    Also, how do I specify the Chip Selects and is it possible to enable more than one chip at a time? I am using a 2-to-4 demux with CS1 and CS3 connected to the address selects, and CS0 is the multiplexed signal.

    You are right. You can use like that.


    Also, if I wish to develop in bare metal, do I add a #define BARE_METAL in the main .c file? I tried that and it caused linker issues.

    What error you are getting ?

    Similar to like this ??
    spi_test C:\ti\pdk_k2hk_4_0_0\packages\MyExampleProjects_k2hk\SPI_BasicExample_K2H_c66xExampleProject\Debug\configPkg\package\cfg\spi_test_pe66.oe66

    If yes, you have to comment it out the "spi_test" task in *.cfg file.

    /* ================ Task configuration ================ */
    //var task0Params = new Task.Params();
    //task0Params.instance.name = "echo";
    //task0Params.stackSize = 0x1000;
    //Program.global.echo = Task.create("&spi_test", task0Params);
  • Thank you Titus,

    I managed to compile it in BARE_METAL.

    Also, how do I specify the Chip Selects and is it possible to enable more than one chip at a time? I am using a 2-to-4 demux with CS1 and CS3 connected to the address selects, and CS0 is the multiplexed signal.

    Thanks & regards,
    Tuck Ging