RFID Tag Problems

I have been testing a basic program where I present a RFID tag and it displays the ID number. For most RFID tags it works as expected. But I have one set of tags that works a few times but then causes it to crash when presenting the tag. I have tested the set on a windows based reader and it works fine every time.


  • karlprescott,

    Is this a Parallax reader and are you using Parallax tags?
    Are the working and failing tags that same part number?

    Also, post your code.
  • I’m using the parallax rfid reader serial. The tags are some I have purchased from eBay. They are all passive tags.
  • karlprescottkarlprescott Posts: 15
    edited 2018-08-28 - 14:39:00
      _clkmode = xtal1 + pll16x
      _xinfreq = 5_000_000
      CLK_FREQ = ((_clkmode - xtal1) >> 6) * _xinfreq
      MS_001   = CLK_FREQ / 1_000
      TX_PIN        = 0                                   'Display Port
      BAUD          = 19_200
      RFID_RX = 17                                                  ' RFID on PAB
      RFID_EN = 16
      servoPin = 10                              ' Servo signal to this I/O pin-change if needed  
      #1, HOME, GOTOXY, #8, BKSP, TAB, LF, CLREOL, CLRDN, CR, #14, GOTOX, GOTOY, #16, CLS      ' PST formmatting control
      LAST_TAG = 3                                                  ' tag #s are 0..LAST_TAG    
      term : "FullDuplexSerial.spin" 
      rfid : "FullDuplexSerialPlus.spin" 
      byte  teststr[32]                                             ' string buffer
      byte  tagbuf[10]                                              ' tag buffer  
    pub main | idx, b
      setup                                                         ' start program objects
      'term.start(TX_PIN, TX_PIN, %1000, BAUD)   ' start LCD terminal
      'rfid.start(RFID_RX, RFID_RX, %1100, 2400)             ' open-drain serial for RFID
        term.str(string(12," Wait Ball:", CR))
        accept_tag(@tagbuf)                                         ' wait for tag
        term.str(string(12," ID "))
        term.str(@Tags[tidx]                                     ' get hub address of tag being tested
        repeat bidx from 0 to 9                                     ' loop through bytes in tag
          if (byte[p_buf][bidx] <> byte[p_check][bidx])             ' if byte mismatch
            quit                                                    ' abort this tag
        if (bidx == 10)                                             ' if all bytes matched
          return tidx                                               ' return this tag id
      return -1                                                     ' return not found
    pub pause(ms) | t
      t := cnt - 1088                                               ' sync with system counter
      repeat (ms #> 0)
        waitcnt(t += MS_001)                                        ' delay 1ms (syncronized)
    pub high(pin)
    '' Makes pin output and high
      outa[pin] := 1
      dira[pin] := 1
    pub low(pin)
    '' Makes pin output and low
      outa[pin] := 0
      dira[pin] := 1
    pub toggle(pin)
    '' Toggles pin state
      dira[pin] := 1
    pub input(pin)
    '' Makes pin input and returns current state
      dira[pin] := 0
      return ina[pin]
    dat { tags data }
      Tag0        byte      "7A00219388"
      Tag1        byte      "7A00216BC1"
      Tag2        byte      "7A00216CAE"
      Tag3        byte      "7A0021A6E3"          
      Tags        word      @Tag0, @Tag1, @Tag2, @Tag3
      Name0       byte      "PINK", 0
      Name1       byte      "ORANGE", 0
      Name2       byte      "BLUE", 0
      Name3       byte      "YELLOW", 0
      Names       word      @Name0, @Name1, @Name2, @Name3        

    ModEdit: Code tags added.
  • The black tags cause problems after a few scans. The keyring one works everytime
    2016 x 1512 - 635K
  • Huh. A lot of that code looks suspiciously like... mine! Anyway, I've updated the way that I handle tags; instead of character-by-character comparison, I store the tags as proper strings and use strcomp. Updated demo is attached. See you you fare with it.
    Jon McPhalen
    Hollywood, CA
    It's Jon or JonnyMac -- please do not call me Jonny.
  • Karl,
    Post your code between code tags see "C" in posting header... B I U C etc.
  • karlprescott,

    Parallax makes high quality products that are rarely faulty but you never know what you will get from ebay.
    Did the seller claim all the tags were from Parallax?
  • Jonny Mac. Some code is your samples you posted. They helped me lots when I was working on a smart card project.

    Aren’t tags just tags? Can you not use any rfid tag with a parallax reader?
  • Infernal Machine
  • JonnyMacJonnyMac Posts: 6,180
    edited 2018-09-01 - 16:27:18
    Aren’t tags just tags? Can you not use any rfid tag with a parallax reader?
    My employer rents a loft in an upscale apartment complex for us to work off-site. It uses RFID keys -- and we only have one. We looked them up and they are listed as 125kHz -- the same as the Parallax reader. Still, we couldn't read the key because there is a secondary protection scheme embedded in it. We had to take the social engineering route to get spares without incurring the $150 per-key charge.

    Jon McPhalen
    Hollywood, CA
    It's Jon or JonnyMac -- please do not call me Jonny.
Sign In or Register to comment.