Use this forum to chat about hardware specific topics for the ESP8266 (peripherals, memory, clocks, JTAG, programming)

User avatar
By beic
btidey wrote:If you wanted to use i2c it mIght be worth trying the brzo i2c library.

You have to use external pull up resistors with i2c. Internal pull ups on esp are not low enough value.

Thank you, I already saw that a few days ago, but for that I need more brain power to write a custom library for the PN532 chip.
User avatar
By StanJ
#84517 The current Arduino ESP I2C library (v2.6.0 via Board Manager) DOES support clock stretching on any bits; I've tested that pretty thoroughly before they released 2.6.0. I don't know offhand what the stretch requirements are for your RFID part, but you can set the stretch UP from it's default 230us to around 5ms before you start to have problems. If you go over ~25ms the WiFi may disconnect. There's a fix in the works for that, but it's not out yet.

To change the stretch limit, add
Wire.setClockStretchLimit(time in microseconds);
immediately after the Wire.begin(); statement.

edit: I just looked up your part: max clock stretch on page 211 is 1ms, so that 'time in microseconds' above is 1000.
You won't have to worry about the 25ms problem, as you're only stretching 1/25th of that pre-2.6.0 limit. With the current (as of a few days ago) ESP8266 library, Adafruit can happily include I2C support if they so choose.
Last edited by StanJ on Thu Jan 30, 2020 7:11 am, edited 1 time in total.