How to change I2c speed

I’m testing Colibri iMX6ULL 512MB IT with Aster Carrier Board with a C/C++ project.

The I2c works fine but I need to change speed from 100Khz to 400Khz.

How can I do this ?
Device tree is the only solution ?

Yes you need to adjust a clock-frequency property for desired I2C channel

Hello @Massimo,

As @alex.tx said, you need to modify the device tree for this.

Before I can help you further, could you please send me the output of tdx-info command (more info here) from which you can get all the hardware and software information?

The cleanest way to add modifications to the device tree would be using a device tree overlay file so that you don’t have to mess up with the original device tree file. After you write the overlay file you just need to build it and deploy it on to the module. This process depends on what OS you have installed on the module - whether it is a Yocto reference image or TorizonCore. Obviously, Torizon makes the whole workflow a lot simpler compared to building the device tree files from the source. Here you will find more details about writing, building, and deploying device tree overlays for TorizonCore using our TorizonCore Builder tool. On the other hand, if you are using one of our Yocto-based reference images, you may find more information here.
On this page, you will also find some more information regarding deploying the overlays and also an example of how an overlay file should look like.

Please let us know if these links could get you started and also feel free to ask if you have more questions :slight_smile:

Hello Rudhi,
this is the tdx-info output:

root@colibri-imx6ull-14926715:~# tdx-info

Software summary
Bootloader:               U-Boot
Kernel version:           6.1.22-6.2.0+git.3b29299e5f60 #1 SMP Thu Mar 30 10:49:31 UTC 2023
Kernel command line:      user_debug=30 ubi.mtd=ubi root=ubi0:rootfs rw rootfstype=ubifs ubi.fm_autoconvert=1 console=tty1 console=ttymxc0,115200n8 consoleblank=0 video=mxsfb:640x480M-16@60
Distro name:              NAME="TDX Wayland with XWayland Upstream"
Distro version:           VERSION_ID=6.2.0-build.6
Hostname:                 colibri-imx6ull-14926715

Hardware info
HW model:                 Toradex Colibri iMX6ULL 256/512MB on Colibri Evaluation Board V3
Toradex version:          0044 V1.1A
Serial number:            14926715
Processor arch:           armv7l
root@colibri-imx6ull-14926715:~# tdx-info -dt

Device tree
Device tree enabled:      -
Compatible string:        toradex,colibri-imx6ull-evalfsl,imx6ull
Device trees available:   -

Device tree overlays
Overlays enabled:         -
Overlays available:       -

Hello @Massimo,

Thanks for your answer.

I just noticed that you are using the Colibri iMX6ULL module with NAND flash memory. The NAND modules do not support device tree overlays.

For the iMX6ULL, the device tree is stored in an ubifs partition. So the solution would be to modify the device tree directly, then compile it to a dtb and then update the ubi volume. This is documented here.
Here is an article on how to modify the device tree itself.

I hope that helps.

Hello @Massimo,

Hope you are doing well! Do you have any updates on this topic?