Shop OBEX P1 Docs P2 Docs Learn Events
RFID and the SX — Parallax Forums

RFID and the SX

Jared WoolstonJared Woolston Posts: 36
edited 2007-07-18 17:09 in General Discussion
I am attempting to get an RFID reader module to work properly and am afraid I cannot do it. My code is heavily based on the RFID_Security sample code on the web site here: http://www.parallax.com/dl/src/prod/RFID_Security.SXB and it will only work in debug mode. I dont have to watch any variables or anything, just be in debug mode. Using the original code with pin numbers changed to fit my application results in the same thing. I do not have an LCD so I just made that an unused pin when using the original code. The enable pin is RC.0 and the SOUT pin of the RFID module is RC.1. From watching the light on the RFID reader it appears the SX chip isnt getting the right data stream from the module and deciding the card is bad after the first few bytes. Any help would greatly be appreciated.

Thanks
Jared

Post Edited (Jared Woolston) : 7/16/2007 7:26:23 PM GMT

Comments

  • Jared WoolstonJared Woolston Posts: 36
    edited 2007-07-16 19:25
    By the way, my appologies for initially neglecting the subject line...it slipped past me.
  • Sparks-R-FunSparks-R-Fun Posts: 388
    edited 2007-07-16 22:10
    I will probably not be able to help you with RFID problems but what do you mean when you say it will only work in Debug Mode? Nothing much should change between the Debug Mode and the Program Mode except maybe your clock source. Are you using an external clock?

    - Sparks
  • Jared WoolstonJared Woolston Posts: 36
    edited 2007-07-16 23:35
    in debug mode the code reads the tag and opens the lock. however , in standalone the code appears to decide halfway through that the card is not valid (judging from the relative length of time before the rfid reader is reinitialized, i dont know for certain). the code is straight from the website, all i changed are pin numbers. the oscillator is internal 4mhz.
  • Sparks-R-FunSparks-R-Fun Posts: 388
    edited 2007-07-17 00:49
    Ok. I highly suspect that your application requires a much more accurate clock signal than the one that is internally generated by the SX itself. You are probably going to need to use an external 4MHz resonator. If you do not have one you *MIGHT* be able to get away with adding a “IRC_CAL IRC_4MHZ” statement while you wait for one to arrive. I really do think you need an external clock source from the problem description you gave even if the IRC_CAL statement gets it to work temporarily.

    I hope this helps.

    - Sparks
  • Jared WoolstonJared Woolston Posts: 36
    edited 2007-07-17 01:04
    thanks for the tip. i myself suspected a timing related issue because the code is only problematic on the serial com part. ill just plug in some crystal. power isnt an issue so ill clock it at whatever ive got. i tried using irc_cal but imnot very familiar with it. when programming it said calibrating then it stopped and never rewrote the eeprom. i wont make it my fix but so that i know for sure, how is it used?
  • Sparks-R-FunSparks-R-Fun Posts: 388
    edited 2007-07-17 01:54
    There are some internal fuses in the SX that can be configured to slightly tweak the timing of its internal RC clock generator. You can set these fuses manually or let the computer choose the best settings with the “IRC_CAL IRC_4MHZ” statement. The RC clock generator is not highly accurate and is known to fluctuate with changes in chip temperature. So what works one moment may not work so well as the chip heats up or if the weather turns cold, etc. I have used the internal clock generator for several projects so please do not think it is useless. But if timing is critical, as is the case for asynchronous serial communications, you will want to use something a lot more accurate.

    It sounds like it tried to adjust the fuses and got stuck unexpectedly. It might be worth another attempt but it would really only serve as a Band-Aid solution.

    - Sparks
  • Jared WoolstonJared Woolston Posts: 36
    edited 2007-07-18 01:00
    hey sparks,

    Just wanted to let you know I plugged in a 50MHz resonator i had lying around and retimed the program and it worked immediately. thanks for the help, its been a while since ive used the sx and i completely forgot about the unreliability of the internal oscillator.

    Jared
  • Sparks-R-FunSparks-R-Fun Posts: 388
    edited 2007-07-18 17:09
    I am glad you were able to get it working!

    Thanks for the update.


    - Sparks
Sign In or Register to comment.