User avatar
joan
Posts: 14393
Joined: Thu Jul 05, 2012 5:09 pm
Location: UK

Using the MCP4131 digital pot safely

Sat Aug 09, 2014 9:05 am

I've been playing with the SPI digital pot MCP4131 datasheet.

Pinout

Code: Select all

CS    1 o  o 8  5V
SCLK  2 o  o 7  B
MIMO  3 o  o 6  Wiper
GND   4 o  o 5  A
Because of the limited number of pins MISO/MOSI is multiplexed on the MIMO pin.

Commands are 8 or 16 bits. After the first 6 bits the MCP4131 starts driving MIMO as an output.

I've just connected the Pi's MOSI gpio to MIMO. This works and lets me output commands to the device but I was wondering if this was safe.

bbodin
Posts: 70
Joined: Sat Jun 28, 2014 3:23 pm

Re: Using the MCP4131 digital pot safely

Sat Aug 09, 2014 12:28 pm

Since the SDI/SDO pin of the MCP4131 has an open-drain drive, it is protected from a drive conflict. To protect the Pi's MOSI gpio pin, ensure that it is configured as an open-drain output. If that is not possible, add a series resistor (about 200 ohm) between the Pi's MOSI and MCP4131's SDI/SDO to limit the current when the Pi's pin is driven high and the other side is driven low.
Binh Bui

User avatar
joan
Posts: 14393
Joined: Thu Jul 05, 2012 5:09 pm
Location: UK

Re: Using the MCP4131 digital pot safely

Sat Aug 09, 2014 12:47 pm

bbodin wrote:Since the SDI/SDO pin of the MCP4131 has an open-drain drive, it is protected from a drive conflict. To protect the Pi's MOSI gpio pin, ensure that it is configured as an open-drain output. If that is not possible, add a series resistor (about 200 ohm) between the Pi's MOSI and MCP4131's SDI/SDO to limit the current when the Pi's pin is driven high and the other side is driven low.
Thanks.

I assume that was what diagram 6.1 Typical MCP41X1 SPI Interface Connections (Host Controller Hardware SPI) was trying to tell me.

Supplementary. Given I have a standard 3 wire SPI on the other channel does it matter if I have the resistor at the MIMO pin rather than the Pi end?

Is this OK?

Code: Select all

Pi MOSI --------+---------------- DIN ADC
                |
                |
                +----RESISTOR---- MIMO POT
Rather than?

Code: Select all

Pi MOSI ----RESISTOR----+-------- DIN ADC
                        |
                        |
                        +-------- MIMO POT

bbodin
Posts: 70
Joined: Sat Jun 28, 2014 3:23 pm

Re: Using the MCP4131 digital pot safely

Sat Aug 09, 2014 2:14 pm

joan wrote:Supplementary. Given I have a standard 3 wire SPI on the other channel does it matter if I have the resistor at the MIMO pin rather than the Pi end?

Is this OK?

Code: Select all

Pi MOSI --------+---------------- DIN ADC
                |
                |
                +----RESISTOR---- MIMO POT
Rather than?

Code: Select all

Pi MOSI ----RESISTOR----+-------- DIN ADC
                        |
                        |
                        +-------- MIMO POT
They are both OK but I'd go with the first configuration so that the resistor doesn't slow down the connection between Pi MOSI and DIN ADC.
Binh Bui

User avatar
joan
Posts: 14393
Joined: Thu Jul 05, 2012 5:09 pm
Location: UK

Re: Using the MCP4131 digital pot safely

Sat Aug 09, 2014 2:49 pm

bbodin wrote: ...
They are both OK but I'd go with the first configuration so that the resistor doesn't slow down the connection between Pi MOSI and DIN ADC.
Thanks. I have added a 470 ohm resistor as per the first configuration.

Return to “Interfacing (DSI, CSI, I2C, etc.)”