element14 Community
element14 Community
    Register Log In
  • Site
  • Search
  • Log In Register
  • About Us
  • Community Hub
    Community Hub
    • What's New on element14
    • Feedback and Support
    • Benefits of Membership
    • Personal Blogs
    • Members Area
    • Achievement Levels
  • Learn
    Learn
    • Ask an Expert
    • eBooks
    • element14 presents
    • Learning Center
    • Tech Spotlight
    • STEM Academy
    • Webinars, Training and Events
    • Learning Groups
  • Technologies
    Technologies
    • 3D Printing
    • FPGA
    • Industrial Automation
    • Internet of Things
    • Power & Energy
    • Sensors
    • Technology Groups
  • Challenges & Projects
    Challenges & Projects
    • Design Challenges
    • element14 presents Projects
    • Project14
    • Arduino Projects
    • Raspberry Pi Projects
    • Project Groups
  • Products
    Products
    • Arduino
    • Avnet Boards Community
    • Dev Tools
    • Manufacturers
    • Multicomp Pro
    • Product Groups
    • Raspberry Pi
    • RoadTests & Reviews
  • Store
    Store
    • Visit Your Store
    • Choose another store...
      • Europe
      •  Austria (German)
      •  Belgium (Dutch, French)
      •  Bulgaria (Bulgarian)
      •  Czech Republic (Czech)
      •  Denmark (Danish)
      •  Estonia (Estonian)
      •  Finland (Finnish)
      •  France (French)
      •  Germany (German)
      •  Hungary (Hungarian)
      •  Ireland
      •  Israel
      •  Italy (Italian)
      •  Latvia (Latvian)
      •  
      •  Lithuania (Lithuanian)
      •  Netherlands (Dutch)
      •  Norway (Norwegian)
      •  Poland (Polish)
      •  Portugal (Portuguese)
      •  Romania (Romanian)
      •  Russia (Russian)
      •  Slovakia (Slovak)
      •  Slovenia (Slovenian)
      •  Spain (Spanish)
      •  Sweden (Swedish)
      •  Switzerland(German, French)
      •  Turkey (Turkish)
      •  United Kingdom
      • Asia Pacific
      •  Australia
      •  China
      •  Hong Kong
      •  India
      •  Korea (Korean)
      •  Malaysia
      •  New Zealand
      •  Philippines
      •  Singapore
      •  Taiwan
      •  Thailand (Thai)
      • Americas
      •  Brazil (Portuguese)
      •  Canada
      •  Mexico (Spanish)
      •  United States
      Can't find the country/region you're looking for? Visit our export site or find a local distributor.
  • Translate
  • Profile
  • Settings
Raspberry Pi
  • Products
  • More
Raspberry Pi
Raspberry Pi Forum Installing Code for PiFace Real Time Clock
  • Blog
  • Forum
  • Documents
  • Quiz
  • Events
  • Polls
  • Files
  • Members
  • Mentions
  • Sub-Groups
  • Tags
  • More
  • Cancel
  • New
Join Raspberry Pi to participate - click to join for free!
Featured Articles
Announcing Pi
Technical Specifications
Raspberry Pi FAQs
Win a Pi
Raspberry Pi Wishlist
Actions
  • Share
  • More
  • Cancel
Forum Thread Details
  • State Suggested Answer
  • Replies 52 replies
  • Answers 4 answers
  • Subscribers 665 subscribers
  • Views 5622 views
  • Users 0 members are here
  • raspberry_pi
Related

Installing Code for PiFace Real Time Clock

fc-element
fc-element over 8 years ago

Dear Element 14 Community.

All my Raspberry Pi devices (RPi 2, RPi Zero, and RPi 3 (planned) are running with the current Raspbian Jessie version. I have successfully installed PiFace Real Time Clock using the PiFace website instructions and GitHub.com software download on a number of RPi 2's and one of my three RPi Zero's.

 

I have recently continued the installations on another two RPi's and cannot continue because after these two lines:

1. chmod +x install-piface-real-time-clock.sh

2. sudo ./install-piface-real-time-clock.sh

 

The following new comments are returned: 1

1.. create new pifacertc init script to load time from PiFace RTC

2. Adding /etc/init.d/pifacertc .

3. install the pifacertc init script

4. enable I2c by using raspi-config

 

As I am a Linux beginner, can someone lead me through (expand) the coding of these lines so I may install PiFace RTC currently and in the future. The changelog on GitHub refers to a revision change but I am not knowledgable enough to understand why the install went through previously by not currently.

 

Thank you very much,

Frank.

  • Sign in to reply
  • Cancel
  • Workshopshed
    0 Workshopshed over 8 years ago

    Hi Frank,

    looking at that file it appears to be checking if the I2C system is enabled. That's the communications used to talk to the real time clock.

     

    raspi-config is a command line tool for changing the Pi's configuration. You can run that by typing

     

    sudo raspi-config

     

    You can the find the right screen to turn on I2C. It appears to be in the advanced options.

    • Cancel
    • Vote Up +1 Vote Down
    • Sign in to reply
    • Verify Answer
    • Reject Answer
    • Cancel
  • mconners
    0 mconners over 8 years ago

    Here was a little post I did about generic I2c and RTC on the Pi

     

    Enabling RTC on the Raspberry Pi 2

     

    Should be the same for the PI3

     

    Mike

    • Cancel
    • Vote Up +1 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
  • Former Member
    0 Former Member over 8 years ago

    Please note that the /etc/init.d folder is for the use of system service platforms like Upstart and Systemd (latest).  I would not put a script there.  If you want some low-level service to automatically start during the Linux boot process, the file /etc/rc.local is a better place to do this (somewhere before the `exit` command that is delivered in the installed rc.local).  On the other hand,  I cannot see the "GitHub.com software" you are talking about because you didn't mention the URL.  Please publish this.

     

    This one?

    https://github.com/jhowie/FreeBSDPiFaceRTC

     

    That one states to put the start up command in rc.local (good advice).

    • Cancel
    • Vote Up +1 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
  • fc-element
    0 fc-element over 8 years ago in reply to mconners

    I thank mconners for your speedy reply however the problem still occurs ater I2C was enabled at numerous stages of the procedure.

    Thankyou, Frank

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
  • fc-element
    0 fc-element over 8 years ago in reply to Workshopshed

    I thank Andy Clark (Workshopshed) for your speedy reply however the problem still occurs after I2C was enabled at numerous stages of the procedure.

    Thank you, Frank

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
  • mconners
    0 mconners over 8 years ago in reply to fc-element

    Are you following these instructions?

     

     

    https://github.com/piface/PiFace-Real-Time-Clock

     

    Mike

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
  • fc-element
    0 fc-element over 8 years ago in reply to Former Member

    Dear texadactyl

    I just now saw your referral to another website I can try and I will do so in the net hour. I don't now if this will be successful. I've never seen this on the web and it appears that I'll have to learn- not knowing what BSD means right now. I'd appreciate your comment about using this method instead of the one descibed below.

    But as to your comment " I cannot see the "GitHub.com software" you are talking about, here is the following:

    Starting Website to Add PiFace Real Time Clock
    http://www.piface.org.uk/products/piface_clock/

    Two Links (located towards bottom of site) were followed:

    1. Documentation (downloaded pdf File)

    2. PiFace Real Time Clock on GitHub
    https://github.com/piface/PiFace-Real-Time-Clock

    Restating the issue
    Previous installations of PiFace RTC on both RPi 2 and RPi Zero following the procedure listed above have worked successfully.

    Currently, during the installation of additional RPi Zero devices. I ran into a problem which prevented me to continue.
    After the command:

    chmod +x install-piface-real-time-clock.sh 

    no problem was rncountered. However after I added:

    sudo ./install-piface-real-time-clock.sh

    The following four lines were returned:

    create new pifacertc init script to load time from PiFace RTC
    Adding /etc/init.d/pifacertc .
    install the pifacertc init script
    enable I2c by using raspi-config
    (and also suggestions as how to inable I2C.

    Within https://github.com/piface/PiFace-Real-Time-Clock, the changemod lists two versions (revisions): v0.2.0 which involves /etc/init.d/pifacertc script and v0.1.0 which involves the /etc/rc.local script. I thoroughly agree that rc.local is the best "option" since this is the path that worked in the past (I guess).

    As I am a Linux beginner, is there any method to select or "grab" the first version or,  solving the present issue, can someone give me the line-by-line coding of the first two lines which involve the script creation so I may install PiFace RTC in the future. This is the one you have not recommended.

    Ill be glad to explain further if there still is a miscommunication on my part.
    Frank.

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
  • Former Member
    0 Former Member over 8 years ago in reply to fc-element

    I didn't mean that using an /etc/init.d/x script was invalid; it just runs the risk of becoming inoperative in the future if the service manager changes.  That is why user-level applications should avoid infrastructure folders unless they are willing to provide a methodology and documentation for each service manager in use by Unix and Linux.  I have done this too so I am no angel.  image

     

    "BSD" usually refers to University of California at Berkeley Unix as late as the 1980s, a precursor to Linux and MacOSX (based on BSD 4.4).

     

    Okay, I have seen the script.  It looks clearly written and very modular although it only provides a service start function (no stop or reload).  I'll stop being picky. 

     

    Having tried it myself, I just found out that this script is dependent on the OS being Raspbian.  Since I am currently running Ubuntu MATE on my Raspberry Pi, I could not go further.  It fails for me when it correctly diagnoses that the raspi-config service is missing.  I'll get out of the way and let you get help from folks who are using Raspbian.  Sorry that I couldn't be of more help.  If you have any general Linux questions, I can help you with that.  Maybe, I'll go back to Raspbian when I have a chance in the future.

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
  • Former Member
    0 Former Member over 8 years ago

    Are those all of the comments that are returned? Having a glance at the install script it seems there should be a piece saying to reboot and another demonstrating how to set the clock etc... If these are missing it would indicate that the install script has not completed correctly.

     

    Has the install script created the /etc/init.d/pifacertc file? check by typing cat /etc/init.d/pifacertc into a terminal window, there should be around 37 lines of text print out into the terminal as a result.

     

    If the installer hasnt completed succesfully it should be easy enough to replicate the procedure manually, everything is provided in that script to do that.

     

    p.s.the comments 1,2 and 3 that appear ate just the install script telling you where it is up to. Comment 4 is an instruction to you to run raspi-config, as I said above, there should also be more text below this

    • Cancel
    • Vote Up +1 Vote Down
    • Sign in to reply
    • Verify Answer
    • Reject Answer
    • Cancel
  • fc-element
    0 fc-element over 8 years ago in reply to Former Member

    Thanks for the response of the many users over the last 48 hrs. 
    Dear lucie tozer:

    Let me respond directly to your suggestion:

    I opened the /etc/init.d/pifacertc file in from the File Manager
    and typed cat /etc/init.d/pifacertc at the terminal.
    Both ways yielded:

    # !/bin/sh
    ### BEGIN INIT INFO
    # Provides:   pifacertc
    # Required-Start:    udev mountkernfs $remote_fs raspi-config
    # Required-Stop:  
    # Required-Start:    S
    # Default-Stop:
    # Short Description: Add the PiFace RTC
    # Description:          Add the PiFace RTC
    ### END INIT INFO

    . /lib/lsb/init-functions

    case "$1" in
       start)
           log_success_msg "Probe the i2c-dev"
           modprobe i2c-dev
           # Calibrate the clock ( default: 0x47).  See datasheet or MCP7940N
           log_success_msg "Calibrate the clock"
           i2cset -y 0x6f 0x08 0x47
           log_success_msg "Probe the mcp7941x driver
           modprobe i2c :mcp7941x
           log-success-msg "Add the mcp7941x device in the sys filesystem"
           #https://www.kernel.org/doc/Documentation/i2c/instantiating-devices
           echo mcp7941x 0x6f > /sys/class/i2c-dev/i2c-0/device/new_device
           log-success-msg "Synchronise the system clock and hardware RTC"
           hwclock --hctosys
           ;;
       stop)
           ;;
       restart)
           ;;
       force-reload)
           ;;
       #)
          echo "Usage: $0 start" >&2
          exit 3
          ;;
    esac

     

    I opened the /etc/init.d/rc.local file in from the File Manager
    and typed cat /etc/init.d/rc.local at the terminal.
    Both ways yielded:

    # !/bin/sh
    ### BEGIN INIT INFO
    # Provides:     rc.local
    # Required-Start:      $ all
    # Required-Stop:  
    # Required-Start:      2 3 4 5
    # Required-Stop:
    # Short Description:  Run /etc/rc.local if it exist 
    ### END INIT INFO

     

    PATH=/sbin:/usr/sbin:/bin:/usr/bin

    ./lib/init/vars.sh
    ./lib/lsb/init-functions

    do_start () {
          if [ -x /etc/rc.local ]; then
                    [ "$VERBOSE" !=no ] && log_begin_msg "Running local boot scripts (/etc/rc.local)"
                    /etc/rc.local
                    ES=$?
                    [ "$VERBOSE" !=no ] && log_end_msg $ES
                    return $ES
          fi
    }
    case "$1" in
          start )
             do_start
             ;;
          restart | reload | force-reload)
                echo "Error: argument "$1" not supported" >&2
                exit 3
                ;;
          stop | status )
                # No-op
                exit 0
                ;;
          *)
                echo "Usage: 0 start|stop" >&2
                exit 3
                ;;
    esac

    I appreciate you speedy response to continue with my problem. To re-summarize my total experience with Installing the PiFace Real Time Clock here's additional, more-specific information.

    I had successully installed previous RPi 2's and one of my RPi 0's all running the current Rasbian Jessie software following these websites:

    Starting Website to Add PiFace Real Time Clock
    http://www.piface.org.uk/products/piface_clock/

    Two Links (located towards bottom of site) were followed:

    1. Documentation (downloaded pdf File)

    2. PiFace Real Time Clock on GitHub
    https://github.com/piface/PiFace-Real-Time-Clock

    The previous installation on a RPi Zero (which was successfull) did not generate a /etc/init.d/pifacertc  file
    and during the boot phase, I did see a line:
    [Failed (in red): Failed to start /etc/rc.local compatibility.
    but evidently the clock installed correctly.
    The text for the rc.local files on this device and the RPi Zero device that failed are identical.

    My PATH to install on the failed device is briefly described next:

    pi@raspberrypi ~$ ls
    Downloads  (among other files)
    pi@raspberrypi ~$ cd Downloads
    install-piface-real-time-clock.sh  (in bold yellow/green color)
    chmod +/ install-piface-real-time-clock.sh  (returns prompt)
    sudo ./install-piface-real-time-clock.sh (problems occur)
    returns:
    Create a new pifacertc init script to load time from PiFace RTC
    Adding /etc/init.d/pifacertc .
    Install the pifacertc init script
    Enable I2C by adding:

    raspi-config

    then navigate to "Advanced Options" > I2C
    and select 'yes' to enable the ARM I2C interface. Then *reboot* ans set the clock with:

    sudo date -s "10 JAN 2014 10:10:30"
    sudo hwclock --systohc
    Downloads $

    (end of PATH return)

    I type the command:
    sudo reboot.
    During the boot phase, I noted the following 2 lines:
     
    [FAILED] Failed to start LSB: Add the PiFace Device
    See "systemct1 status pifacertc service" for details

    In fact, I have configured another RPi Zero device in a separate electrical system and tried the install and the same failure occurs.

    This begs two questions:
    1. How to Run command to "See systemct1 status pifacertc service for details" and
    2. Relative to the long-winded response from the terminal after the sudo ./install ... command (PATH above), what should the new pifacertc script contain, why add another /etc/init.d/pifacertc . , and how to install it. It does not detail any of these returns. Finally, you have indicated that the install script may not have completed correctly. Based on all of the above, did the script complete successully or do I need to create another script of which Iis unknown to me.

    Dear lucie tozer:

    If you've arrived here without abandoning me I appeciate it. I just don't understand why an installation can proceed in entirely two different paths on identical systems but yielding different file structures. I'm sure its my mistake and I am confident I'll find the solution through your and many others help. Thanks again. Frank

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
>
element14 Community

element14 is the first online community specifically for engineers. Connect with your peers and get expert answers to your questions.

  • Members
  • Learn
  • Technologies
  • Challenges & Projects
  • Products
  • Store
  • About Us
  • Feedback & Support
  • FAQs
  • Terms of Use
  • Privacy Policy
  • Legal and Copyright Notices
  • Sitemap
  • Cookies

An Avnet Company © 2025 Premier Farnell Limited. All Rights Reserved.

Premier Farnell Ltd, registered in England and Wales (no 00876412), registered office: Farnell House, Forge Lane, Leeds LS12 2NE.

ICP 备案号 10220084.

Follow element14

  • X
  • Facebook
  • linkedin
  • YouTube