I2C_Stop() API Does Not Disable I2C Master in I2C Component v3.50 of PSoC 3 and PSoC 5LP - KBA231344
- Subscribe to RSS Feed
- Mark as New
- Mark as Read
- Bookmark
- Subscribe
- Printer Friendly Page
- Report Inappropriate Content
Author: RakshithM_16 Version: **
When the I2C Component v3.50 is used in I2C Master mode with Fixed function implementation, the I2C_Stop() API does not disable the master. This is a known issue due to an error in the I2C_Stop() function definition in the Generated Source.
Note: Here, I2C_Stop() is a Component API. Therefore, if the I2C Component in your project is MyI2CComponent, the Component API will be MyI2CComponent_Stop(). For simplicity, the API will be referred to as <i2c_comp>_Stop() now on in this article, where <i2c_comp> is the name of the I2C Component.
<i2c_comp>_Stop() is defined in <i2c_comp>.c, and it contains the following line:
/* Disable block */
<i2c_comp>_CFG_REG &= (uint8) ~<i2c_comp>_CFG_EN_SLAVE;
The issue is that the <i2c_comp>_Stop() disables only the slave block even when the Component is configured as a master. As a workaround, replace this code with the following:
/* Disable block */
<i2c_comp>_CFG_REG &= (uint8) ~<i2c_comp>_ENABLE_MS;
Do one of the following to change the <i2c_comp>_Stop() function:
- Create a custom I2C stop function, for example, <i2c_comp>_Custom_Stop(), with the workaround implemented and call this function instead of <i2c_comp>_Stop().
- Create a modified Component with the workaround. See Customizing a Component using PSoC Creator - KBA229139.
- Modify the existing Generated Source and set Skip Code Generation to True in the project’s Build Settings > Code Generation.
Note: Do not Clean or Clean and Build the project after this setting.