Start reading when gpi pin goes high

Questions about using and running the Rifidi Edge Server

Moderators: Matt, kyle

Post Reply
sailormacg
Posts: 3
Joined: Sun Nov 01, 2009 9:46 am
Organization: GTRI

Start reading when gpi pin goes high

Post by sailormacg » Sun Nov 01, 2009 10:05 am

Im new to LLRP and was looking at possibly starting an rfid read when a pin on the gpio port goes high. Looking through the llrp api i came up with two methods of doing this.

Method 1.
SET_READER_CONFIG Message
Enable GPI Port pin

GET_READER_CONFIG Message
Query the input pin

This method would require constant polling:(

Method 2.
Although im not yet sure how to do this but it could look like:
Enable gpi port pin
Create ReaderEventNotification which could either start a read or send notification to my midleware which would send a start read message as response.

I was wondering if i am thinking about this problem correctly, and if im not could someone please point me in the correct direction. Im new to llrp development and would greatly appreciate any advice i may get.

Regards.

Also im wondering if its possible to set a gpo port high. and what typical voltage would a "high" state measure??? how would i do this

kyle
Posts: 220
Joined: Tue Apr 22, 2008 10:12 pm
Name: Kyle
Organization: Pramari
Location: Hartford, CT
Contact:

Re: Start reading when gpi pin goes high

Post by kyle » Sun Nov 01, 2009 8:21 pm

Hi,
First, let me tell you that I moved this post to the Edge Server forums since it did not relate directly to the Designer product. Secondly, I just wanted to share a related product that will make your life as an LLRP developer much easier: LLRPCommander from the Fosstrak project. It allows you to easily form LLRP messages and send them to an LLRP reader (such as the Rifidi virtual reader).

As far as the GPI question goes: You can solve this problem by using the ROBoundarySpec parameter (see section 10.2.1.1). The ROBoundarySpec allows you to specify when a ROSpec starts and stops. In LLRP, reports are always sent back to the server whenever a ROSpec stops. In order to start reading whenever a GPI happens, set the ROSpecStartTriggerType (in the ROSpecStartTrigger Parameter) to 3 (GPI) and specify the GPITriggerValue. This will allow you to start a rospec when a certain GPI goes either to high or to low.

Next you need to think about how to stop the ROSpec so that you will get a report back. There are two possibilities:
1) Use a timer (for example, the ROSpec stops 500 ms after the GPI event started the trigger)
2) Use another GPI event. (for example, the ROspec stops after GPI line 2 goes low)

This stopping information can be specified in the ROSpecStopTrigger parameter. I hope this helps. Please let me know if you have any further questions about this.

With the Rifidi LLRP reader you can change the value of the GPI states in the GPIO view in the emulator product. Checking the box next to the GPI line indicates that you are turning the GPI line to the high state. I have no knowledge of what typical voltages are.
-Kyle

sailormacg
Posts: 3
Joined: Sun Nov 01, 2009 9:46 am
Organization: GTRI

Re: Start reading when gpi pin goes high

Post by sailormacg » Sat Nov 07, 2009 8:52 am

Thanks alot for your input Kyle.
In the mean time requirements have changed. Something like this
Antenna 4 needs to be constantly reading, and all antennae read for a period when gpio goes high.
i have done it something like this:
config reader to scan on antenna 4
implement polling of gpi(periodically send a get_reader_config message)
config reader to scan on all antenna
start timer for all antenna read
after timeout reconfig to scan on antenna 4

It works which is good but im not sure if i need the constant polling ie periodically sending get_reader_config message
Maybe i could implement the same functionality without the pollig by using llrp???

Your thoughts would be greatly appreciated.

sailormacg
Posts: 3
Joined: Sun Nov 01, 2009 9:46 am
Organization: GTRI

Re: Start reading when gpi pin goes high

Post by sailormacg » Sat Nov 07, 2009 8:54 am

Oh and also thanks for the heads up about llrp commander... making my life so much easier:)

kyle
Posts: 220
Joined: Tue Apr 22, 2008 10:12 pm
Name: Kyle
Organization: Pramari
Location: Hartford, CT
Contact:

Re: Start reading when gpi pin goes high

Post by kyle » Tue Nov 10, 2009 6:30 pm

I'm not sure, but you may be able to solve this problem using two ROSpecs: one ROSpec that will read from antenna 4, and one that starts reading based on GPIO events. The second one could preempt the first (see section 6.1 of the spec). However, you won't be able to test this using the Rifidi LLRP reader because it does not support preemtion.

desaivv
Posts: 3
Joined: Sat May 08, 2010 4:29 am
Organization: Esfera & Aster

Re: Start reading when gpi pin goes high

Post by desaivv » Tue May 25, 2010 2:05 am

Hi,

I apologize if this is the wrong section. I saw this topic already open so am posting here.

I am trying to get tag reads when a GPI input changes state. I am using or trying to use the method specified by kyle. I use SET_READER_CONFIG to set the GPI pin of interest. I then try adding an ROSpec. But I am getting an error message saying "LLRP [837] : GPI 2, event 0 already assigned".

I am using an Impinj Speedway Revolution LLRP reader. When I try using Rifidi, everything seems fine, I get no error messages. But is there a way to simulate a GPI event using the Rifidi emulator?

Here is my SET_READER_CONFIG in XML format.

Code: Select all

<?xml version="1.0" encoding="UTF-8"?>
<llrp:SET_READER_CONFIG xmlns:llrp="http://www.llrp.org/ltk/schema/core/encoding/xml/1.0" Version="1" MessageID="0">
  <llrp:ResetToFactoryDefault>0</llrp:ResetToFactoryDefault>
  <llrp:ReaderEventNotificationSpec>
    <llrp:EventNotificationState>
      <llrp:EventType>GPI_Event</llrp:EventType>
      <llrp:NotificationState>1</llrp:NotificationState>
    </llrp:EventNotificationState>
  </llrp:ReaderEventNotificationSpec>
  <llrp:AntennaConfiguration>
    <llrp:AntennaID>4</llrp:AntennaID>
    <llrp:RFReceiver>
      <llrp:ReceiverSensitivity>31</llrp:ReceiverSensitivity>
    </llrp:RFReceiver>
    <llrp:RFTransmitter>
      <llrp:HopTableID>1</llrp:HopTableID>
      <llrp:ChannelIndex>1</llrp:ChannelIndex>
      <llrp:TransmitPower>61</llrp:TransmitPower>
    </llrp:RFTransmitter>
    <llrp:C1G2InventoryCommand>
      <llrp:TagInventoryStateAware>1</llrp:TagInventoryStateAware>
      <llrp:C1G2RFControl>
        <llrp:ModeIndex>2</llrp:ModeIndex>
        <llrp:Tari>0</llrp:Tari>
      </llrp:C1G2RFControl>
      <llrp:C1G2SingulationControl>
        <llrp:Session>1</llrp:Session>
        <llrp:TagPopulation>0</llrp:TagPopulation>
        <llrp:TagTransitTime>1000</llrp:TagTransitTime>
      </llrp:C1G2SingulationControl>
    </llrp:C1G2InventoryCommand>
  </llrp:AntennaConfiguration>
  <llrp:ROReportSpec>
    <llrp:ROReportTrigger>Upon_N_Tags_Or_End_Of_ROSpec</llrp:ROReportTrigger>
    <llrp:N>0</llrp:N>
    <llrp:TagReportContentSelector>
      <llrp:EnableROSpecID>0</llrp:EnableROSpecID>
      <llrp:EnableSpecIndex>1</llrp:EnableSpecIndex>
      <llrp:EnableInventoryParameterSpecID>1</llrp:EnableInventoryParameterSpecID>
      <llrp:EnableAntennaID>1</llrp:EnableAntennaID>
      <llrp:EnableChannelIndex>1</llrp:EnableChannelIndex>
      <llrp:EnablePeakRSSI>1</llrp:EnablePeakRSSI>
      <llrp:EnableFirstSeenTimestamp>1</llrp:EnableFirstSeenTimestamp>
      <llrp:EnableLastSeenTimestamp>0</llrp:EnableLastSeenTimestamp>
      <llrp:EnableTagSeenCount>1</llrp:EnableTagSeenCount>
      <llrp:EnableAccessSpecID>1</llrp:EnableAccessSpecID>
      <llrp:C1G2EPCMemorySelector>
        <llrp:EnableCRC>0</llrp:EnableCRC>
        <llrp:EnablePCBits>0</llrp:EnablePCBits>
      </llrp:C1G2EPCMemorySelector>
    </llrp:TagReportContentSelector>
  </llrp:ROReportSpec>
  <llrp:GPIPortCurrentState>
    <llrp:GPIPortNum>2</llrp:GPIPortNum>
    <llrp:Config>1</llrp:Config>
    <llrp:State>Low</llrp:State>
  </llrp:GPIPortCurrentState>
</llrp:SET_READER_CONFIG>

Here is my Add_ROSpec in XML format.

Code: Select all

<?xml version="1.0" encoding="UTF-8"?>
<llrp:ADD_ROSPEC xmlns:llrp="http://www.llrp.org/ltk/schema/core/encoding/xml/1.0" Version="1" MessageID="0">
  <llrp:ROSpec>
    <llrp:ROSpecID>132</llrp:ROSpecID>
    <llrp:Priority>0</llrp:Priority>
    <llrp:CurrentState>Disabled</llrp:CurrentState>
    <llrp:ROBoundarySpec>
      <llrp:ROSpecStartTrigger>
        <llrp:ROSpecStartTriggerType>GPI</llrp:ROSpecStartTriggerType>
        <llrp:GPITriggerValue>
          <llrp:GPIPortNum>2</llrp:GPIPortNum>
          <llrp:GPIEvent>1</llrp:GPIEvent>
          <llrp:Timeout>0</llrp:Timeout>
        </llrp:GPITriggerValue>
      </llrp:ROSpecStartTrigger>
      <llrp:ROSpecStopTrigger>
        <llrp:ROSpecStopTriggerType>GPI_With_Timeout</llrp:ROSpecStopTriggerType>
        <llrp:DurationTriggerValue>0</llrp:DurationTriggerValue>
        <llrp:GPITriggerValue>
          <llrp:GPIPortNum>2</llrp:GPIPortNum>
          <llrp:GPIEvent>0</llrp:GPIEvent>
          <llrp:Timeout>1000</llrp:Timeout>
        </llrp:GPITriggerValue>
      </llrp:ROSpecStopTrigger>
    </llrp:ROBoundarySpec>
    <llrp:AISpec>
      <llrp:AntennaIDs>0</llrp:AntennaIDs>
      <llrp:AISpecStopTrigger>
        <llrp:AISpecStopTriggerType>GPI_With_Timeout</llrp:AISpecStopTriggerType>
        <llrp:DurationTrigger>0</llrp:DurationTrigger>
        <llrp:GPITriggerValue>
          <llrp:GPIPortNum>2</llrp:GPIPortNum>
          <llrp:GPIEvent>0</llrp:GPIEvent>
          <llrp:Timeout>10000</llrp:Timeout>
        </llrp:GPITriggerValue>
      </llrp:AISpecStopTrigger>
      <llrp:InventoryParameterSpec>
        <llrp:InventoryParameterSpecID>1</llrp:InventoryParameterSpecID>
        <llrp:ProtocolID>EPCGlobalClass1Gen2</llrp:ProtocolID>
      </llrp:InventoryParameterSpec>
    </llrp:AISpec>
  </llrp:ROSpec>
</llrp:ADD_ROSPEC>

Can someone point me in the right direction.

Thanks.

kyle
Posts: 220
Joined: Tue Apr 22, 2008 10:12 pm
Name: Kyle
Organization: Pramari
Location: Hartford, CT
Contact:

Re: Start reading when gpi pin goes high

Post by kyle » Tue May 25, 2010 9:17 am

But I am getting an error message saying "LLRP [837] : GPI 2, event 0 already assigned".
I think the problem is that you are using GPI 2 for both the ROSpecStopTriggerType and the AISpecStopTriggerType. I would recommend just using a null stop trigger for the ROSpecStopTriggerType, since once the AISpec stops, it will stop the ROSpec. It is probably a mistake that Rifidi Emulator does not send an error message for this case.
But is there a way to simulate a GPI event using the Rifidi emulator
Yes. When you create the reader in Rifidi Emulator, make sure you enable GPI/O functionality. Then, you can open up the GPIO view for the reader by clicking one of the buttons in the toolbar. To simulate a GPI event, just click the corresponding checkbox.

Post Reply

Who is online

Users browsing this forum: No registered users and 4 guests