PCF8575 ESP32 DigitalWrite Not working on sec I2C

I have the digitalread on all pins working on my esp32, I followed the example but is not working. When I measure the pin to ground it stays low on digitalwrite. (the chip is not fried, I have multiple chip with all the same issue).

This is the expansion board I am using
2022-01-24_004035

I have solderd vcc to vdd (for not using the voltage regulator)
2022-01-24_004205

In the library I did

#define NOT_SEQUENTIAL_PINOUT

#include <PCF8575.h>
#include <Wire.h>

TwoWire I2Cone = TwoWire(0);
//TwoWire I2Ctwo = TwoWire(1);
PCF8575 PCF(&I2Cone, 0x20, 16,17);

void setup() {
	Serial.begin(115200);
	while (!Serial);
	//PCF.pinMode(P00, INPUT);

	I2Cone.begin(16, 17, 400000); // SDA pin 16, SCL pin 17, 400kHz frequency

	for (int i = 0; i < 8; i++) {
		PCF.pinMode(i, OUTPUT);
	}
	
	//PCF.begin(16, 17);

	PCF.begin();

	write();
}
void loop() {
	delay(1000);
	//read();
}
void read() {
	Serial.print("val: ");
	Serial.println(PCF.digitalRead(P00));
}
void write() {
	//PCF.digitalWrite(P07, HIGH);

	for (int i = 0; i < 8; i++) {
		PCF.digitalWrite(i, HIGH);
	}
}

Here is my log

Opening port
Port open
�Set pin 0 as 2
writeMode: 1readMode: 0
Write mode: 1
Set pin 1 as 2
writeMode: 11readMode: 0
Write mode: 11
Set pin 2 as 2
writeMode: 111readMode: 0
Write mode: 111
Set pin 3 as 2
writeMode: 1111readMode: 0
Write mode: 1111
Set pin 4 as 2
writeMode: 11111readMode: 0
Write mode: 11111
Set pin 5 as 2
writeMode: 111111readMode: 0
Write mode: 111111
Set pin 6 as 2
writeMode: 1111111readMode: 0
Write mode: 1111111
Set pin 7 as 2
writeMode: 11111111readMode: 0
Write mode: 11111111
Set write mode
usedPin pin 11111111111111111111111100000000
Start end trasmission if stop here check pullup resistor.
Begin trasmission
Write data 1 for pin 0 bin value 1 value 1
--> 1
1
0
Start end trasmission if stop here check pullup resistor.
Begin trasmission
Write data 11 for pin 1 bin value 10 value 1
--> 3
3
0
Start end trasmission if stop here check pullup resistor.
Begin trasmission
Write data 111 for pin 2 bin value 100 value 1
--> 7
7
0
Start end trasmission if stop here check pullup resistor.
Begin trasmission
Write data 1111 for pin 3 bin value 1000 value 1
--> 15
15
0
Start end trasmission if stop here check pullup resistor.
Begin trasmission
Write data 11111 for pin 4 bin value 10000 value 1
--> 31
31
0
Start end trasmission if stop here check pullup resistor.
Begin trasmission
Write data 111111 for pin 5 bin value 100000 value 1
--> 63
63
0
Start end trasmission if stop here check pullup resistor.
Begin trasmission
Write data 1111111 for pin 6 bin value 1000000 value 1
--> 127
127
0
Start end trasmission if stop here check pullup resistor.
Begin trasmission
Write data 11111111 for pin 7 bin value 10000000 value 1
--> 255
255
0
Start end trasmission if stop here check pullup resistor.

The ESP32's Arduino core defines the I2C pins as GPIO_NUM_22, SCL, and GPIO_NUM_21, SDA, why not use those pins? You can program the ESP32's pin matrix to set the I2C pins as GPIO_NUM_17/16, which are natural serial port pins. Here is a link to the ESP32's docs where you can read about how to redefine the ESP32's pin matrix to change the I2C GPIO pins.

I just change the pins to the defaults, still having the same issue.

PCF8575 PCF(0x20)

And left out wire.begin()

Could it be I need to solder the a1,a2 and a3 solderpads to ground? All tutorials tell me an if I want to change the adress. Maybe its a must?

I will try and rescan it, let you know if it works...

The address stays the same

Scanning...
I2C device found at address 0x20 !
done

Nothing changed... still low

Digitalread still works.

I have two 4.7k resistors as pullup. Maybe they are to weak... Can somebody tell me what the right value of pullup resistors?

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