Sonsivri
 
*
Welcome, Guest. Please login or register.
Did you miss your activation email?
December 05, 2016, 07:32:58 19:32


Login with username, password and session length


Pages: [1]
Print
Author Topic: RFID and ... interrupts ?  (Read 1145 times)
0 Members and 1 Guest are viewing this topic.
orpheedulogis
Junior Member
**
Offline Offline

Posts: 61

Thank You
-Given: 9
-Receive: 1


« on: October 11, 2015, 11:45:01 11:45 »

Hi all

Here, mys question is about what to choose -if it exist- to have a low price IC to read RFID.
But I already began to read tags (here with RC522) and my problem is that I dont't want to lost time reading SPI !!
So I want a chip who would be abble to scan everytime and, when it read tags,  it would send an interrupt to microcontroler.

Is it possible ?

Thanks for help
Logged
crunx
Junior Member
**
Offline Offline

Posts: 49

Thank You
-Given: 8
-Receive: 7



« Reply #1 on: October 11, 2015, 02:35:07 14:35 »

If you look the data sheet of NXPs MFRC522 chip, it can work with SPI, I2C and UART modes. So you are not restricted to SPI. It has also interrupt pin, called IRQ, which would be just what you need for interrupting the processor.

Of course there are many other chips with similar functionality. NXP has a lot, and for example Atmel has some. Which chip is right for you depends on your application and other requirements. Note also, that "RFID" is not just one single standard nor using just one frequency, so you should check what works with which type of tags. MFRC522 is not necessarily the cheapest one, but seems to be quite flexible.

You may use for example DigiKey's or some other distributor's such as Mouser, Farnell etc. search engine to find the chips. That helps comparing prices, too.

In the end: Is your project a hobby project, a small series of a product, or a major industrial design project? That may be a factor, as in very small volumes some modules might be easier to integrate instead of "loose" chips. In larger quantity, chips are cheaper, but require more design work.
« Last Edit: October 11, 2015, 02:43:23 14:43 by crunx » Logged
orpheedulogis
Junior Member
**
Offline Offline

Posts: 61

Thank You
-Given: 9
-Receive: 1


« Reply #2 on: October 11, 2015, 06:39:08 18:39 »

My problem is that I can't see how to use interruption with this RC522 module and I'm not alone ;-)
Logged
crunx
Junior Member
**
Offline Offline

Posts: 49

Thank You
-Given: 8
-Receive: 7



« Reply #3 on: October 11, 2015, 07:25:32 19:25 »

OK, I understand no the problem better. At least I think so...
I checked the data sheet of MFRC522 chip, and the interrupt sources are listed there. That seems to include a lot of reasons, but no "wake-up" for automated attempt of reading, and then giving an interrupt when a tag is present.

Another issue may be that there seems to be no interrupt line in the socket of Arduino Uno? I am not too familiar with all flavors of Arduino, but have worked a lot with embedded systems with sensors. I would consider lack of an interrupt line a major flaw, needing a quick fix, even with a wire patch, if necessary.
Logged
pablo2048
Active Member
***
Offline Offline

Posts: 103

Thank You
-Given: 96
-Receive: 82


« Reply #4 on: October 11, 2015, 07:40:47 19:40 »

AFAIK in case of RC522A you have to wait for presence of the card in field, then you have to select card and after that you can read data from card. Also I suggest You to study this link http://arduino.stackexchange.com/questions/9656/using-interrrupts-with-rc522 ...
Logged
crunx
Junior Member
**
Offline Offline

Posts: 49

Thank You
-Given: 8
-Receive: 7



« Reply #5 on: October 11, 2015, 07:54:27 19:54 »

As you for sure know, detecting a passive RFID tag requires the host side active part first to send a signal to activate the passive side's power, and to poll the tag to generate a response from it.

Looking at the underlying chip: I couldn't see any way one could just automagically poll for finding a possibly present tag. Therefore the only way is that the host every now and then (e.g. a few times/second) activates the sender and attempts a read. When using that method the interrupts from chip may be useful, as they can be generated from various sources such as a timer (to trigger the sending attempt) and from status changes and FiFo data present (to avoid waiting loop while hoping for an answer.)

Not too elegant, and a bit power consuming. However, should work.

BTW could this discussion be of help: https://community.particle.io/t/getting-the-rfid-rc522-to-work-solved/3571/3
« Last Edit: October 11, 2015, 08:12:49 20:12 by crunx » Logged
pablo2048
Active Member
***
Offline Offline

Posts: 103

Thank You
-Given: 96
-Receive: 82


« Reply #6 on: October 12, 2015, 06:26:54 06:26 »

Indeed, but there is really no need to poll SPI every time - just set IdleIrq bit and let the interrupt driver handle the rest. I'm using this with FSM inside interrupt and it works...
Logged
orpheedulogis
Junior Member
**
Offline Offline

Posts: 61

Thank You
-Given: 9
-Receive: 1


« Reply #7 on: October 12, 2015, 07:24:49 07:24 »

Ok , thanks a lot.

I'm not using arduino but self made board with STM32 and I have two extern interrupts I can use: one for touch display, one for RFID (if RFID interrupt works !) so I just looking for how to set up RC522 interrupt.
I choose RC522 because of (very) low price boards.
Looking at you links now...

OK

I tried this:

      MFRC522_Init();
      delay_ms(100);
      Write_MFRC522(CommIrqReg,0x80);  // clear interrupt
      Write_MFRC522(CommIEnReg ,0x7F); //enable interrupt
      Write_MFRC522(DivIrqReg ,0x14);     // I tried 0x04, 0x94, 0x84 too

I add clear interrupt in my STM32 interrupt too

But no interrupt appear when I put a tag in front of module antenna ! (I put a logic analyser on IRQ)
« Last Edit: October 12, 2015, 08:54:08 08:54 by orpheedulogis » Logged
pablo2048
Active Member
***
Offline Offline

Posts: 103

Thank You
-Given: 96
-Receive: 82


« Reply #8 on: October 13, 2015, 09:09:16 09:09 »

You have to send any command after this (for start just send Noop - it comes from my mind, i'm not by my PC) and after MFRC goes to idle then IRQ is invoked... One more thing - IMHO "Write_MFRC522(CommIrqReg,0x80);  // clear interrupt" doesn't clear any interrupt - see Table 30 Symbol Set1 ...
« Last Edit: October 13, 2015, 09:41:40 09:41 by pablo2048 » Logged
orpheedulogis
Junior Member
**
Offline Offline

Posts: 61

Thank You
-Given: 9
-Receive: 1


« Reply #9 on: October 13, 2015, 10:35:14 10:35 »

Hi pablo


For line

 Write_MFRC522(CommIrqReg,0x80);

I tried 0x10 or 0xFF without any change ! (here my soft read the tag in a loop but there is no any tag interrupt)
May be I don't understand what you mean.

Also, one question more:
I found RC522 module is too large so it will cause a bad look when I will make the smallest box to put in.
It would be great if I was able to draw an antenna PCB arround the 2.8'' touch display. Do you think it's possible ?
  

« Last Edit: October 13, 2015, 10:40:36 10:40 by orpheedulogis » Logged
pablo2048
Active Member
***
Offline Offline

Posts: 103

Thank You
-Given: 96
-Receive: 82


« Reply #10 on: October 13, 2015, 11:39:19 11:39 »

You got me wrong - there is no simple interrupt when card is in range. What I describe to You is way to create interrupt driven driver for MFRC522. You have to follow command flow from polled (Arduino) driver and write down the used sequence and convert it to STM32 interrupt driven approach (by FSM as i mentioned for example).
I have no experience about antenna design - I just wrote driver for reader which give me our HW department. Sorry...
Logged
orpheedulogis
Junior Member
**
Offline Offline

Posts: 61

Thank You
-Given: 9
-Receive: 1


« Reply #11 on: October 13, 2015, 02:34:48 14:34 »

No problem Pablo  Wink
Actually I decided to look for tag only every second and it works correctly.
Thanks

Logged
Pages: [1]
Print
Jump to:  


DISCLAIMER
WE DONT HOST ANY ILLEGAL FILES ON THE SERVER
USE CONTACT US TO REPORT ILLEGAL FILES
ADMINISTRATORS CANNOT BE HELD RESPONSIBLE FOR USERS POSTS AND LINKS

... Copyright 2003-2999 Sonsivri.to ...
Powered by SMF 1.1.18 | SMF © 2006-2009, Simple Machines LLC | HarzeM Dilber MC