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.

TMS320C6747: TMS320C6747 I2C(I2C0)によるEEPROMアクセスの動作不良

Part Number: TMS320C6747
Other Parts Discussed in Thread: OMAP-L137

Tool/software:

Hi.

I'm having trouble writing to the EEPROM with the I2C0 peripheral.
The symptom is that there is no output to SCL and SDA when the DSP is the master.

The I2C0 peripheral is not unpaused by PSC.
It has been confirmed that each register changes normally when I2C_init() and I2C_write() are executed in steps.
It has been confirmed that ICPFUNC0.PFUNC0 is 0 (Disable).
The UART0 peripheral, which is a pin that conflicts with I2C0's SCL and SDA, is in sleep mode.
The SCL and SDA terminals are pulled up with 10kΩ.

The necessary code is partially extracted and listed below.
These codes are based on the code included in OMAP-L137_C6747_BSL.


/*****************************************************/

char pBuff[16];

/*****************************************************/
u16 I2C_init(void)
{
    ICMDR0   = 0;                // Reset I2C
    ICMDR0  |= ICMDR_MST;        // Release I2C master

    // I2C input clock = 16.384MHz
    ICPSC0  =  0x00000001;      // IPSC=1       I2C Prescaler = 2
                                // Prescaled module clock = 16.384MHz / 2 = 8.192MHz
    ICCLKL0 =  5;               // ICCL=5       (ICCL+6)+(ICCH+6)
    ICCLKH0 =  5;               // ICCH=5       (ICCL+6)+(ICCH+6)
                                // SCL = (16.384MHz / 2) / ( (ICCL+6)+(ICCH+6) )
                                //     = (16.384MHz / 2) / 22
                                //     = 372.363kHz
    ICSTR0 = ICSTR0;
    ICMDR0 |= ICMDR_IRS;        // Release I2C from reset
    ICSTR0 |= (ICSTR_ARDY | ICSTR_BB);
    return 0;
}

/*****************************************************/
s16 I2C_close(void)
{
    ICMDR0     = 0;                      // Reset I2C
    return 0;
}

/*****************************************************/
s16 I2C_reset(void)
{
    I2C_close();
    I2C_init();
    return 0;
}

/*****************************************************/
s16 I2C_write( u16 i2c_addr, u08* data, u16 len )
{
s32 timeout, i;

    ICCNT0   = len;                    // Set length
    ICSAR0   = i2c_addr;               // Set I2C slave address
    ICMDR0   = ICMDR_STT               // Set for Master Write
             | ICMDR_TRX
             | ICMDR_MST
             | ICMDR_IRS
             | ICMDR_FREE;

    i2c_wait( 1000 );                        // Short delay

    for ( i = 0 ; i < len ; i++ )
    {
        ICDXR0 = data[i];              // Write

        timeout = i2c_timeout;
        do
        {
            if ( timeout-- < 0  )
            {
                I2C_reset();
                return -1;
            }
        } while ( ( ICSTR0 & ICSTR_ICXRDY ) == 0 );  // Wait for Tx Ready
    }

    ICMDR0  |= ICMDR_STP;             // Generate STOP
    return 0;

}

/*****************************************************/
void main()
{
s16 ans;

    // PLL,PINMUX setting
        AUXCLK is 16.384MHz
        SYSCNF0.PINMUX8_19_16 = 2       // I2C_SCL
        SYSCNF0.PINMUX8_15_12 = 2       // I2C_SDA
    ...

    //
    I2C_init();

        while(1){
            strcpy(pBuff[], "TEST - 0");
            ans = I2C_write(pBuff, 0x0FF0, 8);        // 0x0FF0 is the write address in the EEPROM
            if(ans == 0) break;
        }
    

}

/*****************************************************/

Thanks.