Page 2 of 2

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

Posted: Wed Mar 01, 2017 6:37 pm
by Scalpel78
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

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

Posted: Wed Mar 01, 2017 7:28 pm
by kolban
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.

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

Posted: Wed Mar 01, 2017 9:57 pm
by Scalpel78
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?

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

Posted: Wed Mar 01, 2017 10:58 pm
by kolban
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.

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

Posted: Fri Mar 03, 2017 1:26 pm
by JanJansen47
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!