NFC module (PN532) not working

Posted on
  • Hello guys
    I've set my module to use I2C and using following example:

    I2C1.setup({scl:22, sda:21,});
    var nfc = require("PN532").connect(I2C1);
    print(nfc.getVersion());
    nfc.SAMConfig(); // start listening
    setInterval(function() {
     nfc.findCards(function(card) {
      print("Found card "+card);
      card = JSON.stringify(card);
      var leds = [LED1,LED2,LED3];
      if (card=="[147,239,211,128]") digitalWrite(leds,1);
      if (card=="[249,192,235,164]") digitalWrite(leds,2);
      if (card=="[4,99,129,114,72,52,128]") digitalWrite(leds,4);
     });
    }, 1000);
    

    And I got I2C errors:

     ____                 _
    |  __|___ ___ ___ _ _|_|___ ___
    |  __|_ -| . |  _| | | |   | . |
    |____|___|  _|_| |___|_|_|_|___|
             |_| espruino.com
     2v01 (c) 2018 G.Williams
    Espruino is Open Source. Our work is supported
    only by sales of official boards and donations:
    http://espruino.com/Donate
    >
    WARNING: Scan stop failed
    WARNING: set rssi scan not implemeted yet
    WARNING: jshI2CSetup: driver installed, sda: 21 sdl: 22 freq: 1000000,
    ERROR: jshI2CWrite:, slave doesn't ACK the transfer.
    ERROR: jshI2CRead:, Operation timeout because the bus is busy.
    ERROR: jshI2CRead:, Operation timeout because the bus is busy.
    {
      "chip": "PN51c",
      "firmware": "232.254",
      "support": 63 }
    ERROR: jshI2CWrite:, Operation timeout because the bus is busy.
    ERROR: jshI2CRead:, Operation timeout because the bus is busy.
    ERROR: jshI2CRead:, Operation timeout because the bus is busy.
    

    Any ideas why basic example does not work? Using ESP32 module.

  • Seems like v197 will work with PN532. But not in v198. Only change what I found is here:
    https://github.com/espruino/Espruino/com­mit/3739ee577d3bc11064b63db61942ac9910da­0e3a

    @Gordon can you figure out why PN532 does not work in newer versions?

  • Can you try : I2C1.setup({scl:22, sda:21, bitrate:50000});?

    And which board is this on? It looks suspiciously like an ESP8266/32?

  • Post a reply
    • Bold
    • Italics
    • Link
    • Image
    • List
    • Quote
    • code
    • Preview
About

NFC module (PN532) not working

Posted by Avatar for markopraakli @markopraakli

Actions