Connect with us

Mutiple clients with one Microcontroller unit

Discussion in 'Microcontrollers, Programming and IoT' started by NS2012, Dec 21, 2012.

Scroll to continue with content
  1. NS2012

    NS2012

    10
    0
    Dec 17, 2012
    Hi,
    I need your help please.
    I'm working on a project where I Microcontroller must accommodate to requests from multiple sources. Lets say there are multiple clients need to process some logic and the controller is supposed to provide that service before returning the result to the respective caller.

    I need to ensure that one client at a time can have access to the controller service. If another client calls at the same time, I need the logic to ignore the new call until the previous one is accommodated. I came up with a complex logic circuit which seams like an overkill and need to avoid some racing conditions. I'm using 8051 as an MC and Serial communication using RS232.

    Your help is very appreciated. Cheers
     
  2. KrisBlueNZ

    KrisBlueNZ Sadly passed away in 2015

    8,393
    1,271
    Nov 28, 2011
    That's a very vague specification. From your attitude in that post, I'm assuming you don't want to tell us much about the application. This is a problem because it wastes everyone's time. So if you would describe the overall application, that would help a lot. Otherwise, please give us some basic information such as number of clients, data rate, typical message size, typical message frequency.

    If you have multiple clients communicating through multiple async serial paths, you will either need a UART (serial transmitter/receiver) for each client, or some kind of retry mechanism in the protocol, because your 8051 will not be able to monitor multiple serial streams, unless the bit rate is very low and UARTs can be implemented in software.

    8051s are available with several UARTs, but not more than 4 AFAIK. You can add external UARTs if you have an external address and data bus, or you can use the Maxim MAX3108 which has a 128-byte FIFO and is addressed through I2C or SPI to give you more serial ports.

    As I said, a thorough description of the project would help a lot. Also you could post your design, because it will also contain clues about your requirements.
     
  3. NS2012

    NS2012

    10
    0
    Dec 17, 2012
    Hi Kris,
    Thanks for the reply. My intention was not to hide the applications purpose. Just not to confuse anyone with possible assumptions.

    Basically I have multiple RFID readers for access control. I have designed a circuit so every reader will have its own microcontroller to do the authentication and authorization. Due to the size of the data needed (additional memory requirements) and the need to re-program each unit everytime I want to add or delete an authorized users (or other maintenance purposes), I am thinking of centerlizing the authentication/authorization process to one controller only which all the readers can call to. I'm using RS485 as a communication protocol.

    Any suggetions regarding any part or the choice of Microcontroller are also appreicated.
    Thanks!
     
  4. KrisBlueNZ

    KrisBlueNZ Sadly passed away in 2015

    8,393
    1,271
    Nov 28, 2011
    I see. Thanks for explaining the application; it makes a big difference.

    So you have an 8051 "slave" connected to each RFID reader, and you want to use RS-485 to communicate between the central processor and the slave processors?

    Are the slave processors physically distant from each other?

    I think you'll need to use a round-robin polling arrangement. The central device polls each of the slave microcontrollers in turn, and the slave microcontroller responds with a message that means "nothing to report", or a message containing data from its connected RFID reader.

    The central controller either validates the information immediately and replies to that slave micro before continuing to the next, or queues the request and replies later, depending on how long it will take to validate the request.

    Each slave will have to be addressed independently and you'll have to ensure that the polling loop runs fast enough to get around all of them in an acceptable amount of time.

    Another approach might be to use an SPI connection to the slave devices instead of RS-485 and chain the devices together so data is shifted through them all like a long shift register. I haven't done this before; it's just a vague thought. Probably not workable if the slaves are at separate locations.

    How many slaves do you expect to have? Minimum, typical, and maximum?

    How much memory do you need in the central processor? What microcontroller families are you familiar with, or have you been considering?

    How much data needs to be transferred from a slave to the central micro and vice versa on each authorisation?

    What is the required time scale for the authorisation process?
     
  5. NS2012

    NS2012

    10
    0
    Dec 17, 2012
    I like the central MC connected to the slave units idea. By keeping the MCs, it will be easier to control the potential inturrptions from the different readers.

    The readers will be between 3m and 30m apart, and there will be around 10 of them. The central prcessor will need around 32KB of memory. I am using AT89S51. I'm expecting 5 bytes to go to the master and 1 byte back to each slave. The authorization should be done within less than half a second.
     
  6. KrisBlueNZ

    KrisBlueNZ Sadly passed away in 2015

    8,393
    1,271
    Nov 28, 2011
    OK. RS-485 is a multi-drop bus. This means that every device on the bus will see every transmission. So you will need to design your protocol so that each device on the bus can identify messages that relate to it, and ignore messages that don't. This means that messages must include an address. Since there is only one master, the address can always be the slave micro's address, for messages in both directions.

    Some kind of message framing is also needed, so devices can determine when a new message is starting, and when a message is finished. Some kind of checksum is also a good idea, so the receiving end can check that the message has not been corrrupted.

    Luckily for you, I have a lot of experience with multi-drop RS-485 communication of this type - it was used extensively by the company I used to work for. So I can give you some very specific suggestions.

    This is probably best done through some kind of instant messaging system. I will send you a PM with some contact information.
     
  7. NS2012

    NS2012

    10
    0
    Dec 17, 2012
    I received your PM. i'm trying to reply since it needs to verify iM over 15 (which i am). I'll get back to u. Soon, thx
     
  8. NS2012

    NS2012

    10
    0
    Dec 17, 2012
    Hi Kris,
    Sorry I didn't get back to you earlier, first it was the holidays then the project was changed. Now no longer want to connect the readers to a central controller. But rather each reader will be standalone with its controller.

    BTW, I was mistaken........I skimmed through the message when it prevented me from replying to your PM and I thought it is complaining about age verification,but I just re-read it when I tried to reply back to your post and it is complaining the I only have 7 posts, and I can only PM after posting 15 of them......LOL. For now seems I'm not going with the 485 protocol.But thanks for the help.
     
Ask a Question
Want to reply to this thread or ask your own question?
You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.
Electronics Point Logo
Continue to site
Quote of the day

-