Overview

Inputs and Outputs

The RTC must be powered from the BeagleBone's 5V supply (note it must be powered from the DC adapter, or else I2C bus will hang, as there is not enough current provided by the usb bus to power the RTC). The RTC uses an I2C interface to communicate with the BBB.

Bone Wiring

On boot BBB is connected power from the DC power adapter, therefore it loads the correct /dev/rtc modules.

serviceSetup.sh

This file manipulates the rtc-ds1307.service to run from a paramaterized directory. It copies over clock_init.sh, and rtc-ds1307.service to the given directory, and manipulates the variables inside of the service file to react accordingly. It then enables the service, so that it will run at startup.

In order to manually start the service execute:
systemctl start rtc-ds1306.service
and stop:
systemctl stop rtc-ds1306.service

#!/bin/bash
# By Alex Alvarez, alvarep@rose-hulman.edu
# This script creates a new directory if passed as the parameter, and places the rtc script and service files in those given directories. It also manipulates the service file such that the working directories change with the given directory parameter.
# If no paramter is given the working directory is used as the service location
if [ "$1" ]; then
DIR=$2
$(mkdir $2)
else
DIR=$(pwd)
fi
SED_ARG="-e 's@WorkingDirectory=.*@WorkingDirectory=$DIR@' rtc-ds1307.service"
eval sed "$SED_ARG" > tmp.txt
mv tmp.txt rtc-ds1307.service
cp rtc-ds1307.service $DIR
cp clock_init.sh $DIR
systemctl enable $DIR/rtc-ds1307.service