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.

I2C0 didn't generate clock out.

Dear all:

I have I2C test program (basically it's from spectrum digital's example )  runs on DSP of omapl137, it never send data successfully, can someone help me to see what's happened.

I used I2C0 and pinmux8 set as 0x28822111 (for I2C0_SCL, I2C0_DAT) via AISGen tool, that is the test program is as AIS format file, all PSCs are enabled. system clock is set as 24M Hz crystal, CPU 300 MHz. EMIFA 100MHz, EMIFB 300MHz.

Since I2C0 clock input is auxclk, and MDIO test program is OK (which use auxclk also), I assume the auxclk is enabled when program runs.

I want to use I2C0 to act as master transmit mode. Below is my init code for I2C0:

 

/* 24M Hz I2C input clock, I2C system clock 8M Hz, I2C 40Kbits/sec */

    I2C_ICMDR   = 0;               
    I2C_ICPSC   = 2;                
    I2C_ICCLKL  = 95;           
    I2C_ICCLKH  = 95;

      while(I2C_ICIVR != 0) I2C_ICIVR;
      I2C_ICSTR = I2C_ICSTR;         
   
    I2C_ICMDR = 0   | ICMDR_FREE
                    | ICMDR_STT      
                    | ICMDR_STP     
                    | ICMDR_MST                 // master mode     
                    | ICMDR_TRX;                // transmit mode

  I2C_ICMDR  |= ICMDR_IRS;        // Release I2C0 from reset

After init routine, I try to transmit data, but I get time-out message. I can't see clock signal from the scope during program runs, below is the code for transmit:

        I2C_ICCNT = len;                   
        I2C_ICSAR = i2c_addr;

       for ( i = 0 ; i < len ; i++ )
        {
            while(I2C_ICIVR != 0) I2C_ICIVR;
            I2C_ICSTR = I2C_ICSTR;          
                                         
            I2C_ICDXR = data[i];          
           
            timeout = i2c_timeout;
            do
            {
                if ( timeout-- < 0  )
                {
                    EVMOMAPL137_I2C_reset( );
                    return -1;
                }
            } while ( ( I2C_ICSTR & ICSTR_ICXRDY ) == 0 );
        }

   The routine always time out and have no clock, data send out, can someone tell me what's wrong, or what can I check to fix the problem?

 

 

 

  • Can you clarify whether you are using the EVM or your own custom board? The Spectrum example should definitely work on the EVM, so if you are having problems on your custom board, are there any differences on the I2C bus on yours an the Spectrum board?

    Also before using AISgen try debugging all in CCS using the GEL files to set pinmuxing and PSCs. Once you get it working in CCS then work on converting to a standalone flashed image.

    Jeff

  • Dear JC:

     It's a custom board and the board is boot from UART1 to load DSP program, such as I2C0 test program (AISgen format).  I ran  several programs fine, including UART test, Ethernet loopback test , NAND test, all based on Spectrum example with a little modification. The I2C0 test program also comes from Spectrum's example.

    I can't run GEL due to it's a custom board. However I set the pinmux to enable I2C0 pins as previous mail mentioned and enable all PSCs. Can you give me the GEL file so I can check what's the difference between the GEL and my I2C0 configuration.

    The I2C0 hardware on my board is very simple, just pull high and connect to  both clock generator and RTC. It should have no problem for the I2C0 hardware. So I think there must be some registers I forget to configure or wrong use to make I2C0 runs. Do you think somewhere is not proper in my program (please see previous mail for the program).

     

  • You can still use the Spectrum GEL file with your board. The only modification might be to the SDRAM settings and/or PLLs if you use a different crystal.

    The examples rely on the GEL to setup pinmuxing, PSC, and clocking so it is important to get the GEL file working.

    Jeff