I2C baud rate

Runtime
switcher
2014-08-13
2020-02-13
  • switcher

    switcher - 2014-08-13

    Hi,

    How can I change I2C baud rate permanently?

    Default is 400kHz.

    I tried:
    sudo modprobe i2c_bcm2708 baudrate=100000
    sudo bash -c "echo options i2c_bcm2708 baudrate=100000 > /etc/modprobe.d/i2c.conf"

    But this doesn't work. After reboot, baud rate is set to 400kHz again.

    Thank you.

    BR
    Zdenko.

     
  • eschwellinger

    eschwellinger - 2014-08-13

    Hi Zdenko,

    you need to change this in:

    /etc/init.d/codesyscontrol

    snippet:

            make_mknod
            killall codesyscontrol.bin > /dev/null;
            export PlcConfigFile=/etc/CODESYSControl.cfg
            echo bcm2708_i2c.0 > /sys/bus/platform/drivers/bcm2708_i2c/unbind
            echo 400000 > /sys/module/i2c_bcm2708/parameters/baudrate
            echo bcm2708_i2c.0 > /sys/bus/platform/drivers/bcm2708_i2c/bind
    

    BR
    Edwin

     
  • switcher

    switcher - 2014-08-14

    Thank you Edwin! It works .

    BR,
    Zdenko.

     
  • kimao

    kimao - 2014-09-29

    Hello
    I'm trying to change the i2c baud rate to 100kHz following the example above. I have copied the code in to the "codesyscontrol" file but when restarting the pi, codesys does not work.
    Is this how the change was intended? see attached picture.

    Thank

    IMG: codesyscontrol.png

     
  • switcher

    switcher - 2014-11-07

    Hi,

    it looks ok.

    You don't have to copy anything.
    Just change parameter in /etc/init.d/codesyscontrol:
    echo 400000 > /sys/module/i2c_bcm2708/parameters/baudrate
    to:
    echo 100000 > /sys/module/i2c_bcm2708/parameters/baudrate

    and save file, then do reboot.
    It should work.

    Best regards,
    Zdenko.

     
  • Stefan2

    Stefan2 - 2020-02-07

    Hi,

    did the location of

    echo 400000 > /sys/module/i2c_bcm2708/parameters/baudrate
    

    moved?

    can't find it anymore in

    /etc/init.d/codesyscontrol

    BR Stefan

     
  • Anonymous - 2020-02-12

    Originally created by: carlos.rivera

    Stefan2 hat geschrieben:
    Hi,
    did the location of

    echo 400000 > /sys/module/i2c_bcm2708/parameters/baudrate
    

    moved?
    can't find it anymore in
    /etc/init.d/codesyscontrol
    BR Stefan

    Stefan were you be able to change the baudrate at the end? does anyone knows where to change it for the new raspberry. I can find /etc/init.d/codesyscontrol but cannot see this line echo 400000 > /sys/module/i2c_bcm2708/parameters/baudrate. Thank you.

     
  • eschwellinger

    eschwellinger - 2020-02-13

    Hi,
    we have removed it,
    it is more feasible to set it in /boot/config.txt as RASBIAN offer to do.

    BR
    Edwin

     
  • Stefan2

    Stefan2 - 2020-02-13

    Hi Edwin,

    thanks for Reply.

    I'll check /boot/config.txt for that.

    BR Stefan

     
  • Anonymous - 2020-02-13

    Originally created by: carlos.rivera

    Edwin Schwellinger hat geschrieben:
    Hi,
    we have removed it,
    it is more feasible to set it in /boot/config.txt as RASBIAN offer to do.
    BR
    Edwin

    Thanks so much Edwin. It worked.

     

Log in to post a comment.