Skip to content

ESP32 I2C PCF8574 read issue #2949

@Gustavomurta

Description

@Gustavomurta

In February 2018, I ran my sketch (arduino IDE) in my project - ESP32 digital voltmeter and it worked fine - Arduino IDE 1.8.5 and ESP32 Board version 1.0.0.
The communication of the digital voltmeter is made with PCF8574 I2C interface.
Pullups resistors are 3K3 ohms (VCC = 3.3V)

Links of my project:
https://www.elektormagazine.com/labs/esp32-digital-voltmeter#/comments/labs/1459
https://github.com/Gustavomurta/ESP32-DVM

Schematic of ESP32 Voltmeter
https://github.com/Gustavomurta/ESP32-DVM/blob/master/ESP32%20DVM7135%20V3.jpg

Hardware:

Board: DOIT ESP32 DEVKIT V1
Core Installation version: 1.0.2
IDE name: Arduino IDE 1.8.9
Flash Frequency: 80 MHz
PSRAM enabled: NO
Upload Speed: 115200
Computer OS: Windows 10

The sketch I use to read ESP32 voltmeter is:
https://github.com/Gustavomurta/ESP32-DVM/blob/master/ESP32_DVM7135_PT_V1.ino

Simple as -
`


void ReadData ()
{
 Wire.begin();                   // Start I2C
 Wire.requestFrom(PCF8574, 1);   // Read One Byte from PCF8574
 pcfData = Wire.read();          // Byte Read
}

`

Now with Arduino 1.8.9 and ESP32 Board version 1.0.2, the I2C interface runs in crazy mode. The SCL pin sends continuous pulses and the SDA returns with erroneous data (checked with logic analyzer).
My ESP32 is DOIT ESP32 DevKit V1 and the all hardware is OK and checked with my I2C scanner. (based on Nick Gammon).

https://github.com/Gustavomurta/ESP32-DVM/blob/1bc07438e89eac39ae83f6d824451ad7248b3536/ESP32_I2Cscanner2.ino

Messages at Arduino Serial Console:

configsip: 0, SPIWP:0xee
clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00
mode:DIO, clock div:1
load:0x3fff0018,len:4
load:0x3fff001c,len:928
ho 0 tail 12 room 4
load:0x40078000,len:8424
ho 0 tail 12 room 4
load:0x40080400,len:5868
entry 0x4008069c

I2C scanner. Scanning ...
Found address: 32 (0x20)
Found 1 device(s).

Researching this problem with the Debug option, I found these messages.
But I have not identified the error yet. No error is being detected.
I suspect there is now a conflict between I2C and PWM Channel 0 that I use to generate clock of 480 KHz to TLC 7135 (Voltmeter chip). Note that my project worked fine with old libraries.

rst:0x1 (POWERON_RESET),boot:0x17 (SPI_FAST_FLASH_BOOT)
configsip: 0, SPIWP:0xee
clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00
mode:DIO, clock div:1
load:0x3fff0018,len:4
load:0x3fff001c,len:928
ho 0 tail 12 room 4
load:0x40078000,len:8424
ho 0 tail 12 room 4
load:0x40080400,len:5868
entry 0x4008069c
[D][esp32-hal-i2c.c:1337] i2cProcQueue():  Busy Timeout start=0xd6, end=0xd6, =0, max=50 error=0
[E][esp32-hal-i2c.c:319] i2cDumpI2c(): i2c=0x3ffbebe0
[I][esp32-hal-i2c.c:320] i2cDumpI2c(): dev=0x60013000 date=0x16042000
[I][esp32-hal-i2c.c:322] i2cDumpI2c(): lock=0x3ffb84ec
[I][esp32-hal-i2c.c:324] i2cDumpI2c(): num=0
[I][esp32-hal-i2c.c:325] i2cDumpI2c(): mode=1
[I][esp32-hal-i2c.c:326] i2cDumpI2c(): stage=3
[I][esp32-hal-i2c.c:327] i2cDumpI2c(): error=0
[I][esp32-hal-i2c.c:328] i2cDumpI2c(): event=0x3ffb8570 bits=0
[I][esp32-hal-i2c.c:329] i2cDumpI2c(): intr_handle=0x3ffb85a0
[I][esp32-hal-i2c.c:330] i2cDumpI2c(): dq=0x3ffb854c
[I][esp32-hal-i2c.c:331] i2cDumpI2c(): queueCount=1
[I][esp32-hal-i2c.c:332] i2cDumpI2c(): queuePos=0
[I][esp32-hal-i2c.c:333] i2cDumpI2c(): errorByteCnt=0
[I][esp32-hal-i2c.c:334] i2cDumpI2c(): errorQueue=0
[I][esp32-hal-i2c.c:335] i2cDumpI2c(): debugFlags=0x00020000
[I][esp32-hal-i2c.c:289] i2cDumpDqData(): [0] 7bit 20 R STOP buf@=0x3ffbfeb8, len=1, pos=0, ctrl=11110
[I][esp32-hal-i2c.c:307] i2cDumpDqData(): 0x0000: .                                00 
[I][esp32-hal-i2c.c:347] i2cDumpInts(): 0 row	count	INTR	TX	RX	Tick 
[I][esp32-hal-i2c.c:438] i2cTriggerDumps(): after ProcQueue
[I][esp32-hal-i2c.c:347] i2cDumpInts(): 0 row	count	INTR	TX	RX	Tick 

The same topic at ESP32 forum:
https://www.esp32.com/viewtopic.php?f=19&t=11261#p45725

Can someone help me? Thanks in advance.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions