Skip to content

Document glitch filter values #34

Description

@mbenkmann

I'm reading through the code to get an in-depth understanding and I'm hanging on this part

// Set filter
if(busFreq >= 48000000)
    *(i2c->FLT) = 4;
else
    *(i2c->FLT) = busFreq/12000000;

Could you document this better. How did you arrive at these values? Why have the glitch factor depend on the bus frequency for slower buses and have a fixed value of 4 for faster busses. Why have it depend on the bus frequency at all? Shouldn't the glitch filter depend on the I2C frequency or more precisely be based on the number of bus clocks per i2c clock pulse width?
And why such a low value? If I compute this correctly, the above code would set the glitch filter to just about 40ns for a Teensy 3.2 with F_BUS 36000000. I haven't done any experiments but my gut feeling is that just by touching a jump wire on my breadboard I could get glitches longer than that.

Wouldn't it make sense to use the highest value for the glitch filter that does not interfere with the data rate?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions