MKR1000 with GroveNFC on I2C

Hi all,
I am very new to Arduino and I am trying to connect a Grove NFC (PN532 on I2C) to the MKR1000 wifi. I have soldered the jumpers P1 - P3 to I2C, SCL and SDA respectively.
I have tried the sample code provided by seeed but i'm getting compile errors about softwareserial.h. I understand this is something to do with using digital pins and creating a software serial port - which I don't need.
I can't seem to find sample code for the MKR with the grove NFC.
Would someone be kind enough to provide a working sample code so that I can try to figure it out?
Thank you!

patciantar:
I have tried the sample code provided by seeed

Please post a link to where you got the code.

pert:
Please post a link to where you got the code.

Code is here: Grove - NFC | Seeed Studio Wiki
In the section "play with seeduino (I2C)"
Since I posted I got the NFC reader to work on an Arduino UNO but not yet on the MKR. My understanding so far is that the issue is the processor type, the MKR having hardware I2C.
Is there a way I can configure the grove libraries (also in the link) to be able to work on the MKR?
Thank you :slight_smile:

Hi @patciantar. Sorry for the delay responding. I have investigated the issue and found the solution. However, it will require making a simple modification to the "Seeed_Arduino_NFC" library. In order for me to provide you with exact instructions for that fix, it will be helpful for me to see the exact text of the error message you're getting.
Please do this:

  • When you encounter an error, you'll see a button on the right side of the orange bar "Copy error messages" in the Arduino IDE (or the icon that looks like two pieces of paper at the top right corner of the black console window in the Arduino Web Editor). Click that button..
  • In a forum reply here, click on the reply field.
  • Click the </> button on the forum toolbar. This will add the forum's code tags markup to your reply.
  • Press "Ctrl + V". This will paste the error between the code tags.
  • Move the cursor outside of the code tags before you add any additional text to your reply.

If the text exceeds the forum's 9000 character limit, save it to a .txt file and post it as an attachment. If you click the "Reply" button here, you will see an "Attachments and other settings" link that will allow you to make the attachment.


patciantar:
My understanding so far is that the issue is the processor type, the MKR having hardware I2C.

No. It has nothing to do with I2C. The issue is purely the poor design of the Seeed_Arduino_NFC library.

Hi @Pert,

Thank you for getting back to me!

Here is the error message below as requested:

Arduino: 1.8.13 (Windows 10), Board: "Arduino MKR1000"





















In file included from C:\Users\Patrick\Documents\Arduino\libraries\Seeed_Arduino_NFC-master\src\PN532\PN532_SWHSU\PN532_SWHSU.cpp:2:0:

C:\Users\Patrick\Documents\Arduino\libraries\Seeed_Arduino_NFC-master\src/PN532/PN532_SWHSU/PN532_SWHSU.h:5:10: fatal error: SoftwareSerial.h: No such file or directory

 #include <SoftwareSerial.h>

          ^~~~~~~~~~~~~~~~~~

compilation terminated.

Multiple libraries were found for "NfcAdapter.h"

 Used: C:\Users\Patrick\Documents\Arduino\libraries\Seeed_Arduino_NFC-master

 Not used: C:\Program Files (x86)\Arduino\libraries\Seeed_Arduino_NFC-master

exit status 1

Error compiling for board Arduino MKR1000.



This report would have more information with
"Show verbose output during compilation"
option enabled in File -> Preferences.

Attached is the message with the verbose output enabled.

Thank you again for taking your time to help me :slight_smile:

ERROR.txt (37.7 KB)

OK. So the fix is to delet this folder:

C:\Users\Patrick\Documents\Arduino\libraries\Seeed_Arduino_NFC-master\src\PN532\PN532_SWHSU

After that, you should be able to compile the sketch for the MKR1000 without getting this error.

You probably noticed that this library allows you to chose which communication interfaces to use with the PN532 (hardware serial, software serial, I2C, SPI). The problem is that all the code for all the communication interfaces are compiled even though you're only using one of them. So it breaks if the board you're compiling for doesn't have a SoftwareSerial library even when you don't even need SoftwareSerial. Fortunately, the fix is simple: we only needed to delete the problematic unused part of the library.

Great I’ll give this a shot later on as I’m no longer at my laptop!

Yes I noticed it allows to choose the Interface, in fact I had started stripping down the code but the error kept showing up.

I have no experience with libraries so I didn’t know how to touch those to disable the software serial.

Thank you so much for your help. I will keep you updated!

Just a quick update - IT HAS COMPILED!! But unfortunately I don't have the board with me so I will have to try it on Monday or Tuesday :frowning:

Thank you so much for your help!

You're welcome. I'm glad if I was able to be of assistance. Enjoy!
Per

@pert it worked :slight_smile:

Thank you! Now to find RFID tags which are NDEF because it seems like the ones I bought aren't :sob:

This topic was automatically closed 120 days after the last reply. New replies are no longer allowed.