- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello , I would like to stop i2c communication during runtime and use the scl pin to toggle several times to reset a slaves State Machine. It seems that calling the SCL_Stop() function is not enough to get the scl pin back to normal output function. Here is my code: I2C_Stop(); /* Stop I2C */ I2C_scl_SetDriveMode(I2C_scl_DM_STRONG); /*set DriveMode*/ I2C_scl_Write( 1u ); /*set pin output manually*/
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello Jens,
High-Speed I/O Matrix (HSIOM) multiplexes the 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);
for(i= 0u; i < 5u; i++)
{
/* 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
Hello Jens,
High-Speed I/O Matrix (HSIOM) multiplexes the 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);
for(i= 0u; i < 5u; i++)
{
/* Toggle Pin with 100-ms delay */
I2C_scl_Write(0u);
CyDelay(100u);
I2C_scl_Write(1u);
CyDelay(100u);
}
Thanks and Regards,
Geona Mary