Control I2C peripheral over MIPI

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
subk1234
Level 2
Level 2
10 questions asked 10 sign-ins 10 replies posted

Hi,

I am working on a Denebola CX3 Kit which comes with a OV5640 image sensor. I used the sample application "Cx3UvcOV5640" and flashed the board. I am able to see the video on e-CamView and it works fine.

I would like to control a peripheral, other than the camera I2C, which is connected to CAM_I2C_SDA and CAM_I2C_SCL on the MIPI connector.

How do I configure it and transmit/receive to the peripheral ?

I see the API CyU3PMipicsiInitializeI2c() which should initialize the I2C interface. How do I transmit and receive to this I2C interface. Is there any MipiI2c transmit and receive APIs available? Any examples you can point to me will be really helpful.

Thanks and Regards,

Subbu

0 Likes
1 Solution
JayakrishnaT_76
Moderator
Moderator
Moderator
First question asked 1000 replies posted 750 replies posted

Hello Subbu,

Based on your description, I understand that you would like to communicate with an I2C peripheral connected to CX3 on your custom board. If my understanding is correct, then you can refer to the following example project:

C:\Program Files (x86)\Cypress\EZ-USB FX3 SDK\1.3\firmware\serialif_examples\cyfxusbi2cregmode

The above project is used for communicating with the onboard EEPROM connected to FX3/CX3 device. You can use it as a reference for building your project for communicating with other I2C peripherals. Please note that the API CyU3PMipicsiInitializeI2c () in CX3 projects will take care of initializing and configuring the I2C block of CX3. The data transmission/reception part only needs to be implemented by referring to the example project from FX3 SDK that was shared above.

Best Regards,
Jayakrishna

View solution in original post

0 Likes
9 Replies
JayakrishnaT_76
Moderator
Moderator
Moderator
First question asked 1000 replies posted 750 replies posted

Hello Subbu,

Based on your description, I understand that you would like to communicate with an I2C peripheral connected to CX3 on your custom board. If my understanding is correct, then you can refer to the following example project:

C:\Program Files (x86)\Cypress\EZ-USB FX3 SDK\1.3\firmware\serialif_examples\cyfxusbi2cregmode

The above project is used for communicating with the onboard EEPROM connected to FX3/CX3 device. You can use it as a reference for building your project for communicating with other I2C peripherals. Please note that the API CyU3PMipicsiInitializeI2c () in CX3 projects will take care of initializing and configuring the I2C block of CX3. The data transmission/reception part only needs to be implemented by referring to the example project from FX3 SDK that was shared above.

Best Regards,
Jayakrishna
0 Likes
subk1234
Level 2
Level 2
10 questions asked 10 sign-ins 10 replies posted

Hi Jayakrishna,

Thanks for getting back quickly.

I am still using the CX3 Dev Kit. The camera sensor connected to the MIPI has an I2C peripheral.

So, I can use I2C the following way

CyU3PMipicsiInitializeI2c () - Initalize the I2C CX3 block

CyU3PI2cTransmitBytes() for transmitting to peripheral

CyU3PI2cReceiveBytes() for receiving from peripheral

Is this correct?

Thanks and Regards

Subbu

0 Likes

Hello Subbu,

Yes, your understanding is correct. But, please do refer to the datasheet of the peripheral to understand better about the command sets and communication supported.

Best Regards,
Jayakrishna
0 Likes

Hi Jayakrishna,

I tried with the above functions. I get an CY_U3P_ERROR_LOST_ARBITRATION error. Can you let me know why this error occurs? This error message is when I call CyU3PI2cReceiveBytes().

Thanks and Regards,

Subbu

0 Likes

Hello Subbu,

Please refer to the FX3 API guide. As mentioned in the API guide, this error will occur because of failure due to I2C arbitration error or invalid bus activity. Please let me know if you have a multi master system. If it is not a multi master system, then please share the I2C traces for us to check.

Best Regards,
Jayakrishna
0 Likes

Hi Jayakrishna,

Are there any test points on the CX3 Dev Kit for the I2C SCL and SDA ?

Thanks and Regards,

Subbu

0 Likes

Hello Subbu,

Please refer to CN8 and CN10 in the schematics of Denebola kit. You can probe the I2C lines from these connectors.

Best Regards,
Jayakrishna
0 Likes

Hi Jayakrishna,

It's working now. There was an issue in message format compared to what peripheral was expecting.

Thanks and Regards,

Subbu

0 Likes

Hello Subbu,

We are glad to hear that the issue is resolved.

Best Regards,
Jayakrishna