9 Replies Latest reply on Oct 20, 2016 3:22 AM by antran

    RFID RC522 won’t read tag on Edison

    GaelP

      Hello,


      I’m porting one of my projects from Galileo to the Edison platform.


      Everything works perfect with the Galileo Gen 2, but doesn’t work with the Edison (+ Arduino breakout board).


      I use a very common NFC reader (RFID RC522) which uses the SPI interface. This is a 3,3v module. I use the same wiring with Galileo and Edison.

      300px-RFID-RC522_RF_IC_Card_Sensor_Module_203517.jpg

       

      I get no errors when compiling the sketch in the Arduino IDE, but nothing happens when I launch the sketch and put a tag in front of the reader.


      I tried with 2 different Edison boards and 2 Galileos.

      100% working on Galileo, 0% on Edison.


      Is there anything to do to make it work ?


      Thanks,

      Gael

        • 1. Re: RFID RC522 won’t read tag on Edison
          CMata_Intel

          Hi GaelP;

           

          Make sure you are using the Voltage Reference as you need in 3.3V, take a look at this document to verify this. Also, Which libraries are you using in the sketch?

           

          Regards;

          CMata

          • 2. Re: RFID RC522 won’t read tag on Edison
            GaelP

            Thank you Cmata for the advice,

             

            I already tried to change the jumpers in order to get 3,3V but it doesn't solve the problem.

             

            I'm using this library : https://github.com/miguelbalboa/rfid

            The example sketch (dumpInfo) doesn't show any information from the NFC tag.

             

            Does the SPI bus work identical between Galileo and Edison ?

             

            Gael

            • 3. Re: RFID RC522 won’t read tag on Edison
              CMata_Intel

              Hi GaelP

               

              If the question is related to..Is SPI working in the Edison Board? Yes, it works you can run the examples on the IDE and will work.

              When you upload your sketch using the Galileo and Edison (make sure you are selecting the right board on tools), Do you obtain the same result in the log?

              Transfer complete….

              I think it is related to the libraries that Galileo and Edison use (are different), there could be some differences that is causing the problem because the library that you are using is for Arduino and not for these boards. I will take a look at the libraries in the IDE and let you know what is the outcome of it.

               

              Regards;

              CMata

              • 4. Re: RFID RC522 won’t read tag on Edison
                GaelP

                Hi Cmata_Intel,

                 

                The right board is selected, and the transfer is complete.

                 

                The serial monitor displays : "Scan PICC to see UID and type..."

                 

                The program seems to be stuck in this while loop  :

                 

                <code>

                i = 2000;

                     while (1) {

                          n = PCD_ReadRegister(ComIrqReg);     // ComIrqReg[7..0] bits are: Set1 TxIRq RxIRq IdleIRq   HiAlertIRq LoAlertIRq ErrIRq TimerIRq

                 

                          if (n & waitIRq) {                         // One of the interrupts that signal success has been set.

                               break;

                          }

                          if (n & 0x01) {                              // Timer interrupt - nothing received in 25ms

                               return STATUS_TIMEOUT;

                          }

                          if (--i == 0) {                              // The emergency break. If all other condions fail we will eventually terminate on this one after 35.7ms. Communication with the MFRC522 might be down.

                               return STATUS_TIMEOUT;

                          }

                     

                     }

                </code>

                 

                which calls this function :

                 

                <code>

                /**

                * Reads a byte from the specified register in the MFRC522 chip.

                * The interface is described in the datasheet section 8.1.2.

                */

                byte MFRC522::PCD_ReadRegister(     byte reg     ///< The register to read from. One of the PCD_Register enums.

                                                        ) {

                   

                     byte value;

                     digitalWrite(_chipSelectPin, LOW);               // Select slave

                 

                     SPI.transfer(0x80 | (reg & 0x7E));               // MSB == 1 is for reading. LSB is not used in address. Datasheet section 8.1.2.3.

                 

                     value = SPI.transfer(0);                         // Read the value back. Send 0 to stop reading.

                 

                     digitalWrite(_chipSelectPin, HIGH);               // Release slave again

                     return value;

                } // End PCD_ReadRegister()


                </code>

                • 5. Re: RFID RC522 won’t read tag on Edison
                  GaelP

                  Any idea ?

                  • 6. Re: RFID RC522 won’t read tag on Edison
                    CMata_Intel

                    Hi GaelP;

                     

                    I'm checking the MFRC522, SPI, Arduino and trace libraries for Edison and Galileo in order to detect what is the issue. It could be related to the frequency that SPI is using. Here are a couple of useful threads.

                    Sources for /dev/spidev5.1 and what it calls

                    Trouble performing SPI read.

                    I will do a couple of tests with the MFRC522 lib but I don't have the RFID RC522 that you are using, even though I will try to post here new advances or suggestions for you as soon as possible.

                     

                    Regards;

                    CMata

                    • 7. Re: RFID RC522 won’t read tag on Edison
                      GaelP

                      I found this article concerning the SPI bus frequencies between Galileo and Edison (with Arduino Breakout Board) :

                      Porting SPI code from (Intel) Galileo to Edison - Arduino - Electrical Engineering Stack Exchange

                      • 8. Re: RFID RC522 won’t read tag on Edison
                        CMata_Intel

                        Hi GaelP I haven't found an error in the libraries that could be causing this. As I said the SPI library work fine but we are missing something with this other one (MFRC522) . Have you tried using a pull down resistor in the MOSI? As you know Edison and Galileo have different hardware structures so it could be needed for your RFID - Edison. Also, have you tried to read the signals that you are sending with the Galileo and the Edison in order to see what are the differences? Just like the link that you put above

                         

                        Regards;

                        CMata

                        • 9. Re: RFID RC522 won’t read tag on Edison
                          antran

                          i also have the same problem, i can't solve. have you solved this problem ?