I am trying to communicate with TCS34725 module with NUCLEO-F401R board. The first I tried is to read out ID register of TCS34725, which should be 0x44, to check the connection. Everything works fine when I have my scope probe (gain is x10) is connected to SCL/SDA Line:
BUT, whenever I disconnect my probes (both or one of them), the HAL_I2C_Mem_Read
function call will timeout and readout
will be 0
not 0x44
. I have no idea on how to fix this, so I am here for help.
Here is my hardware connection:
The TCS34725 Module is a product by DFROBOT, the schematic is (Source):
My code is:
#define TCS34725_ADDRESS (0x29 << 1)
#define TCS34725_ID (0x12)
extern I2C_HandleTypeDef hi2c1;
void TCS34725_Read(unsigned char subAddr, unsigned char* dataBuffer, unsigned char bytesNumber) {
subAddr |= TCS34725_COMMAND_BIT;
HAL_I2C_Mem_Read(&hi2c1, TCS34725_ADDRESS, subAddr, I2C_MEMADD_SIZE_8BIT, dataBuffer, bytesNumber, 1000);
}
uint8_t TCS34725_Init(void) {
unsigned char readout;
TCS34725_Read(TCS34725_ID, &readout, 1);
return readout;
}
Here is my current hardware setup, I have changed another breadboard and redo my wiring to make sure nothing is loose. But same problem still exists.