Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

PSoC™ 5, 3 & 1 Forum Discussions

YoKu_3014931
Level 2
Level 2
Welcome!

Hello,

Below circuit was made for switching internal / external master I2C for PSoC3. Internal I2C (I2C_1) is working correctly, but external I2C( MiniProg3 w/ Bridge control panel connects to SCL_EXT pin and SDA_EXT pin) does not work now. I could see the clock wave from on TP1 for both Internal and external, but SCL pin outputs internal clock only. I am not sure what wrong points. Could you give me same advice? I attached source code for CY8CKIT-001_PSoC_Development_Kit.  

pastedImage_0.png

0 Likes
1 Solution
ShanmathiN_06
Employee
Employee
25 likes received 10 likes received First like received

Hello,

It looks like the SCL will always be driven low. The reason being all the SCL and SDA lines of I2C are expected to be at 'open drain drives low' drive mode. So, once the I2C line is pulled low, it stays low forever and acts as a permanent latch.

I'm afraid the switching functionality could not be achieved by a simple schematic. However, a custom verilog component could be developed to act as an I2C mux. It basically snoops the I2C packets from the master and decides how to connect the buses. I have attached the project. Please use it as reference.

Known limitation:

Currently, the component assumes that the slave will not stretch the clock when individual data or address bits are sent by the master.

Similarly, it is assumed that the master will not stretch the clock when receiving individual bits from the slave.

In simple words, the component assumes that clock stretching will occur only during ACK/NACK phase and between bytes in a multi-byte transfer.

I hope this helps.

Thanks,
Shanmathi

View solution in original post

0 Likes
2 Replies
ShanmathiN_06
Employee
Employee
25 likes received 10 likes received First like received

Hello,

It looks like the SCL will always be driven low. The reason being all the SCL and SDA lines of I2C are expected to be at 'open drain drives low' drive mode. So, once the I2C line is pulled low, it stays low forever and acts as a permanent latch.

I'm afraid the switching functionality could not be achieved by a simple schematic. However, a custom verilog component could be developed to act as an I2C mux. It basically snoops the I2C packets from the master and decides how to connect the buses. I have attached the project. Please use it as reference.

Known limitation:

Currently, the component assumes that the slave will not stretch the clock when individual data or address bits are sent by the master.

Similarly, it is assumed that the master will not stretch the clock when receiving individual bits from the slave.

In simple words, the component assumes that clock stretching will occur only during ACK/NACK phase and between bytes in a multi-byte transfer.

I hope this helps.

Thanks,
Shanmathi

0 Likes

Hello,

Thank you for sending the project. I will confirm weather it meet our requirement. 

0 Likes