Skip to content

I2C Clock stretching on PN532 leads to bus error (?) #1541

Closed
@ghost

Description

Busy with debugging issues with a PN532 tag reader. Most of the time things are ok, but sometimes when reading a tag, the I2C bus get's stuck. The ESP will automatically reset the PN532 and everything will be just fine after that. But what's going on with the bus error and why?.

I already figured out that SDA remains low for some reason (and stays until the PN532 is reset)

So I started debugging with the logic analyzer and there may be some issue due to clock stretching?
I'm just guessing here... It could be that the PN532 is not ready and stretches the clock?

This is what happens with a normal read from the PN532. There's a gap between start and first byte written. It's approx. 100 uSec and things run ok.
pn532_read_no_tag

But when the bus error appears, there's a gap of approx. 250 uSec and the first byte has an issue. It should be a zero byte but I guess somethings happening within the I2C libs...
pn532_read_sda_error

Could my theory make any sense? If it is clock stretching, does the I2C library support what's going on here...

Want to back this issue? Post a bounty on it! We accept bounties via Bountysource.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions