Issues with I2C? Only 1 of 4 devices found by i2cscanner.c

Scalpel78
Posts: 51
Joined: Sun Feb 26, 2017 7:31 am

Re: Issues with I2C? Only 1 of 4 devices found by i2cscanner.c

Postby Scalpel78 » Wed Mar 01, 2017 6:37 pm

Hi,
looking at the traces from the logic analyzer I see that the one I did on the Teensy show a very stable 100KHz clock signal. On the trace I did on the ESP32 the clock signal is more like 98-99kHz, and does have some weird ticks, like for instance the 65kHz tick in the screenshot below.

Image

With regards to the FreeRTOS tick period, it is set to 100, which I assume is the default since I haven't changed it.
Image

User avatar
kolban
Posts: 1683
Joined: Mon Nov 16, 2015 4:43 pm
Location: Texas, USA

Re: Issues with I2C? Only 1 of 4 devices found by i2cscanner.c

Postby kolban » Wed Mar 01, 2017 7:28 pm

Aha ... and THERE is the issue ... the current FreeRTOS Tick rate is 1000HZ, 1KHz or 1 tick per milliseconds ... see:

https://github.com/espressif/esp-idf-te ... onfig#L126

So what this means is that your sdkconfig/make menuconfig is not the default with respect to the latest available ESP-IDF-Template.

When creating new projects, I do not recommend copying an existing project from your file system and then tweaking it. Rather, extract/download the latest ESP-IDF-Template for each new project you build.
Free book on ESP32 available here: https://leanpub.com/kolban-ESP32

Scalpel78
Posts: 51
Joined: Sun Feb 26, 2017 7:31 am

Re: Issues with I2C? Only 1 of 4 devices found by i2cscanner.c

Postby Scalpel78 » Wed Mar 01, 2017 9:57 pm

Aha, very nicely troubleshooted.

I did infact copy this folder based from a previous project. The template I'm working out from is about 25 days old, did the default value get changed more recently than that?

User avatar
kolban
Posts: 1683
Joined: Mon Nov 16, 2015 4:43 pm
Location: Texas, USA

Re: Issues with I2C? Only 1 of 4 devices found by i2cscanner.c

Postby kolban » Wed Mar 01, 2017 10:58 pm

Interestingly, if we select the line and then click blame ... direct link here:

https://github.com/espressif/esp-idf-te ... onfig#L126

We see that the line has never changed from its original value created on 2016-08-18. However, that doesn't mean that something else somewhere in the repository didn't over-ride that value.
Free book on ESP32 available here: https://leanpub.com/kolban-ESP32

JanJansen47
Posts: 27
Joined: Sun Jan 01, 2017 9:21 pm

Re: Issues with I2C? Only 1 of 4 devices found by i2cscanner.c

Postby JanJansen47 » Fri Mar 03, 2017 1:26 pm

I noticed a reliability aspect during my endurance test of the MCP23017. After several hours the "flashing of leds "stops" while the I2C digitaWrite() receives the correct information. The rest of the endurance test (Oled displays) and more works as expected. Never used RTOS so my first concern was RTOS. Several tasks sending messages via a queue to MCP and Oleds works like a charm.

Reading this forum I checked the generic_i2c_rw.h and it defines following:

/* this is just a timeout. It doesn't actually wait 1 second */
#define BEGIN_TIMEOUT (1000 / portTICK_RATE_MS)


Following the discussion this timeout is very generous.
I added "extra" pullups for the I2C and wait .........yes I don't have a good scope

Thx for the excellent works for MCP and Oled!
Jan Jansen
Amsterdam
The Netherlands

Who is online

Users browsing this forum: Baidu [Spider], Majestic-12 [Bot], sterisa and 288 guests