Page 2 of 2

Re: WeMos D1 mini and PN532 RFID on I2C

PostPosted: Wed Aug 07, 2019 11:31 am
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.

Re: WeMos D1 mini and PN532 RFID on I2C

PostPosted: Mon Nov 11, 2019 9:17 pm
by StanJ
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 current limit. With the current (as of a few days ago) ESP8266 library, Adafruit can happily include I2C support if they so choose.

Re: WeMos D1 mini and PN532 RFID on I2C

PostPosted: Tue Nov 12, 2019 11:55 am
by beic
That's why I went back to SPI mode.

And that you for your reply! ;)