ESP32 i2C support

yashdave88
Posts: 9
Joined: Fri Jan 31, 2020 6:52 am

ESP32 i2C support

Postby yashdave88 » Wed Feb 19, 2020 3:54 am

Hi,

Problem statement: I am facing problem while reading registers over I2c, for CY8cmbr3116 cypress capsense controller.

Firmware details:
• ESP32 is configured as I2c master.
• Two devices are connected over I2c bus.
• Both are operating on 100Khz frequency.

ESP-IDF V3.3

I am using same i2c driver for port expander to read and write data over port.
I have verified slave address, for capsense controller and it is correct.

Could you please help me to resolve this.

ESP_houwenxiang
Posts: 118
Joined: Tue Jun 26, 2018 3:09 am

Re: ESP32 i2C support

Postby ESP_houwenxiang » Wed Feb 19, 2020 8:44 am

Hi, yashdave88

Can you provide more information about the I2C problem you are experiencing? Such as providing waveforms during communication.

thanks !!
wookooho

yashdave88
Posts: 9
Joined: Fri Jan 31, 2020 6:52 am

Re: ESP32 i2C support

Postby yashdave88 » Thu Feb 20, 2020 5:13 am

Hi

Kindly find attached screenshot of signal. Also find attached code we are using.
Attachments
i2c_example_main.c
(14.33 KiB) Downloaded 403 times
20200219_163608.jpg
20200219_163608.jpg (3.24 MiB) Viewed 6751 times

WiFive
Posts: 3529
Joined: Tue Dec 01, 2015 7:35 am

Re: ESP32 i2C support

Postby WiFive » Fri Feb 21, 2020 2:08 am

I am facing problem
We are supposed to guess? You have to show logs and error codes.

yashdave88
Posts: 9
Joined: Fri Jan 31, 2020 6:52 am

Re: ESP32 i2C support

Postby yashdave88 » Tue Feb 25, 2020 8:34 am

HI,

We do not receive any error code
But our register read always fail.

Here with my logs
I (232) heap_init: Initializing. RAM available for dynamic allocation:
I (239) heap_init: At 3FFAE6E0 len 00001920 (6 KiB): DRAM
I (245) heap_init: At 3FFB2AA0 len 0002D560 (181 KiB): DRAM
I (252) heap_init: At 3FFE0440 len 00003AE0 (14 KiB): D/IRAM
I (258) heap_init: At 3FFE4350 len 0001BCB0 (111 KiB): D/IRAM
I (264) heap_init: At 4008ADE4 len 0001521C (84 KiB): IRAM
I (271) cpu_start: Pro cpu start user code
I (288) spi_flash: detected chip: generic
I (289) spi_flash: flash io: dio
I (289) cpu_start: Starting scheduler on PRO CPU.
I (0) cpu_start: Starting scheduler on APP CPU.
----Port expander init done----
----hardware reset init done----
----TASK[0] Task READ ----
f8 ff fd 3f 1f 51 6d fc d3 9c c2 f4 a9 d9 20 bc
ec 2f 23 9a
----TASK[0] Task READ ----
f8 ff fd 3f 1f 51 6d fc d3 9c c2 f4 a9 d9 20 bc
ec 2f 23 9a
----TASK[0] Task READ ----
f8 ff fd 3f 1f 51 6d fc d3 9c c2 f4 a9 d9 20 bc
ec 2f 23 9a
----TASK[0] Task READ ----
f8 ff fd 3f 1f 51 6d fc d3 9c c2 f4 a9 d9 20 bc
ec 2f 23 9a
----TASK[0] Task READ ----
f8 ff fd 3f 1f 51 6d fc d3 9c c2 f4 a9 d9 20 bc
ec 2f 23 9a
----TASK[0] Task READ ----
f8 ff fd 3f 1f 51 6d fc d3 9c c2 f4 a9 d9 20 bc
ec 2f 23 9a
----TASK[0] Task READ ----
f8 ff fd 3f 1f 51 6d fc d3 9c c2 f4 a9 d9 20 bc
ec 2f 23 9a
----TASK[0] Task READ ----
f8 ff fd 3f 1f 51 6d fc d3 9c c2 f4 a9 d9 20 bc
ec 2f 23 9a
----TASK[0] Task READ ----
f8 ff fd 3f 1f 51 6d fc d3 9c c2 f4 a9 d9 20 bc
ec 2f 23 9a
----TASK[0] Task READ ----
f8 ff fd 3f 1f 51 6d fc d3 9c c2 f4 a9 d9 20 bc
ec 2f 23 9a
----TASK[0] Task READ ----
f8 ff fd 3f 1f 51 6d fc d3 9c c2 f4 a9 d9 20 bc
ec 2f 23 9a


kindly suggest.

ESP_Sprite
Posts: 8921
Joined: Thu Nov 26, 2015 4:08 am

Re: ESP32 i2C support

Postby ESP_Sprite » Thu Feb 27, 2020 9:52 am

How do you get that your register read always fails? From what I can see at a quick glance, that looks like mostly sane data to get from address 0xA0 in that chip.

yashdave88
Posts: 9
Joined: Fri Jan 31, 2020 6:52 am

Re: ESP32 i2C support

Postby yashdave88 » Mon Mar 02, 2020 7:11 am

Hi,

kindly find attached code we are using.

Also find below log according to this code.

I (190) cpu_start: Project name: i2c-example
I (196) cpu_start: App version: v4.1-dev-1543-g431066f16-dirty
I (203) cpu_start: Compile time: Mar 2 2020 10:54:56
I (209) cpu_start: ELF file SHA256: 2d45717555bc47dc...
I (215) cpu_start: ESP-IDF: v4.1-dev-1543-g431066f16-dirty
I (222) cpu_start: Starting app cpu, entry point is 0x40081074
0x40081074: call_start_cpu1 at C:/msys32/home/vishakhak/esp/esp-idf/components/esp32/cpu_start.c:276

I (0) cpu_start: App cpu up.
I (232) heap_init: Initializing. RAM available for dynamic allocation:
I (239) heap_init: At 3FFAE6E0 len 00001920 (6 KiB): DRAM
I (245) heap_init: At 3FFB2AA0 len 0002D560 (181 KiB): DRAM
I (251) heap_init: At 3FFE0440 len 00003AE0 (14 KiB): D/IRAM
I (258) heap_init: At 3FFE4350 len 0001BCB0 (111 KiB): D/IRAM
I (264) heap_init: At 4008ADE4 len 0001521C (84 KiB): IRAM
I (270) cpu_start: Pro cpu start user code
I (288) spi_flash: detected chip: generic
I (289) spi_flash: flash io: dio
I (289) cpu_start: Starting scheduler on PRO CPU.
I (0) cpu_start: Starting scheduler on APP CPU.
----Port expander init done----
----hardware reset init done----
----TASK[0] Task READ ----
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00
----TASK[0] Task READ ----
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00
----TASK[0] Task READ ----
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00
----TASK[0] Task READ ----
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00
----TASK[0] Task READ ----
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00
----TASK[0] Task READ ----
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00
----TASK[0] Task READ ----
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00

Let me know any change require in code to get proper data.
Attachments
i2c_example_main.c
(14.39 KiB) Downloaded 391 times

ESP_Sprite
Posts: 8921
Joined: Thu Nov 26, 2015 4:08 am

Re: ESP32 i2C support

Postby ESP_Sprite » Tue Mar 03, 2020 2:03 pm

No, I'm not going to debug your code, especially if it's a hacked together example with remaining stuff commented out. Try some stuff yourself first: for instance, the I2C driver routines can return an error; how about actually checking if they do?

Who is online

Users browsing this forum: No registered users and 135 guests