Home › Forums › The libraries hosted on the site › PCF8574 i2c digital I/O expander › Can’t get PCF8574 lib working on Wio Terminal
Tagged: Question
- This topic has 6 replies, 1 voice, and was last updated 3 years, 10 months ago by
RoSchmi.
-
AuthorPosts
-
-
14 June 2021 at 13:21 #12563
RoSchmi
Hello again @xreef,
thank you for providing this library.I’m just trying to get the PCF8574 library working with Seeed Wio Terminal, but it doesn’t work ( doesn’t return from pcf8574.begin() ).
I have tried other I2C devices on the Wio Terminal and everything works.
https://github.com/RoSchmi/PlatformIO/tree/master/Proj/Wio_Terminal_M5Stack_ENV_Hat_Test
So I think that I have used the correct pins.
I have also set up your example code on an Arduino Nano and it works.
So I think that I have used the correct address for my PCF8574.
Before trying to set up oscilloscope and logic analyzer I wand to ask if you already know a reason why it doesn’t work.
Here is the example code I’m using:#include "Arduino.h" #include "PCF8574.h" // Set i2c address //PCF8574 pcf8574(0x39); // For PCF8574A PCF8574 pcf8574(0x20); // For PCF8574 void setup() { Serial.begin(9600); while(!Serial); delay(1000); Serial.println("Starting..."); // Set pinMode to OUTPUT pcf8574.pinMode(P0, OUTPUT); pcf8574.pinMode(P1, INPUT); Serial.print("Init pcf8574..."); if (pcf8574.begin()){ Serial.println("OK"); }else{ Serial.println("KO"); } } void loop() { pcf8574.digitalWrite(P0, HIGH); delay(1000); pcf8574.digitalWrite(P0, LOW); delay(1000); }
Thanks in advance
RoSchmiAttachments:
You must be logged in to view attached files. -
14 June 2021 at 14:27 #12566
Hi RoSchmi,
It’s possible that endTransmission (where I retrieve the begin status) had no return on Wio Terminal.Can you try if work even if the begin had no return?
You can check your wiring with the pinout diagram
[caption id="attachment_12555" align="alignnone" width="300"]
Wio Terminal pinout mischianti low resolution[/caption]
the default configuration require BCM2 (SDA) and BCM3 (SCL) pinout.
Bye Renzo
-
14 June 2021 at 16:12 #12594
RoSchmi
Hi, I doublechecked the SDA and SCL pins (are o.k.)
When I enable debug messages I get:
Starting…
Set pin 0 as 1
W: 1 R ALL: 0 R Down: 0R Up: 0
Set pin 1 as 0
W: 1 R ALL: 10 R Down: 10R Up: 0
Init pcf8574…Set write mode
resetInitial pin 11
Start end trasmission if stop here check pullup resistor.When I set breakpoints in the driver code it reaches:
this->transmissionStatus = _wire->endTransmission();when I set breakpoints in the return statements of TwoWire::enttransmission none of the three posible returns is reached.
I had 4.7 k pullups, didn’t work and I removed the pullups, didn’t work
Does it work on your side with the Wio Terminal?
-
-
14 June 2021 at 17:50 #12596
Hi RoSchmi,
I have not yet tested the device with the i2c, I am completing the article with a small application that gives the status of the FTP server.
But seems a connection problem, have you tried making an i2c scanner?
I try to test as soon as possible, but this week It’s full, I do my best.Bye Renzo
-
14 June 2021 at 18:55 #12597
RoSchmi
Hi Renzo,
I finally found the reason. It was a bad soldering junction at the pullup resistor for SDA (so that it didn’t pull up). Apparently the sensor which I used at this same socket had its own pullup so that it worked and I didn’t notice it.
It’s like always, the true reason for something that doesn’t work is always the last thing you try. It took my many hours to find out.
Apologies for wasting your time
Thanks
-
14 June 2021 at 21:38 #12598
Hi RoSchmi,
don’t worry, I’m happy to hear you. I write a simple interface for FTP server, I’m going to release It soon as example of the library.Attachments:
You must be logged in to view attached files. -
15 June 2021 at 09:45 #12610
RoSchmi
Hi Renzo,
I’m looking forward to try it on the Wio Terminal. Is it ready to be tested. Some years ago I created an ftp like file transfer program using bluetooth from PC to NETMF boards:https://www.youtube.com/watch?v=8tauo8kqe6w
Ftp is very useful. Thanks.
Kind regards
RoSchmi
-
-
-
AuthorPosts
- You must be logged in to reply to this topic.