Page 3 of 4
Re: ESP32 read I2C speed increase
Posted: Thu Feb 13, 2025 3:50 pm
by stefan.erni
I have IDF Version: v5.0.6 ...
On another computer I have 5.31 and it's compiling and running there.
I'm now trying to read data from the my IMU
Re: ESP32 read I2C speed increase
Posted: Mon Feb 17, 2025 7:57 am
by mnfisher
Did it work? Any benefits?
Martin
Re: ESP32 read I2C speed increase
Posted: Mon Feb 17, 2025 10:28 am
by stefan.erni
Hi Martin
Yes, it has improved,
but there is something extra at the end. I'll see what it is.
Do I have to start with FCD_ in the variables and take the definition out of the loop and put the variable definition at the beginning of the main?
It is very nice that I can set the clock to 1.2Mega
I assume that reading now only takes 120uSec, maybe a bit tight if I have to sample with 8Khz:)
Do you know how I can test this?
polling mode can help to reduce your 50 µs pause because it avoids the overhead of interrupts. If you want to test it, try portMAX_DELAY as timeout for i2c_master_cmd_begin()

- scope_99.png (43.22 KiB) Viewed 2788 times
Re: ESP32 read I2C speed increase
Posted: Mon Feb 17, 2025 11:21 am
by mnfisher
Yes - it sort of trades the delay at the beginning for one at the end.. A little quicker though..
Could use FC variables - local start with FCL_ global with FCV_ (capitalised name too)
Martin
Re: ESP32 read I2C speed increase
Posted: Wed Feb 19, 2025 1:09 pm
by stefan.erni
Hi Martin
I have additional measurements with FC10 and a PIC32 and with an ESP32 but with a Python compiler.
So Flowcode seems to work well.
I guess it's time to look at I3C
From a microchip PIC32MZ2048 and FC10, with two breaks:

- scope_107.png (42.21 KiB) Viewed 2712 times
From an ESP32 and Python compiler, mega long long time break...

- scope_100.png (41.71 KiB) Viewed 2712 times
Re: ESP32 read I2C speed increase
Posted: Wed Feb 19, 2025 1:47 pm
by mnfisher
It is odd isn't it...
Is maybe an issue with the transactional nature of i2c (I suspect none of the above support direct control of the i2c using Start, Stop etc - but it might be fun to try a chip that does)
Is there an SPI version??
Martin
Re: ESP32 read I2C speed increase
Posted: Wed Feb 19, 2025 2:20 pm
by stefan.erni
I'm still looking at an STM32F405
Yes I have a spi version of the chip

- 2025-02-19_08-44-26.PNG (615.09 KiB) Viewed 2697 times

- 2025-02-19_08-44-12.PNG (732.68 KiB) Viewed 2697 times
Re: ESP32 read I2C speed increase
Posted: Thu Feb 20, 2025 6:34 am
by mnfisher
That should allow a faster read rate - hopefully. The gyro might have a maximum update speed?
Martin
Re: ESP32 read I2C speed increase
Posted: Thu Feb 20, 2025 10:37 am
by stefan.erni
Hi Martin
Yes Accelero and Gyro can be used with 8kHz.
A problem is the size from the spi version, I2C is much smaler
and the I2C version is reaydy to use with I3C.
So I test first with the spi version an hope I3C with Flowcode will follow soon.
I will simply change the component Gyro_L3GD20 ( spi)
Size from both:

- thumbnail_IMG_4067.jpg (162.12 KiB) Viewed 2444 times
Re: ESP32 read I2C speed increase
Posted: Thu Feb 20, 2025 10:52 am
by mnfisher
The esp32-p4 should support i3c.
Flowcode (v11!) too?