Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                

Amc 6821

Download as odt, pdf, or txt
Download as odt, pdf, or txt
You are on page 1of 4

Interfacing Odroid-C2 with AMC6821 (Fan Controller)

(I2C Communication)

Step 1:Switch to Root User

odroid@odroid64:~$ su

Password: [Default Password: Odroid]


root@odroid64:/home/odroid#

Step 2: Install Depended Packages ( git,gcc )

root@odroid64:~# apt-get update

root@odroid64:~# apt-get install lzop build-essential libncurses5-dev

Install Git:
root@odroid64:~# apt-get install git

Install alternative gcc-4.9 :


root@odroid64:~# apt-get install gcc-4.9

Step 3:Set Priority for gcc and make high priority for gcc-4.9

root@odroid64:~# update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-5 10


root@odroid64:~# update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-4.9 20
root@odroid64:~# update-alternatives --config gcc
There are 2 choices for the alternative gcc (providing /usr/bin/gcc).

Selection Path Priority Status


------------------------------------------------------------
*0 /usr/bin/gcc-4.9 20 auto mode
1 /usr/bin/gcc-4.9 20 manual mode
2 /usr/bin/gcc-5 10 manual mode

Press <enter> to keep the current choice[*], or type selection number: ^C


root@odroid64:~#

Step 4: Check gcc-4.9 is selected by checking gcc version:


root@odroid64:~# gcc -v

Using built-in specs.


::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
gcc version 4.9.3 (Ubuntu/Linaro 4.9.3-13ubuntu2)

Step 5: Download the kernel source files from git:

root@odroid64:~# cd /usr/src
root@odroid64:/usr/src# git clone --depth 1 https://github.com/hardkernel/linux.git -b
odroidc2-3.14.y
Cloning into 'linux'...
remote: Counting objects: 51208, done.
remote: Compressing objects: 100% (47984/47984), done.
remote: Total 51208 (delta 3707), reused 20881 (delta 2572), pack-reused 0
Receiving objects: 100% (51208/51208), 139.38 MiB | 2.96 MiB/s, done.
Resolving deltas: 100% (3707/3707), done.
Checking connectivity... done.
Checking out files: 100% (48395/48395), done.

Step 6: Change to linux direcory

root@odroid64:/usr/src# cd linux/
root@odroid64:/usr/src/linux#

Step 7: Enabling Driver Support for (AMC6821) through following steps

root@odroid64:/usr/src/linux# make odroidc2_defconfig


#
# configuration written to .config
#

Step 8: Enabling Driver Support for (AMC6821)

root@odroid64:/usr/src/linux# make menuconfig

Now using Down Arrow key Choose the Device Drivers and then Enter
Now using Down Arrow key Choose the Hardware Monitoring Support and then Enter

Now using Down Arrow key Choose the Texas Instruments AMC6821 and then press Y

Now Press S to Save and press E to Exit from curent window until it shows main window
finally press Esc until you see this window

Here press Y to save configuration


Step 9: Now make and Install the modules

root@odroid64:/usr/src/linux# make -j4


[Note:it may take upto 60 Mins. For the first time]
root@odroid64:/usr/src/linux# make modules_install

Step 10: Copy the compiled files to the boot drive and reboot

root@odroid64:/usr/src/linux#cp -f arch/arm64/boot/Image
arch/arm64/boot/dts/meson64_odroidc2.dtb /media/boot/

root@odroid64:/usr/src/linux#sync
root@odroid64:/usr/src/linux#reboot

Step 11: Now install required tools for i2c

root@odroid64:/usr/src/linux#sudo apt-get install device-tree-compiler i2c-tools

Step 12: Check i2cdetect to verify i2c library (Example Address : 68 for rtc-ds1307)

root@odroidc2:/usr/src/linux# i2cdetect -y 1
[Note:1-we are using 1 I2C Device]
0 1 2 3 4 5 6 7 8 9 a b c d e f
00: -- -- -- -- -- -- -- -- -- -- -- -- --
10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
60: -- -- -- -- -- -- -- -- 68 -- -- -- -- -- -- --
70: -- -- -- -- -- -- -- --

Step 13:Now start i2c,amc6821 using modprobe

root@odroid64:/usr/src/linux#modprobe aml_i2c
root@odroid64:/usr/src/linux#modprobe i2c-dev
root@odroid64:/usr/src/linux#modprobe amc6821

Step 14: To enable AMC6821 on boot


root@odroidc2:/usr/src/linux#nano /etc/modules

[Paste the following content and save it by Ctrl+x and Y and Enter]
aml_i2c
i2c-dev
amc-6821

Step 15: root@odroidc2:/usr/src/linux#nano /etc/rc.local

[Paste the following content and save it by Ctrl+x and Y and Enter]
# Setup AMC6821
echo amc6821 0x4f > /sys/class/i2c-adapter/i2c-1/new_device
[Note: where 0x4f replace with your device address]

You might also like