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.

AM2634: Not able get I2C output on SCL and SDA lines for I2C2

Part Number: AM2634
Other Parts Discussed in Thread: SYSCONFIG,

Tool/software:

Hi Team,

 I have interfaced I2C based digipot to I2C2. I am using code from resource explorer "i2c_read_am263x-cc_r5fss0-0_nortos_ti-arm-clang". However, not able to see any output on scope for both the pins.

SDA pin : C6

SCL pin:  A5

I2C2 configuration is given below

Code:

void i2c_read_main(void *arg0)
{
uint16_t sample;
int32_t status;
uint32_t i2cReadTargetAddr;
uint8_t rxBuffer[I2C_READ_LEN];
uint8_t txBuffer[I2C_WRITE_LEN];
I2C_Handle i2cHandle;
I2C_Transaction i2cTransaction;

Drivers_open();
Board_driversOpen();

i2cReadTargetAddr = Board_i2cGetEepromDeviceAddr();
i2cHandle = gI2cHandle[CONFIG_I2C1];

DebugP_log("[I2C] Read data ... !!!\r\n");
txBuffer[0]=1;
/* Set default transaction parameters */
I2C_Transaction_init(&i2cTransaction);

/* Override with required transaction parameters */
i2cTransaction.readBuf = rxBuffer;
i2cTransaction.readCount = I2C_READ_LEN;
i2cTransaction.targetAddress = i2cReadTargetAddr;
i2cTransaction.writeCount= I2C_WRITE_LEN;
i2cTransaction.writeBuf= txBuffer;


/* Read 20 samples and log them */
for(sample = 0; sample < 20; sample++)
{
status = I2C_transfer(i2cHandle, &i2cTransaction);
if(status == I2C_STS_SUCCESS)
{
DebugP_log("[I2C] Sample %u: %u\r\n", sample, rxBuffer[0]);
}
else
{
i2c_read_error_handler(sample, i2cTransaction.status);
}
}

DebugP_log("[I2C] Read data ... DONE !!!\r\n");
if(status == SystemP_SUCCESS)
{
DebugP_log("All tests have passed!!\r\n");
}
else
{
DebugP_log("Some tests have failed!!\r\n");
}

Board_driversClose();
Drivers_close();

return;
}

Please let me know if I am missing any configuration or code change.

Appreciate your help!

  • Requesting for urgent support!

  • Requesting for urgent support!

  • Hi Ajith,

    Looks like you're configured to a wrong pin.

    The correct pins are mentioned in the user guide https://www.ti.com/lit/ug/spruj09d/spruj09d.pdf?ts=1723183030506.

    Can you try changing to this in the sysconfig?

    Let me know if the issue still exists

    Regards,

    Abishek S S

  • Hi Abhishek,

    As per the datasheet, I2C2 is only coming out on HSEC pins as shown below not on B7 and C7 as shown in page no 43,.

  • Hi Achishek, also please let me know pins for I2C0 and I2C1

  • Hi Ajit,

    The pin names you have shared are the pinmux options. If you select B7 or C7 in the sysconfig, our SDK pinmux driver will configure the mux to route the signal to I2C. I hope this answers your question.

    Also for I2C1, please use the pins suggested from Sysconfg

    Thanks,

    Abishek S S

  • Sure Abhishek, I have selected C7 and B7 from syscfg options for I2C2 as shown below

    For I2C0  SCL->A13  and SDA->B13

    For I2C1 SCL->D7 and SDA ->C8

    Please verify.

    And also I am using external pull ups of 4.7k and freq of 100KHZ

    We are connecting AM2634 control card to 

    TMDSHSECDOCK  to use all I2C pins. I will use HSEC pinouts of getting Dock station pins

    Thanks!

  • I2C3 SDA ->A16 SCL->B15

  • Still not able to get I2C waveforms from I2C0 pins SCL->A13 and SDA->B13

    Trying to send 0x55 on I2C0 but not seeing any waveform on scope.

    Appreciate your urgent support!

  • Ajit,

    Did you re-build your example in CCS with the new SysConfig settings?

    Regards,

    Brennan

  • Hi Brennan, 

    Yes I have rebuild the code

  • Ajit,

    Are you setting the select bit of the I2C0 MUX correctly?

    This signal, which comes from the I2C-controlled IO expander must be set HIGH to route signals to the HSEC pins of the control card EVM. 

    Regards,

    Brennan

  • Hi Brennan,

    I have configured I2C pins for I2C0 in syscfg. Do I need to do anything else for I2C0_MUX_SEL bit.? how can I do it in code? how can verify if its already done in code?

  • Hi Brennan,

    I also started checking for I2C1 since I2C1 pins are directly connected to HSEC180 connector.

    But still not getting any waveforms on I2C1SDA and I2C1SCL pins. 

    Please support on this!

  • Ajit,

    For I2C0_MUX_SEL bit, you need to send an I2C command to the IO expander device on the AM263x-CC to set the bit high. You can find example IO expander code at the SDK example at file location mcu_plus_sdk_am263x_09_02_00_56\examples\drivers\gpmc\gpmc_psram_io\am263x-cc\io_expander.c

    For I2C1, can you please describe how you are probing the SDA and SCL pins and what connections you are making?

    Regards,

    Brennan

  • Hi Brennan,

    I will check io_expander code for I2C0

    For I2C1, I am using below connections

  • Ajit,

    Are you connecting each scope probe to a common GND point on the control card?

    Regards,

    Brennan

  • Ajit, 

    Have you tried probing any of the other I2C peripherals on the HSEC pins?

  • Hi Brennan, Yes I have tried I2C2 but same result.

    Is it possbile to discuss this issue over call? If yes then please let me know suitable timings and timezone. I will schedule meeting.

  • I2C1 is directly coming on HSEC connector as shown below. Then why am I not getting I2C signals on pin 85 and 87 of HSEC Docking station.

    Please find below are syscfg and code files

    /**
    * These arguments were used when this file was generated. They will be automatically applied on subsequent loads
    * via the GUI or CLI. Run CLI with '--help' for additional information on how to override these arguments.
    * @cliArgs --device "AM263x_beta" --package "ZCZ" --part "AM263x" --context "r5fss0-0" --product "MCU_PLUS_SDK_AM263x@09.02.00"
    * @versions {"tool":"1.20.0+3587"}
    */

    /**
    * Import the modules used in this configuration.
    */
    const i2c = scripting.addModule("/drivers/i2c/i2c", {}, false);
    const i2c1 = i2c.addInstance();
    const i2c2 = i2c.addInstance();
    const debug_log = scripting.addModule("/kernel/dpl/debug_log");
    const mpu_armv7 = scripting.addModule("/kernel/dpl/mpu_armv7", {}, false);
    const mpu_armv71 = mpu_armv7.addInstance();
    const mpu_armv72 = mpu_armv7.addInstance();
    const mpu_armv73 = mpu_armv7.addInstance();
    const mpu_armv74 = mpu_armv7.addInstance();
    const mpu_armv75 = mpu_armv7.addInstance();
    const default_linker = scripting.addModule("/memory_configurator/default_linker", {}, false);
    const default_linker1 = default_linker.addInstance();
    const general = scripting.addModule("/memory_configurator/general", {}, false);
    const general1 = general.addInstance();
    const region = scripting.addModule("/memory_configurator/region", {}, false);
    const region1 = region.addInstance();
    const section = scripting.addModule("/memory_configurator/section", {}, false);
    const section1 = section.addInstance();
    const section2 = section.addInstance();
    const section3 = section.addInstance();
    const section4 = section.addInstance();
    const section5 = section.addInstance();
    const section6 = section.addInstance();
    const section7 = section.addInstance();
    const section8 = section.addInstance();
    const section9 = section.addInstance();
    const section10 = section.addInstance();
    const section11 = section.addInstance();
    const section12 = section.addInstance();

    /**
    * Write custom configuration values to the imported modules.
    */
    i2c1.$name = "CONFIG_I2C0";
    i2c1.I2C.$assign = "I2C0";
    i2c1.I2C.SCL.$assign = "I2C0_SCL";
    i2c1.I2C.SDA.$assign = "I2C0_SDA";
    i2c1.I2C_child.$name = "drivers_i2c_v1_i2c_v1_template0";

    i2c2.$name = "CONFIG_I2C1";
    i2c2.I2C.$assign = "I2C1";
    i2c2.I2C.SCL.$assign = "I2C1_SCL";
    i2c2.I2C.SDA.$assign = "I2C1_SDA";
    i2c2.I2C_child.$name = "drivers_i2c_v1_i2c_v1_template1";

    debug_log.enableUartLog = true;
    debug_log.uartLog.$name = "CONFIG_UART_CONSOLE";
    debug_log.uartLog.UART.$assign = "UART0";
    debug_log.uartLog.UART.RXD.$assign = "UART0_RXD";
    debug_log.uartLog.UART.TXD.$assign = "UART0_TXD";
    debug_log.uartLog.child.$name = "drivers_uart_v2_uart_v2_template0";

    mpu_armv71.$name = "CONFIG_MPU_REGION0";
    mpu_armv71.size = 31;
    mpu_armv71.attributes = "Device";
    mpu_armv71.accessPermissions = "Supervisor RD+WR, User RD";
    mpu_armv71.allowExecute = false;

    mpu_armv72.$name = "CONFIG_MPU_REGION1";
    mpu_armv72.size = 15;
    mpu_armv72.accessPermissions = "Supervisor RD+WR, User RD";

    mpu_armv73.$name = "CONFIG_MPU_REGION2";
    mpu_armv73.baseAddr = 0x41010000;
    mpu_armv73.size = 15;
    mpu_armv73.accessPermissions = "Supervisor RD+WR, User RD";

    mpu_armv74.$name = "CONFIG_MPU_REGION3";
    mpu_armv74.baseAddr = 0x70000000;
    mpu_armv74.size = 21;
    mpu_armv74.accessPermissions = "Supervisor RD+WR, User RD";

    mpu_armv75.$name = "CONFIG_MPU_REGION4";
    mpu_armv75.baseAddr = 0x60000000;
    mpu_armv75.size = 28;
    mpu_armv75.accessPermissions = "Supervisor RD, User RD";

    default_linker1.$name = "memory_configurator_default_linker0";

    general1.$name = "CONFIG_GENERAL0";
    general1.linker.$name = "TIARMCLANG0";

    region1.$name = "MEMORY_REGION_CONFIGURATION0";
    region1.memory_region.create(11);
    region1.memory_region[0].type = "TCMA";
    region1.memory_region[0].$name = "R5F_VECS";
    region1.memory_region[0].size = 0x40;
    region1.memory_region[0].auto = false;
    region1.memory_region[1].type = "TCMA";
    region1.memory_region[1].$name = "R5F_TCMA";
    region1.memory_region[1].size = 0x7FC0;
    region1.memory_region[2].type = "TCMB";
    region1.memory_region[2].size = 0x8000;
    region1.memory_region[2].$name = "R5F_TCMB";
    region1.memory_region[3].$name = "SBL";
    region1.memory_region[3].auto = false;
    region1.memory_region[3].size = 0x40000;
    region1.memory_region[4].$name = "OCRAM";
    region1.memory_region[4].auto = false;
    region1.memory_region[4].manualStartAddress = 0x70040000;
    region1.memory_region[4].size = 0x40000;
    region1.memory_region[5].type = "FLASH";
    region1.memory_region[5].auto = false;
    region1.memory_region[5].size = 0x80000;
    region1.memory_region[5].$name = "FLASH";
    region1.memory_region[6].$name = "USER_SHM_MEM";
    region1.memory_region[6].auto = false;
    region1.memory_region[6].manualStartAddress = 0x701D0000;
    region1.memory_region[6].size = 0x4000;
    region1.memory_region[6].isShared = true;
    region1.memory_region[6].shared_cores = ["r5fss0-1","r5fss1-0","r5fss1-1"];
    region1.memory_region[7].$name = "LOG_SHM_MEM";
    region1.memory_region[7].auto = false;
    region1.memory_region[7].manualStartAddress = 0x701D4000;
    region1.memory_region[7].size = 0x4000;
    region1.memory_region[7].isShared = true;
    region1.memory_region[7].shared_cores = ["r5fss0-1","r5fss1-0","r5fss1-1"];
    region1.memory_region[8].type = "CUSTOM";
    region1.memory_region[8].$name = "RTOS_NORTOS_IPC_SHM_MEM";
    region1.memory_region[8].auto = false;
    region1.memory_region[8].manualStartAddress = 0x72000000;
    region1.memory_region[8].size = 0x3E80;
    region1.memory_region[8].isShared = true;
    region1.memory_region[8].shared_cores = ["r5fss0-1","r5fss1-0","r5fss1-1"];
    region1.memory_region[9].type = "CUSTOM";
    region1.memory_region[9].$name = "MAILBOX_HSM";
    region1.memory_region[9].auto = false;
    region1.memory_region[9].manualStartAddress = 0x44000000;
    region1.memory_region[9].size = 0x3CE;
    region1.memory_region[9].isShared = true;
    region1.memory_region[9].shared_cores = ["r5fss0-1","r5fss1-0","r5fss1-1"];
    region1.memory_region[10].type = "CUSTOM";
    region1.memory_region[10].$name = "MAILBOX_R5F";
    region1.memory_region[10].auto = false;
    region1.memory_region[10].manualStartAddress = 0x44000400;
    region1.memory_region[10].size = 0x3CE;
    region1.memory_region[10].isShared = true;
    region1.memory_region[10].shared_cores = ["r5fss0-1","r5fss1-0","r5fss1-1"];

    section1.load_memory = "R5F_VECS";
    section1.group = false;
    section1.$name = "Vector Table";
    section1.output_section.create(1);
    section1.output_section[0].$name = ".vectors";
    section1.output_section[0].palignment = true;

    section2.load_memory = "OCRAM";
    section2.$name = "Text Segments";
    section2.output_section.create(5);
    section2.output_section[0].$name = ".text.hwi";
    section2.output_section[0].palignment = true;
    section2.output_section[1].$name = ".text.cache";
    section2.output_section[1].palignment = true;
    section2.output_section[2].$name = ".text.mpu";
    section2.output_section[2].palignment = true;
    section2.output_section[3].$name = ".text.boot";
    section2.output_section[3].palignment = true;
    section2.output_section[4].$name = ".text:abort";
    section2.output_section[4].palignment = true;

    section3.load_memory = "OCRAM";
    section3.$name = "Code and Read-Only Data";
    section3.output_section.create(2);
    section3.output_section[0].$name = ".text";
    section3.output_section[0].palignment = true;
    section3.output_section[1].$name = ".rodata";
    section3.output_section[1].palignment = true;

    section4.load_memory = "OCRAM";
    section4.$name = "Data Segment";
    section4.output_section.create(1);
    section4.output_section[0].$name = ".data";
    section4.output_section[0].palignment = true;

    section5.load_memory = "OCRAM";
    section5.$name = "Memory Segments";
    section5.output_section.create(3);
    section5.output_section[0].$name = ".bss";
    section5.output_section[0].output_sections_start = "__BSS_START";
    section5.output_section[0].output_sections_end = "__BSS_END";
    section5.output_section[0].palignment = true;
    section5.output_section[1].$name = ".sysmem";
    section5.output_section[1].palignment = true;
    section5.output_section[2].$name = ".stack";
    section5.output_section[2].palignment = true;

    section6.load_memory = "OCRAM";
    section6.$name = "Stack Segments";
    section6.output_section.create(5);
    section6.output_section[0].$name = ".irqstack";
    section6.output_section[0].output_sections_start = "__IRQ_STACK_START";
    section6.output_section[0].output_sections_end = "__IRQ_STACK_END";
    section6.output_section[0].input_section.create(1);
    section6.output_section[0].input_section[0].$name = ". = . + __IRQ_STACK_SIZE;";
    section6.output_section[1].$name = ".fiqstack";
    section6.output_section[1].output_sections_start = "__FIQ_STACK_START";
    section6.output_section[1].output_sections_end = "__FIQ_STACK_END";
    section6.output_section[1].input_section.create(1);
    section6.output_section[1].input_section[0].$name = ". = . + __FIQ_STACK_SIZE;";
    section6.output_section[2].$name = ".svcstack";
    section6.output_section[2].output_sections_start = "__SVC_STACK_START";
    section6.output_section[2].output_sections_end = "__SVC_STACK_END";
    section6.output_section[2].input_section.create(1);
    section6.output_section[2].input_section[0].$name = ". = . + __SVC_STACK_SIZE;";
    section6.output_section[3].$name = ".abortstack";
    section6.output_section[3].output_sections_start = "__ABORT_STACK_START";
    section6.output_section[3].output_sections_end = "__ABORT_STACK_END";
    section6.output_section[3].input_section.create(1);
    section6.output_section[3].input_section[0].$name = ". = . + __ABORT_STACK_SIZE;";
    section6.output_section[4].$name = ".undefinedstack";
    section6.output_section[4].output_sections_start = "__UNDEFINED_STACK_START";
    section6.output_section[4].output_sections_end = "__UNDEFINED_STACK_END";
    section6.output_section[4].input_section.create(1);
    section6.output_section[4].input_section[0].$name = ". = . + __UNDEFINED_STACK_SIZE;";

    section7.load_memory = "OCRAM";
    section7.$name = "Initialization and Exception Handling";
    section7.output_section.create(3);
    section7.output_section[0].$name = ".ARM.exidx";
    section7.output_section[0].palignment = true;
    section7.output_section[1].$name = ".init_array";
    section7.output_section[1].palignment = true;
    section7.output_section[2].$name = ".fini_array";
    section7.output_section[2].palignment = true;

    section8.load_memory = "USER_SHM_MEM";
    section8.type = "NOLOAD";
    section8.$name = "User Shared Memory";
    section8.group = false;
    section8.output_section.create(1);
    section8.output_section[0].$name = ".bss.user_shared_mem";
    section8.output_section[0].alignment = 0;

    section9.load_memory = "LOG_SHM_MEM";
    section9.$name = "Log Shared Memory";
    section9.group = false;
    section9.type = "NOLOAD";
    section9.output_section.create(1);
    section9.output_section[0].$name = ".bss.log_shared_mem";
    section9.output_section[0].alignment = 0;

    section10.load_memory = "RTOS_NORTOS_IPC_SHM_MEM";
    section10.type = "NOLOAD";
    section10.$name = "IPC Shared Memory";
    section10.group = false;
    section10.output_section.create(1);
    section10.output_section[0].$name = ".bss.ipc_vring_mem";
    section10.output_section[0].alignment = 0;

    section11.load_memory = "MAILBOX_HSM";
    section11.type = "NOLOAD";
    section11.$name = "SIPC HSM Queue Memory";
    section11.group = false;
    section11.output_section.create(1);
    section11.output_section[0].$name = ".bss.sipc_hsm_queue_mem";
    section11.output_section[0].alignment = 0;

    section12.load_memory = "MAILBOX_R5F";
    section12.$name = "SIPC R5F Queue Memory";
    section12.group = false;
    section12.type = "NOLOAD";
    section12.output_section.create(1);
    section12.output_section[0].$name = ".bss.sipc_r5f_queue_mem";
    section12.output_section[0].alignment = 0;

    Code:

    #include <drivers/i2c.h>
    #include <kernel/dpl/DebugP.h>
    #include "ti_drivers_config.h"
    #include "ti_drivers_open_close.h"
    #include "ti_board_open_close.h"

    extern uint32_t Board_i2cGetEepromDeviceAddr(void);
    #define I2C_READ_LEN (1U)
    #define I2C_WRITE_LEN (1U)

    static void i2c_read_error_handler(uint16_t sample, int32_t status);

    void i2c_read_main(void *arg0)
    {
    uint16_t sample;
    int32_t status;
    uint32_t i2cReadTargetAddr;
    uint8_t rxBuffer[I2C_READ_LEN];
    uint8_t txBuffer[I2C_READ_LEN];
    I2C_Handle i2cHandle;
    I2C_Transaction i2cTransaction;
    txBuffer[0]=0xAA;
    Drivers_open();
    Board_driversOpen();

    i2cReadTargetAddr = Board_i2cGetEepromDeviceAddr();
    i2cHandle = gI2cHandle[CONFIG_I2C1];

    DebugP_log("[I2C] Read data ... !!!\r\n");

    /* Set default transaction parameters */
    I2C_Transaction_init(&i2cTransaction);

    /* Override with required transaction parameters */
    i2cTransaction.writeBuf=txBuffer;
    i2cTransaction.writeCount = I2C_WRITE_LEN;
    // i2cTransaction.readBuf = rxBuffer;
    // i2cTransaction.readCount = I2C_READ_LEN;
    i2cTransaction.targetAddress = i2cReadTargetAddr;

    /* Read 20 samples and log them */
    while(1)
    {
    status = I2C_transfer(i2cHandle, &i2cTransaction);
    if(status == I2C_STS_SUCCESS)
    {
    DebugP_log("[I2C] RX-> %x, TX->%x\r\n",rxBuffer[0], txBuffer[0]);
    }
    else
    {
    i2c_read_error_handler(sample, i2cTransaction.status);
    }
    }

    DebugP_log("[I2C] Read data ... DONE !!!\r\n");
    if(status == SystemP_SUCCESS)
    {
    DebugP_log("All tests have passed!!\r\n");
    }
    else
    {
    DebugP_log("Some tests have failed!!\r\n");
    }

    Board_driversClose();
    Drivers_close();

    return;
    }

    static void i2c_read_error_handler(uint16_t sample, int32_t status)
    {
    switch(status)
    {
    case I2C_STS_ERR:
    DebugP_logError("[I2C] Sample %u: Generic error occurred", sample);
    break;
    case I2C_STS_ERR_TIMEOUT:
    DebugP_logError("[I2C] Sample %u: Timeout error occurred", sample);
    break;
    case I2C_STS_ERR_NO_ACK:
    DebugP_logError("[I2C] Sample %u: No acknowledgement received", sample);
    break;
    case I2C_STS_ERR_ARBITRATION_LOST:
    DebugP_logError("[I2C] Sample %u: Arbitration lost", sample);
    break;
    case I2C_STS_ERR_BUS_BUSY:
    DebugP_logError("[I2C] Sample %u: Bus Bus Busy error occurred", sample);
    break;
    }

    return;
    }

    This is very urgent for project milestones and delivery. Please review and support on this. Is there any example where I2C1 is used?

  • Hello Ajit,

    Brennan is on leave currently so I will step in here to try and help.

    I don't have the full hardware setup to test the I2C1 connection today but will have that available on Monday. In the meantime I can do a review of the schematic / SysConfig / code to identify any issues with it.

    RE: examples with I2C1 I'll review the SDK examples but we don't usually have examples for every serial communication port.

    Best Regards,

    Ralph Jacobi

  • Hello Ajit,

    Reviewing the SW + SysConfig everything seems to check out on the surface. I verified your pin selections are correct based on the ControlCard schematics. FYI we have pull-ups on the ControlCard so you don't even need those on the I2C lines. I don't think they are doing any harm but you can simplify your test setup.

    For I2C1, I am using below connections

    So you are probing directly at the ControlCard HSEC pins without using the Dock? I've never tried probing signals like that before but it's doable in theory. Can you send an image of the exact HW setup so I can verify vs our schematic that you are probing the correct pins then?

    Ideally it would be better to use the HSEC Dock here. If so, let me know which pins you are probing on that. While I don't recall running into this with I2C, I've had a past instance where documentation misled on which HSEC Dock pin to probe so would want to verify exactly where you are probing.

    I will have a full HW setup on Monday where I can run your exact code and validate on my end. Also checking with another team member if they can do similar today.

    Best Regards,

    Ralph Jacobi

  • Sure Ralph, Appreciate your support!

  • Hi Ralph, I am using dock for testing signals for I2C1. I am connecting to 85 and 87 on dock

    HW setup picture as given below.

    Is there any issue with SW? 

  • Currently I am using i2c_read_am263x-cc_r5fss0-0_freertos_ti-arm-clang from resource explorer and trying to configure I2C1 in this. I have already shared SysCfg and code details.

  • Hi Ajit,

    Are you powering the dock from the USB-C connector on the Dock when running the test? Or if not how are you powering the setup?

    Best Regards,

    Ralph Jacobi

  • Hi Ralph,

    I am using Type-C adaptor to power up the control card. Dock card is getting supply from control card. I have also tried using SPI pins on dock station and SPI works but I2C1 is not working

  • Thanks Ajit, one of my team members is working to replicate this exact setup. Will report back when they have results.

    Best Regards,

    Ralph Jacobi

  • Hello Ajit,

    My team member confirmed operation of I2C1 on the AM263 ControlCard + HSECDOCK setup with Pins 85 and 87 outputting I2C using a project built from the SysConfig / Application code you provided with one edit being hardcoding the I2C address instead of using the Board_i2cGetEepromDeviceAddr API which was just to streamline the test.

    Given this result, I would expect you get proper outputs on your board. Is the image shown without the debug connections made? Because Pins 85/87 aren't being probed on that image.

    Best Regards,

    Ralph Jacobi

  • Yes, in the image it's not connected. But I am connecting it to 85 and 87 to scope.

    Is it possible share syscfg and code files so that I can compare and check the issues.

  • Hello Ajit,

    We took your exact code and re-used it as is except I replaced

    i2cReadTargetAddr = Board_i2cGetEepromDeviceAddr();

    with 

    i2cReadTargetAddr = 0x20;

    Just so I didn't have to import the board.c file.

    Looking at your board, it looks like you are using QSPI flash mode, so are you loading the .out file and executing from QSPI then? I believe the attempt my team member made was using NOBOOT mode in CCS directly rather than using any boot loaders.

    https://e2e.ti.com/cfs-file/__key/communityserver-discussions-components-files/908/1222.example.syscfg

    /*
     *  Copyright (C) 2021 Texas Instruments Incorporated
     *
     *  Redistribution and use in source and binary forms, with or without
     *  modification, are permitted provided that the following conditions
     *  are met:
     *
     *    Redistributions of source code must retain the above copyright
     *    notice, this list of conditions and the following disclaimer.
     *
     *    Redistributions in binary form must reproduce the above copyright
     *    notice, this list of conditions and the following disclaimer in the
     *    documentation and/or other materials provided with the
     *    distribution.
     *
     *    Neither the name of Texas Instruments Incorporated nor the names of
     *    its contributors may be used to endorse or promote products derived
     *    from this software without specific prior written permission.
     *
     *  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
     *  "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
     *  LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
     *  A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
     *  OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
     *  SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
     *  LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
     *  DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
     *  THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
     *  (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
     *  OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
     */
    
    #include <stdio.h>
    #include <kernel/dpl/DebugP.h>
    #include "ti_drivers_config.h"
    #include "ti_drivers_open_close.h"
    #include "ti_board_open_close.h"
    
    /*
     * This is an empty project provided for all cores present in the device.
     * User can use this project to start their application by adding more SysConfig modules.
     *
     * This application does driver and board init and just prints the pass string on the console.
     * In case of the main core, the print is redirected to the UART console.
     * For all other cores, CCS prints are used.
     */
    
    #include <drivers/i2c.h>
    #include <kernel/dpl/DebugP.h>
    #include "ti_drivers_config.h"
    #include "ti_drivers_open_close.h"
    #include "ti_board_open_close.h"
    
    //extern uint32_t Board_i2cGetEepromDeviceAddr(void);
    #define I2C_READ_LEN (1U)
    #define I2C_WRITE_LEN (1U)
    
    static void i2c_read_error_handler(uint16_t sample, int32_t status);
    
    void i2c_read_main(void *arg0)
    {
        uint16_t sample;
        int32_t status;
        uint32_t i2cReadTargetAddr;
        uint8_t rxBuffer[I2C_READ_LEN];
        uint8_t txBuffer[I2C_READ_LEN];
        I2C_Handle i2cHandle;
        I2C_Transaction i2cTransaction;
        txBuffer[0]=0xAA;
        Drivers_open();
        Board_driversOpen();
    
        i2cReadTargetAddr = 0x20;
        i2cHandle = gI2cHandle[CONFIG_I2C1];
    
        DebugP_log("[I2C] Read data ... !!!\r\n");
    
        /* Set default transaction parameters */
        I2C_Transaction_init(&i2cTransaction);
    
        /* Override with required transaction parameters */
        i2cTransaction.writeBuf=txBuffer;
        i2cTransaction.writeCount = I2C_WRITE_LEN;
        // i2cTransaction.readBuf = rxBuffer;
        // i2cTransaction.readCount = I2C_READ_LEN;
        i2cTransaction.targetAddress = i2cReadTargetAddr;
    
        /* Read 20 samples and log them */
        while(1)
        {
            status = I2C_transfer(i2cHandle, &i2cTransaction);
            if(status == I2C_STS_SUCCESS)
            {
                DebugP_log("[I2C] RX-> %x, TX->%x\r\n",rxBuffer[0], txBuffer[0]);
            }
            else
            {
                i2c_read_error_handler(sample, i2cTransaction.status);
            }
        }
    
        DebugP_log("[I2C] Read data ... DONE !!!\r\n");
        if(status == SystemP_SUCCESS)
        {
            DebugP_log("All tests have passed!!\r\n");
        }
        else
        {
            DebugP_log("Some tests have failed!!\r\n");
        }
    
        Board_driversClose();
        Drivers_close();
    
        return;
    }
    
    static void i2c_read_error_handler(uint16_t sample, int32_t status)
    {
        switch(status)
        {
        case I2C_STS_ERR:
            DebugP_logError("[I2C] Sample %u: Generic error occurred", sample);
            break;
        case I2C_STS_ERR_TIMEOUT:
            DebugP_logError("[I2C] Sample %u: Timeout error occurred", sample);
            break;
        case I2C_STS_ERR_NO_ACK:
            DebugP_logError("[I2C] Sample %u: No acknowledgement received", sample);
            break;
        case I2C_STS_ERR_ARBITRATION_LOST:
            DebugP_logError("[I2C] Sample %u: Arbitration lost", sample);
            break;
        case I2C_STS_ERR_BUS_BUSY:
            DebugP_logError("[I2C] Sample %u: Bus Bus Busy error occurred", sample);
            break;
        }
    
        return;
    }
    

    Best Regards,

    Ralph Jacobi

  • Hi Ralph, 

    I have used same code but still no output on scope.

    Can you please send me your board setup image? Are you providing seperate power to dock board? 

    If possible, please provide complete project that you have used.

    Thanks!

  • I have setup meeting on Monday. Please let me know on timings, so I will ready with setup.

    Meeting link-> Join the meeting now

  • Code is getting stuck at status = I2C_transfer(i2cHandle, &i2cTransaction);

    Debug terminal output

  • Hi Ralph,

    I am able to get the I2C1 waveforms on scope. Now, I will connect slave device and check the communication

    Thanks!

    Can you please let me know complete steps to enable mux options for I2C0 also? Because we need to use two I2C bus in project. I have looked into IO expander code but did not get how to enable I2C0 mux options

  • Hi Ralph, I can either write or read from I2C1 but not both in same I2C_transfer call.

    Do I need to call I2C_transfer seperate for writing data and seperate for reading data from slave device.

    Also, can we initialize both txbuf and rxbuf at same time? as shown below before I2C_transfer

    i2cTransaction.writeBuf = txBuffer;
    i2cTransaction.writeCount = 1;
     i2cTransaction.readBuf = rxBuffer;
    i2cTransaction.readCount = 1;
    i2cTransaction.targetAddress = deviceAddress;

  • Hello Ajit,

    Do I need to call I2C_transfer seperate for writing data and seperate for reading data from slave device.

    I have not tried to do this with one call so I'm not certain, I'll ask one of our software experts to comment on this. It's not clear from API documentation to me which is something we can improve.

    I am able to get the I2C1 waveforms on scope. Now, I will connect slave device and check the communication

    Glad to hear you were able to get I2C1 working.

    Can you please let me know complete steps to enable mux options for I2C0 also? Because we need to use two I2C bus in project. I have looked into IO expander code but did not get how to enable I2C0 mux options

    I am working on verifying the code for this right now and will update when I have confirmed getting the signals output for I2C0.

    Best Regards,

    Ralph Jacobi

  • Sure, appreciate your support!

  • Hi Ajit,

    Okay so as far as I2C0 goes - that is actually routed to the Board ID EEPROM usually. From what I can see you could also route it with the HSEC mux option and then use it as an I2C on the HSEC pins but you'd have to add the pull ups at that point.

    If so, we'd need to set the I2C0_MUX_SEL output from the I/O expender to be high.

    Would that be suitable for your needs? If so I'll provide a project that handles all of those elements tomorrow.

    Best Regards,

    Ralph Jacobi

  • Sure, that will be helpful. Also, please check if any example where write and read both are done using I2C1.

    Thanks!

  • Hi Ajit,

    I haven't been able to get this working today and I am not sure how much time I will have in the next couple days to spend more time on this as putting together these examples are a bit out of my usual scope.

    That said here is the IO expander scope to handle the I2C0 mux. You'll need to configure I2C2 for pins C7 and B7 at 400kHz and then run this:

    void i2c_io_expander(void *args)
    {
        int32_t         status;
        uint32_t        i2cTargetAddr;
        uint8_t         txBuffer[3];
        I2C_Handle      i2cHandle;
        I2C_Transaction i2cTransaction;
        i2cTargetAddr     = 0x20;
        i2cHandle = gI2cHandle[CONFIG_I2C2];
        status = I2C_probe(i2cHandle, i2cTargetAddr);
    
    
        if(status == SystemP_SUCCESS)
        {
            DebugP_log("[I2C] IO Expander found at device address 0x%02x \r\n", i2cTargetAddr);
        }
        else
        {
            DebugP_logError("[I2C] IO Expander not found at device address 0x%02x \r\n", i2cTargetAddr);
        }
        if(status == SystemP_SUCCESS)
                {
    
    
                    I2C_Transaction_init(&i2cTransaction);
                    i2cTransaction.writeBuf   = txBuffer;
                    i2cTransaction.writeCount = 3;
                    i2cTransaction.targetAddress = i2cTargetAddr;
                    txBuffer[0] = 0x06; /* configuration register 1 */
                    txBuffer[1] = 0xF3; /* ICSSM1_MUX_SEL ,ICSSM2_MUX_SELconfigured as output */
                    //txBuffer[2] = 0x07; /* configuration register 2 */
                    txBuffer[2] = 0xFC; /* RGMII_MUX_SEL configured as output, I2C0_MUX_SEL configured as output */
    
    
                    I2C_transfer(i2cHandle, &i2cTransaction);
                    DebugP_log("[I2C] IO Expander Configuration complete. [GPMC][PSRAM] ready for operation. \r\n");
                }
        Drivers_i2cClose();
    }
    

    Best Regards,

    Ralph Jacobi