Announcements

Help us improve the Power & Sensing Selection Guide. Share feedback

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

cross mob
TamirM
Level 2
Level 2
25 sign-ins First like given 10 questions asked

Im experiencing clock latching from I2C slave.

I want to toggle the I2C clock (SCL) a few times to make the slave to release the line.

I couldn't find an API to do so.

How can I do that? 

0 Likes
1 Solution
MotooTanaka
Level 9
Level 9
Distributor - Marubun (Japan)
First comment on blog Beta tester First comment on KBA

Hi,

I think that the part which back up the pin configuration and restore it is in the loop

        uint32 regVal, regValtemp;

        regVal = CY_GET_REG32(I2CM_scl__0__HSIOM);

	...

        regVal = CY_SET_REG32(I2CM_scl__0__HSIOM, regVal);

So the author of the discussion was

if sda == 0 enter the loop (while)

back up the register setting of SCL

configuring the SCL pin as GPIO

flip SCL once

restore the SCL configuration 

After the program exited the loop, it cleans the status of I2C component by calling

    status = I2CM_I2CMasterSendStop(timeout);

    //Reset I2C


    I2CM_I2CMasterClearStatus();

    I2CM_I2CMasterClearReadBuf();

    I2CM_I2CMasterClearWriteBuf();

 

Could I make sense?

 

moto

View solution in original post

0 Likes
4 Replies
MotooTanaka
Level 9
Level 9
Distributor - Marubun (Japan)
First comment on blog Beta tester First comment on KBA
0 Likes

Hi,

Yes, it helps.

I just need few clarifications:

Calling the following functions is enough to reset SCL pin the its default I2C configuration

(in case of "Show I2C terminals" box is UNCHECKED)?:

- I2C_I2CMasterClearStatus();

- I2C_I2CMasterClearReadBuf();

- I2C_I2CMasterClearWriteBuf();

0 Likes
MotooTanaka
Level 9
Level 9
Distributor - Marubun (Japan)
First comment on blog Beta tester First comment on KBA

Hi,

I think that the part which back up the pin configuration and restore it is in the loop

        uint32 regVal, regValtemp;

        regVal = CY_GET_REG32(I2CM_scl__0__HSIOM);

	...

        regVal = CY_SET_REG32(I2CM_scl__0__HSIOM, regVal);

So the author of the discussion was

if sda == 0 enter the loop (while)

back up the register setting of SCL

configuring the SCL pin as GPIO

flip SCL once

restore the SCL configuration 

After the program exited the loop, it cleans the status of I2C component by calling

    status = I2CM_I2CMasterSendStop(timeout);

    //Reset I2C


    I2CM_I2CMasterClearStatus();

    I2CM_I2CMasterClearReadBuf();

    I2CM_I2CMasterClearWriteBuf();

 

Could I make sense?

 

moto

0 Likes
TamirM
Level 2
Level 2
25 sign-ins First like given 10 questions asked

You couldn't make more sense 🙂

Thanks a lot. toggling the clock actually helped and recovered the I2C