Arduino w/ PWM expander and DC motor issue

Status
Not open for further replies.
Great Mike. Thanks. Looking forward to the I2C release "uncrashing" method.
 
Try adding extra pullup resistors to the I2C lines? eg. 4k7 to 3.3V
It seems some arduinos have some level of onboard pullup and others may rely on the weak pullups within the MCU, which are too high value for proper I2C operation.

And / Or reduce the I2C bus speed, if you have it above 100KHz?
 
To clear the I2C lines at reset, you check SDA (D20) is high, if not clock SCK (D21).

So,
Code:
#define SDA D20
#define SCL D21

void clearI2C(){
    pinMode(SDA,INPUT);
    digitalWrite(SCL,HIGH);
    pinMode(SCL,OUTPUT);
    digitalWrite(SCL,HIGH);
    while(digitalRead(SDA)==LOW){
        digitalWrite(SCL,LOW);
        digitalWrite(SCL,HIGH);
    }
}

Mike.
 
To clear the I2C lines at reset, you check SDA (D20) is high, if not clock SCK (D21).
Mike!
Thanks. That works.
However, I am not sure how I would know when to reset. I2C channel doesn't report back when it falls out of sync. Correct?
 
I've lowered the I2C but speed to 20KHz. No real difference.
I've also added pull-up 4.7K resistors to the I2C lines. Also not helping.
 
Can you post a photo (or phorts) of the entire setup, showing the boards, power supplies, motor, transistor and all wiring?
 
Thanks. That works.
However, I am not sure how I would know when to reset. I2C channel doesn't report back when it falls out of sync. Correct?
The I2C lines get out of sync when they are interrupted during transmission. Normally, this cannot happen but if a random reset occurs by uploading a new sketch then it can. So, the only place you need to clear the lines is when it first boots up I.E. in setup before initializing the I2C.

Mike.
 
Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…