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.

DS90UB949-Q1EVM: Interface forum

Part Number: DS90UB949-Q1EVM
Other Parts Discussed in Thread: USB2ANY, ALP

I am using DS90UB949-Q1EVM serializer (Device ID: 0x18) with DS90UB926 Deserializer (Device ID: 0x5A)  which is connected to DLPC3030 in S32K platform(Device ID: 0x36), the Image projection part is working fine. But we are not able to connect to the i2c remote slave i.e , S32K platform(Device ID: 0x36) . We tried to  write the Slave ID[0] register 0x07 and Slave alias ID 0x08 as our Remote Slave address 0x36, but communication is not happening.

code: This is our code. I2C communication to remote slave.

int vl2= u2aI2C_RegisterWrite(handle, 0x0C, 0x07, 0x36);//Slave ID[0]
int vl3= u2aI2C_RegisterWrite(handle, 0x0C, 0x08, 0x36); //Slave Alias ID[0]
// Read I2C
// remote slave 7 bit address 0x1B -->8 bit address 0x36
ret = u2aI2C_InternalRead(handle, 0x1B, 0x00, 1, 1, data); 
if (ret >= 0)
ret = (int) data[0];
if (ret >= 0){
qDebug() << "Read value from slave I2C device. " << (BYTE) ret;
}
else {
qDebug() << "I2C read failed - Error " << ret;
}
 
This is an important task for us so any help is much appreciated.
Thanks 
  • Hi Sundar,

    For these lines:

    int vl2= u2aI2C_RegisterWrite(handle, 0x0C, 0x07, 0x36);//Slave ID[0]
    int vl3= u2aI2C_RegisterWrite(handle, 0x0C, 0x08, 0x36);//Slave Alias ID[0]

    What is the value of vl2, vl3?

    Is 0x0C the address of your master device?

    For this line:

    ret = u2aI2C_InternalRead(handle, 0x1B, 0x00, 1, 1, data); 

    The second parameter can hold 16 bits. Why not use 0x36?

    Best Regards,

    Gil Abarca

  • Hi,

    0x0C is nothing but Serializer's address in 7 bit representation (8 bit representation is 0x18).

    I have connected my PC with Serializer. I am using USB2ANY APIs for accessing I2C slave( a MCU) connected in Deserializer side.

    The USB2ANY API takes only 7 bit address format.

    The same 7 bit format I used for u2aI2C_InternalRead as well, 0x1B (8 bit representation is 0x36).

  • Also the value of vl2, vl3 is 0.

  • Hi Sundar,

    Do you have I2C Passthrough enabled?

    Best Regards,

    Gil Abarca

  • yes, 0x03 register is set to "0xDA" as data

  • Hi Sundar,

    Can you change this line: ret = u2aI2C_InternalRead(handle, 0x1B, 0x00, 1, 1, data); 

    For this line: ret = u2aI2C_RegisterRead(handle, 0x0C, 0x0);

    Best Regards,

    Gil Abarca

  • I changed this line, I am getting the value for "ret" as 0x18. Also I found out, I have to use Slave[0] and Slave_Alias[0] register value as 0x6C, which is the proper slave address. now communication is happening a few times but not every time. During any read or write to Slave 0x6C the entire I2C communication got hanged. I have to reset the Serializer EVM to start again. Can you please provide any example script to communicate with Remote slave connected to Deserializer, which I could directly run in ALP application.

  • Hi Sundar,

    Here is an example script:

    serAddr = 0x18 #update as needed
    desAddr = 0x5A #update as needed
    slaveID = 0x6C #update as needed
    slaveAlias = 0x6C #update as needed

    #set I2C Passthrough
    I2C_PASS_THROUGH = board.ReadI2C(serAddr,0x03, 1)
    I2C_PASS_THROUGH = I2C_PASS_THROUGH | 0xDA
    board.WriteI2C(serAddr,0x03,I2C_PASS_THROUGH)

    #set slave ID and alias
    board.WriteI2C(serAddr,0x07, slaveID)
    board.WriteI2C(serAddr,0x08, slaveAlias)

    Best Regards,

    Gil Abarca

  • Hi, I have setup the Serializer registers as the above configuration, now write to I2C slave is happening. When I try to Read from I2C Slave, I am getting "Error -46: Read timeout". I using S32k144 MCU, I could see txbuff in my code is properly setting up, still I am not getting the I2C read values. Any idea on this?

  • Hi Sundar,

    Can you provide me with what are you coding to read from I2C slave?

    Best Regards,

    Gil Abarca

  • Hi,

    I am using s32k144 as Slave MCU using I2C fast mode(400 KHz), clock stretching is enabled by default.

            LPI2C_Set_SlaveIgnoreNACK(baseAddr, LPI2C_SLAVE_NACK_END_TRANSFER);
            LPI2C_Set_SlaveTransmitNACK(baseAddr, LPI2C_SLAVE_TRANSMIT_ACK);
            /* Enable clock stretching except ACKSTALL (we don't need to send ACK/NACK manually) */
            LPI2C_Set_SlaveACKStall(baseAddr, false);
            LPI2C_Set_SlaveTXDStall(baseAddr, true);
            LPI2C_Set_SlaveRXStall(baseAddr, true);
            LPI2C_Set_SlaveAddrStall(baseAddr, true);


    Here, I am setting the data of lpi2c0_tx_buf to "52 0F 05 08 6E".

    	uint8_t checksum = 0;
    	if((NULL == p_data) || (0 == data_len) || (data_len >= LPI2C0_TX_BUF_SIZE))
       	{
        	printf("\nSTATUS_ERROR......\n");
            return STATUS_ERROR;
        }
    
        memcpy(lpi2c0_tx_buf, p_data, data_len);
    	checksum = DeviceDS90UB926_CalcChecksum(lpi2c0_tx_buf, data_len);
    	lpi2c0_tx_buf[data_len] = checksum;
    	lpi2c0_tx_len = data_len + 1;
    	for(int tv = 0; tv<lpi2c0_tx_len; tv++)
    		printf("lpi2c0_tx_buf %d : %x\n", tv, lpi2c0_tx_buf[tv]);
    	printf("\nSetTxData done......\n");
        return STATUS_SUCCESS;

    For Slave Read/Write operation, I am writing an application in QT tool. I am using the Write and Read API from USB2ANY I2C library.

    I2C WRITE Function: addr= 0x6C, reg= 0x83, len = 5, data = 52 0F 05 08 6E

        int ret = 0;
    
        ret = u2aI2C_InternalWrite(handle, addr, reg, 1, len, (BYTE*) data);
    
        if (ret < 0)
        {
            QString str1 = QString("Write -> addr = %1 reg = %2 error").arg(hex2str(addr)).arg(hex2str(reg));
            emit sgnl_DisplayError(str1);
            qDebug("I2C write failed - Error %d: %s", ret, u2aGetStatusText(ret, NULL, 0));
            return false;
        }
    
        QString str = QString("Write -> addr = %1 reg = %2 \ndata = %3").arg(hex2str(addr)).arg(hex2str(reg)).arg(hex2text(data, len));
        emit sgnl_DisplayTxInfo(str);
        return true;

    Write data is properly writing to Slave MCU. I could verify using a print command in MCU. Below is the Signal response.

    I2C READ Function: addr= 0x6C, reg= 0x83, len = 5 

        int ret = 0;
    
        ret = u2aI2C_InternalRead(handle, addr, reg, 1, len, data);
    
        if (ret < 0)
        {
            QString str1 = QString("Read -> addr = %1 reg = %2 error").arg(hex2str(addr)).arg(hex2str(reg));
            emit sgnl_DisplayError(str1);
            qDebug("I2C read failed - Error %d: %s", ret, u2aGetStatusText(ret, NULL, 0));
            return false;
        }
    
        QString str = QString("Read -> addr = %1 reg = %2 \ndata = %3").arg(hex2str(addr)).arg(hex2str(reg)).arg(hex2text(data, len));
        emit sgnl_DisplayRxInfo(str);
        return true;

    Here, I am reading from MCU but read function is not happening. Once after the read command, the Serializer goes hung and it is not properly responding. I need to reset the serializer to start the process again.

    I am not sure why Read is not happening properly, any suggestions?

  • Hi Sundar,

    Can you provide a screenshot of both the SER I2C bus and DES I2C bus?

    When you are writing are you trying to read immediately? 

    Does your MCU support clock stretching?

    Best Regards,

    Gil Abarca

  • Hi,

    Yes, clock stretching is enabled in my MCU code, I have pasted the MCU code in above reply. Also I am not reading immediately after writing as well. 

    Here are the oscilloscope outputs form both MCU side and Serializer side,

    MCU Side: SCL - Yellow, SDA - Turquoise.

    Serializer Side: SCL - Violet, SDA - Blue.

    REMOTE SLAVE I2C WRITE:

    REMOTE SLAVE I2C READ:

  • Hi Sundar,

    Are you meeting the I2C start condition? It is unclear in the images provided but it seems when starting a transaction both SCL and SDA go low at the same time. Can you provide a zoom up of the start and stop condition?

    Best Regards,

    Gil Abarca

  • Hi, Please refer the below images,

    MCU Side Signals for READ I2C:

    SERIALIZER Side Signal for Read I2C:

    Delay between the Serializer and MCU.

  • Hi Sundar,

    Have you tested the I2C protocol in the MCU without the FPD-Link devices just using the USB2ANY and the MCU?

    Best Regards,

    Gil Abarca

  • Hi, I connected the MCU I2C directly to MSP430(USB2ANY) I2C pins in EVM, with PDB of Serializer and Deserializer held Low. I used "Example_USB2ANY_I2C_GUI" Application from USB2ANY SDK Sample code. The Write and Read functions are working as expected. I also tested by enabling PDB of serializer, while MCU I2C connected to MSP430(USB2ANY) I2C in EVM. I used ALP Scripting for Read and Write, which is also working fine.
    Whenever I am connecting the FPD link between serializer and Deserializer, and connecting the MCU I2C as a slave to Deserializer, The read I2C is not working at all, I am getting the "Read TimeOut Error".
  • If possible, can you please provide me the default Register configurations of Serializer (DS90UB949) and Deserialzer 
    (DS90UB926) .nrd files.

  • Hi Sundar,

    What I am thinking is there is a problem with your MCU. When it says "Read TimeOut Error" do you know what is the timeout of your MCU? When you have it connected directly to the MSP430 it works fine because there is no delay, whereas, when you have the FPD-Link devices implemented in your system there is going to be a delay in the communication even with clock stretching enabled. Your MCU might not be able to handle the speeds that are needed in your application.

    Best Regards,

    Gil Abarca