Shop OBEX P1 Docs P2 Docs Learn Events
SPI pin labeling complaint — Parallax Forums

SPI pin labeling complaint

RaymanRayman Posts: 14,844
edited 2012-03-11 17:29 in Propeller 1
I've had to modify some SPI code recently from OBEX and I can't help but complain about the way people are labelling the SPI pins...

What I am trying to avoid is having the In and Out hooked up backwards (either by me or a customer...).

It appears to me that the majority of code is calling the pins DO and DI, presumably for data in and data out.
But, I think it would be better for everybody if they were called MOSI and MISO, like it is on Wikipedia...

Most chips I've seen, label the pins SI and SO for slave-in and slave-out, which is fine.
But, on the Prop side, I think they should be called MI and MO or the full MOSI and MISO.

Anyway, that's my little rant for the day. This is what happens when I stay up too late...

Comments

  • Martin HodgeMartin Hodge Posts: 1,246
    edited 2012-03-10 23:01
    ^^^ This! ^^^
  • Phil Pilgrim (PhiPi)Phil Pilgrim (PhiPi) Posts: 23,514
    edited 2012-03-10 23:03
    I concur. DI and DO are too ambiguous.

    -Phil
  • Cluso99Cluso99 Posts: 18,069
    edited 2012-03-11 00:28
    Well DI & DO (as in D"I"n and D"O"out not D1 and D0(zero) is what the SD card specifies. If you use D1 or D0 it will fail with an error.
    I didn't like it at first, but that's the spec so I got used to it.
  • evanhevanh Posts: 16,113
    edited 2012-03-11 07:10
    SD Cards only use a subset of defacto SPI specs. The card is always a slave and it's well defined which way the data is flowing, hense they can sort of get away with a more basic labelling.

    The full labelling is an attempt to clarify the age old problem of having the pin label at each end being the opposite labels. Traditional and intuitive labelling of wires says use the same label at both ends but this conflicts with the view point of data flow where the data usually goes in one direction on a particular wire and gets labelled accordingly.
  • RaymanRayman Posts: 14,844
    edited 2012-03-11 15:41
    Glad that a few people at least agree with me... I'm going to start calling the lines MISO and MOSI (or at least MI and MO) in anything do and hopefully things will change...
    I imagine that having these lines reversed messes up a lot of people.
    People probably reverse regular serial lines a lot too, but I guess there's nothing to be done there... People just have to learn that TX goes to RX and vice versa...
  • Cluso99Cluso99 Posts: 18,069
    edited 2012-03-11 17:07
    Rayman: I always label P31 as SI and P30 as SO to avoid confusion for these pins.

    Perhaps it is about time we put together a set of standards recommended naming for use by the prop pins such as...
    And maybe it could be part of the GoldStandard??
    '' Proposed Standard Prop Pin Names and preferred pins
    '' Note: a value of -1 means not used/available
    '' Cluso 20120312
      PIN_SI        = 31            'serial in
      PIN_SO        = 30            'serial out
      PIN_SDA       = 29            'eeprom data
      PIN_SCL       = 28            'eeprom clock
      PIN_KDB_CLK   = 27            'keyboard clock
      PIN_KBD_DAT   = 26            'keyboard data
      PIN_MSE_CLK   = 25            'mouse clock
      PIN_MSE_DAT   = 24            'mouse data
      PIN_VGA       = 16            'VGA basepin (16..23)
      PIN_TV        = 12            'TV  basepin (12..14/15)
      PIN_AUDIO     = ?             'audio out
      PIN_AUDIO2    = ?             'audio out (second channel)
      PIN_SD_CS     = 3             'SD card chip select
      PIN_SD_MOSI   = 2             'SD card data in  DI
      PIN_SD_CLK    = 1             'SD card clock
      PIN_SD_MISO   = 0             'SD card data out DO
      PIN_SD_CD     = ?             'SD card detect
      PIN_SD_WP     = ?             'SD card write protect
    
  • RaymanRayman Posts: 14,844
    edited 2012-03-11 17:29
    I do think MOSI and MISO helps a lot.
    Not really sure your SI and SO on 31&30 will help. I think it's just trouble, no matter what you do there...
Sign In or Register to comment.