- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello,
if i load a new firmware to my pSoC4 sometimes a connected I2C-Slave hang (SDA is low).
I have to disconnect the power to reset the slave.
Can i reset the I2C Bus from the master?
Günter
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello All,
High-Speed I/O Matrix (HSIOM) multiplexes pin and connects to a particular peripheral selected in HSIOM_PORT_SELx register. Please make use of below code to control SCL pin using firmware.
regVal = CY_GET_REG32(I2C_scl__0__HSIOM);regVal &= ~I2C_scl__0__HSIOM_MASK; /* Set Pin as GPIO controlled by firmware */
regVal = CY_SET_REG32(I2C_scl__0__HSIOM, regVal |(I2C_scl__0__HSIOM_GPIO <<I2C_scl__0__HSIOM_SHIFT)); /* Set Pin drive mode */
I2C_scl_SetDriveMode(I2C_scl_DM_STRONG); /* Toggle Pin with 100-ms delay */ I2C_scl_Write(0u);
CyDelay(100u);
I2C_scl_Write(1u);
CyDelay(100u);
Thanks and Regards,
Geona Mary
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I made the same experience with some I2C devices. Now I disconnect them before I re-program my PSoC or -as you did- power down the system. No chance to reset the slave except it has got a command or a reset line.
Bob
PS: Where in Europe are you located?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello Bob,
i think the slave waits for additional clock to complete a byte.
In other microcontrollers i toggle Scl and wait until SDA is high. Then i send a stop condition.
But i am new to the pSoCs...
P.S. Germany
Günter
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Unfortunately there is no timeout defined in the I2C protocol, so you may give youe solution a try.
Bob
PS: Yes, I thought Germany or Austria. I live near Bremen, and you are from...?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello Bob,
i live near Ulm.
When i force the SCL to ground with a jumper for a short moment, SDA goes high!
How can i manipulate the Pin SCL when it is attached to the I2C SCB?
Günter
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
CY_SYS_PINS_CLEAR_PIN (CYREG_PRT3_DR, 0);
CyDelay(1);
CY_SYS_PINS_SET_PIN (CYREG_PRT3_DR, 0);
dont work...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
The Cypress I2C has a stall condition and is being looked at as
fix in future releases. Has to do with start condition and buss
setup.
Regards, Dana.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
You may give this a try
I2C_Reset(void)// Set scl lowwhile(I2C_sda_Read() == 0) Wait(); // Wait until sda is high// Release scl lineBob
void
{
I2C_scl_Write(0);
I2C_scl_Write(1);
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello Bob,
I2C_1_sda_Read() works fine, but I2C_1_scl_Write(0); dont work. I can measure no Pulse on SCL.
Now i can detect the problem with I2C_1_sda_Read() and hold the pSoc in a loop. A short pulse to ground with a jumper and the I2C bus works fine.
So the only problem is to get the SCL-PIN down a few times...
Günter
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thans Bob,
it works!
while(I2C_1_sda_Read() == 0) // SDA hang low
{
I2C_1_SET_I2C_SCL_HSIOM_SEL(I2C_1_HSIOM_GPIO_SEL); //Switch to GPIO
I2C_1_scl_Write(0);
CyDelay(1);
I2C_1_scl_Write(1);
CyDelay(1);
I2C_1_SET_I2C_SCL_HSIOM_SEL(I2C_1_HSIOM_I2C_SEL); //Switch to Component
}
I2C_1_I2CMasterSendStop();
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Great! Did you try what happens when there is no I2C device is connected? Would be bad if program hangs.
Bob
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello Bob,
without a slave SDA will be high, so everyting is OK.
Thanks for your help!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello Cypress,
it would be nice to have such a function builtin in the I2C component. It is better try to a I2Creset after a timeout than die in a endless loop...
Günter
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi Bob and Günter -
Unfortunately, I am having the same problem, and the I2C_SET_I2C_SCL_HSIOM_SEL command does not appear to be supported in SCB IP components later than V0. I tried commenting out that line and simply went straight to I2C_scl_Write(0), but it would not assert my I2C clock line low. I was wondering if you had any alternatives using newer versions of the SCB component? FYI, I also tried I2C_I2CReStartGeneration() with no effect on the clock line.
Thank you,
Kevin
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi Kevin,
Did you get any solution for writing to the scl pin?
Bob,
I am facing the same problem as Kevin
--
I2CM_SET_I2C_SCL_HSIOM_SEL command does not appear to be supported in SCB IP components later than V0. I tried commenting out that line and simply went straight to I2C_scl_Write(0), but it would not assert my I2C clock line low. I was wondering if you had any alternatives using newer versions of the SCB component?
Regards,
Vivek
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello All,
High-Speed I/O Matrix (HSIOM) multiplexes pin and connects to a particular peripheral selected in HSIOM_PORT_SELx register. Please make use of below code to control SCL pin using firmware.
regVal = CY_GET_REG32(I2C_scl__0__HSIOM);regVal &= ~I2C_scl__0__HSIOM_MASK; /* Set Pin as GPIO controlled by firmware */
regVal = CY_SET_REG32(I2C_scl__0__HSIOM, regVal |(I2C_scl__0__HSIOM_GPIO <<I2C_scl__0__HSIOM_SHIFT)); /* Set Pin drive mode */
I2C_scl_SetDriveMode(I2C_scl_DM_STRONG); /* Toggle Pin with 100-ms delay */ I2C_scl_Write(0u);
CyDelay(100u);
I2C_scl_Write(1u);
CyDelay(100u);
Thanks and Regards,
Geona Mary