Hello everyone I'm having some issues with the digital pot MCP4251 and Teensy 4.1, cannot make it work, the resistor values are fixed and not responding. Here are my connections:
All connections are as shown (on a custom PCB and on a breadboard) but I don't have any change in the resistance between wiper and Pin 1 or 2 for either pots. Any suggestions?
- Chip Select: Teensy Pin 4
- SCK: Teensy Pin 13 (SCK)
- MOSI: Teensy Pin 11 (MOSI)
- VSS: GND
- POT0 pin 1
- POT0 wiper
- POT0 pin 2
- POT1 pin 2
- POT1 wiper
- POT1 pin 1
- WP: 3v3
- SHDN: 3v3
- SDO: unconnected
- VDD: 3v3
Code:
#include <SPI.h>
#define POT0 0
#define POT1 1
#define DIGIPOT_CS 4
void setup() {
// put your setup code here, to run once:
pinMode(DIGIPOT_CS, OUTPUT);
SPI.begin();
}
void loop()
{
for(int i =0; i < 255; i++)
{
digiPot(DIGIPOT_CS, POT0, i);
digiPot(DIGIPOT_CS, POT1, i);
}
}
void digiPot (byte chip_select, byte address, byte value)
{
digitalWrite(chip_select, LOW);
SPI.transfer(address << 4);
SPI.transfer(value & 255);
digitalWrite(chip_select, HIGH);
}
All connections are as shown (on a custom PCB and on a breadboard) but I don't have any change in the resistance between wiper and Pin 1 or 2 for either pots. Any suggestions?