DDR Clock Adjustment

1. Brief DDR spec. of ODROID-C2 and available DDR clock sets

  • The DDR parts of C2 support max DDR3-1866 (CL - tRCD - tRP : 13-13-13) and the limit of max DDR clock is 933MHz based on DDR part spec.
  • Existing DDR clock and timing : 912MHz (912×2=1824) / 13-13-13

Here is the available DDR clock sets you can test.

DDR Clock CL - tRCD - tRP
1104 MHz 14-14-14
912 MHz 13-13-13
792 MHz 11-11-11
408 MHz 7-7-7

Max ddr clock based on DDR parts of C2 is 933MHz.

So, when you run with DDR clock 1104MHz, system stability can be unstable depends on ddr parts of each board, because it's over-clocking value so 1104MHz is not guaranteed for system stability.

2. Update Guide (1) for Ubuntu

This section is for Ubuntu. First, download c2_update_ddrclk.sh to your root filesystem.

$ wget http://dn.odroid.com/S905/BootLoader/ODROID-C2/c2_update_ddrclk.sh
$ chmod +x ./c2_update_ddrclk.sh

The usage of c2_update_ddrclk.sh is as following.

Usage : ./c2_update_ddrclk.sh  < DDR_CLK (1104 | 912 | 792 | 408) >

After updating, you must run reboot the system.

$ ./c2_update_ddrclk.sh 1104
$ reboot
c2_update_ddrclk.sh

Here is c2_update_ddrclk.sh.

c2_update_ddrclk.sh
#!/bin/sh
#
# Copyright (C) 2016 Hardkernel Co,. Ltd
# Joy Cho <joy.cho@hardkernel.com>
#
# SPDX-License-Identifier:      GPL-2.0+
#
# update ddr clock for Ubuntu
#
 
if [ -z $1 ]; then
        echo "Usage ./c2_update_ddrclk.sh <DDR_CLK (1104 | 912 | 792 | 408)>"
        exit 1
fi
 
if [ $1 != 1104 -a $1 != 912 -a $1 != 792 -a $1 != 408 ]; then
        echo "Wrong DDRCLK! Usage ./c2_update_ddrclk.sh <DDR_CLK (1104 | 912 | 792 | 408)>"
        exit 1
fi
 
DDRCLK=$1
 
bl1=/tmp/bl1.bin.hardkernel.$DDRCLK
tmp=/tmp/temp.bin
 
##### 1. check the current DDR clock ####
dd if=/dev/mmcblk0 of=$tmp bs=1 count=2 skip=43530 status=none
CUR_DDRCLK=$(hexdump -e '"%d"' $tmp)
 
if [ $DDRCLK -eq $CUR_DDRCLK ]; then
        echo "current ddr clk is already set as $DDRCLK MHz"
        exit 1
fi
 
echo "existing DDR clk is $CUR_DDRCLK"
 
##### 2. download bl1 binary from dn server ####
wget -P /tmp/ http://dn.odroid.com/S905/BootLoader/ODROID-C2/bl1.bin.hardkernel.$DDRCLK
if [ ! -f $bl1 ];then
        echo "error: bl1 binary doesn't exist"
        exit 1
fi
 
dd if=$bl1 of=/dev/mmcblk0 bs=1 count=442 status=none
dd if=$bl1 of=/dev/mmcblk0 bs=512 skip=1 seek=1 status=none
 
echo "Update done!"
 
##### 3. check the updated DDR clock ####
echo "Now let's check if update has been completed..."
 
dd if=/dev/mmcblk0 of=$tmp bs=1 count=2 skip=43530 status=none
 
CUR_DDRCLK=$(hexdump -e '"%d"' $tmp)
echo "updated DDR clk is $CUR_DDRCLK"
 
if [ $DDRCLK != $CUR_DDRCLK ]; then
	echo "updating DDR clock FAIL!! Expected : $DDRCLK, Updated : $CUR_DDRCLK"
else
	echo "updating DDR clock has been completed!!!"
fi
 
rm $bl1
rm $tmp

3. Update Guide (2) for Android

This section is for Android. First, download c2_update_ddrclk_android.sh as following.

Run Terminal Emulator application on your C2 board.

# su
# mount -o rw,remount /
# wget http://dn.odroid.com/S905/BootLoader/ODROID-C2/c2_update_ddrclk_android.sh
$ chmod 755 ./c2_update_ddrclk_android.sh

The usage of c2_update_ddrclk_android.sh is as following.

Usage : ./c2_update_ddrclk_android.sh  < DDR_CLK (1104 | 912 | 792 | 408) >

After updating, you must run reboot the system.

$ ./c2_update_ddrclk_android.sh 1104
$ reboot
c2_update_ddrclk_android.sh

Here is the script, c2_update_ddrclk_android.sh.

c2_update_ddrclk_android.sh
#!/bin/sh
#
# Copyright (C) 2016 Hardkernel Co,. Ltd
# Joy Cho <joy.cho@hardkernel.com>
#
# SPDX-License-Identifier:      GPL-2.0+
#
# update ddr clock for Android
#
 
if [ -z $1 ]; then
        echo "Usage ./c2_update_ddrclk_android.sh <DDR_CLK (1104 | 912 | 792 | 408)>"
        exit 1
fi
 
if [ $1 != 1104 -a $1 != 912 -a $1 != 792 -a $1 != 408 ]; then
        echo "Wrong DDRCLK! Usage ./c2_update_ddrclk_android.sh <DDR_CLK (1104 | 912 | 792 | 408)>"
        exit 1
fi
 
DDRCLK=$1
 
bl1=/bl1.bin.hardkernel.$DDRCLK
tmp=/temp.bin
 
##### 1. check the current DDR clock ####
dd if=/dev/block/mmcblk0 of=$tmp bs=1 count=2 skip=43530
CUR_DDRCLK=$(hexdump -e '"%d"' $tmp)
 
if [ $DDRCLK -eq $CUR_DDRCLK ]; then
        echo "current ddr clk is already set as $DDRCLK MHz"
        exit 1
fi
 
echo "existing DDR clk is $CUR_DDRCLK"
 
##### 2. download bl1 binary from dn server ####
wget http://dn.odroid.com/S905/BootLoader/ODROID-C2/bl1.bin.hardkernel.$DDRCLK
if [ ! -f $bl1 ];then
        echo "error: bl1 binary doesn't exist"
        exit 1
fi
 
dd if=$bl1 of=/dev/block/mmcblk0 bs=1 count=442
dd if=$bl1 of=/dev/block/mmcblk0 bs=512 skip=1 seek=1
 
echo "Update done!"
 
##### 3. check the updated DDR clock ####
echo "Now let's check if update has been completed..."
 
dd if=/dev/block/mmcblk0 of=$tmp bs=1 count=2 skip=43530
 
CUR_DDRCLK=$(hexdump -e '"%d"' $tmp)
echo "updated DDR clk is $CUR_DDRCLK"
 
if [ $DDRCLK != $CUR_DDRCLK ]; then
	echo "updating DDR clock FAIL!!! Expected : $DDRCLK, Updated : $CUR_DDRCLK"
else
	echo "updating DDR clock has been completed!!!"
fi
 
rm $bl1
rm $tmp

4. How to confirm bl1 boot with the new DDR clock has been updated well

Wht the output message while updating with c2_update_ddrclk.sh, you can confirm if update is done with the new DDR clock you choose as following.

$ ./c2_update_ddrclk.sh  1104

existing DDR clk is 912   <<<------
.....
.....
Update done!
Now let's check if update has been completed...
updated DDR clk is 1104 <<<------
updating DDR clock has been completed!!!

After reboot, you can check the DDR configuration using the following logs of boot loader if you have a usb-uart module kit.

BL2 Built : 11:44:26, Nov 25 2015. 
Board ID = 8
set vcck to 1100 mv
set vddee to 1070 mv
CPU clk: 1536MHz
DDR channel setting: DDR0 Rank0+1 same
DDR0: 2048MB(auto) @ 912MHz(2T)-13
en/c2_adjust_ddrclk.txt · Last modified: 2016/09/22 19:35 by joy.cho
CC Attribution-Share Alike 3.0 Unported
Driven by DokuWiki Recent changes RSS feed Valid CSS Valid XHTML 1.0