title: Beaglebone Black: RTC DS1307/DS1338 gives error in Android at bootup
body: <p>I am using the TI-Android-JB-4.2.2-DevKit-4.1.1 to build an Android for Beaglebone Black which works perfectly well. I try to use the RTC-Cape (<a href="http://elinux.org/CircuitCo:RTC_Cape" rel="nofollow">http://elinux.org/CircuitCo:RTC_Cape</a>). With the "onboard" Angström on the BBB I was able to set and read the RTC manually, therefore I assume that the hardware is ok.</p>
  
  <p>To put the RTC in operation with Android, I added in the file <code>kernel/arch/arm/mach-omap2/board-am335xevm.c</code> in the struct</p>
  
  <pre><code>static struct i2c_board_info __initdata am335x_i2c0_boardinfo[]
  </code></pre>
  
  <p>at the end</p>
  
  <pre><code>{
      I2C_BOARD_INFO("ds1338", 0x68),
  },
  </code></pre>
  
  <p>In <code>kernel/arch/arm/configs/am335x_evm_android_defconfig</code> I activated the <code>CONFIG_RTC_DRV_DS1307</code> (<code>CONFIG_RTC_DRV_DS1307=y</code>) and deactivated the <code>CONFIG_RTC_DRV_OMAP</code>.</p>
  
  <p>At bootup it says</p>
  
  <pre><code>&lt;4&gt;[    1.880767] rtc-ds1307: probe of 1-0068 failed with error -5
  &lt;6&gt;[    1.886779] i2c /dev entries driver
  </code></pre>
  
  <p>and</p>
  
  <pre><code>&lt;3&gt;[    2.306884] drivers/rtc/hctosys.c: unable to open rtc device (rtc0)
  </code></pre>
  
  <p>I tried to adapt the changes from this Beaglebone/Linux mailing list: <a href="https://groups.google.com/forum/#!msg/beagleboard/DegreEdtI-Q/ZEdFLNnuTvMJ" rel="nofollow">https://groups.google.com/forum/#!msg/beagleboard/DegreEdtI-Q/ZEdFLNnuTvMJ</a>.</p>
  
  <p>I am new to Android/Linux kernel configuration. How do I have to include and configure the RTC in the kernel properly that it is usable at bootup?</p>
  
  <p>Regards</p>
  
  <p>Matthias</p>
  
  <p><strong>Update</strong></p>
  
  <p>It turns out the DS1338 on the Beaglebone Balck Cape is in fact connected to 17 and 18 on P9, which is I2C1 or i2c-2 on Android. This bus is deactivated by default in Android. As a short workaround I cut the printed curcuit paths and wired it to 19 and 20 on P9 (I2C2 oder i2c-3).</p>
  
  <p>Then I moved the <code>I2C_BOARD_INFO</code> block to</p>
  
  <pre><code>static struct i2c_board_info am335x_i2c2_boardinfo[]
  </code></pre>
  
  <p>The compiled kernel now reads the time from the RTC at bootup.</p>
  
  <p>Thanks very much for the hint, user3926077.</p>
  
  <p>A proper solution would be to activate the i2c-2 in the Android kernel and put the <code>I2C-BOARD_INFO</code> block in <code>static struct i2c_board_info am335x_i2c1_boardinfo[]</code>. Unfortunately i do not know how to achieve this at the moment and we need the RTC only for debugging, so the soldering solution works for us.</p>