Difference between revisions of "I2C"
From Autopilot Wiki
(Created page with "This page is a stub! This page contains basic information about using I2C devices on the Raspberry Pi == Enabling I2C == See the "i2c" script (python -m autopilot.setup.run...") |
|||
Line 12: | Line 12: | ||
: <syntaxhighlight lang="bash">sudo sed -i '$s/$/\ni2c-dev/' /etc/modules</syntaxhighlight> | : <syntaxhighlight lang="bash">sudo sed -i '$s/$/\ni2c-dev/' /etc/modules</syntaxhighlight> | ||
* Enable i2c with d2param and modprobe | * Enable i2c with d2param and modprobe | ||
− | : <syntaxhighlight lang="bash">sudo dtparam i2c_arm=on | + | : <syntaxhighlight lang="bash">sudo dtparam i2c_arm=on |
− | + | sudo modprobe i2c-dev</syntaxhighlight> | |
* **Optional:** Increase i2c baudrate to 100kHz, set i2c_arm_baudrate=100000 in /boot/config.txt | * **Optional:** Increase i2c baudrate to 100kHz, set i2c_arm_baudrate=100000 in /boot/config.txt | ||
: <syntaxhighlight lang="bash">sudo sed -i '$s/$/\ni2c_arm_baudrate=100000/' /boot/config.txt </syntaxhighlight> | : <syntaxhighlight lang="bash">sudo sed -i '$s/$/\ni2c_arm_baudrate=100000/' /boot/config.txt </syntaxhighlight> |
Revision as of 04:39, 12 February 2021
This page is a stub!
This page contains basic information about using I2C devices on the Raspberry Pi
Enabling I2C
See the "i2c" script (python -m autopilot.setup.run_script i2c)
- Uncomment dtparam=i2c_arm=on in /boot/config.txt
sudo sed -i 's/^#dtparam=i2c_arm=on/dtparam=i2c_arm=on/g' /boot/config.txt'
- Add i2c-dev to /etc/modules
sudo sed -i '$s/$/\ni2c-dev/' /etc/modules
- Enable i2c with d2param and modprobe
sudo dtparam i2c_arm=on sudo modprobe i2c-dev
- **Optional:** Increase i2c baudrate to 100kHz, set i2c_arm_baudrate=100000 in /boot/config.txt
sudo sed -i '$s/$/\ni2c_arm_baudrate=100000/' /boot/config.txt