ADAFRUIT NFC + WizFi

For other supported Arduino products from Adafruit: Shields, accessories, etc.

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
laks
 
Posts: 11
Joined: Tue Nov 26, 2013 12:55 am

ADAFRUIT NFC + WizFi

Post by laks »

I have used both the NFC and WizFi Shields, I used Basic server test sketch and read mifare sketch, the moment I connect the server with the PC software the the server did not work and if I test with the ping command i get only reset timeout error, but the NFC cards are reading. If i exclude the NFC card read then the WizFi server works and transfer data from PC

what could be the bug

User avatar
adafruit_support_rick
 
Posts: 35092
Joined: Tue Mar 15, 2011 11:42 am

Re: ADAFRUIT NFC + WizFi

Post by adafruit_support_rick »

Not familiar with WizFI. Do you have to poll it regularly? nfc readPassiveTargetID is a blocking call, so it will prevent you from polling WizFi.

laks
 
Posts: 11
Joined: Tue Nov 26, 2013 12:55 am

Re: ADAFRUIT NFC + WizFi

Post by laks »

thanks let me check and come back

laks
 
Posts: 11
Joined: Tue Nov 26, 2013 12:55 am

Re: ADAFRUIT NFC + WizFi

Post by laks »

Is there any interrupt driven sample code available?

laks
 
Posts: 11
Joined: Tue Nov 26, 2013 12:55 am

Re: ADAFRUIT NFC + WizFi

Post by laks »

I checked the readPassiveTargetID routine in SPI mode looks like that it is not blocking routine ...

Am i right i have copied the routine below for your ref


Code: Select all

***** ISO14443A Commands ******/

/**************************************************************************/
/*! 
    Waits for an ISO14443A target to enter the field
    
    @param  cardBaudRate  Baud rate of the card
    @param  uid           Pointer to the array that will be populated
                          with the card's UID (up to 7 bytes)
    @param  uidLength     Pointer to the variable that will hold the
                          length of the card's UID.
    
    @returns 1 if everything executed properly, 0 for an error
*/
/**************************************************************************/
boolean Adafruit_PN532::readPassiveTargetID(uint8_t cardbaudrate, uint8_t * uid, uint8_t * uidLength) {
  pn532_packetbuffer[0] = PN532_COMMAND_INLISTPASSIVETARGET;
  pn532_packetbuffer[1] = 1;  // max 1 cards at once (we can set this to 2 later)
  pn532_packetbuffer[2] = cardbaudrate;
  
  if (! sendCommandCheckAck(pn532_packetbuffer, 3))
    return 0x0;  // no cards read
  
  // read data packet
  readspidata(pn532_packetbuffer, 20);
  // check some basic stuff

  /* ISO14443A card response should be in the following format:
  
    byte            Description
    -------------   ------------------------------------------
    b0..6           Frame header and preamble
    b7              Tags Found
    b8              Tag Number (only one used in this example)
    b9..10          SENS_RES
    b11             SEL_RES
    b12             NFCID Length
    b13..NFCIDLen   NFCID                                      */
  
#ifdef MIFAREDEBUG
    Serial.print("Found "); Serial.print(pn532_packetbuffer[7], DEC); Serial.println(" tags");
#endif
  if (pn532_packetbuffer[7] != 1) 
    return 0;
    
  uint16_t sens_res = pn532_packetbuffer[9];
  sens_res <<= 8;
  sens_res |= pn532_packetbuffer[10];
#ifdef MIFAREDEBUG
    Serial.print("ATQA: 0x");  Serial.println(sens_res, HEX); 
    Serial.print("SAK: 0x");  Serial.println(pn532_packetbuffer[11], HEX); 
#endif
  
  /* Card appears to be Mifare Classic */
  *uidLength = pn532_packetbuffer[12];
#ifdef MIFAREDEBUG
    Serial.print("UID:"); 
#endif
  for (uint8_t i=0; i < pn532_packetbuffer[12]; i++) 
  {
    uid[i] = pn532_packetbuffer[13+i];
#ifdef MIFAREDEBUG
      Serial.print(" 0x");Serial.print(uid[i], HEX); 
#endif
  }
#ifdef MIFAREDEBUG
    Serial.println();
#endif

  return 1;
}
Last edited by adafruit_support_rick on Sat Dec 13, 2014 10:08 am, edited 1 time in total.
Reason: please use Code tags when posting code (</> button)

User avatar
adafruit_support_rick
 
Posts: 35092
Joined: Tue Mar 15, 2011 11:42 am

Re: ADAFRUIT NFC + WizFi

Post by adafruit_support_rick »

Code: Select all

  if (! sendCommandCheckAck(pn532_packetbuffer, 3))
This call defaults to a 1 second timeout. That is, it blocks for 1000ms each time it is called. You can shorten the blocking time by passing the optional third parameter, like this:

Code: Select all

  if (! sendCommandCheckAck(pn532_packetbuffer, 3, 10))
Don't pass it a 0 - that is an infinite timeout. Pass it a 1 if you want it to return immediately

laks
 
Posts: 11
Joined: Tue Nov 26, 2013 12:55 am

Re: ADAFRUIT NFC + WizFi

Post by laks »

I have made the corrections still the WizFi wireless shield is getting disconnected the moment i give a connect command from PC Client software
But the Mifare card reading is working perfectly ...
till i give the CONNECT command I am able to read the card as well as able to get responses for the PING command from PC

laks
 
Posts: 11
Joined: Tue Nov 26, 2013 12:55 am

Re: ADAFRUIT NFC + WizFi

Post by laks »

Sorry I made the corrections in Sketch folder but library folder also has this file so when I changed as per your suggestion it works now
Thank you very much for the timely help

User avatar
adafruit_support_rick
 
Posts: 35092
Joined: Tue Mar 15, 2011 11:42 am

Re: ADAFRUIT NFC + WizFi

Post by adafruit_support_rick »

Great!

laks
 
Posts: 11
Joined: Tue Nov 26, 2013 12:55 am

Re: ADAFRUIT NFC + WizFi

Post by laks »

The WizFi and NFC shield are working fine as long as the serial port is open. Once I disconnect the connection / physically remove the serial cable, the NFC shield stops working. I am required to reset the board for the NFC to start working.

What could be the bug here?

User avatar
adafruit_support_rick
 
Posts: 35092
Joined: Tue Mar 15, 2011 11:42 am

Re: ADAFRUIT NFC + WizFi

Post by adafruit_support_rick »

I don't think I'm following - what serial cable? I thought you had two shields stacked?
Could you post a picture of your setup?

laks
 
Posts: 11
Joined: Tue Nov 26, 2013 12:55 am

Re: ADAFRUIT NFC + WizFi

Post by laks »

It is the USB cable from Mega board to PC
I call it as serial cable .... serial port

User avatar
adafruit_support_rick
 
Posts: 35092
Joined: Tue Mar 15, 2011 11:42 am

Re: ADAFRUIT NFC + WizFi

Post by adafruit_support_rick »

Oh, OK. So you have the Mega connected to both external power from the barrel jack, and to USB, right? And when you pull the USB, the system hangs? Then if you reset it with the USB cable unplugged, the system works again?
What external power supply are you using? How many volts?

laks
 
Posts: 11
Joined: Tue Nov 26, 2013 12:55 am

Re: ADAFRUIT NFC + WizFi

Post by laks »

Yes you are right ... external supply 12V .. when USB cable is unplugged the card reading hangs ... only when USB is plugged the card reading works.. the external power supply can supply more than 2 A

User avatar
adafruit_support_rick
 
Posts: 35092
Joined: Tue Mar 15, 2011 11:42 am

Re: ADAFRUIT NFC + WizFi

Post by adafruit_support_rick »

I can't think of anything that would cause that except possibly a bad external power supply, or a bad voltage regulator on your Mega. Do you have a different supply you can try?

Locked
Please be positive and constructive with your questions and comments.

Return to “Other Arduino products from Adafruit”