Electrical type for SPI device MISO pins?

Referring to the “electrical type of schematic symbol pins” FAQ, https://forum.kicad.info/t/electrical-type-of-schematic-symbol-pins/9439, I still feel uncertain with respect to how to define device SPI output pins (MISO). The practice in the official library seems to vary. For instance in the library Memory_EEPROM.lib 25LC_EEPROM has all pins, even MISO defined as Input. Logically that does not seem right. Another example, LTC1644CGN in the adc-dac library has DOUT/MISO pins defined as Output. But if defined as output there will be DRC errors when multiple SPI devices have MISO pins on the same bus.

The problem is of course that these pins change between being output when chip is active and otherwise high impedance, typically when chip is not selected, for instance when another device on the bus is active. DRC does of course not “understand” that. It seems to be common practice to not have pull up or pull down resistors on these pins, and in my own experience this works well.

Often the processor DIN has an internal weak pull up, so an external resistor is not needed to park the bus at a valid logic level when no slave is selected

Sadly there are still symbols in the official lib that are not of very high quality. I think the miso pin should be an input for the master and a tristade for slaves.
Some devices offer i2c and spi on the same pins. For such devices one would either have to make a separate symbol depending on selected bus interface or the pins might need to be defined as bidirectional.

1 Like

Yes, that is right for MCUs I am using. (As long as the MCUs MOSI pin does not oscillate in a non-defined state causing increased power consumption, the state of the pin is functionally irrelevant when SPI is inactive). The question is what is the most correct pin setting for the symbol of the connected device? In some data sheets, for instance for LTC2400/2410 (these are not in the official library), MOSI is designated as a 3-state output. Several more devices I checked in the official library defines MOSI as output, but it will as stated cause DRC errors with multiple devices on the bus. Perhaps Tri-state would be a more suitable pin property for MISO pins?

Thanks Rene, (I edited my last message in parallel with your reply). I tend to agree. Can you point me to a slave device in the library that uses Tri-state for MISO? Could this be expressed clearer in the FAQ (“pins that have a z-high state are tri-state”)?

I assume you mean a MISO pin not MOSI. One example i found is MC13192 (In RF_Zigbee of the new lib, In motorola lib of the version 4 libs.)

As i found that most devices have the wrong type, i opened an issue to ask the community for help https://github.com/KiCad/kicad-symbols/issues/232

I reworded it to include that tri state is used for pins that have a high impedance state. (high z might not be as universally known as i thought it would be.)

1 Like

Thanks Rene, found it (with tri-state) although my version is a bit old as I have not updated the library since late November; will do soon once things have settled a bit more. Thanks for the FAQ change!
(I corrected to MISO in my message above)

IC’s do not have pull ups or pull downs, they have current sources and current sinks. They are speced as a current with a tolerance from about -50% to +100%.

Try plugging those numbers into your circuit calculations and you are likely to find that they are useless for anything other than holding the pad at a known state while it is on the IC tester.

John Eaton

A little slip; I should have left out the word resistor in the above. The specs can vary though, for instance the dsPIC 33F series the specification for CNx Pull-up Current is Min 50μA Typical 250 μA, Max 400 μA. (I suspect you mean 50% to 200% of nominal value, as -50% sounds like a current with opposite polarity). While it further states that “the pull-ups act as a current source that is connected to the pin and eliminate the need for external resistors when push button or keypad devices are connected”, it is likely wise to not depend on these for signaling. Also on some chips the pull up (or in some cases pull down) need to be configured to be active.

That is not always true, open collector outputs have a high impedance state but are not tristate.

Perhaps something could be added along the lines, that the pin “otherwise is capable of both a high and low active state” ?

Except when they do. :wink:

1 Like

The minus sign does not refer to current direction but rather that the tolerance on the low side is different than that on the high side. So 100 uA +/- 10% can be 90 to 110 uA. 100 uA -50 +100 % is 50 to 200 uA. Your example is 250 uA -80 +60%

John Eaton

1 Like

I made another change to it. Hopefully it is more clear now.

1 Like

Thanks, Rene, much clearer now.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.