- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi Kandla,
I've already changed the sensor ID based on the MT9v034 in sensor.c, by using UART log still showing Reading sensor ID failed!
Please advise
According to datasheet MT9V034 sensor id is 0x1324
The 0x00, 0x00 is actually what address ?
Thanks & Regards,
Nigel
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Reading sensor ID issue is solved by setting proper I2C Configuration as per the sensor requirement.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Nigel,
The 0x00, 0x00 is the memory location that we are tryting to read - considering that Sensor ID is located in 0x0000 address.
Please refer the source code of SensorRead2B.
In the default AN75779 firmware, the sensor ID is located at 0x00, 0x00 location.
Can you please print the buf[2] here and check whether it is matching the Sensor ID?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
HI Sridhar,
May i know where should i print buf[2], is it in the sensor.c file------>from the funtion of SensorI2cBusTest ??
Rgds
Nigel
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
You can print in sensor.c file in I2CBusTest function itself.
Regards,
Sridhar
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi Sridhar,
Can i used the way below to print out the buf[0] and buf[1] ??
====================================================================
uint8_t SensorI2cBusTest(void) {
/* The sensor ID register can be read here to verify sensor connectivity. */
uint8_t buf[2];
/* Reading sensor ID */
if (SensorRead2B(SENSOR_ADDR_RD, 0x00, 0x00, buf) == CY_U3P_SUCCESS) {
CyU3PDebugPrint("%d", buf[0]);
CyU3PDebugPrint("%d", buf[1]);
return 1;
}
=====================================================================
Rgds
Nigel
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Add priority value to this API CyU3PDebugPrint(4, "%d", buf[0]); CyU3PDebugPrint(4, "%d", buf[1]);
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi Sridhar,
This is how i wrote the program to print =======>uint8_t buf[2];
SensorRead2B (SENSOR_ADDR_RD, 0x00, 0x00, buf);
CyU3PDebugPrint(4, "%d", buf[0]);
CyU3PDebugPrint(4, "%d", buf[1]);
On the uart log it shows this :
Entering USB Suspend Mod 00UsbEventCB: Detected SS USB Connection
USBSetupCB:In SET_FTR 0::1
USBSetupCB:In SET_FTR 0::1
USBSetupCB:In SET_FTR 0::1
UsbEventCB: SUSPEND encountered...
Entering USB Suspend
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Can you please do this?
uint8_t
SensorI2cBusTest (
void)
{
/* The sensor ID register can be read here to verify sensor connectivity. */
uint8_t buf[2];
CyU3PDebugPrint(4, "I am in bus test \r\n");
/* Reading sensor ID */
if (SensorRead2B (SENSOR_ADDR_RD, 0x00, 0x00, buf) == CY_U3P_SUCCESS)
{
CyU3PDebugPrint(4, "%d\n\r", buf[0]);
CyU3PDebugPrint(4, "%d\n\r", buf[1]);
if ((buf[0] == 0x24) && (buf[1] == 0x81))
{
return CY_U3P_SUCCESS;
}
}
else
{
CyU3PDebugPrint(4, "Reading 0x0000 location of sesnor is failing \r\n");
}
return 1;
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Please use the Debugprints in your firmware except in callback functions and find where it is going wrong.
In your last response, there is no debug print related to Sensor ID if the SensorRead2B is success you should see the buf 0 and buf 1 values.
You may use JTAG debugger as well. If you are using SuperSpeed Explorers kit, you can also integradted OpenOCD debugger as well.
Please refer UserGuide provided in documentation folder of the SDK: C:\Program Files (x86)\Cypress\EZ-USB FX3 SDK\1.3\doc\firmware
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi Sridhar,
I have tested the code that you shared. It seems like the sensor id is not store at 0x0000 address.
On the uart log it shows this :
I am in bus test
Reading 0x0000 location of sesnor is failing
Error: Reading Sensor ID failed!
UsbEventCB: Detected SS USB Connection
USBSetupCB:In SET_FTR 0::1
USBSetupCB:In SET_FTR 0::1
USBSetupCB:In SET_FTR 0::1
UsbEventCB: SUSPEND encountered...
Entering USB Sus
Rgds
Nigel
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Nigel,
As per the logs, SensorRead2B is failing.
Add the following in SensorRead2B function.
apiRetStatus = CyU3PI2cReceiveBytes (&preamble, buf, 2, 0);
CyU3PDebugPrint (4, "I2C Read Statue = %x\n\r", apiRetStatus);
Please probe the I2C lines and understand what is happening over I2C (whether there is ACK from the I2C device).
Please confirm whether the i2c slave device address is correct.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi Sridhar,
according to the mt9v034 image sensor data sheet the i2c slave addresss is 0x91 its correct.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi Sridhar,
I probed to the sckl but its seems the signal its just flat 3.4v. I'm using the AN75779 firmware change the i2c slave address according to the MT9v034.
Rgds
Nigel
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Can you please use the I2c example firmware on explorer kit and check whether there is any activity on I2C lines?
SDK path: C:\Program Files (x86)\Cypress\EZ-USB FX3 SDK\1.3\firmware\serialif_examples\cyfxusbi2cdmamode
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi Sridhar,
Yes i have tested:
C:\Program Files (x86)\Cypress\EZ-USB FX3 SDK\1.3\firmware\serialif_examples\cyfxusbi2cdmamode
The i2c lines just at 3.4v
Rgds
Nigel
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Please let me know your testing procedure.
Regards,
Sridhar
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi Sridhar,
Procedure:
- Imported the code from C:\Program Files (x86)\Cypress\EZ-USB FX3 SDK\1.3\firmware\serialif_examples\cyfxusbi2cdmamode to EZusbsuite
- In Ezusbsuite: Click Project-> Build all then debug folder created.
- The PMODE J4 is open short when load the code into i2c EEPROM.
- Used control center to load the UsbI2cDmaMode.img which is created in the Debug folder, the UsbI2cDmaMode.img is loaded into the I2C EEPROM
Rgds
Nigel
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Nigel,
- Imported the code from C:\Program Files (x86)\Cypress\EZ-USB FX3 SDK\1.3\firmware\serialif_examples\cyfxusbi2cdmamode to EZusbsuite
- In Ezusbsuite: Click Project-> Build all then debug folder created
- Place the Jumper J4 so that the device will enumerate as Cypress USB bootloader device
- Read the Readme.txt
- Open Control Center, select Control Endpoint of Bootloader device
- Send the Vendor Command as said in Readme.txt
- Probe the I2C lines while sending the Vendor command
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi Sridhar,
I just checked on the register reference of mt9m114, the sensor id is store at R0x0000 value= 0x2481 which is same as the one in an75779
For Mt9v034 the register reference shows the sensor id is store at R0x00 value=0x1324. Its only 8bit address instead of 16 bit.
Its only 8bit address instead of 16 bit. So need to change this potion to 8 bit.
May i know if i want to change the preamble.buffer[?], which do i need to change ?
Rgds
Nigel
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Nigel,
Reduce the Premable length to 3 and pass only one byte address.
Regards,
Sridhar
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi Sridhar,
In the meantime, i will design the hardware for mt9v034 and fx-3.
- Do we need the ext SRAM because FX-3 already have embedded SRAM ?
- To store the firmware we need an EEPROM, if i follow the one in Eva board is that advisable?
Please kindly advise
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Nigel,
Have you test the below?
Reduce the Premable length to 3 and pass only one byte address.
Note that this needs to be done only when you are reading Sensor ID:
preamble.buffer[0] = slaveAddr & I2C_SLAVEADDR_MASK; /* Mask out the transfer type bit. */
preamble.buffer[1] = lowAddr;
preamble.buffer[2] = slaveAddr;
preamble.length = 3;
preamble.ctrlMask = 0x0003; /* Send start bit after secondbyte of preamble. */
- Do we need the ext SRAM because FX-3 already have embedded SRAM ?
>> Yes. You do not need it. The SRAM which is externally placed on CYUSB3KIT-003 is for demonstration of ASYNC SRAM functionality.
2. To store the firmware we need an EEPROM, if i follow the one in Eva board is that advisable?
>> Yes, you can use the one used on Eva board. You may also use SPI Flash as well. Please refer AN76405
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Nigel,
Please create a new thread for a new query.
Regards,
Sridhar
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi Sridhar,
Yes i have tested. But the sensor id read from I2c still doesn't match the one in datasheet.
I'm using the following code:
CyU3PReturnStatus_t SensorRead2B(uint8_t slaveAddr, uint8_t lowAddr, uint8_t *buf)
{
CyU3PReturnStatus_t apiRetStatus = CY_U3P_SUCCESS;
CyU3PI2cPreamble_t preamble;
if ((slaveAddr != (uint8_t)0x91) && (slaveAddr != (uint8_t)0xA1))
{
CyU3PDebugPrint (4, "I2C Slave address is not valid!\n");
return 1;
}
preamble.buffer[0] = slaveAddr & 0xFE; /* Slave address: Write operation */
preamble.buffer[1] = lowAddr;
preamble.buffer[2] = slaveAddr; /* Slave address: Read operation */
preamble.length = 3;
preamble.ctrlMask = 0x0003; // After the second byte,need to restart the I2C communication
apiRetStatus = CyU3PI2cReceiveBytes(&preamble, buf, 2, 0);
SensorI2CAccessDelay (apiRetStatus);
return apiRetStatus;
}
uint8_t
SensorI2cBusTest (void)
{
/* The sensor ID register can be read here to verify sensor connectivity. */
uint8_t buf[2];
CyU3PDebugPrint(4," I am in Sensor I2C bus Test API222222\r\n");
/* Reading sensor ID */
if (SensorRead2B (0x91, 0x00, buf) == CY_U3P_SUCCESS)
{
if ((buf[0] == 0x24) && (buf[1] == 0x81))
{
CyU3PDebugPrint(4,"Buf[0] = %x Buf[1] = %x \r\n", buf[0], buf[1]);
return CY_U3P_SUCCESS;
}
}
else
{
CyU3PDebugPrint(4,"Sensor Read Failed\r\n");
CyU3PDebugPrint(4,"Buf[0] = %x Buf[1] = %x \r\n", buf[0], buf[1]);
}
return 1;
}
Then I used this command:
The UART reading:
Yellow: SCLK
Purple: Sdata
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Reading sensor ID issue is solved by setting proper I2C Configuration as per the sensor requirement.