Hi,experts:
As the title implies, I encountered a strange problem in the vx_app_rtos_linux_mcu2_0 program:
1). The I2C slave device address can be detected by debugging the drv_i2c_utility program through CCS, such as
I2C-0> setting I2C: CMD: setting ================================================================= Setting Menu: ================================================================= 0: Change I2C Instance 1: Change Addressing/Data Mode 2: Byte Ordering Mode 3: File Read Mode 4: quit Enter option:1 Available Modes: ================================================================= 0: 8 bits addresses and 8 bits data.: 1: 8 bits addresses and 16 bits data.: 2: 16 bits addresses and 8 bits data.: 3: 16 bits addresses and 16 bits data.: Enter I2C Mode ID:2 Available Modes: ================================================================= 0: MSB First.: 1: LSB First.: Enter Byte Ordering Mode ID:0 I2C-0> I2C: CMD: I2C-0> probe I2C: CMD: probe Probing for 0 is in progress... I2C0: Passed for address 0x29 !!! I2C0: Passed for address 0x48 !!! I2C-0> rd 0x48 0x0050 1 I2C: CMD: rd 0x48 0x0050 1 I2C: Reading 0x01 registers starting from REG 0x50 of device 0x48 ... !!! I2C:(0x2000000) Starting transaction to slave: 0x48 I2C:(0x2000000) Starting transaction to slave: 0x48 I2C: 0x50 = 0x0 I2C-0> rd 0x48 0x0051 1 I2C: CMD: rd 0x48 0x0051 1 I2C: Reading 0x01 registers starting from REG 0x51 of device 0x48 ... !!! I2C:(0x2000000) Starting transaction to slave: 0x48 I2C:(0x2000000) Starting transaction to slave: 0x48 I2C: 0x51 = 0x1 I2C-0> rd 0x48 0x0052 1 I2C: CMD: rd 0x48 0x0052 1 I2C: Reading 0x01 registers starting from REG 0x52 of device 0x48 ... !!! I2C:(0x2000000) Starting transaction to slave: 0x48 I2C:(0x2000000) Starting transaction to slave: 0x48 I2C: 0x52 = 0x2 I2C-0> rd 0x48 0x0053 1 I2C: CMD: rd 0x48 0x0053 1 I2C: Reading 0x01 registers starting from REG 0x53 of device 0x48 ... !!! I2C:(0x2000000) Starting transaction to slave: 0x48 I2C:(0x2000000) Starting transaction to slave: 0x48 I2C: 0x53 = 0x3
2). In the setupI2CInst() function of the vx_app_rtos_linux_mcu2_0 program, I added the code for detecting the I2C device, as follows:
static int32_t setupI2CInst(uint8_t i2cInst)
{
int32_t status = -1;
I2C_Params i2cParams;
/* Initializes the I2C Parameters */
I2C_Params_init(&i2cParams);
i2cParams.bitRate = I2C_400kHz;
/* Configures the I2C instance with the passed parameters*/
if(NULL == gISS_Sensor_I2cHandle)
{
printf("[***ybcs-dbg***] open i2c%d.\n",i2cInst);
gISS_Sensor_I2cHandle = I2C_open(i2cInst, &i2cParams);
}
if(gISS_Sensor_I2cHandle == NULL)
{
printf(" I2C: ERROR: I2C Open Failed for instance %d !!!\n", i2cInst);
status = -1;
}
else
{
status = 0;
}
//@@@lyh
int32_t retVal = 0;
uint16_t slaveAddr;
printf("[---ybcs-dbg---] Probing for %d is in progress...\r\n", i2cInst);
/* I2C_open() should have been called for this instance
* for its proper initialization. */
if (NULL != gISS_Sensor_I2cHandle)
{
for (slaveAddr = 0U; slaveAddr < 128U; slaveAddr++)
{
if (I2C_control(gISS_Sensor_I2cHandle, I2C_CMD_PROBE, &slaveAddr) == I2C_STATUS_SUCCESS)
{
printf("[---ybcs-dbg---] I2C%d: Passed for address 0x%x !!! \r\n",i2cInst,slaveAddr);
}
}
}
else {
printf("[***ybcs-dbg***] gmsl_i2cdev_probe: function parameter is error.\n");
retVal = -1;
}
//@@@end
return status;
}
When I run the vx_app_single_cam.out program under linux, the MCU2_0 program vx_app_rtos_linux_mcu2_0 enters ImageSensor_RemoteServiceHandler() and then enters IssSensor_DeserializerInit() => setupI2CInst() by sending the IM_SENSOR_CMD_ENUMERATE command through the linux side,The process is as follows:
linux: send IM_SENSOR_CMD_ENUMERATE
mcu2_0: ImageSensor_RemoteServiceHandler() => IssSensor_DeserializerInit() => setupI2CInst()
At this point the problem arises:
The program cannot execute to printf("[---ybcs-dbg---] I2C%d: Passed for address 0x%x !!! \r\n",i2cInst,slaveAddr); to print, I don't know what the problem is where? Please help me analyze the problem
TDA4 SDK development environment :
ti-processor-sdk-linux-j7-evm-08_01_00_07
ti-processor-sdk-rtos-j721e-evm-08_01_00_13
Thanks!