ESP32 read I2C speed increase

For general Flowcode discussion that does not belong in the other sections.
stefan.erni
Valued Contributor
Posts: 957
http://meble-kuchenne.info.pl
Joined: Wed Dec 02, 2020 10:53 am
Has thanked: 186 times
Been thanked: 210 times

Re: ESP32 read I2C speed increase

Post 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

mnfisher
Valued Contributor
Posts: 1401
Joined: Wed Dec 09, 2020 9:37 pm
Has thanked: 129 times
Been thanked: 692 times

Re: ESP32 read I2C speed increase

Post by mnfisher »

Did it work? Any benefits?

Martin

stefan.erni
Valued Contributor
Posts: 957
Joined: Wed Dec 02, 2020 10:53 am
Has thanked: 186 times
Been thanked: 210 times

Re: ESP32 read I2C speed increase

Post 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
scope_99.png (43.22 KiB) Viewed 1535 times

mnfisher
Valued Contributor
Posts: 1401
Joined: Wed Dec 09, 2020 9:37 pm
Has thanked: 129 times
Been thanked: 692 times

Re: ESP32 read I2C speed increase

Post 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

stefan.erni
Valued Contributor
Posts: 957
Joined: Wed Dec 02, 2020 10:53 am
Has thanked: 186 times
Been thanked: 210 times

Re: ESP32 read I2C speed increase

Post 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
scope_107.png (42.21 KiB) Viewed 1459 times
From an ESP32 and Python compiler, mega long long time break... :)
scope_100.png
scope_100.png (41.71 KiB) Viewed 1459 times

mnfisher
Valued Contributor
Posts: 1401
Joined: Wed Dec 09, 2020 9:37 pm
Has thanked: 129 times
Been thanked: 692 times

Re: ESP32 read I2C speed increase

Post 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

stefan.erni
Valued Contributor
Posts: 957
Joined: Wed Dec 02, 2020 10:53 am
Has thanked: 186 times
Been thanked: 210 times

Re: ESP32 read I2C speed increase

Post 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
2025-02-19_08-44-26.PNG (615.09 KiB) Viewed 1444 times
2025-02-19_08-44-12.PNG
2025-02-19_08-44-12.PNG (732.68 KiB) Viewed 1444 times

mnfisher
Valued Contributor
Posts: 1401
Joined: Wed Dec 09, 2020 9:37 pm
Has thanked: 129 times
Been thanked: 692 times

Re: ESP32 read I2C speed increase

Post by mnfisher »

That should allow a faster read rate - hopefully. The gyro might have a maximum update speed?

Martin

stefan.erni
Valued Contributor
Posts: 957
Joined: Wed Dec 02, 2020 10:53 am
Has thanked: 186 times
Been thanked: 210 times

Re: ESP32 read I2C speed increase

Post 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
thumbnail_IMG_4067.jpg (162.12 KiB) Viewed 1191 times

mnfisher
Valued Contributor
Posts: 1401
Joined: Wed Dec 09, 2020 9:37 pm
Has thanked: 129 times
Been thanked: 692 times

Re: ESP32 read I2C speed increase

Post by mnfisher »

The esp32-p4 should support i3c.

Flowcode (v11!) too?

Post Reply