View Full Version : SPI pin labeling complaint
03-11-2012, 04:31 AM
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...
03-11-2012, 07:01 AM
^^^ This! ^^^
Phil Pilgrim (PhiPi)
03-11-2012, 07:03 AM
I concur. DI and DO are too ambiguous.
03-11-2012, 08:28 AM
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.
03-11-2012, 02:10 PM
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.
03-11-2012, 10:41 PM
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...
03-12-2012, 12:07 AM
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
03-12-2012, 12:29 AM
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...