PN532 with NodeMCU 3 not working

Moderators: grovkillen, Stuntteam, TD-er

Message
Author
tozett
Normal user
Posts: 734
Joined: 22 Dec 2015, 15:46
Location: Germany

Re: PN532 with NodeMCU 3 not working

#51 Post by tozett » 01 Feb 2016, 12:24

sounds great.
at the moment, i have no idea about "clock streching". i googled a bit, and looked here:

https://github.com/esp8266/Arduino/blob ... 266_si2c.c

so, i want to replicate you good results, i would have to wait for an update of the core (when the devs put your patch in?),
or i would have to patch my core 2.0 sources myself in my local installation. right? i would give it a try, too.

(but at least, a dont have your equipment to see bus-error. or are they logged?)

tozett
Normal user
Posts: 734
Joined: 22 Dec 2015, 15:46
Location: Germany

Re: PN532 with NodeMCU 3 not working

#52 Post by tozett » 01 Feb 2016, 12:33

it this is true, its maybe worth to put in the wiki for the i2c...
If you using strong pullup resistor, please consider the on board MCU is working on 3.3V voltage.
The I2C wires can't longer than 15cm, otherwise, the port will not working properly.
found here:http://www.digole.com/forum.php?topicID=275
is all about bugs with clock streching on esp with the soft-i2c (with picture from oszi)

length of i2c cable: max usual 1-2m, depends on capacity of the wire and components
http://www.esacademy.com/en/library/tec ... c-faq.html

pppp33
Normal user
Posts: 67
Joined: 25 Oct 2015, 17:53

Re: PN532 with NodeMCU 3 not working

#53 Post by pppp33 » 01 Feb 2016, 14:03

...a great thank to the tag robot for its' unvaluable work....and, yeah, also to Martinus' patience... :D
Regards
Paolo

tozett
Normal user
Posts: 734
Joined: 22 Dec 2015, 15:46
Location: Germany

Re: PN532 with NodeMCU 3 not working

#54 Post by tozett » 01 Feb 2016, 14:11

pppp33 wrote:...a great thank to the tag robot for its' unvaluable work....and, yeah, also to Martinus' patience... :D

yeahhhhh, me too!!

how does the robot looks like? i am interested in an photo... :mrgreen:

Martinus

Re: PN532 with NodeMCU 3 not working

#55 Post by Martinus » 01 Feb 2016, 15:26

Yep, the "tag robot" makes testing a less boring job. I won't publish pictures though, because I've used quite some "scotch tape" to hold everything together. :oops: :oops:

About the clock stretching thing, I wanted to try something more to get rid of the excessive stretching if possible. It may have something to do with wake-up from standby or power down modes. So this morning I started another plugin version with the unpatched ESP core library and may be we can solve (or at least improve) this without hacking the core library.

So the first goal is to keep the reset count as low as possible without patching the library. Have to check when I get home...

tozett
Normal user
Posts: 734
Joined: 22 Dec 2015, 15:46
Location: Germany

Re: PN532 with NodeMCU 3 not working

#56 Post by tozett » 02 Feb 2016, 20:45

i discovered a new situation in R076 with my esp12.
it lying around at my desk now for longterm testing. i noticed 2 or 3 reboots over the day, but there are a lot wires sticking in the breadboard. maybe i touched one, i thought. but some minutes ago, the ESP disapered from the wifi.
i looked into the serial monitor and captured the following log.
fiddling with off/on of the pn532 did not help, no reset. the esp didn not come to wifi again. i had to do a cold reset...

Code: Select all

Reset Pin high...
PN532: poll count: 0 sda: 0 scl: 1
Reset Pin low...
Reset Pin high...
PN532: Read errors: 202
Reset Pin low...
Reset Pin high...
PN532: poll count: 0 sda: 0 scl: 1
Reset Pin low...
Reset Pin high...
PN532: Read errors: 203
Reset Pin low...
Reset Pin high...
DS   : Temperature: 23.50 (28-ff-dd-f0-4c-4-0-3a)
HTTP : connecting to 192.168.14.253
HTTP : connection failed
Delayed Reset 60
Delayed Reset 59
Delayed Reset 58
Delayed Reset 57
Delayed Reset 56
Delayed Reset 55
Delayed Reset 54
Delayed Reset 53
Delayed Reset 52
Delayed Reset 51
Delayed Reset 50
Delayed Reset 49
Delayed Reset 48
Delayed Reset 47
Delayed Reset 46
Delayed Reset 45
Delayed Reset 44
Delayed Reset 43
Delayed Reset 42
Delayed Reset 41
Delayed Reset 40
Delayed Reset 39
Delayed Reset 38
Delayed Reset 37
Delayed Reset 36
Delayed Reset 35
Delayed Reset 34
Delayed Reset 33
Delayed Reset 32
Delayed Reset 31
Delayed Reset 30
Delayed Reset 29
Delayed Reset 28
Delayed Reset 27
Delayed Reset 26
Delayed Reset 25
Delayed Reset 24
Delayed Reset 23
Delayed Reset 22
Delayed Reset 21
Delayed Reset 20
Delayed Reset 19
Delayed Reset 18
Delayed Reset 17
Delayed Reset 16
Delayed Reset 15
Delayed Reset 14
Delayed Reset 13
Delayed Reset 12
Delayed Reset 11
Delayed Reset 10
Delayed Reset 9
Delayed Reset 8
Delayed Reset 7
Delayed Reset 6
Delayed Reset 5
Delayed Reset 4
Delayed Reset 3
Delayed Reset 2
Delayed Reset 1

 ets Jan  8 2013,rst cause:4, boot mode:(3,2)

wdt reset
load 0x4010f000, len 1264, room 16 
tail 0
chksum 0x42
csum 0x42
~ld
ªU
INIT : Booting Build nr:76
bcn 0
del if1
mode : sta(18:fe:34:a6:9c:81)
WIFI : Connecting... 1
f 0, scandone
state: 0 -> 2 (b0)
state: 2 -> 3 (0)
state: 3 -> 5 (10)
add 0
aid 4
pm open phy_2,type:2 0 0
cnt 

connected with wifi, channel 11
dhcp client start...
state: 5 -> 2 (2c0)
rm 0
pm close 7 0 0/6168860
reconnect
state: 2 -> 0 (0)
f 0, scandone
state: 0 -> 2 (b0)
WIFI : Disconnecting!
state: 2 -> 0 (0)
WIFI : Connecting... 2
f -180, scandone
state: 0 -> 2 (b0)
reconnect
state: 2 -> 0 (0)
f 0, scandone
state: 0 -> 2 (b0)
state: 2 -> 3 (0)
state: 3 -> 5 (10)
add 0
aid 4
pm open phy_2,type:2 0 0
cnt 

connected with fo46egre, channel 11
dhcp client start...
WIFI : Disconnecting!
state: 5 -> 0 (0)
rm 0
pm close 7 0 0/3978428
WIFI : Connecting... 3
f -180, scandone
state: 0 -> 2 (b0)
state: 2 -> 3 (0)
state: 3 -> 5 (10)
add 0
aid 4
pm open phy_2,type:2 0 0
cnt 
chg_B:-120
state: 5 -> 2 (7a0)
rm 0
pm close 7 0 0/241755
state: 2 -> 2 (2a0)
reconnect
state: 2 -> 0 (0)
f 0, scandone
state: 0 -> 2 (b0)
state: 2 -> 2 (4a0)
state: 2 -> 3 (0)
state: 3 -> 5 (10)
add 0
aid 4
pm open phy_2,type:2 0 0
cnt 
state: 5 -> 2 (7a0)
rm 0
pm close 7 0 0/242829
state: 2 -> 2 (2a0)
reconnect
state: 2 -> 0 (0)
f -180, scandone
state: 0 -> 2 (b0)
state: 2 -> 2 (4a0)
state: 2 -> 3 (0)
state: 3 -> 5 (10)
add 0
aid 4
pm open phy_2,type:2 0 0
cnt 
chg_B:-120
chg_B:-60
state: 5 -> 2 (2c0)
rm 0
pm close 7 0 0/4012030
WIFI : Disconnecting!
state: 2 -> 0 (0)
INIT : I2C
Reset Pin low...
Reset Pin high...
Reset Pin low...
Reset Pin high...
Reset Pin low...
Reset Pin high...
INIT : Output -1
UDP  : Send Sysinfo message
INIT : Boot OK
INIT : Normal boot
NTP  : NTP sync requested
NTP  : NTP send to 0.0.0.0
NTP  : No reply
PN532: poll count: 0 sda: 0 scl: 1
Reset Pin low...
Reset Pin high...
PN532: Read errors: 1
PN532: poll count: 1 sda: 0 scl: 1
Reset Pin low...
Reset Pin high...
PN532: Read errors: 2
PN532: poll count: 1 sda: 0 scl: 1

costo
Normal user
Posts: 490
Joined: 21 Nov 2015, 15:03

Re: PN532 with NodeMCU 3 not working

#57 Post by costo » 03 Feb 2016, 00:03

tozett wrote:i discovered a new situation in R076 with my esp12.
it lying around at my desk now for longterm testing. i noticed 2 or 3 reboots over the day, but there are a lot wires sticking in the breadboard. maybe i touched one, i thought. but some minutes ago, the ESP disapered from the wifi.
I had problems like that with my esp07. Like when connecting a wire to GND or VCC the esp on the breadboard would reset.
Then I soldered a 4.7 nF ceramic SMD capacitor direct over the reset pin to the metal case and also a 2.2 uF tantalium SMD capacitor between Vcc and the case. After this modification I never experienced spontaneous resets with my esp07 again when I touched the circuit or connected a wire.

picture of the modification:
[img=100,75]http://static.tweakers.net/ext/f/3TE1pp ... /thumb.jpg[/img]

Martinus

Re: PN532 with NodeMCU 3 not working

#58 Post by Martinus » 03 Feb 2016, 17:31

After some more evenings of fun with the PN532, it looks like there's no other solution than to patch the ESP core library to avoid the serious bus errors that needs a device reset.

So I went into the process of forking / patching / testing / pull request, and it's now up to the Arduino ESP core developers to approve this patch.

It's a bit of a bummer, because I had hoped to get a new stable ESP Easy out with Core 2.0.0. and that will be impossible.

tozett
Normal user
Posts: 734
Joined: 22 Dec 2015, 15:46
Location: Germany

Re: PN532 with NodeMCU 3 not working

#59 Post by tozett » 03 Feb 2016, 18:57

costo wrote: ...I soldered a 4.7 nF ceramic SMD capacitor direct over the reset pin to the metal case and also a 2.2 uF tantalium SMD capacitor between Vcc and the case. After this modification I never experienced spontaneous resets with my esp07 again when I touched the circuit or connected a wire.
i am not the experienced in discrete electronics, but i think i can solder two capacitors. Must one be "tantalium", or could i take 4.7nF and 2.2uF in ceramic? than i will search a ceramic-collection of alibaba, two single capacitors could cost in germany more than one ESP ... :mrgreen:

thanks for the hint.

edit: i dont find cheap collections in the uF-dimension for ceramic. so thats why tantalium?
but i dont find cheap tantalium-collection in china, only aluminim-electrolytic. they have +/- sides, dont they? do they do instead of tantalium?
edit2: i found them for 0.04 EUR and 0.07EUR with 5.60 EUR shipping. hurrahhh :lol:
http://www.reichelt.de/Bauelemente/X7R- ... 603+4%2C7N
http://www.reichelt.de/Bauelemente/SMD- ... 2%2C2%2F20

costo
Normal user
Posts: 490
Joined: 21 Nov 2015, 15:03

Re: PN532 with NodeMCU 3 not working

#60 Post by costo » 04 Feb 2016, 00:50

tozett wrote: i am not the experienced in discrete electronics, but i think i can solder two capacitors. Must one be "tantalium", or could i take 4.7nF and 2.2uF in ceramic? than i will search a ceramic-collection of alibaba, two single capacitors could cost in germany more than one ESP ... :mrgreen:
The SMD capacitor for on the reset can be any ceramic SMD capacitor in the range between 1nF and 10nF
The capacitor over the Vcc must be soldered with the shortest wires as possible, therefor SMD is recommended as they have zero wirelength.
It does not have to be tantalium, any electrolytic capacitor in the range of 1 to 10 uF will also be good.

For the reset pin this 5n6 seems a good choice http://www.aliexpress.com/item/100pcs-l ... 8aa0f379bd

For the Vcc this 2u2 seems a good choice: http://www.aliexpress.com/item/Free-shi ... 71c14a2195

tozett
Normal user
Posts: 734
Joined: 22 Dec 2015, 15:46
Location: Germany

Re: PN532 with NodeMCU 3 not working

#61 Post by tozett » 04 Feb 2016, 08:38

thanks for helping with links to the smd-parts.
i have actually three of them, and i must power them.
i found this, looked like a good solution to the ESP12, but its no longer sold :cry:

https://www.tindie.com/products/Ba0sh1/ ... d-adapter/

tozett
Normal user
Posts: 734
Joined: 22 Dec 2015, 15:46
Location: Germany

Re: PN532 with NodeMCU 3 not working

#62 Post by tozett » 04 Feb 2016, 19:36

Martinus wrote:After some more evenings of fun with the PN532, it looks like there's no other solution than to patch the ESP core library...
So I went into the process of forking / patching / testing / pull request, and it's now up to the Arduino ESP core developers to approve this patch.
It's a bit of a bummer, because I had hoped to get a new stable ESP Easy out with Core 2.0.0. and that will be impossible.
from the ws2812 thread "https://github.com/deennoo/ESP8266-ws2812b" i catched, that there is 2.1.rc.. around? maybe a help?
edit: found it here: http://esp8266.github.io/Arduino/versions/2.1.0-rc2/
dont think so, but i am glad you tracked down the problem up to here.. ;)

Martinus

Re: PN532 with NodeMCU 3 not working

#63 Post by Martinus » 05 Feb 2016, 14:04

tozett wrote:from the ws2812 thread "https://github.com/deennoo/ESP8266-ws2812b" i catched, that there is 2.1.rc.. around? maybe a help?
edit: found it here: http://esp8266.github.io/Arduino/versions/2.1.0-rc2/
Yes there is 2.1.0rc but that's unstable stuff. We should stay far away...

As with most of these projects (including our own) there's no separated track for stable and unstable development. So stable 2.0.0. will not be patched for bugfixes. If you need a fix, you have to wait for the next stable and hope that it's actually stable.

tozett
Normal user
Posts: 734
Joined: 22 Dec 2015, 15:46
Location: Germany

Re: PN532 with NodeMCU 3 not working

#64 Post by tozett » 05 Feb 2016, 14:34

I test every of your patches,
the last ones all helped a lot!
Thanks here ahain

tozett
Normal user
Posts: 734
Joined: 22 Dec 2015, 15:46
Location: Germany

Re: PN532 with NodeMCU 3 not working

#65 Post by tozett » 05 Feb 2016, 22:46

to get the module (more) stable....
costo wrote: I had problems like that with my esp07. Like when connecting a wire to GND or VCC the esp on the breadboard would reset.
Then I soldered a 4.7 nF ceramic SMD capacitor direct over the reset pin to the metal case and also a 2.2 uF tantalium SMD capacitor between Vcc and the case. ...
http://www.esp8266.nu/forum/viewtopic.p ... t=50#p3749

helpful for me (and other newbees) maybe some hints for stability in the wiki?
if they use esp12 modules, and not nodemcu or other boards.

i found this now in the core, better to put it also in a prominent place on the wiki?
it took me some time now to find it (by accident..)

https://github.com/esp8266/Arduino/blob ... bility.png

tozett
Normal user
Posts: 734
Joined: 22 Dec 2015, 15:46
Location: Germany

Re: PN532 with NodeMCU 3 not working

#66 Post by tozett » 18 Apr 2016, 22:51

Martinus wrote: And it seems that there's I2C clock stretching going on with more than the usual delay, approx. 250 uSecs

And I also found out that the Arduino ESP core does not seem to support clock stretching for more than 100 uSec. (mentioned as a comment inside the library). So we seem to have found the root cause for these bus resets...
...
just to prove this theory, I decided to patch the ESP core I2C library to allow for up to 1 mSec clock stretching,...This morning results after approx. 14 hours run: 817 tag movements ...0 bus errors (!)

i am now on r101, platform 2.1, changed for stability to the wemos boards (more easy!), and found in the advanced/experimental a clock strech-setting. i still need the reset-wire to the pn532 board to work properly over i2c.
does r101 and the clock-strech-setting now needs to be somehow configured to get rid of the reset-wire?

tozett
Normal user
Posts: 734
Joined: 22 Dec 2015, 15:46
Location: Germany

Re: PN532 with NodeMCU 3 not working

#67 Post by tozett » 16 Jul 2016, 09:18

as plattfrom version went up from 2.0 to 2.3 now and espeasy improved up to v109,
and there is a i2c streching option (how to use?), i dont know if the reset-function is still needed to have nfc proper working.
:roll: :roll: :roll:

meanwhile i also ordered a new version of nfc-boards from aliexpress and got the elechouse v3 boards (by incident). i will try these now, but do i still need the reset? was there any changing in the code that made the reset overcome?
:D
Attachments
PN532-7.jpg
PN532-7.jpg (43.05 KiB) Viewed 5182 times

tozett
Normal user
Posts: 734
Joined: 22 Dec 2015, 15:46
Location: Germany

Re: PN532 with NodeMCU 3 not working

#68 Post by tozett » 16 Jul 2016, 16:46

i build a new nfc-reader with espeasy on a gizwit module.
it lacks 3.3V, but i found it on a pin of the LDR.
it seems that both pcb's run alone from usb-power.
did not test if i still need the reset-line, so left it in at first.
Attachments
pn532.png
pn532.png (147.43 KiB) Viewed 5142 times

User avatar
beic
Normal user
Posts: 118
Joined: 18 Aug 2016, 18:19

Re: PN532 with NodeMCU 3 not working

#69 Post by beic » 26 Jun 2020, 00:28

tozett wrote:
16 Jul 2016, 16:46
i build a new nfc-reader with espeasy on a gizwit module.
it lacks 3.3V, but i found it on a pin of the LDR.
it seems that both pcb's run alone from usb-power.
did not test if i still need the reset-line, so left it in at first.
Hey tozett,

I know it's an old post, but did you ever try to use PN532 module over SPI ?

Kind regards,
Viktor

Post Reply

Who is online

Users browsing this forum: No registered users and 7 guests