Hello everyone,
We used the i2c of RP to control some slave devices. Now, we find out that bitrate of I2C is 400k, which is too fast for our application. Is there a possibility to lower the rate to 100k? Thank you very much!
Best,
Chang
I2C bitrate
-
- Posts: 799
- Joined: Sat May 23, 2015 5:22 pm
Re: I2C bitrate
It should be possible by specifying the following Linux kernel boot argument:
Boot arguments can be added by editing the bootargs variable in u-boot.script:
https://github.com/RedPitaya/RedPitaya/ ... oot.script
Code: Select all
cdns-i2c.baudrate=100000
https://github.com/RedPitaya/RedPitaya/ ... oot.script
-
- Posts: 31
- Joined: Mon Apr 18, 2016 12:30 pm
Re: I2C bitrate
Thanks for your fast response.
May I ask you where could I put the boot argument?
I didn't find the patches folder on the SD card. There is a boot.script in the sd card. I open the boot.script.
I add the argument in the file, but the RP doesn't work anymore.
Could you please give me an example?
Best,
Chang
May I ask you where could I put the boot argument?
Code: Select all
cdns-i2c.baudrate=100000
Code: Select all
setenv high 0x1c000000
setenv fdt_high ${high}
setenv initrd_high ${high}
echo Loading from SD card (FAT file system) to memory
mmcinfo
fatload mmc 0 0x2001000 uImage
fatload mmc 0 0x4000000 devicetree.dtb
echo Booting Linux kernel with ramdisk and devicetree
setenv bootargs console=ttyPS0,115200 root=/dev/mmcblk0p2 ro rootfstype=ext4 earlyprintk rootwait
setenv sdboot bootm 0x2001000 - 0x4000000
setenv bootdelay 0
bootd
Could you please give me an example?
Best,
Chang
-
- Posts: 799
- Joined: Sat May 23, 2015 5:22 pm
Re: I2C bitrate
I'd add it to the bootargs variable:
Code: Select all
setenv bootargs console=ttyPS0,115200 root=/dev/mmcblk0p2 ro rootfstype=ext4 earlyprintk rootwait cdns-i2c.baudrate=100000
-
- Posts: 799
- Joined: Sat May 23, 2015 5:22 pm
Re: I2C bitrate
Correction to my previous posts. Apparently, I was looking at a wrong place and the cdns-i2c driver doesn't have baudrate parameter.
It's still possible to change the rate via the device tree:
It's still possible to change the rate via the device tree:
- convert devicetree.dtb to devicetree.dts
Code: Select all
dtc -I dtb -O dts -o devicetree.dts devicetree.dtb
- edit devicetree.dts and replace
with
Code: Select all
clock-frequency = <0x61a80>;
Code: Select all
clock-frequency = <0x186a0>;
- convert devicetree.dts to devicetree.dtb
dtc -I dts -O dtb -o devicetree.dtb devicetree.dts
-
- Posts: 31
- Joined: Mon Apr 18, 2016 12:30 pm
Re: I2C bitrate
Hi Pavel,
It works perfectly with the revised devicetree.dtb. Thank you very much!
Best,
Chang
It works perfectly with the revised devicetree.dtb. Thank you very much!
Best,
Chang
jadalnie klasyczne ekskluzywne meble wypoczynkowe do salonu ekskluzywne meble tapicerowane ekskluzywne meble do sypialni ekskluzywne meble włoskie
Who is online
Users browsing this forum: No registered users and 11 guests