CX3 I2C problem

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

cross mob
bk
Level 2
Level 2
5 replies posted 10 sign-ins 5 sign-ins

Hi.

 

I'm using CX3, and have I2c problem.

below is part of my code, which  the I2c trouble exists.
 
status = CyU3PMipicsiSetIntfParams (&1Mega_img, CyFalse);
 
status =  SENSOR_WriteConfigurationSettings_Reg32(0x00F1, (0x11)); // I2c Write Function (Addr = 0xF1, Data = 0x11)
status =  SENSOR_WriteConfigurationSettings_Reg32(0x00F1, (0x11)); // I2c Write Function (Addr = 0xF1, Data = 0x11)
 
status =  CyU3PMipicsiSetPhyTimeDelay(1,8);
 
When i first send i2c data, I2c Slave receives address 0xf9.(but I send 0xF1)
next time, I2c Slave receives address 0xf1.
 
how can i resolve it???
0 Likes
1 Solution
bk
Level 2
Level 2
5 replies posted 10 sign-ins 5 sign-ins

Hello,

The I2c function you were talking about was a modified function.

And there was no problem with the operation.

I checked I2c with an oscilloscope.

when I ran the CyU3PMipicsiSetIntfParams() function, something was outputted as I2c.

As a result, a problem occurred in the I2c Rx (FPGA).

So, I modified code as below and solved the issue.

**Before**

status = CyU3PMipicsiSetIntfParams (&1Mega_img, CyFalse);
status =  SENSOR_WriteConfigurationSettings_Reg32(0x00F1, (0x11)); // I2c Write Function (Addr = 0xF1, Data = 0x11)
status =  SENSOR_WriteConfigurationSettings_Reg32(0x00F1, (0x11)); // I2c Write Function (Addr = 0xF1, Data = 0x11)
status =  CyU3PMipicsiSetPhyTimeDelay(1,8);

 

**After**

CyU3PI2cDeInit();
status = CyU3PMipicsiSetIntfParams (&1Mega_img, CyFalse);
CyU3PMipicsiInitializeI2c(CY_U3P_MIPICSI_I2C_100KHZ);
status =  SENSOR_WriteConfigurationSettings_Reg32(0x00F1, (0x11)); // I2c Write Function (Addr = 0xF1, Data = 0x11)
status =  CyU3PMipicsiSetPhyTimeDelay(1,8);
 
Best Regards,
Bk
 

View solution in original post

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

Hello,

Please let me know why the function SENSOR_WriteConfigurationSettings_Reg32() is used? As per your description, the address is 0x00F1 and the data is 0x11. The function SENSOR_WriteConfigurationSettings_Reg32() makes use of 2 arguments. The first argument is a pointer to the configuration structure of type CySensorReg32_t and second is the size of the configuration structure. CySensorReg32_t makes use of 32 bit configuration data for each sensor register. But, here I find that the size of the data is just 8bits. In this case, please make use of the function Sensor_WriteConfigurationSettings_Reg8()

Please try the following standard approach:

1. In cycx3_uvc.c file, call a function (defined in cyu3imagesensor.c file) after the API CyU3PMipicsiSetIntfParams() is used. Please refer to the following code as an example:

status = CyU3PMipicsiSetIntfParams (&1Mega_img, CyFalse);

CyCx3_Set_my_sensor();

2. Make a sensor configuration structure in cyu3imagesensor.c file as shown below for using in Sensor_WriteConfigurationSettings_Reg8() :

CySensorReg8_t temp[] =
{
{0x00F1,0x11}
};

3. Define the CyCx3_Set_my_sensor()  in cyu3imagesensor.c file as shown below:

CyU3PReturnStatus_t
CyCx3_Set_my_sensor(
void)

{

      CyU3PReturnStatus_t status = CY_U3P_SUCCESS;    

      status = Sensor_WriteConfigurationSettings_Reg8(temp,1);

      return status;

}

Please try this approach and let us know if you still face the issue.

     

Best Regards,
Jayakrishna
0 Likes
bk
Level 2
Level 2
5 replies posted 10 sign-ins 5 sign-ins

Thank you.

It was very helpful

 

Best Regards,

Bk

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

Hello,

Please let us know if the issue is resolved with the suggestions mentioned in my previous response.

Best Regards,
Jayakrishna
0 Likes
bk
Level 2
Level 2
5 replies posted 10 sign-ins 5 sign-ins

Hello,

The I2c function you were talking about was a modified function.

And there was no problem with the operation.

I checked I2c with an oscilloscope.

when I ran the CyU3PMipicsiSetIntfParams() function, something was outputted as I2c.

As a result, a problem occurred in the I2c Rx (FPGA).

So, I modified code as below and solved the issue.

**Before**

status = CyU3PMipicsiSetIntfParams (&1Mega_img, CyFalse);
status =  SENSOR_WriteConfigurationSettings_Reg32(0x00F1, (0x11)); // I2c Write Function (Addr = 0xF1, Data = 0x11)
status =  SENSOR_WriteConfigurationSettings_Reg32(0x00F1, (0x11)); // I2c Write Function (Addr = 0xF1, Data = 0x11)
status =  CyU3PMipicsiSetPhyTimeDelay(1,8);

 

**After**

CyU3PI2cDeInit();
status = CyU3PMipicsiSetIntfParams (&1Mega_img, CyFalse);
CyU3PMipicsiInitializeI2c(CY_U3P_MIPICSI_I2C_100KHZ);
status =  SENSOR_WriteConfigurationSettings_Reg32(0x00F1, (0x11)); // I2c Write Function (Addr = 0xF1, Data = 0x11)
status =  CyU3PMipicsiSetPhyTimeDelay(1,8);
 
Best Regards,
Bk
 
0 Likes
JayakrishnaT_76
Moderator
Moderator
Moderator
First question asked 1000 replies posted 750 replies posted

Hello,

We are glad to hear that the issue is resolved.

Best Regards,
Jayakrishna
0 Likes