Shop OBEX P1 Docs P2 Docs Learn Events
Parallax Card Reader Woes — Parallax Forums

Parallax Card Reader Woes

MorrolanMorrolan Posts: 98
edited 2010-10-17 09:45 in BASIC Stamp
Hi all,

I'm using a slightly modified version of the demo code that came with the ISCSC4442 (256 byte) card. The only thing I've really added is the ability to read the card and see ASCII values - in order to do this I had to "restrict" the characters shown as command characters were causing clear-screens etc, so it only shows characters between 20 - 127.

As the code is quite large (only just short of filling the EEPROM) I have chosen to attach the entire code, and I will just quote the bit I am having trouble with.

What I'm experiencing is irregularities with the authentication of the cards - I have left the PSC set to the default value of $FFFFFF as the authentication is not a feature I need to implement so I haven't touched it.

However what I experience is that I don't get consistent numbers of tries - if I disconnect the power and reconnect sometimes it appears to reset, sometimes it says the card is locked, sometimes it says I have 2 tries remaining? This was all experienced on one single card.

I have read the following http://forums.parallax.com/showthread.php?t=124363&highlight=smart+card and have made the corrections to the comparison (replacing $ with % and adding the %000 line) but I still get irregular readings from the card.
  command = UpdateSecurity                      ' Updates error counter if PSC is invalid
  address = 0
   IF(errCounter = %000) THEN dat = %011
   IF(errCounter = %111) THEN dat = %011
   IF(errCounter = %011) THEN dat = $001
   IF(errCounter = %001) THEN dat = $000
  GOSUB Send_Command
  GOSUB Process

However I notice further down that there is a subroutine to "replace" UpdateSecurity and seems to reset the error counter - is it simply a case of commenting out the above and uncommenting the one below?
'   Command = UpdateSecurity                                ' Erase Error Counter
'   Address = $00
'   Dat = $07                                               ' If password match then the counter restore
'   GOSUB Send_Command
'   GOSUB Process

I also had little the same results that came in the demo code for the card from the product page of item 32321.

Please can someone point me in the right direction, as the documentation for the card doesn't really go into much detail about how the PSC works?

Many Thanks,
Morrolan

Comments

  • jzhongjzhong Posts: 1
    edited 2010-10-17 09:45
    Hi Morrolan,

    I want to let you know the ErrCounter can always be read. You can read it before Authorization. So, there's no need to add this " IF(errCounter = %000) THEN dat = %011" into the code.
      command = UpdateSecurity                      ' Updates error counter if PSC is invalid
      address = 0
      ' IF(errCounter = %000) THEN dat = %011
       IF(errCounter = %111) THEN dat = %011
       IF(errCounter = %011) THEN dat = %001
       IF(errCounter = %001) THEN dat = %000
      GOSUB Send_Command
      GOSUB Process
    


    I don't recommend you comment the code. Otherwise even thought you got the right PSC code, you will have your card locked after run the Authorization Compare(Even Successfully Authorization) three times .
Sign In or Register to comment.