PN532 with NodeMCU 3 not working

Moderators: grovkillen, Stuntteam, TD-er

Message
Author
pppp33
Normal user
Posts: 71
Joined: 25 Oct 2015, 17:53

PN532 with NodeMCU 3 not working

#1 Post by pppp33 » 24 Dec 2015, 16:05

Hi there,
I can't get my pn532 NFC board running with my nodemcu v3.
I am using v49
I get the init msg form PN532:

PN532: Init: Found chip PN532 FW: 1.6

but when i do an I2C bus scan, i get this error:

No I2C devices found

Unknow error at address 0x1
Unknow error at address 0x2
Unknow error at address 0x3
.....
.....
Unknow error at address 0x7e
Unknow error at address 0x7f

Did somebody get them working ?
Is there any known issue with PN532 and/or NodeMCU v3 ?

Regards, Thnx, and Merry XMas to all the forum members !

User avatar
costo
Normal user
Posts: 500
Joined: 21 Nov 2015, 15:03
Location: NL, zw-NB

Re: PN532 with NodeMCU 3 not working

#2 Post by costo » 24 Dec 2015, 16:24

I don't own a PN532 so I can't say anything bout it.
I do work with a NodeMCU V3 ...... that is, there so much different versions called nodeMCU V3 and they are almost the same as nodeMCU V1.
You have a link of the board you use ?

I advice you to upgrade to a newer version of ESPEasy and then do the scan I2C again, if it is not working check if you have declared the right I2C pins in the hardware tab and eventually exchange SCL and SDA

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

Re: PN532 with NodeMCU 3 not working

#3 Post by pppp33 » 24 Dec 2015, 18:32

hi costo,
thanx for suggestions.
here's the link:
http://g01.a.alicdn.com/kf/HTB1FNENKpXX ... basata.jpg

I'll upgrade & recheck ASAP.....

Thanks & regards
paolo

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

Re: PN532 with NodeMCU 3 not working

#4 Post by pppp33 » 25 Dec 2015, 00:48

Hi,
I just upgraded to v57, and got almost the same result.....
Any idea ?
Is there any forum member that got it working ?
Thanx & regards
paolo

User avatar
costo
Normal user
Posts: 500
Joined: 21 Nov 2015, 15:03
Location: NL, zw-NB

Re: PN532 with NodeMCU 3 not working

#5 Post by costo » 25 Dec 2015, 02:28

Looks like there is something wrong with your I2C connection. I got similar messages when i had the SDA line accidentally grounded.
It is also possible that you need pullup resistors, they are needed for I2C to work correctly. Some I2C devices have them onboard, then you do not need external pullups. Usually pullup resistors are a few kiloohms between Vcc and the SCL and SDA line. Maybe you can check with a volt/ohm meter if they are on the PN532 board.

edit:
Here you find facts about this PN532 board: https://learn.adafruit.com/adafruit-pn5 ... out-wiring
this says :
If you are using the breakout in I2C mode, you will also need to add two 1.5K pullups on the SCL/SDA lines, since the breakout and the Arduino don't include the pullups. Simply solder or add a 1.5K resistor between SCL and 3.3V, and SDA and 3.3V, and then connect the breakout as you normally would.
So that may be the solution to your problem

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

Re: PN532 with NodeMCU 3 not working

#6 Post by pppp33 » 30 Dec 2015, 14:02

thnx costo,
I think my problem is related to board manager 2.0.0.
Is there some forum member using pn532 AND board manager 2.0.0 ?

thanx for the info....
paolo

Martinus

Re: PN532 with NodeMCU 3 not working

#7 Post by Martinus » 31 Dec 2015, 09:34

If I understand correctly, it's working for you on the 1084 staging release but not on 2.0.0 ?

I'm using the Wiegand reader myself so this sensor has not been tested with 2.0.0.
I'll see if I can find some time to hook it up again.

r_255
Normal user
Posts: 32
Joined: 20 Nov 2015, 20:42

Re: PN532 with NodeMCU 3 not working

#8 Post by r_255 » 31 Dec 2015, 10:02

I had it working, on the old version.
did had to fidele with connectors a bit to get it running, but it worked.

https://plus.google.com/u/0/+RobinFrantzen

But stupid me blew up the esp with retrying ( mixed up polarity ) because it did not work as before and i kept on trying.
That was after 2.0 was installed, so you might have a good point.

Martinus

Re: PN532 with NodeMCU 3 not working

#9 Post by Martinus » 02 Jan 2016, 18:03

To test drive the hardware again, I've used this simle sketch using the original libraries. (The ESP Easy plugin code is based on these libraries)

It's running in the test lab for some time using ESP core 2.0.0. I've put a Mifare card on top of the reading module so it will detect and report the card 4 times/second and display on serial output. So far the count is 35730 readings.

But it seems to have an issue sometimes with detecting the PN532 during boot, i have to power off/on the PN532 module to get it working again.

Maybe other people could also try this sketch and see it it works reliably.

Don't forget the grab the PN532 libraries from https://github.com/elechouse/PN532. You only need the folders named "PN532" and "PN532_I2C" and copy them to the "libraries" folder from your Arduino IDE.

Code: Select all

// Test sketch for PN532 on ESP8266
// Used libraries from https://github.com/elechouse/PN532
// Copy PN532 and PN532_I2C folders to the Arduino libraries folder

#include <Wire.h>
#include <PN532_I2C.h>
#include <PN532.h>
PN532_I2C pn532i2c(Wire);
PN532 nfc(pn532i2c);

void setup(void) {
  Serial.begin(115200);
  Serial.println("Sketch started...");

  nfc.begin();

  Serial.println("Scan I2C bus...");
  for (byte address = 1; address <= 127; address++ )
  {
    Wire.beginTransmission(address);
    if (Wire.endTransmission() == 0)
    {
      Serial.println(address, HEX);
    }
  }

  uint32_t versiondata = nfc.getFirmwareVersion();
  if (! versiondata) {
    Serial.println("Didn't find PN53x board");
    Serial.println("Sketch halted!");
    while (1)
      delay(1000);
  }

  // Got ok data, print it out!
  Serial.print("Found chip PN5"); Serial.println((versiondata >> 24) & 0xFF, HEX);
  Serial.print("Firmware ver. "); Serial.print((versiondata >> 16) & 0xFF, DEC);
  Serial.print('.'); Serial.println((versiondata >> 8) & 0xFF, DEC);

  // configure board to read RFID tags
  nfc.SAMConfig();

  Serial.println("Waiting for an ISO14443A Card ...");
}

unsigned long counter=0;

void loop(void) {
  uint8_t success;
  uint8_t uid[] = { 0, 0, 0, 0, 0, 0, 0 };  // Buffer to store the returned UID
  uint8_t uidLength;                        // Length of the UID (4 or 7 bytes depending on ISO14443A card type)

  // Wait for an ISO14443A type cards (Mifare, etc.).  When one is found
  // 'uid' will be populated with the UID, and uidLength will indicate
  // if the uid is 4 bytes (Mifare Classic) or 7 bytes (Mifare Ultralight)
  success = nfc.readPassiveTargetID(PN532_MIFARE_ISO14443A, uid, &uidLength);

  if (success) {
    // Display some basic information about the card
    Serial.print(++counter);
    Serial.print(" Found an ISO14443A card with ");
    Serial.print(" UID Length: "); Serial.print(uidLength, DEC); Serial.print(" bytes");
    Serial.print(" and UID Value: ");
    nfc.PrintHex(uid, uidLength);

    delay(250);
  }
}

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

Re: PN532 with NodeMCU 3 not working

#10 Post by pppp33 » 14 Jan 2016, 21:13

I can confirm that, after some tricky reset and/off power cycle, it reads tags.....
But now we need to get stability and reliability.
Any idea ?
regards
paolo

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

Re: PN532 with NodeMCU 3 not working

#11 Post by tozett » 23 Jan 2016, 16:26

i had no great success with my pn532 in espeasy R070.
it had only _1_working reading.
than i tried the sketch, wich runs perfectly in the same hardware-environment (in contrast to espeasy r070)
constant readings, no fiddlings.

edit:
i was too quick. it works from start on, but i there is nothing going on for some minutes, the test-sketch stops working and my serial-monitor shows nothing....hmmmm hardware? sleep?...voltage level...?
i can reproduce it: it always runs from reboot and than ongoing reading. i there is a pause for some minutes, all readings stopss

i will give the R070 another try, but hoped to find here some infos, it i have to consider this is a "young" or beta-feature",
or must i spent little/much more time to have an reliable RFID reading with the ESPeasy firmware?

my board is a ESP-12E, just got it running ...

any hints to try something else?
Last edited by tozett on 23 Jan 2016, 16:37, edited 1 time in total.

Martinus

Re: PN532 with NodeMCU 3 not working

#12 Post by Martinus » 23 Jan 2016, 16:37

tozett wrote:i had no great success with my pn532 in espeasy R070.
it had only _1_working reading.
than i tried the sketch, wich runs perfectly in the same hardware-environment (in contrast to espeasy r070)
constant readings, no fiddlings.

i will give the R070 another try, but hoped to find here some infos, it i have to consider this is a "young" or beta-feature",
or must i spent little/much more time to have an reliable RFID reading with the ESPeasy firmware?

my board is a ESP-12E, just got it running ...
The issue with PN532 is a known issue in combination with ESP Easy. I think it's better to remove the plugin until this is sorted out.

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

Re: PN532 with NodeMCU 3 not working

#13 Post by tozett » 23 Jan 2016, 16:41

if i do a reset over the resetline of the esp12, i got this

Code: Select all

Scan I2C bus...
Didn't find PN53x board
Sketch halted!
.

i works, if i shut down power of both, esp12 and pn532-device...

Code: Select all

Scan I2C bus...
1
24
Found chip PN532
Firmware ver. 1.6
Waiting for an ISO14443A Card ...
.

would be wonderful to have an wifi-RFID reader.. anything more what to test here?

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

Re: PN532 with NodeMCU 3 not working

#14 Post by tozett » 23 Jan 2016, 16:58

after the testsketch i flashed R070 again. no change in hardware.
with the testsketch, a coldreset of both, esp12-e and pn532 helped to bring it running up again.
on the R070 it does not help.

Code: Select all

WIFI : Connected!
INIT : I2C
PN532: Init: Found chip PN532 FW: 1.6
INIT : Boot OK
INIT : Cold Boot
WD   : Uptime 0 ConnectFailures 0 FreeMem 26168
but no readings....

i think i must put this on halt. maybe see to divide this int the pn532 with sda/scl on an arduino (more stable?).
and use the ESP for wifi on the arduino...
edit: good place could be in the pro-mini-extender.ino ... ;-)
a pitty... to have it on the espeasy would be wonderful...

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

Re: PN532 with NodeMCU 3 not working

#15 Post by tozett » 26 Jan 2016, 20:41

Martinus wrote:The issue with PN532 is a known issue in combination with ESP Easy. I think it's better to remove the plugin until this is sorted out.
would love to see it stay in... is there a big coding problem?
maybe let the plugin in, but switch PN532 not only as i2c. i can put mine to uart-mode.
what do you think?

Martinus

Re: PN532 with NodeMCU 3 not working

#16 Post by Martinus » 27 Jan 2016, 16:34

As this is already part of the existing plugin collection, I've spend considerable time to get things sorted out with this one. It would be best to fix it before we launch the next build on sourceForge or we better remove it.

Yesterday I hooked up the logic analyzer to see what's happening on the I2C bus and added some serial debug logging in the PN532 plugin. Dived a bit into the NXP datasheets in order to understand more about this little device.

I found out some error situations that needs to be resolved. And it also seems that the original library uses a "blocking" read to scan cards and we certainly can not use that in our application. So the adapted code needed some additional changes and it looks like some progress is made already.

I also constructed a lab test where another ESP Easy controls a servo motor to place/remove the tag from the reader. So testing can be automated! (finally had a purpose for the Servo feature :ugeek: :ugeek:)

And I used a mosfet to connect the reader to VCC, so the ESP can power off the reader in case of errors. I don't know if this is still needed but it is certainly easy during development and testing.

Keep you posted...

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

Re: PN532 with NodeMCU 3 not working

#17 Post by tozett » 27 Jan 2016, 18:46

wonderful.
i dont know how to express my gratitude for all this coding..
(as i am a simple user, i cannot underestime your effort in improving this thing)!
ESPeasy is a great peace!
+1, keep on ..! i will follow/test...
:D

Martinus

Re: PN532 with NodeMCU 3 not working

#18 Post by Martinus » 28 Jan 2016, 16:20

The PN532 plugin has been updated in R73 on github. This is a 'test version' and it still has some debugging stuff in there. Many things have been changed and now my PN532 board seems quite happy with it. It worked for 24 hours and also survives reboots and cold boot situations.

And instead of controlling the VCC with a mosfet, I hooked up a GPIO to the PN532 reset pin (This is the pin labeled NRSTPD, not to be confused with RSTO which is a reset out pin!)
This is now an optional feature in the webgui. It's seems also stable without it, but connecting this pin makes the ESP more in control. If there's a I2C bus error, it will reset the PN532. Verified to work.

But from experience, I know that stuff that works here :D .......... does not work elsewhere :cry: ......... so your mileage may very ....... let me know ......

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

Re: PN532 with NodeMCU 3 not working

#19 Post by tozett » 28 Jan 2016, 18:26

// R73 28-01-2016 in https://github.com/ESP8266nu/ESPEasy/bl ... eNotes.ino
updated 2hrs ago. SUPERB, didnt you want to freeze R072? :oops: it would have been a shame :P
so i will pull now and report, GREAT work, really :D

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

Re: PN532 with NodeMCU 3 not working

#20 Post by tozett » 28 Jan 2016, 20:13

i flashed R073 to an ESP12e.
the same before, which run stable somehow. some breadboard, same arduino environment 1.6.5, same libraries from R048 as before.
i had 2-3, once 5 readings, than garbish in the serial monitor. board stuck.
i did a reset over the esp reset-pin. same again...
i had log-level 6 (enough?)
something that i can check/test?

Code: Select all

hcp client start...
ip:192.168.14.44,mask:255.255.255.0,gw:192.168.14.236
WIFI : Connected!
INIT : I2C
PN532: Found chip PN532 FW: 1.6
INIT : Boot OK
INIT : Normal boot
NTP  : NTP sync requested
NTP  : NTP send to 192.53.103.108
NTP  : No reply
WD   : Uptime 0 ConnectFailures 0 FreeMem 26064
PN532: poll count: 96
PN532: Tag: 2227488915 1
HTTP : connecting to 192.168.14.235
HTTP : connection failed
PN532: Tag: 2227488915 2
HTTP : Delay 1000 ms
HTTP : connecting to 192.168.14.235
HTTP : connection failed
PN532: Tag: 2227488915 3
HTTP : connecting to 192.168.14.235
HTTP : connection failed
PN532: Tag: 2227488915 4
HTTP : Delay 1000 ms
HTTP : connecting to 192.168.14.235
HTTP : connection failed
---------------
connected with wifi, channel 1
dhcp client start...
ip:192.168.14.44,mask:255.255.255.0,gw:192.168.14.236
WIFI : Connected!
INIT : I2C
PN532: Found chip PN532 FW: 1.6
INIT : Boot OK
INIT : Normal boot
NTP  : NTP sync requested
NTP  : NTP send to 192.53.103.108
NTP  : NTP replied!
WD   : Uptime 0 ConnectFailures 0 FreeMem 26144
PN532: poll count: 99
WD   : Uptime 1 ConnectFailures 0 FreeMem 26128
PN532: poll count: 199
PN532: Tag: 2227488915 1
HTTP : connecting to 192.168.14.235
HTTP : connection failed
PN532: Tag: 2227488915 2
HTTP : Delay 1000 ms
HTTP : connecting to 192.168.14.235
HTTP : connection failed
PN532: poll count: 0 sda: 0 scl: 1
-----
IFI : Connected!
INIT : I2C
PN532: Found chip PN532 FW: 1.6
INIT : Boot OK
INIT : Normal boot
NTP  : NTP sync requested
NTP  : NTP send to 192.53.103.108
NTP  : No reply
FLASH: Settings saved
FLASH: Settings saved
FLASH: Settings saved
FLASH: Settings saved
WD   : Uptime 0 ConnectFailures 0 FreeMem 26048
PN532: poll count: 93
Upload start esp.css
Upload end
FLASH: Settings saved
FLASH: Settings saved
WD   : Uptime 1 ConnectFailures 0 FreeMem 25968
PN532: poll count: 189
PN532: Tag: 2227488915 1
HTTP : connecting to 192.168.14.235
HTTP : connection failed
PN532: Tag: 2227488915 2
HTTP : Delay 1000 ms
HTTP : connecting to 192.168.14.235
HTTP : connection failed
PN532: Tag: 2227488915 3
HTTP : connecting to 192.168.14.235
HTTP : connection failed
PN532: Tag: 2227488915 4
HTTP : Delay 1000 ms
HTTP : connecting to 192.168.14.235
HTTP : connection faile

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

Re: PN532 with NodeMCU 3 not working

#21 Post by tozett » 28 Jan 2016, 20:21

this is my hardware
(sorry only 1 imag attachable, and file was too large with 283k, i reduces size and colors....)
Attachments
nfc-all.png
nfc-all.png (70.19 KiB) Viewed 39014 times

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

Re: PN532 with NodeMCU 3 not working

#22 Post by tozett » 28 Jan 2016, 20:24

i power all with a breadboard power supply, which gots hot after some minutes.
it has an "ams1117" regulator, and google said, this is normal.
i suspect the powersupply to cause some disfunctions/reboots/unstable behavior... have to change it soon..

Martinus

Re: PN532 with NodeMCU 3 not working

#23 Post by Martinus » 29 Jan 2016, 08:48

tozett wrote:... didnt you want to freeze R072?
You are right, new feature development is on hold.
But the work on the existing PN532 plugin is considered "bugfixing".
If it doesn't work, we should not publish it anymore.

Martinus

Re: PN532 with NodeMCU 3 not working

#24 Post by Martinus » 29 Jan 2016, 09:53

tozett wrote: ... i had 2-3, once 5 readings, than garbish in the serial monitor. board stuck ...
I've never seen this behaviour with the PN532 plugin. The ESP may lose communication with the PN532 module but the ESP nevers quits like this.
This means that propably other issues occur in your setup, maybe hardware related.



I have a device very similar to yours:
PN532.png
PN532.png (239.29 KiB) Viewed 39008 times
In my testlab it's still running fine after two days.

1) Did you connect 10k pull-up resistors on the SDA and SCL lines ? My board does not have these build-in so I had to add those to the setup.

2) Could you check the results if you hook up a GPIO pin to the PN532 reset pin and configure this in the ESP webgui ?

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

Re: PN532 with NodeMCU 3 not working

#25 Post by tozett » 29 Jan 2016, 19:12

i have some different pn532-boards in use. most of them are running since month in uart-mode at some raspberry pi's and with libnfc and libnfc-daemon to open some doors. without any hassle.

this was my first try with sda/scl-connections. i cannot see on the board, if pullups are integrated, so i will try to put one between sda and 3.3 and another one between SCL and 3.3 on the breadboard in my unchanged setting with the esp12. and solder/connect the reset-pin...

i have found another board, where i also can not see if pullups are on the board, so i will test this with R073 afterwards, with+without pullups, to see how it goes.. i will report ...
Attachments
nfc.png
nfc.png (164.33 KiB) Viewed 39000 times

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

Re: PN532 with NodeMCU 3 not working

#26 Post by tozett » 29 Jan 2016, 19:53

the same as before, R073, pullups on SDA+SCL to 3.3V, powersupply from breadboard-powersupply,
i can make 1-3 readings: board hangs...
(without-rest-pin... i will try next..)

Code: Select all

Jan 29 19:51:56 ESP Unit: 0 : WIFI : Connected!
Jan 29 19:51:56 ESP Unit: 0 : INIT : I2C
Jan 29 19:51:56 ESP Unit: 0 : PN532: Found chip PN532 FW: 1.6
Jan 29 19:51:56 ESP Unit: 0 : UDP  : Send Sysinfo message
Jan 29 19:51:57 ESP Unit: 0 : INIT : Boot OK
Jan 29 19:51:57 ESP Unit: 0 : INIT : Cold Boot
Jan 29 19:51:57 ESP Unit: 0 : NTP  : NTP sync requested
Jan 29 19:51:57 ESP Unit: 0 : NTP  : NTP send to 192.53.103.108
Jan 29 19:51:57 ESP Unit: 0 : NTP  : NTP replied!
Jan 29 19:52:00 ESP Unit: 0 : PN532: Tag: 2227488915 1
Jan 29 19:52:00 ESP Unit: 0 : HTTP : connecting to 192.168.14.235
Jan 29 19:52:00 ESP Unit: 0 : HTTP : connection failed
Jan 29 19:52:02 ESP Unit: 0 : PN532: Tag: 2227488915 2
Jan 29 19:52:02 ESP Unit: 0 : HTTP : connecting to 192.168.14.235
Jan 29 19:52:02 ESP Unit: 0 : HTTP : connection failed
Jan 29 19:52:02 ESP Unit: 0 : PN532: Tag: 2227488915 3
Jan 29 19:52:02 ESP Unit: 0 : HTTP : Delay 1000 ms
Jan 29 19:52:03 ESP Unit: 0 : HTTP : connecting to 192.168.14.235
Jan 29 19:52:03 ESP Unit: 0 : HTTP : connection failed
Jan 29 19:52:04 ESP Unit: 0 : PN532: Tag: 2227488915 4
Jan 29 19:52:04 ESP Unit: 0 : HTTP : Delay 1000 ms

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

Re: PN532 with NodeMCU 3 not working

#27 Post by tozett » 29 Jan 2016, 20:03

same as before (without reset-pin of pn532),
but with other board ... (the red one)
i got 6 readings ...
on this board, the reset-pin is named RSTPD_N,
on the blue-board, it is named: RSTPDN
these are the ones?

Code: Select all

Jan 29 19:55:58 ESP Unit: 0 : WIFI : Connected!
Jan 29 19:55:58 ESP Unit: 0 : INIT : I2C
Jan 29 19:55:58 ESP Unit: 0 : PN532: Found chip PN532 FW: 1.6
Jan 29 19:55:58 ESP Unit: 0 : UDP  : Send Sysinfo message
Jan 29 19:55:59 ESP Unit: 0 : INIT : Boot OK
Jan 29 19:55:59 ESP Unit: 0 : INIT : Cold Boot
Jan 29 19:55:59 ESP Unit: 0 : NTP  : NTP sync requested
Jan 29 19:55:59 ESP Unit: 0 : NTP  : NTP send to 192.53.103.108
Jan 29 19:55:59 ESP Unit: 0 : NTP  : NTP replied!
Jan 29 19:56:11 ESP Unit: 0 : PN532: Tag: 2227488915 1
Jan 29 19:56:11 ESP Unit: 0 : HTTP : connecting to 192.168.14.235
Jan 29 19:56:11 ESP Unit: 0 : HTTP : connection failed
Jan 29 19:56:12 ESP Unit: 0 : PN532: Tag: 2227488915 2
Jan 29 19:56:12 ESP Unit: 0 : HTTP : Delay 1000 ms
Jan 29 19:56:13 ESP Unit: 0 : HTTP : connecting to 192.168.14.235
Jan 29 19:56:13 ESP Unit: 0 : HTTP : connection failed
Jan 29 19:56:14 ESP Unit: 0 : PN532: Tag: 2227488915 3
Jan 29 19:56:14 ESP Unit: 0 : HTTP : connecting to 192.168.14.235
Jan 29 19:56:14 ESP Unit: 0 : HTTP : connection failed
Jan 29 19:56:15 ESP Unit: 0 : PN532: Tag: 2227488915 4
Jan 29 19:56:15 ESP Unit: 0 : HTTP : Delay 1000 ms
Jan 29 19:56:16 ESP Unit: 0 : HTTP : connecting to 192.168.14.235
Jan 29 19:56:16 ESP Unit: 0 : HTTP : connection failed
Jan 29 19:56:17 ESP Unit: 0 : PN532: Tag: 2227488915 5
Jan 29 19:56:17 ESP Unit: 0 : HTTP : connecting to 192.168.14.235
Jan 29 19:56:17 ESP Unit: 0 : HTTP : connection failed
Jan 29 19:56:17 ESP Unit: 0 : PN532: Tag: 2227488915 6
Jan 29 19:56:17 ESP Unit: 0 : HTTP : Delay 1000 ms

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

Re: PN532 with NodeMCU 3 not working

#28 Post by tozett » 29 Jan 2016, 20:04

i checked github.. still R073 ...
:mrgreen:

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

Re: PN532 with NodeMCU 3 not working

#29 Post by tozett » 29 Jan 2016, 20:41

i got 31 readings, than stuck....
(without reset-pin connected)

i exchanged my breadboard powersupply with the same model,
than i thought i killed the esp, because the 3.3v rail was jumpered to 5v.
in this assumption, i disconnected the other esp12 (wich was not connected to power, but ground and two gpios)
than it worked until 31 readings..stuck

Code: Select all

Jan 29 20:18:23 ESP Unit: 0 : HTTP : connecting to 192.168.14.235
Jan 29 20:18:23 ESP Unit: 0 : HTTP : connection failed
Jan 29 20:18:24 ESP Unit: 0 : PN532: Tag: 2227488915 27
Jan 29 20:18:24 ESP Unit: 0 : HTTP : Delay 1000 ms
Jan 29 20:18:25 ESP Unit: 0 : HTTP : connecting to 192.168.14.235
Jan 29 20:18:25 ESP Unit: 0 : HTTP : connection failed
Jan 29 20:18:26 ESP Unit: 0 : PN532: Tag: 2227488915 28
Jan 29 20:18:26 ESP Unit: 0 : HTTP : Delay 1000 ms
Jan 29 20:18:27 ESP Unit: 0 : HTTP : connecting to 192.168.14.235
Jan 29 20:18:27 ESP Unit: 0 : HTTP : connection failed
Jan 29 20:18:27 ESP Unit: 0 : PN532: Tag: 2227488915 29
Jan 29 20:18:27 ESP Unit: 0 : HTTP : Delay 1000 ms
Jan 29 20:18:28 ESP Unit: 0 : HTTP : connecting to 192.168.14.235
Jan 29 20:18:28 ESP Unit: 0 : HTTP : connection failed
Jan 29 20:18:30 ESP Unit: 0 : PN532: Tag: 2227488915 30
Jan 29 20:18:30 ESP Unit: 0 : HTTP : connecting to 192.168.14.235
Jan 29 20:18:30 ESP Unit: 0 : HTTP : connection failed
Jan 29 20:18:30 ESP Unit: 0 : PN532: Tag: 2227488915 31
Jan 29 20:18:30 ESP Unit: 0 : HTTP : Delay 1000 ms
Jan 29 20:18:31 ESP Unit: 0 : HTTP : connecting to 192.168.14.235
Jan 29 20:18:31 ESP Unit: 0 : HTTP : connection failed

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

Re: PN532 with NodeMCU 3 not working

#30 Post by tozett » 29 Jan 2016, 20:46

this was the hardware settings, as the second esp was still connected to breadboard..
Attachments
nfc-red.png
nfc-red.png (137.23 KiB) Viewed 38987 times

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

Re: PN532 with NodeMCU 3 not working

#31 Post by tozett » 29 Jan 2016, 20:49

than without...more readings, but after a certain amount: stuck...hmmm
higher log-level?
Attachments
nfc-red2.png
nfc-red2.png (167.39 KiB) Viewed 39257 times

r_255
Normal user
Posts: 32
Joined: 20 Nov 2015, 20:42

Re: PN532 with NodeMCU 3 not working

#32 Post by r_255 » 29 Jan 2016, 20:51

Motivated by the new release i did give it a try....

1st readings work great, but then again i do have the same board as Martinus.
Running this from a 5v nodemcu dev v1.0 powered by usb from a pc.

Will keep on trying thru the evening and post back with stability report

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

Re: PN532 with NodeMCU 3 not working

#33 Post by tozett » 29 Jan 2016, 21:18

Thumb up! i am not alone ....
:D

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

Re: PN532 with NodeMCU 3 not working

#34 Post by tozett » 29 Jan 2016, 21:34

42 minutes uptime, still running?
(resetpin on GPIO13 to pn532)

as the pn532 was first not recoginzed in the i2c scan, i striped the ground-wire to power it off/on 3-4 times...
it was not recognized..but after some minutes it came by himself to live...and lives now for at least 42 minutes...hmmm
esp and pn532 running, i can get consecutive readings without hangs...

log-level 6 has not that detail-level it could have...but 8-)

edit: too fast.. i was too fast. right after the posting, i could see led flashing while the tag is over the reader, but nothing apeared in the logs..
than after some minutes, i saw the reset of the pn532 and the reading started again working. a secret reset....

Code: Select all

Jan 29 21:35:54 ESP Unit: 0 : WD   : Uptime 47 ConnectFailures 10 FreeMem 25480
Jan 29 21:35:54 ESP Unit: 0 : UDP  : Send Sysinfo message
Jan 29 21:35:54 raspberry-nfc rsyslogd-2007: action 'action 77' suspended, next retry is Fri Jan 29 21:37:24 2016 [try http://www.rsyslog.com/e/2007 ]
Jan 29 21:35:58 ESP Unit: 0 : PN532: Found chip PN532 FW: 1.6
^C
root@raspberry-nfc:~# tail -f /var/log/syslog
Jan 29 21:34:24 ESP Unit: 0 : UDP  : Send Sysinfo message

Jan 29 21:34:54 ESP Unit: 0 : WD   : Uptime 46 ConnectFailures 10 FreeMem 25480
Jan 29 21:34:54 ESP Unit: 0 : UDP  : Send Sysinfo message
Jan 29 21:35:24 ESP Unit: 0 : WD   : Uptime 46 ConnectFailures 10 FreeMem 25480
Jan 29 21:35:24 ESP Unit: 0 : UDP  : Send Sysinfo message
Jan 29 21:35:54 ESP Unit: 0 : WD   : Uptime 47 ConnectFailures 10 FreeMem 25480
Jan 29 21:35:54 ESP Unit: 0 : UDP  : Send Sysinfo message
Jan 29 21:35:58 ESP Unit: 0 : PN532: Found chip PN532 FW: 1.6
Jan 29 21:36:15 ESP Unit: 0 : PN532: Tag: 2227488915 37
Jan 29 21:36:15 ESP Unit: 0 : HTTP : connecting to 192.168.14.253
Jan 29 21:36:15 ESP Unit: 0 : /esp01?device=sw13?device=rfid1&param=rfid&value=2227489024.00
Jan 29 21:36:15 ESP Unit: 0 : HTTP : closing connection
Jan 29 21:36:15 ESP Unit: 0 : PN532: Tag: 2227488915 38

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

Re: PN532 with NodeMCU 3 not working

#35 Post by tozett » 30 Jan 2016, 08:50

720 min uptime, than two readings, than reset of pn532 via resetpin-gpio connection..

Code: Select all

43226508 : PN532: Tag: 2227488915 63
43226510 : HTTP : connecting to 192.168.14.253
43228017 : HTTP : connection failed
43228281 : PN532: Tag: 2227488915 64
43228282 : HTTP : Delay 1000 ms
43229284 : HTTP : connecting to 192.168.14.253
43230892 : HTTP : connection failed
43247495 : WD : Uptime 720 ConnectFailures 2 FreeMem 25480
43247495 : UDP : Send Sysinfo message
43250313 : PN532: Found chip PN532 FW: 1.6

r_255
Normal user
Posts: 32
Joined: 20 Nov 2015, 20:42

Re: PN532 with NodeMCU 3 not working

#36 Post by r_255 » 30 Jan 2016, 09:25

Sorry to say, but here its been running all night without any issues. Did remove power several times but it comes up every reboot.


if i see your log it says it cant connect to the ip adress

43226510 : HTTP : connecting to 192.168.14.253
43228017 : HTTP : connection failed
43228281 : PN532: Tag: 2227488915 64
43228282 : HTTP : Delay 1000 ms
43229284 : HTTP : connecting to 192.168.14.253
43230892 : HTTP : connection failed[/u][/u]
43247495 : WD : Uptime 720 ConnectFailures 2 FreeMem 25480
43247495 : UDP : Send Sysinfo message

and this one in your syslog :
Jan 29 21:35:24 ESP Unit: 0 : WD : Uptime 46 ConnectFailures 10 FreeMem 25480

vs mine :

WD : Uptime 664 ConnectFailures 0 FreeMem 25856
PN532: poll count: 131594

I would check your connection as there might be an issue.
not sure on how espeasy firmware behaves when connection is lost... but you could try to see what happens if you disconnect your esp from wifi ?

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

Re: PN532 with NodeMCU 3 not working

#37 Post by tozett » 30 Jan 2016, 09:56

720 min uptime was superb...
the connection errors happend because the http receiving port was wrong, i changed this as i noticed.
ESP runs and runs, but after 720 min and two readings only the PN532 was reset.
it than runs further. the resettime was only around 1 minute.
i look into the details, because im am testing if i can make the ESP a door-lock like my stable running raspberry-Pi..

Code: Select all

 PN532: Tag: 2227488915 2
Jan 30 09:49:18 ESP Unit: 0 : HTTP : connecting to 192.168.14.253
Jan 30 09:49:18 ESP Unit: 0 : /esp01?device=sw13?device=rfid1&param=rfid&value=2227489024.00
Jan 30 09:49:18 ESP Unit: 0 : HTTP : closing connection
Jan 30 09:49:19 ESP Unit: 0 : PN532: Tag: 2227488915 3
Jan 30 09:49:19 ESP Unit: 0 : HTTP : Delay 1000 ms
Jan 30 09:49:19 ESP Unit: 0 : HTTP : connecting to 192.168.14.253
Jan 30 09:49:19 ESP Unit: 0 : /esp01?device=sw13?device=rfid1&param=rfid&value=2227489024.00
The TAG-ID is different in the LOG than on the HTTP-send string. looks like data-type/rounding error..??
Maybe this can be the same? or configurable?

--------------code with color
Jan 30 09:49:18 ESP Unit: 0 : /esp01?device=sw13?device=rfid1&param=rfid&value=2227489024.00
Jan 30 09:49:19 ESP Unit: 0 : PN532: Tag: 2227488915 3
--------------/code

Martinus

Re: PN532 with NodeMCU 3 not working

#38 Post by Martinus » 30 Jan 2016, 10:32

tozett wrote:The TAG-ID is different in the LOG than on the HTTP-send string. looks like data-type/rounding error..??
You're right about this. This was a specific bug for the generic HTTP controller that internally still parsed a long value as a float, loosing precision.
It's fixed in R74

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

Re: PN532 with NodeMCU 3 not working

#39 Post by tozett » 31 Jan 2016, 08:34

i am now on R074
BUG (2): a (wrong) Carriage-Return in Log of Http-Request. still in?

my observation:
- now long uptimes, but if i start a new reading after a long uptime, the PN532 gets resetted via the GPIO pin...
- something wrong with the initialisation? i startet with a cold reboot, than the i2c scan showed nothing. while still running the ESP12, i cold rebooted the PN532 through swithing off/on the GND-wire for a short moment. after that the i2c scan found the module an everting worked for long uptimes..

Code: Select all

39567804 : WD : Uptime 658 ConnectFailures 0 FreeMem 25464
39567804 : UDP : Send Sysinfo message
39570890 : PN532: Found chip PN532 FW: 1.6
39571162 : PN532: Tag: 2227488915 27
39571165 : HTTP : connecting to 192.168.14.253
39571227 : /esp01?device=sw13?device=rfid1¶m=rfid&value=2227488915
39571440 : HTTP : closing connection
39597805 : WD : Uptime 659 ConnectFailures 0 FreeMem 25464
39597805 : UDP : Send Sysinfo message

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

Re: PN532 with NodeMCU 3 not working

#40 Post by tozett » 31 Jan 2016, 08:52

R074, Uptime 697 min...
i did some readings, than the PN532 vanished...
i2c scanned gave me errors, module was gone and not found (like after the very first cold reboot)
SORRY: my mistake. i saw it now: the resetpin on the PN532-module was not connected anymore. it jumped off somehow.
i fixed this an will do some more testing again..., but it doesnt seem to work stable without the reset-gpio wire...
Attachments
nfc-bug.png
nfc-bug.png (74.78 KiB) Viewed 39213 times

Martinus

Re: PN532 with NodeMCU 3 not working

#41 Post by Martinus » 31 Jan 2016, 11:18

If one of the variables used has special characters, it would lead to issues. I've added URLEncode to the variable substitution to solve this.

And since the PN532 reset action was quite aggressive, I changed the threshold for the basic communication errors. For me this is difficult to test, because I hardly have these errors on my unit. But it could help.

Available in R75

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

Re: PN532 with NodeMCU 3 not working

#42 Post by tozett » 31 Jan 2016, 11:31

Great thank,
i will upgrade...

this is my HTTP/MQTT/Publish-Template:

Code: Select all

esp01?device=sw13?device=%tskname%&param=%valname%&value=%value%
i cannot see any special charater. The Carriage-Return only showed up in the log on the ESP, _not_ in the syslog...

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

Re: PN532 with NodeMCU 3 not working

#43 Post by tozett » 31 Jan 2016, 12:16

i upgraded to R075

do i have to put here in advanced settings something else as default zero (0) in?

Code: Select all

WD I2C Address:	0 
i made a cold boot. pn532 was not found. i did this twice, to be sure. pn532 was only recognized, after i manually powered it off/on through hook off the GND-wire from the pn532-pcb. than the i2c scan showed the device, the log showed the initialization of the pn532
("Jan 31 12:11:14 ESP Unit: 0 : PN532: Found chip PN532 FW: 1.6") an than it is working.

as it was _not_ there after cold-booting, the log showed some info about SDA/SCL up/down...hmmmm

Feature-Request?: on boot, result of the i2c scan in the log. (i have log-level 7 as default now). maybe with a delay?

maybe one has to tweak the initialization/power-on sequenz of the i2c-bus, or the module?...hmmmm
(i have the rest-gpio connection working this time. i checked it seriously...)

Martinus

Re: PN532 with NodeMCU 3 not working

#44 Post by Martinus » 31 Jan 2016, 12:24

tozett wrote:this is my HTTP/MQTT/Publish-Template:

Code: Select all

esp01?device=sw13?device=%tskname%&param=%valname%&value=%value%
Does your template actually work? It looks like your template is malformed. First querystring valuepair starts with "?" and remaining should start with "&"
And you use "device" twice as a valuepair with different values.

Guess that it should be like this:

Code: Select all

esp01?device=%tskname%&param=%valname%&value=%value%
assuming that "esp01" is the webpage that is called? I would expect something like "data.asp" or "data.php" ?

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

Re: PN532 with NodeMCU 3 not working

#45 Post by tozett » 31 Jan 2016, 12:29

Martinus wrote: assuming that "esp01" is the webpage that is called? I would expect something like "data.asp" or "data.php" ?
i send this to my gira-homeserver, where i have to build a parser. there is no really webpage. the parser is build for this string, but i should build it more "normal", i guess..
i wanted to differentiate some more devices on the same port coming in, so i set the device-name static in front.
i would take a variable of the device, if there would be one. would be nice to have all config-fields of the ESP as variables to build such strings...

i can change the string, but the carriage-return followed after the device name. i checked the field, but there was no special character so see in the webgui.

another observation following:
Last edited by tozett on 31 Jan 2016, 12:32, edited 1 time in total.

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

Re: PN532 with NodeMCU 3 not working

#46 Post by tozett » 31 Jan 2016, 12:30

new observation:
i wanted to track down the carriage-return in the log of the http-string, so i changed the device name of the pn532.
i submitted the new name on the webgui of the esp on the device page, and:
the pn532 lost the i2c communication. it was not found anymore with the i2c scan. also powering off/on through the gnd-wire did not help.
only a cold-boot of the esp12. at first it was also not found on the web-page of the i2c scan, but after some seconds i saw in the syslog the initialisation of the module.

maybe something wrong going on on the i2c-bus, if the device settings are saved. initialisation needs optimisatzion....

Code: Select all

Jan 31 12:19:27 ESP Unit: 0 : WD   : Uptime 9 ConnectFailures 0 FreeMem 25568
Jan 31 12:19:27 ESP Unit: 0 : UDP  : Send Sysinfo message
Jan 31 12:19:57 ESP Unit: 0 : WD   : Uptime 9 ConnectFailures 0 FreeMem 25568
Jan 31 12:19:57 ESP Unit: 0 : UDP  : Send Sysinfo message
Jan 31 12:20:27 ESP Unit: 0 : WD   : Uptime 10 ConnectFailures 0 FreeMem 25536
Jan 31 12:20:27 ESP Unit: 0 : UDP  : Send Sysinfo message
Jan 31 12:20:48 192.168.14.52 hostapd: wlan0: STA 18:fe:34:a6:9c:81 IEEE 802.11: authenticated
Jan 31 12:20:48 192.168.14.52 hostapd: wlan0: STA 18:fe:34:a6:9c:81 IEEE 802.11: associated (aid 4)
Jan 31 12:20:48 192.168.14.52 hostapd: wlan0: STA 18:fe:34:a6:9c:81 WPA: pairwise key handshake completed (RSN)
Jan 31 12:20:50 ESP Unit: 0 : WIFI : Connected!
Jan 31 12:20:50 ESP Unit: 0 : INIT : I2C
Jan 31 12:20:50 ESP Unit: 0 : UDP  : Send Sysinfo message
Jan 31 12:20:51 ESP Unit: 0 : INIT : Boot OK
Jan 31 12:20:51 ESP Unit: 0 : INIT : Normal boot
Jan 31 12:20:51 ESP Unit: 0 : NTP  : NTP sync requested
Jan 31 12:20:51 ESP Unit: 0 : NTP  : NTP send to 192.53.103.108
Jan 31 12:20:52 ESP Unit: 0 : NTP  : No reply
Jan 31 12:20:56 ESP Unit: 0 : PN532: Found chip PN532 FW: 1.6
Jan 31 12:21:21 ESP Unit: 0 : WD   : Uptime 0 ConnectFailures 0 FreeMem 26032
Jan 31 12:21:21 ESP Unit: 0 : UDP  : Send Sysinfo message
Jan 31 12:21:51 ESP Unit: 0 : WD   : Uptime 1 ConnectFailures 0 FreeMem 26000
Jan 31 12:21:51 ESP Unit: 0 : UDP  : Send Sysinfo message
Jan 31 12:22:21 ESP Unit: 0 : WD   : Uptime 1 ConnectFailures 0 FreeMem 25968
Jan 31 12:22:21 ESP Unit: 0 : UDP  : Send Sysinfo message
Jan 31 12:22:51 ESP Unit: 0 : WD   : Uptime 2 ConnectFailures 0 FreeMem 25904
Jan 31 12:22:51 ESP Unit: 0 : UDP  : Send Sysinfo message

Martinus

Re: PN532 with NodeMCU 3 not working

#47 Post by Martinus » 31 Jan 2016, 13:00

Better focus on one thing at the time else we're loosing track here. I'd like to fix the boot step and stability issues first.
Could you try R76 that has an init retry added to the PN532 plugin?

In the mean time, I'm automating my "servo tag robot" setup. It now places the tag once every minute and pulls it away after 3 seconds.
Serial logging turned on and we'll see how it goes...

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

Re: PN532 with NodeMCU 3 not working

#48 Post by tozett » 31 Jan 2016, 22:32

ok. i will upgrade and report
:P

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

Re: PN532 with NodeMCU 3 not working

#49 Post by tozett » 01 Feb 2016, 07:44

looks better...
looks to me, as if the pn532 was resetted meanwhile, but it was there from cold-boot on, and the reset was fast, so i only noticed through the logs...
i will now let it collect uptime minutes ...

Code: Select all

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...
ip:192.168.14.44,mask:255.255.255.0,gw:192.168.14.236
WIFI : Connected!
INIT : I2C
Reset Pin low...
Reset Pin high...
PN532: Found chip PN532 FW: 1.6
UDP  : Send Sysinfo message
INIT : Boot OK
INIT : Cold Boot
NTP  : NTP sync requested
NTP  : NTP send to 192.53.103.108
NTP  : NTP replied!
WD   : Uptime 0 ConnectFailures 0 FreeMem 26128
UDP  : Send Sysinfo message
PN532: poll count: 99

Martinus

Re: PN532 with NodeMCU 3 not working

#50 Post by Martinus » 01 Feb 2016, 10:37

With the tag robot in place, it makes testing a lot easier. Yesterday I saw a 5% bus error rate during a 3 hours testing with 180 tag movements and 540 tag reads.
So still some issues left although the system keeps running fine. So i hooked up the Logic analyzer once more and triggered on PN532 reset signal with a 50% pre-trigger capture ratio.
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...

I2C Clock stretching beyond Arduino ESP Core limits.

Just to prove this theory, I decided to patch the ESP core I2C library to allow for up to 1 mSec clock stretching, uploaded the same sketch again and started the tag robot for the next run.

This morning results after approx. 14 hours run:

817 tag movements
2450 tag reads
162140 reader checks
0 bus errors (!)

I rest my case...

Post Reply

Who is online

Users browsing this forum: No registered users and 22 guests