Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[stm32l1] [i2c] Hanging on I2C error #5735

Closed
Cr0s opened this issue Aug 7, 2016 · 1 comment
Closed

[stm32l1] [i2c] Hanging on I2C error #5735

Cr0s opened this issue Aug 7, 2016 · 1 comment
Labels
State: duplicate State: The issue/PR is a duplicate of another issue/PR Type: bug The issue reports a bug / The PR fixes a bug (including spelling errors)

Comments

@Cr0s
Copy link

Cr0s commented Aug 7, 2016

Hello everyone,

It's possible to overhaul current STM32L1's I2C peripheral driver code to remove the

while(1){}

from the I2C error ISR?

Due to this stub, the application code freezes if any I2C bus error occurs. That obviously makes an application less robust.

The current implementation code is like this:

void I2C_0_ERR_ISR(void)
{
    unsigned state = I2C1->SR1;
    DEBUG("\n\n### I2C1 ERROR OCCURED ###\n");
    DEBUG("status: %08x\n", state);
    if (state & I2C_SR1_OVR) {
        DEBUG("OVR\n");
    }
    if (state & I2C_SR1_AF) {
        DEBUG("AF\n");
    }
    if (state & I2C_SR1_ARLO) {
        DEBUG("ARLO\n");
    }
    if (state & I2C_SR1_BERR) {
        DEBUG("BERR\n");
    }
    if (state & I2C_SR1_PECERR) {
        DEBUG("PECERR\n");
    }
    if (state & I2C_SR1_TIMEOUT) {
        DEBUG("TIMEOUT\n");
    }
    if (state & I2C_SR1_SMBALERT) {
        DEBUG("SMBALERT\n");
    }
    while (1) {}
}

My suggestion is to replace this hanging stub to the routine which rising an error flag somewhere instead. It will make possible to handle bus errors on application side and gives more control over the situation.

Best regards,
Cr0s

@Cr0s Cr0s changed the title [i2c] Hanging on I2C error [stm32l1] [i2c] Hanging on I2C error Aug 7, 2016
@LudwigKnuepfer LudwigKnuepfer added Type: bug The issue reports a bug / The PR fixes a bug (including spelling errors) State: duplicate State: The issue/PR is a duplicate of another issue/PR labels Aug 7, 2016
@LudwigKnuepfer
Copy link
Member

See #3366

@Cr0s Cr0s closed this as completed Aug 7, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
State: duplicate State: The issue/PR is a duplicate of another issue/PR Type: bug The issue reports a bug / The PR fixes a bug (including spelling errors)
Projects
None yet
Development

No branches or pull requests

2 participants