Shop OBEX P1 Docs P2 Docs Learn Events
An SPI question. — Parallax Forums

An SPI question.

sdysdy Posts: 40
edited 2007-07-12 17:11 in BASIC Stamp
Why do they tie the SI and SO together, and the serin & serout commands use the same ports, instead of connecting seperate ports to SI & SO and using serin with the SO port and serout with the SI port numbers? Will both ways work with an SPI ram IC?

Comments

  • FranklinFranklin Posts: 4,747
    edited 2007-07-12 01:04
    If you are not reading and writing at the same time tying the pins together saves a pin on the stamp. It won't always work for all devices though.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    - Stephen
  • sdysdy Posts: 40
    edited 2007-07-12 01:47
    Thanks. A guy at work is doing it the second way, but not getting anything (could be anything wrong at this early stage). I always saw and did it the first way. I was just wondering what the difference was.
  • Mike GreenMike Green Posts: 23,101
    edited 2007-07-12 03:10
    With SPI, you don't use SERIN / SEROUT. They won't work. You have to use SHIFTIN / SHIFTOUT. SPI is a synchronous clocked serial protocol. SERIN / SEROUT are used for asynchronous serial data transfers.

    Note that tying the serial input and output pins together when the device doesn't support it can damage the device or the Stamp or both.
  • sdysdy Posts: 40
    edited 2007-07-12 03:13
    Sorry, I meant shiftin/out. (end of long day)
  • Chris SavageChris Savage Parallax Engineering Posts: 14,406
    edited 2007-07-12 17:11
    Typically on an SPI device as long as the device doesn’t output on the SDO line at the same time as it inputs on the SDI line you can connect your BASIC Stamp I/O pin to SDI and then connect SDI to SDO through a 1K resistor. This would prevent any I/O pin conflicts from causing a damaged pin. Take care.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Chris Savage
    Parallax Tech Support
Sign In or Register to comment.