• AVR Freaks

Hot!How to know the current that SPI bus lines are driving from MCP23S17 device driver?

Author
Eusuvi
New Member
  • Total Posts : 22
  • Reward points : 0
  • Joined: 2020/05/27 01:29:31
  • Location: 0
  • Status: offline
2020/11/13 03:37:44 (permalink)
0

How to know the current that SPI bus lines are driving from MCP23S17 device driver?

I'm connecting 8 mcp chips to the same SPI bus where the master node is a Raspberry Pi3.
 
1. I'm trying to check whether some of the lines would need a driver or not, between master line and slave, but I don't see information about current parameters on datasheet. I would like to check if a master SPI driver can give enough current to the slave. I guess that if there are 8 SPI nodes receiving hardware address data frame by MOSI, the MCPs will read and process the bytes at MOSI pin. So I should multiplicate per 8 the CLOCK, CS and MOSI lines current consumption. 
 
2. I have a second question regarding MCP chip SPI bus, whereas devices put the MISO line at high impedance when CS is high, what happening with the CS, SCLK and MOSI pins? How the MCP SPI driver handle the inputs when CS is high? Are also the rest of the lines put in high Z when the driver reads a low level at CS pin? 
 
Thanks for your attention.
post edited by Eusuvi - 2020/11/13 03:57:29
#1

13 Replies Related Threads

    oliverb
    Super Member
    • Total Posts : 369
    • Reward points : 0
    • Joined: 2009/02/16 13:12:38
    • Location: 0
    • Status: offline
    Re: How to know the current that SPI bus lines are driving from MCP23S17 device driver? 2020/11/13 04:26:15 (permalink)
    0
    The inputs should present negligible DC loading, so the limitation is probably a mix of total capacitance and cable/trace length. This tends to manifest as overshoots and ringing that can cause extra clock transitions, so the clock tends to be the first signal to give trouble. You may find you need a small resistance (try 100 ohm) in series with each output to damp this down.
     
    If you do need to buffer the lines then at the PI end the buffers can be always enabled, and the MCP23S17 parts probably won't need buffering, they should have enough drive anyway.
     
    #2
    marcov
    Super Member
    • Total Posts : 291
    • Reward points : 0
    • Joined: 2006/10/08 01:59:40
    • Location: Eindhoven, NL.
    • Status: offline
    Re: How to know the current that SPI bus lines are driving from MCP23S17 device driver? 2020/11/13 08:00:26 (permalink)
    0
    One tip: Read the errata about the "id" pins.
    #3
    oliverb
    Super Member
    • Total Posts : 369
    • Reward points : 0
    • Joined: 2009/02/16 13:12:38
    • Location: 0
    • Status: offline
    Re: How to know the current that SPI bus lines are driving from MCP23S17 device driver? 2020/11/14 02:22:51 (permalink)
    -1 (1)
    That reminds me: You'll probably find it easier to code the initialization if you implement a reset line. It means using up another GPIO line but you don't have to deal with having the parts in an uncertain state at program start.
     
    OK so I don't follow my own advice instead I just tie reset high, but then I have to issue extra IOCON writes to deal with the uncertainty.
    #4
    Eusuvi
    New Member
    • Total Posts : 22
    • Reward points : 0
    • Joined: 2020/05/27 01:29:31
    • Location: 0
    • Status: offline
    Re: How to know the current that SPI bus lines are driving from MCP23S17 device driver? 2020/11/16 01:11:30 (permalink)
    0
    @oliverb and company, thanks for your reply. Your suggestions are useful and I understand what you mean. But I'm trying to know if I would need a buffer. That's the thing I don't know and I'm wondering. I suspect that if Rasp gives 16mA for output pins and so it writes things towards 8 MCP devices I should multiply one chip line consumption x 8 chips. As I don't know what is the current value that a bus line pinat MCP is demanding, I don't know if master maximum driver current (16mA) will be enough for 8 devices reading the address frame at the same time.
     
    Do you understand me what I mean?
    #5
    ric
    Super Member
    • Total Posts : 29435
    • Reward points : 0
    • Joined: 2003/11/07 12:41:26
    • Location: Australia, Melbourne
    • Status: online
    Re: How to know the current that SPI bus lines are driving from MCP23S17 device driver? 2020/11/16 01:13:08 (permalink)
    +2 (2)
    Eusuvi
    Do you understand me what I mean?

    Yes, they did, and they already said the input current is negligible.
     

    I also post at: PicForum
    Links to useful PIC information: http://picforum.ric323.co...opic.php?f=59&t=15
    NEW USERS: Posting images, links and code - workaround for restrictions.
    To get a useful answer, always state which PIC you are using!
    #6
    marcov
    Super Member
    • Total Posts : 291
    • Reward points : 0
    • Joined: 2006/10/08 01:59:40
    • Location: Eindhoven, NL.
    • Status: offline
    Re: How to know the current that SPI bus lines are driving from MCP23S17 device driver? 2020/11/16 01:54:00 (permalink)
    -1 (1)
    I second oliverb's remark btw, for us a reset line was really needed to reliable init the s17s.
     
    We had some other S17 initialization troubles, but in the end that was due to putting CS high too fast after SPI writes ended. Inserted some nops and it has been fine ever after.
    post edited by marcov - 2020/11/16 01:55:19
    #7
    oliverb
    Super Member
    • Total Posts : 369
    • Reward points : 0
    • Joined: 2009/02/16 13:12:38
    • Location: 0
    • Status: offline
    Re: How to know the current that SPI bus lines are driving from MCP23S17 device driver? 2020/11/16 04:26:59 (permalink)
    0
    Regarding device loads I know it is a bit strange. I was first taught TTL logic, and I remember one demonstration board using 1k pull-down resistors!! I've seen the current requirement put at 1.6mA.
     
    Most logic ICs and ASICs are made in MOS technology, CMOS or NMOS, meaning that the active devices are "Field effect transistors" which are activated by voltage not current. The input to a CMOS device is a small capacitance. I couldn't find a figure for the MCP23S17 but an ordinary logic gate might have a capacitance of around 5pF. One exception is if there is an unpowered logic device on a bus. There is an internal diode between each logic pin and the positive supply pin (usually, exceptions exists) so an unpowered device will attempt to "steal" power from the bus. This is bad and can be destructive. Try not to let it happen.
     
    The result of that is is takes negligible power to maintain the state of the bus, it only takes power to switch it, and the power is used to charge and discharge the capacitance of the inputs and of the traces leading to them. How much power depends on how far the signals need to go and how fast they need to be.
     
     
     
    #8
    Mysil
    Super Member
    • Total Posts : 4062
    • Reward points : 0
    • Joined: 2012/07/01 04:19:50
    • Location: Norway
    • Status: offline
    Re: How to know the current that SPI bus lines are driving from MCP23S17 device driver? 2020/11/16 04:40:26 (permalink)
    +2 (2)
    Hi, Eusuvi
     
    Since you are asking again, it may seem you do not understand explaination above.
    The Input in complementary metal–oxide–semiconductors as used in microcontrollers,
    computer chps, and MCP23S17 port expanders,
    is just a small pad of metal, on top of a layer of silicon oxide, which is basically a kind of glass.
     
    These inputs use no current when the signal is stable.
    The input act as a very small capacitor.  Bonding wire, together with connection pad and traces inside the chip package and pin of the package, also contribute with a little capacitance.
    Together, these are sometimes estimated to 5 picoFarad or less for each input pin.
    Traces on your circuit board, and other wiring between devices, may contribute much more capacitance,
    especially if there is long wiring between devices.
    Twisted pair wiring as used in Cat5e Ethernet cable, is specified to have nominally 52 pF/meter capacitance.
    So signaling quality depend much more upon length and layout of wiring and connections,
    than number of devices connected. And frequency of signaling.
     
    You may calculate rise and fall times of signals when capacitance of the whole connect,
    and other properties are known.
    You may calculate signal propagation based on transmission line theory,
    Or you may observe the signals using oscilloscope.
    How long time does it take for signals at the far end of the setup to reach stable level,
    and for eventual reflections and overshoot to decay.
     
    Inputs of microcontrollers and computer chips are sensitive to EMC and EMI interference,
    so if there are long wiring, signal transcievers may still be a good idea.
     
        Mysil
    #9
    oliverb
    Super Member
    • Total Posts : 369
    • Reward points : 0
    • Joined: 2009/02/16 13:12:38
    • Location: 0
    • Status: offline
    Re: How to know the current that SPI bus lines are driving from MCP23S17 device driver? 2020/11/16 04:58:27 (permalink)
    -1 (1)
    Another GOOD reason to add transcievers is that the PI has 3.3V outputs, and it is quite likely that you intend to run the MCP23S17 parts from 5V. There are rules for safely mixing 3.3V and 5V parts in the same system, but adding a level-translator may be simpler.
    #10
    Eusuvi
    New Member
    • Total Posts : 22
    • Reward points : 0
    • Joined: 2020/05/27 01:29:31
    • Location: 0
    • Status: offline
    Re: How to know the current that SPI bus lines are driving from MCP23S17 device driver? 2020/11/27 03:31:35 (permalink)
    0
    @Mysil, thanks.
     
     Are you refering to SPI input lines when you talk about "inputs"?
     
    Some people suggest that one of the things that is needed to desing an SPI net circuit is to calculate the fanout, they said to me "looking at nodes datasheet specifications". Because if nodes are not able to offer good leveles of current it is a common of signal distorsion's one of the causes. Obviously there is a bit more causes that can contribute to the reflexion and distorsion, as you say. But I'm note able to conclude which the parameters to use for knowing if current could needs to be amplified by buffers. This is my first SPI PCB net design with more than one or two nodes neither wired SPI bus. So I have no experience using buffers for SPI bus. But it's tur that I have seen examples (from makers users to unversity projects) using buffers or transistors at lines. The problem is that I did not find information about how to know if I the bus lines will need buffers, what kind of them and how to choose the propper one (comercial parameters that I have to focus). Example of 1 meter wire based work:
     
    "Although the length of the bus lines is not too long (in the worst ofcases, it will not exceed one meter in length), we must take precautions when
    time to transmit signals at high frequency. It is a requirement to use "buffer" s of output for the lines, since they are integrated that allow to increase
    the capacity of output current, decreasing the detrimental effects of capacities parasitic on the bus, which produces distortion of the signals.
    This effect worsens when increase the lengths of the cables, as they increase the parasitic capacities.
    In the bus we must also place termination resistors. These resistors, produce dissipation of the energy that propagates through the lines
    of transmission. If not, the energy would bounce off the line producing a major distortion. This aspect is not only important in long cables,
    since it depends on the characteristic impedance of the transmission line, and is independent of the length of it. "
     
    In this case the user seems to suggest buffers: 74HC244 or 74HC125
     
    I guess you are refering to transcievers for getting differential and wire twisted lines, but I hope it could be unnecessary. This focus change could take a time and resources that we don't have any more. So I'm loooking for improving basic SPI issues first, as fanout, termination resistors, etc. Our system opperations don't need more than 1Mhz, even 500Mhz would be enough. We don't need more frequency. Our SPI wire will be 40cm. 
     
    I'm so sorry for my no great experience. 
     
    Regards.
    #11
    ric
    Super Member
    • Total Posts : 29435
    • Reward points : 0
    • Joined: 2003/11/07 12:41:26
    • Location: Australia, Melbourne
    • Status: online
    Re: How to know the current that SPI bus lines are driving from MCP23S17 device driver? 2020/11/27 04:57:48 (permalink)
    +2 (2)
    What are you doing that could be a metre long? That is a long distance for SPI, at which point you have to start treating the signals as "transmission lines" which can get very messy.

    I also post at: PicForum
    Links to useful PIC information: http://picforum.ric323.co...opic.php?f=59&t=15
    NEW USERS: Posting images, links and code - workaround for restrictions.
    To get a useful answer, always state which PIC you are using!
    #12
    oliverb
    Super Member
    • Total Posts : 369
    • Reward points : 0
    • Joined: 2009/02/16 13:12:38
    • Location: 0
    • Status: offline
    Re: How to know the current that SPI bus lines are driving from MCP23S17 device driver? 2020/11/27 07:19:17 (permalink)
    +1 (1)
    From experience you can do it by dropping the clock rate. I had a truely awful PIC implementation where I ended up needing filtered D connectors at each end, but at 250kHz it worked. Clarification: the filtered connectors had roughly 1n capacitance each which is excessive.
     
    Incidentally what I was trying to do really should have used RS485 or similar but the product had been in operation for about 6 months before I realised and it has worked out so far.
     
    Regarding treating the lines as transmission lines yes it can but there are some guidelines we can share, such as taking special care of the clock because glitches on the clock are critical. Sometimes low value resistors in series with the outputs can help. It is surprising what will work though, speaking as someone who has helped improvise an expansion board for an 8 bit computer (Dragon) using stripboard, hookup wire and a short 40-way ribbon to get at the expansion bus.
     
     
     
    post edited by oliverb - 2020/11/30 08:42:12
    #13
    Jerry Messina
    Super Member
    • Total Posts : 589
    • Reward points : 0
    • Joined: 2003/11/07 12:35:12
    • Status: offline
    Re: How to know the current that SPI bus lines are driving from MCP23S17 device driver? 2020/11/27 09:22:47 (permalink)
    +1 (1)
    oliverb
    From experience you can do it by dropping the clock rate



    With a synchronous bus like SPI, it's usually the edge rates that cause problems more so than the actual clock frequency.
    As you point out, glitches on the clock line are a killer, and a series R can help slow down the edges.
     
    Some pics also have slew rate control on the IO pins.
    #14
    Jump to:
    © 2021 APG vNext Commercial Version 4.5