Comments (7)
SCL is defined as pin 23 (not 22) in the board definitions, despite what the pinout diagram says.
Unfortunately, Pin 23 isn't brought out to the pins.
Change the SCL pin definition in C:\Users<user>\AppData\Local\Arduino15\packages\esp32\hardware\esp32\1.0.4\variants\ttgo-t1\pins_arduino.h and it will work.
from ttgo-t-display.
Which pin do you use?
You can explicitly initialize the designated I2C pin,
Wire.begin(sda,scl)
Is your external pull-up resistor 110 ohms? You can use 4.7k or 10k for external pull-up.
from ttgo-t-display.
This board already includes 10k resistors on SDA and SCL :
For some reason I'm not able to use the default I2C pin 22, but for example with pins SDA = 21 and SCL = 15 it works flawlessly (I'm using I2C with a TMP102 temperature sensor).
Notice that pins 35 to 39 are input only so they can't be used for I2C.
#define I2C_SDA 21
#define I2C_SCL 15
void setup()
{
Wire.begin (I2C_SDA, I2C_SCL);
pinMode (I2C_SDA, INPUT_PULLUP);
pinMode (I2C_SCL, INPUT_PULLUP);
}
from ttgo-t-display.
Except for the specified SDA SCL, everything else is the same. I can work normally. Please rule out the problem with the module, or you can try with an I2C device.
#include <Wire.h>
#include <Arduino.h>
const uint8_t sda = 21;
const uint8_t scl = 22;
void setup()
{
Serial.begin(9600);
Wire.begin(sda, scl);
while (!Serial); // Leonardo: wait for serial monitor
Serial.println("\nI2C Scanner");
}
void loop()
{
int nDevices = 0;
Serial.println("Scanning...");
for (byte address = 1; address < 127; ++address) {
Wire.beginTransmission(address);
byte error = Wire.endTransmission();
if (error == 0) {
Serial.print("I2C device found at address 0x");
if (address < 16) {
Serial.print("0");
}
Serial.print(address, HEX);
Serial.println(" !");
++nDevices;
} else if (error == 4) {
Serial.print("Unknown error at address 0x");
if (address < 16) {
Serial.print("0");
}
Serial.println(address, HEX);
}
}
if (nDevices == 0) {
Serial.println("No I2C devices found\n");
} else {
Serial.println("done\n");
}
delay(5000); // Wait 5 seconds for next scan
}
from ttgo-t-display.
#define I2C_SDA 21
#define I2C_SCL 15void setup()
{
Wire.begin (I2C_SDA, I2C_SCL);
pinMode (I2C_SDA, INPUT_PULLUP);
pinMode (I2C_SCL, INPUT_PULLUP);
}
when I am trying to do it this way, LCD screen shows garbage and I2C connection still doesn't work.
Tested on PN532 with Adafruit library:
#define I2C_SDA 21
#define I2C_SCL 15
void initialize_PN532(){
Serial.println("Initializing PN532");
Wire.begin (PN532_SDA, PN532_SCL);
pinMode (PN532_SDA, INPUT_PULLUP);
pinMode (PN532_SCL, INPUT_PULLUP);
nfc.begin();
uint32_t versiondata = nfc.getFirmwareVersion();
if (! versiondata) {
Serial.print("Didn't find PN53x board");
while (1); // halt
}
}
This happens also when I used pins 26 / 27.
from ttgo-t-display.
In your code you define the I2C_SDA and I2C_SCL, but then you write Wire.begin (PN532_SDA, PN532_SCL) so you're probably not using the pins 21 and 15 that you defined first.
Could it be that because of this you're sending SDA/SCL data to another pin which is connected to the TFT and this give the random pixels on the screen ?
Have a look at the example (from above) :
#define I2C_SDA 21
#define I2C_SCL 15
void setup()
{
Wire.begin (I2C_SDA, I2C_SCL);
pinMode (I2C_SDA, INPUT_PULLUP);
pinMode (I2C_SCL, INPUT_PULLUP);
}
This works for me, even without the two INPUT_PULLUP lines.
I can also recommend this small sketch, which will detect any I2C device and give its address. It can be useful if you board can be configured for several addresses : https://playground.arduino.cc/Main/I2cScanner/
from ttgo-t-display.
In your code you define the I2C_SDA and I2C_SCL, but then you write Wire.begin (PN532_SDA, PN532_SCL) so you're probably not using the pins 21 and 15 that you defined first. Could it be that because of this you're sending SDA/SCL data to another pin which is connected to the TFT and this give the random pixels on the screen ?
Have a look at the example (from above) :
#define I2C_SDA 21 #define I2C_SCL 15
void setup() { Wire.begin (I2C_SDA, I2C_SCL); pinMode (I2C_SDA, INPUT_PULLUP); pinMode (I2C_SCL, INPUT_PULLUP); }
This works for me, even without the two INPUT_PULLUP lines.
I can also recommend this small sketch, which will detect any I2C device and give its address. It can be useful if you board can be configured for several addresses : https://playground.arduino.cc/Main/I2cScanner/
Hi all, is this too later?
can the config here be able to set other pin than 21/22, let's say 13/14?
Thanks
from ttgo-t-display.
Related Issues (20)
- Reintroduce the MIT Licence HOT 1
- What means soder option on the product page to order? HOT 1
- Connection lost HOT 1
- ESP32 doesn't wake-up from deep sleep when battery goes flat
- Ghosting old artifacts
- Display fails when code uploaded by PlatformIO HOT 1
- I2C Connection Issue with PN532 HOT 1
- T-Display Blank Screen HOT 3
- WebSocket Client Sample for LILYGO board
- SPI SDcard not working with LilygGO T-Display
- loading library from h:\...\Arduino\libraries\T-Display-S3: invalid library: no header files found
- 3D files
- TTGO T-display C1101
- How to make circuitpython work? HOT 3
- blank screen but still uploads code HOT 3
- Does readrect() work on this display HOT 1
- LilyGo T display won't mount. HOT 4
- TTGO T-Display v1.1 serial port problems HOT 2
- Crashing LVGL with Wifi
- Getting GPIO Error HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from ttgo-t-display.