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.

I2C: Error to change Slave Address

Other Parts Discussed in Thread: TMS570LS3137

Hi,

I'm working with TMS570LS3137 and i'm trying to startup my I2C driver (Interrupts mode)

I try to communicate the TMS with an Accelerometer (MMA8451Q). This accelerometer has a Device Address 0x1C, but depends if you want to read or write, the final value of the Slave Address change to:
     Write Command has a Device Address 0x38
     Read Command has a Device Address 0x39

If I set as Slave Address 0x1C and I send a frame, then I can see the frame in the osciloscope. (In debbuger mode, I can see how the program arrives to breakpoints in  ISR code)

But if I change the Slave address to any different value, then the frame is truncated (In debugger mode, the flow of the program never arrives to breakpoints in  ISR cod)

void I2C_vInit(void)
{
    I2C__tstMemMap *pstI2C = I2C__ADDR_PTR;
    
    /** - i2c out of reset */
    pstI2C->MDR = I2C__MDR_nIRS_MASK;

    /* Set I2C mode */
    pstI2C->MDR = (I2C__MDR_BC(0)     |    /* Bit count */
                I2C__MDR_MST_MASK    |    /* Master/Slave mode */
                I2C__MDR_STP_MASK    |    /* Stop Transmision */
                I2C__MDR_TRX_MASK    );    /* Transmitter enable */
                                                              /* 7-bit addressing mode */
                        

    /* Frame LEN */
    pstI2C->CNT = 2;

    /* Disable Interrupts */
    pstI2C->IMR = 0;

    /* Preescale */
    pstI2C->PSC = I2C__PREESCALE_cfg;

    /* Clock */
    pstI2C->CLKH = I2C__CLK_cfg;
    pstI2C->CLKL = I2C__CLK_cfg;

    /* I2C mode */
    pstI2C->FUN = 0;
   
    /* Enable Interrupts */
    pstI2C->IMR = I2C__IMR_RXRDYEN_MASK | I2C__IMR_SCDEN_MASK;        /* Receive and Stop Condition   */
    
    pstI2C->MDR |= I2C__MDR_nIRS_MASK; /* i2c out of reset */
    

    pstI2C->OAR = I2C__OWN_ADDRESS_cfg;  /* set own address */
    pstI2C->SAR = I2C__SLAVE_ADDRESS_cfg;  /* set slave address */
}

void I2C_vSendBuffer(uint8 *pu8Data, uint16 u16Length)
{
    volatile I2C__tstMemMap *pstI2C = I2C__ADDR_PTR;
    I2C__stTransferData.u16Length = u16Length;
    I2C__stTransferData.pu8Data   = pu8Data;

    pstI2C->MDR = ( I2C__MDR_nIRS_MASK    |
                    I2C__MDR_MST_MASK    |    /* Master/Slave mode */
                    I2C__MDR_TRX_MASK    |    /* Transmitter enable */
                    I2C__MDR_STP_MASK    );    /* Stop Transmision */


    pstI2C->CNT = u16Length;
    pstI2C->DXR = *I2C__stTransferData.pu8Data++;
    pstI2C->MDR |= I2C__MDR_STT_MASK;
    pstI2C->IMR |= I2C__IMR_TXRDYEN_MASK;
    
}

Regards