Shop OBEX P1 Docs P2 Docs Learn Events
Slave I2C or UART ? — Parallax Forums

Slave I2C or UART ?

richaj45richaj45 Posts: 179
edited 2008-10-10 11:49 in General Discussion
Hello:

What would take the minimum resources on an SX: A slave I2C or UART?

I am wondering if i used SX48s as slave controllers what would be the most robust slave interface with the least amount of SX code and ram spave taken up.

rich

Post Edited By Moderator (Bean (Hitt Consulting)) : 10/9/2008 10:30:02 AM GMT

Comments

  • Peter VerkaikPeter Verkaik Posts: 3,956
    edited 2008-10-09 07:54
    Define resources.
    A background uart takes less code than a background I2C slave.
    If you want to minimize cycles, you can split up code into
    several states, which means code size increases but the number
    of cycles inside the isr decreases, although it requires more
    interrupt periods to complete a task.
    So it is a tradeoff between memory and speed, as usual.

    regards peter
  • BeanBean Posts: 8,129
    edited 2008-10-09 10:28
    IMO the UART would be the easiest to implement and use less resources.
    The UART would require a resonator though...

    Bean.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    "It is our choices, Harry, that show what we truly are, far more than our abilities."·Dumbledore from Harry Potter

    www.iElectronicDesigns.com

    ·
  • T&E EngineerT&E Engineer Posts: 1,396
    edited 2008-10-09 11:54
    Let me confirm that the term UART is simply sending (Tx) and / or receiving (Rx) bytes at a certain baud rate between 2 SX chips or devices. Is that correct? I see this all the time on the forum but don't see it refered to as UART so much. Just wanted to be clear. I had to Google UART and get the definition on Wikipedia. I am currently do this on another project with both UART (SX chip Tx to SX chip Rx) and I2C (using an EEPROM). I2C definately uses more programing space from my limited experience with both.
  • JonnyMacJonnyMac Posts: 9,214
    edited 2008-10-09 20:35
    If you want to create a slave go with the UART approach. As others have indicated it's easier to implement. My company (EFX-TEK) makes a bunch of little accessory boards that are all SX-based slaves that use a simple serial protocol.
  • Guenther DaubachGuenther Daubach Posts: 1,321
    edited 2008-10-10 08:48
    To my knowledge, the term UART was initially used for a hardware component - a Universal Asynchronous Receiver and Transmitter. On the SX, you can implement such UART hardware features in software.

    Common to all implementations is that they deal with asynchronous communications, i.e. there is no separate clock signal, like in I2C, SPI and other serial protocols.

    Depending on specific needs, you will in most cases only implement some of the UART features, like just one fixed baud rate, so it would be just an "ART", or you only need an Asynchronous serial Receiver, so it would actually be an "AR", or an "AT" for a transmitter.

    Nevertheless, we are so used to the term UART that we use it for all kinds of serial asynchronous implementations.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Greetings from Germany,

    G
  • T&E EngineerT&E Engineer Posts: 1,396
    edited 2008-10-10 11:49
    Thanks for the UART reference.

    I remember in college building a single board computer and adding a UART chip for communications which may be why it didn't sound right to me when I hear UART. But the SX is very capable of that and so many more functions that the user can define.

    Thanks again!
Sign In or Register to comment.