Strange Output in I2C
I am using STM32F103C8T6 and developed on STM32CubeIDE. This equipment has six similar I2C boards (same ICs, same function) connected to the master which are addressed accordingly. Each of these boards have 8 digital Inputs amounting to 8 bit value as data from each board. A few of this equipment were made and working fine for over 3 years period.
off recent, the new machine made, has a peculiar problem. When no digital inputs to any of these 6 boards, three boards (Boards 4, 5 & 6) give out an 8 bit integer value (eg: 182, 212, 247).
Doubting the boards I switch places. Boards previous at 4,5 & 6 are now placed at 1, 2 & 3. Despite switching places, boards 4, 5 & 6 give out same 182, 212 & 247.
This means the problem is not board related. Then where are these values creeping in from.
Help needed to solve this problem, have been struggling for last few days
Thanking in advance.
I2C IC PCA9554D used, data latched by 74HC573 operating at 400KHz-- I2C clk
HAL_I2C_Master_Transmit(&hi2c2,0x40, 0, 1,5);
err = HAL_I2C_Master_Receive(&hi2c2,0x40, &data, 1,5);
if ( err != HAL_OK )
{
defect_PCB = 1;
}
else
PU_Array1_up = data;
HAL_I2C_Master_Transmit(&hi2c2,0x42, 0, 1,5); //42
err = HAL_I2C_Master_Receive(&hi2c2,0x42, &data, 1,5);
if ( err != HAL_OK )
{
defect_PCB = 2;
}
else
PU_Array2_up = data;
HAL_I2C_Master_Transmit(&hi2c2,0x44,0, 1,5); //44
err = HAL_I2C_Master_Receive(&hi2c2,0x44,&data, 1,5);
if ( err != HAL_OK )
{
defect_PCB = 3;
}
else
PU_Array3_up = data;
HAL_I2C_Master_Transmit(&hi2c2,0x46, 0, 1,5); //0x46
err = HAL_I2C_Master_Receive(&hi2c2,0x46, &data, 1,5);
if ( err != HAL_OK )
{
defect_PCB = 4;
}
else
PU_Array4_up = data;
HAL_I2C_Master_Transmit(&hi2c2,0x48, 0, 1,5); //0x48
err = HAL_I2C_Master_Receive(&hi2c2,0x48, &data, 1,5);
if ( err != HAL_OK )
{
defect_PCB = 5;
}
else
PU_Array5_up = data;
HAL_I2C_Master_Transmit(&hi2c2,0x4A,0, 1,5); //0x4A
err = HAL_I2C_Master_Receive(&hi2c2,0x4A,&data, 1,5);
if ( err != HAL_OK )
{
defect_PCB = 6;
}
else
PU_Array6_up = data;
