- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi, I am trying to reset an I2C Master after inserting random glitches to the hardware I2C. I have not been successful on resetting the hardware. It seems that once I2C Master is hanged due to random glitches, it stop responding even though the hardware is reinitialized. I am testing this with no slaved attached, so all transaction are NAKed.
I2C_Stop();
I2C_MCSR_REG = 0;
I2C_Init();
I2C_Enable();
I2C_EnableInt();
I2C_MasterClearReadBuf();
I2C_MasterClearWriteBuf();
I2C_MasterClearStatus();
Even after those routines are called, the I2C_MCSR_BUS_BUSY bit in I2C_MCSR_REG remains '1'. Can anyone help with resetting the I2C hardware?
- Labels:
-
PSoC 3
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Are you using Fixed function I2C Master component or UDB based component. In case of the UDB based component there is an hardware Reset terminal which resets the hardware state of the entire hardware module you could try the same. You could connect a pin to this reset terminal and make it zero. Or you could connect a Control Register Component(Present in Digital --> Registers Folder in component catalog) to this terminal and configure it for one bit operation and make this register toggle between a logic an logic zero to reset the I2C component.
- How are you inserting Glitches and could you give some information about these glitches.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Dear all,
Unfortuneatley I am experiencing a similar problem:
My setup is as follows (silicon PsoC3, production):
I2CMaster_0 (fixed function, 400kHz) connected to one slave of specific type
I2CMaster_1 (UDB, 400kHz) connected to one slave of same type
I2CMaster_2 (UDB, 400kHz) connected to one slave of same type
I2CMaster_3 (UDB, 400kHz) connected to one slave of same type
From time to time the master implemented as FF stalls and the communication breaks down.
I'm unable to reset the FF I2CMaster.
Due to resource limitations I cannot implement all 4 masters as UDBs
Any thoughts?
Matthias Arnold
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi Matthias,
Is the communication from the FIxed Function I2C Master breaking down everytime or only when glitches is introduced?
Is the hardware configuration of the I2C master set right? Both the pins SDA and SCL should be Bidirectional with Drive Mode as Open-Drain Drives Low. The external pull-up resistors used should be used and the length of the cable must be within the maximum permissible limits. Are all these requirements taken care of? This is to confirm that there is no timing violation.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
adding I2C_CFG_REG = 0u works.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
@user_10802449 is correct.
As of version 3.50 of the I2C Component, there is a bug in the generated API. Even though it's configured as Fixed Function I2C Master, I2C_1_Stop() clears the SLAVE enable, not MASTER, as seen in this line of code:
/* Disable block */
I2C_1_CFG_REG &= (uint8) ~I2C_1_CFG_EN_SLAVE;
For Fixed-Function I2C, the master status register (I2C_MCSR) BUS_BUSY bit will not clear unless the I2C component is disabled in the configuration register (I2C_CFG). Also, beware that calling I2C_1_Start() does not reinitialize because the "initialized" flag (I2C_1_initVar) never gets cleared by provided API functions. I used the following to solve my problem:
void I2C_Reset(void)
{
I2C_1_Stop();
/* Disable/clear everything, then reinitialize. */
I2C_1_CFG_REG = 0x00; // NECESSARY to get MCSR to reset and clear BUS_BUSY bit.
I2C_1_XCFG_REG = 0x00; // not sure if necessary.
I2C_1_initVar = 0; // MUST BE SET TO ZERO to allow I2C_1_Start() to call I2C_1_Init()
I2C_1_Start();
}