Search code examples
linuxubuntuarmi2cbaud-rate

How to set up the baud rate for i2c-bus in Linux?


I have an ARM-computer which is based on the riko-3288 processor. I also have the Ubuntu image for the device with a custom kernel (without the module system).

I am currently trying to set a baud rate of up to 100KHz for the i2c-bus. I'm not an expert in Linux and I don't know what I have to do for it. The i2c-bus works with higher baud rate, I think it's more than 1MHz.

I've read that I must write a command like this "dtparam=i2c_arm=on,i2c_arm=on_baudrate=100000" in the boot-loading file. My boot-loading file bellow:

{boot-partition}/extlinux/extlinux.conf

label kernel-4.4
    kernel /zImage
    fdt /rk3288-miniarm.dtb
    append  earlyprintk console=tty1 console=ttyS2,115200n8 rw root=/dev/mmcblk1p7 rootfstype=ext4 init=/sbin/init

I tried past the command to the append string and I tried some different commands for it, but nothing works.

Could you tell me how I can change the baud rate for the i2c-bus?

P.S. And does someone know how to get the baud rate in the operation system?


Solution

  • I found the easy solution here. http://www.chip-community.org/index.php/Troubleshooting#I2C_.2F_TWI_problems

    For my cause:

    sudo apt update
    sudo apt install device-tree-compiler
    sudo mount /dev/mmcblk1p6 /mnt # {boot-partition}
    sudo cp /mnt/rk3288-miniarm.dtb /boot/rk3288-miniarm.dtb.bak
    sudo fdtput --type u /mnt/rk3288-miniarm.dtb i2c4 clock-frequency 50000
    sudo systemctl reboot