0
\$\begingroup\$

I am using an STM32F103 and TI's TCA9539 and TCA6408A Port extender. Both of them support 400 kHz (I2C Fastmode) and 100 kHz (I2C standard mode) clock frequencies. I use 3 TCA9539 and 1 TCA6408A. Here is my Schematic diagram:

enter image description here

I use STM32CubeMX and here is the configuration and code:

enter image description here

I tested both 400 kHz mode and 100 kHz mode.

HAL_GPIO_WritePin(TS0_RESET_GPIO_Port, TS0_RESET_Pin, GPIO_PIN_SET);
HAL_GPIO_WritePin(TS1_RESET_GPIO_Port, TS1_RESET_Pin, GPIO_PIN_SET);
HAL_GPIO_WritePin(TS2_RESET_GPIO_Port, TS2_RESET_Pin, GPIO_PIN_SET);
HAL_GPIO_WritePin(TS3_RESET_GPIO_Port, TS3_RESET_Pin, GPIO_PIN_SET);

// ...

while (1) {
  uint8_t test_data[3] = {0x08, 0, 0};
  HAL_I2C_Master_Transmit(&hi2c1, 0X75<<1, test_data, 2,10);
  HAL_I2C_Master_Transmit(&hi2c1, 0X20<<1, test_data, 2,10);
}
// ...

According the datasheet, since I connect the address pin of TCA6408A, the address of it should be 0x20 (7 bits), and the three TCA9539's addresses should be 0x74,0x75 and 0x77. So I sent the test data in the above code.

However, only the TCA6408A responds (ACK), and the TCA9539 doesn't. I changed the different addresses but it doesn't work. Here is the wave:

enter image description here

TCA6408: enter image description here

TCA9539: enter image description here

They are all similar devices from TI. I think the only difference between them is that they have different GPIO bits, so I wonder why they have different situations.

\$\endgroup\$
6
  • \$\begingroup\$ Does it work if you try lower speed, like 100 kHz? \$\endgroup\$
    – Justme
    Commented Nov 12, 2019 at 5:24
  • \$\begingroup\$ What is the light blue waveform in your screenshots? I2C_SDA? \$\endgroup\$
    – joribama
    Commented Nov 12, 2019 at 5:28
  • \$\begingroup\$ @joribama it is obvious from the data patterns that blue is SDA. \$\endgroup\$
    – Justme
    Commented Nov 12, 2019 at 5:30
  • \$\begingroup\$ Also show the GPIO configuration for SCL and SDA. \$\endgroup\$
    – Justme
    Commented Nov 12, 2019 at 5:31
  • 2
    \$\begingroup\$ Based on the light blue waveforms, it seems like your pull resistors (10kΩ in the schematic) are too weak. Try using 3.3k or 2.2k to see if it makes any difference. I'm still intrigued why the I2C_SCL line (I'm assuming it's the orange waveforms) has a much faster rise time, though. It's almost like that line is being driven as push-pull by the STM32. \$\endgroup\$
    – joribama
    Commented Nov 12, 2019 at 5:42

2 Answers 2

1
\$\begingroup\$

In fact the address is wrong. They are 0x74, 0x76 and 0x77, but not 0x75, because A1 is high and A0 is low in the schematic. However there might still be other issues left.

\$\endgroup\$
0
\$\begingroup\$

As Justme has pointed out, the addresses of the three TCA9539 in your configuration are 0x74 (A1A0=00), 0x76 (A1A0=10) and 0x77 (A1A0=11.)

The main issue may be the SDA line however, as the scope shot of it looks pretty bad. It may be that the SDA pull-up is not strong enough, or some other connection issue with SDA.

I suggest finding the issue with SDA and square it up before any other troubleshooting. Perhaps start by adding another parallel pull-up resistor to the SDA line and see if the waveform starts to improve.

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.