element14 Community
element14 Community
    Register Log In
  • Site
  • Search
  • Log In Register
  • 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 & Tria Boards Community
    • Dev Tools
    • Manufacturers
    • Multicomp Pro
    • Product Groups
    • Raspberry Pi
    • RoadTests & Reviews
  • About Us
    About the element14 Community
  • 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
      •  Japan
      •  Korea (Korean)
      •  Malaysia
      •  New Zealand
      •  Philippines
      •  Singapore
      •  Taiwan
      •  Thailand (Thai)
      •  Vietnam
      • 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 697 subscribers
  • Views 7448 views
  • Users 0 members are here
  • raspberry_pi
Related

Installing Code for PiFace Real Time Clock

fc-element
fc-element over 9 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
  • clem57
    0 clem57 over 9 years ago in reply to fc-element

    Swap SD cards and if the problem moves, then the problem is on that card and is not identical!

    Clem

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

    Looking at the rest of the scripts output you just posted, it would appear that the installer did complete successfully, have you checked to see if the service is enabled sudo systemctl is-enabled pifacertc or you could try to find it in the list of services sudo systemctl -a even just trying to start the service manually might give some clues if it returns an error sudo systemctl start pifacertc

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

    Dear Ms tozer,

    Thanks for your speedy comments and otherwise approaches I had no knowledge of.

    No- I did not check these commands but I will do so in the near future. If in fact the installation was successfull, I still am getting a Failed line: Failed to Add PiFace RTC  during the boot phase but this may have been resolved within the remaining lines. To be honest when I have a returned response that I must create another init pifacertc script, I may not have proceeded successfully with the date verification and i2c-dev checking.  I'll continue to eperiment and thanks or you help. Frank.

    Dear Clem Martins,

    Thanks or your continuing interest.
    Yes- I swapped SD cards and BOTH RPi Zero systems failed. The SD cards are identical in brand, model, and capacity. However, I certainly may have proceeded slightly different in their installations. I should mention that installed on each system are also a WiPi network adapter, a Flash drive, and an ENC28j60 Ethernet module on a poered hub but all these components are performing admirably.

    In the future, I may recode Failed SD card from the beginning and install all the components rom scratch again. I would appreciate if you can recommend a specific Rasbpian Jessie version and also comment on the initial commands other than:   

    sudo apt-get update
    sudo apt-get upgrade

    In addition, there are a multitude of additional "switches" like,  sudo apt-get upgrade -y
    What are the current standards that I should use ?

    I also plan on cloning the successfull SD card on my windows laptop using notepad ++ and also examining each and every file to determine the differences from the failed SD card. You are certainly correct that something is different with these cards.

    Dear Sir, I promise I won't continue bothering you and Ms tozer with these seemingly simple problems
    Thans or your consideration.

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

    Dear Ms. Tozer

    After attempting to get PiFace Real Time Clock to install on Raspberry Pi Zero over the last two months, I've to the possibility that the INSTALL PROGRAM at:  http://github.com/piface/PiFace-Real-Time-Clock does not address the Zero Model. The following is an extraction from the install code:

    #=======================================================================
    # NAME: start_on_boot
    # DESCRIPTION: Load the I2C modules and send magic number to RTC, on boot.
    #=======================================================================
    start_on_boot() {
        echo "Create a new pifacertc init script to load time from PiFace RTC."
        echo "Adding /etc/init.d/pifacertc ."

        if [[ $RPI_REVISION == "3" ]]; then
            i=1  # i2c-1
        elif [[ $RPI_REVISION == "2" ]]; then
            i=1  # i2c-1
        else
            i=0  # i2c-0
        fi

        cat > /etc/init.d/pifacertc  << EOF

     

    (end of code)

     

    Are these revisions referring to Software Revisions 2 and 3 or the Hardware Models 2 and 3 ?

    Does anyone know if Piface RTC can be installed on to a RPi ZERO model or not. ?

    Sorry for the persistence in my requests to you and the community but I'm running out of ideas but not patience.

    Am I am able to accomplish this task or not.

    Thank you.

    PS. The commands that you suggested,, such as:

    sudo systemctl is-enabled pifacertc

    sudo systemctl -a

    sudo systemctl start pifacertc

    all return the statements "PiFace RTC "not added, "failed to be added", "cannot be started" or generally notfound.

    Thanks for your help and hope someone out there will continue to respond.

    Frank

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
  • Robert Peter Oakes
    0 Robert Peter Oakes over 9 years ago in reply to fc-element

    A word on PI Revisions

    if you run the command  " cat  /proc/cpuinfo" you will get a bunch on information returned including the revision value

    Here is what I get on a Quark 1000 based Intel Galileo

    processor       : 0

    vendor_id       : GenuineIntel

    cpu family      : 5

    model           : 9

    model name      : Quark SoC X1000

    stepping        : 0

    cpu MHz         : 399.088

    cache size      : 16 KB

    fdiv_bug        : no

    f00f_bug        : no

    coma_bug        : no

    fpu             : yes

    fpu_exception   : yes

    cpuid level     : 7

    wp              : yes

    flags           : fpu vme pse tsc msr pae cx8 apic pbe nx smep

    bugs            :

    bogomips        : 798.17

    clflush size    : 32

    cache_alignment : 32

    address sizes   : 32 bits physical, 32 bits virtual

    power management:

    if I run this on a PI i get this

    processor       : 0

    model name      : ARMv7 Processor rev 4 (v7l)

    BogoMIPS        : 76.80

    Features        : half thumb fastmult vfp edsp neon vfpv3 tls vfpv4 idiva idivt vfpd32 lpae evtstrm crc32

    CPU implementer : 0x41

    CPU architecture: 7

    CPU variant     : 0x0

    CPU part        : 0xd03

    CPU revision    : 4

     

     

    processor       : 1

    model name      : ARMv7 Processor rev 4 (v7l)

    BogoMIPS        : 76.80

    Features        : half thumb fastmult vfp edsp neon vfpv3 tls vfpv4 idiva idivt vfpd32 lpae evtstrm crc32

    CPU implementer : 0x41

    CPU architecture: 7

    CPU variant     : 0x0

    CPU part        : 0xd03

    CPU revision    : 4

     

     

    processor       : 2

    model name      : ARMv7 Processor rev 4 (v7l)

    BogoMIPS        : 76.80

    Features        : half thumb fastmult vfp edsp neon vfpv3 tls vfpv4 idiva idivt vfpd32 lpae evtstrm crc32

    CPU implementer : 0x41

    CPU architecture: 7

    CPU variant     : 0x0

    CPU part        : 0xd03

    CPU revision    : 4

     

     

    processor       : 3

    model name      : ARMv7 Processor rev 4 (v7l)

    BogoMIPS        : 76.80

    Features        : half thumb fastmult vfp edsp neon vfpv3 tls vfpv4 idiva idivt vfpd32 lpae evtstrm crc32

    CPU implementer : 0x41

    CPU architecture: 7

    CPU variant     : 0x0

    CPU part        : 0xd03

    CPU revision    : 4

     

     

    Hardware        : BCM2709

    Revision        : a02082

    Serial          : 00000000a1243900

    You can see the repeated parts for the 4 processor cores but also the revision statement near the end, you can see this does not match any of the test statements that simply expect a 2 or 3.... the reason for this is that Raspberry PI's made by sony have the 2, 3 style revision numbers, but the PI's made by Embest have the style above "a02082",

     

    now this also seems to have moved to the later style for both. here is a table I found

     

    RevisionRelease DateModelPCB RevisionMemoryNotes
    BetaQ1 2012B (Beta) ?256 MBBeta Board
    0002Q1 2012B1.0256 MB
    0003Q3 2012B (ECN0001)1.0256 MBFuses mod and D14 removed
    0004Q3 2012B2.0256 MB(Mfg by Sony)
    0005Q4 2012B2.0256 MB(Mfg by Qisda)
    0006Q4 2012B2.0256 MB(Mfg by Egoman)
    0007Q1 2013A2.0256 MB(Mfg by Egoman)
    0008Q1 2013A2.0256 MB(Mfg by Sony)
    0009Q1 2013A2.0256 MB(Mfg by Qisda)
    000dQ4 2012B2.0512 MB(Mfg by Egoman)
    000eQ4 2012B2.0512 MB(Mfg by Sony)
    000fQ4 2012B2.0512 MB(Mfg by Qisda)
    0010Q3 2014B+1.0512 MB(Mfg by Sony)
    0011Q2 2014Compute Module1.0512 MB(Mfg by Sony)
    0012Q4 2014A+1.1256 MB(Mfg by Sony)
    0013Q1 2015B+1.2512 MB ?
    0014Q2 2014Compute Module1.0512 MB(Mfg by Embest)
    0015 ?A+1.1256 MB / 512 MB(Mfg by Embest)
    a01040Unknown2 Model B1.01 GBUnknown
    a01041Q1 20152 Model B1.11 GB(Mfg by Sony)
    a21041Q1 20152 Model B1.11 GB(Mfg by Embest)
    a22042Q3 20162 Model B (with BCM2837)1.21 GB(Mfg by Embest)
    900092Q4 2015Zero1.2512 MB(Mfg by Sony)
    900093Q2 2016Zero1.3512 MB(Mfg by Sony)
    a02082Q1 20163 Model B1.21 GB(Mfg by Sony)
    a22082Q1 20163 Model B1.21 GB(Mfg by Embest)

     

    As you can see most current boards don't have what the script is looking for.

     

    To make this work for you, you can modify the script to just work for your board or change it to look for these additional identifiers.

     

    Now technically this should still work even without modification on most latest boards as it will default t I2C-0 if the revision is not matched.

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

    See the procedure just above start_on_boot i.e.

    #=======================================================================

    # NAME: set_revision_var

    # DESCRIPTION: Stores the revision number of this Raspberry Pi into

    #              $RPI_REVISION

    #=======================================================================

    set_revision_var() {

        revision=$(grep "Revision" /proc/cpuinfo | sed -e "s/Revision\t: //")

        RPI2_REVISION=$((16#a01041))

        RPI3_REVISION=$((16#a02082))

        if [ "$((16#$revision))" -ge "$RPI3_REVISION" ]; then

            RPI_REVISION="3"

        elif [ "$((16#$revision))" -ge "$RPI2_REVISION" ]; then

            RPI_REVISION="2"

        else

            RPI_REVISION="1"

        fi

    }

     

    It is only recognizing RPi CPUs for hardware models 2 and 3.  I cannot see what the "Revision" value at the bottom of /proc/cpuinfo is because I do not have an RPi zero.  You might be able to modify these two procedures and make it work.

     

    Whether you are successful or not, I would suggest filing an issue at the github site if you have not yet already done so.  It would be great if you can develop a mod for the Pi Zero.  Good luck.

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

    Agreed, if the Pi zero doesnt have a compatable revision that the install script can use, it should be easy enough to do the install manually.

     

    Off the top of my head, I think the script was trying to work out the standard i2c port to register the real time clock with, different pi models must have different standard ports i2c-0, i2c-1 etc... I'll have a closer look when theres time unless someone else beats me to it!

     

    If someone finds a way to do it manually, it should be easy enough to make a new script or suggest a modification to the standard script for other people to use.

     

    -----------------------------

     

    I can see me having to get a pi zero in the near future (just wish they had onboard wifi...)

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
  • Robert Peter Oakes
    0 Robert Peter Oakes over 9 years ago in reply to Robert Peter Oakes

    Just realized my PI3 is using an I2C-1, not -0 so it would fail with this script.....

     

    simply run i2cdetect -l to see what is available to you

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

    Can you enable the i2c port using the raspi-config command and then do ls /dev

     

     

    You should see either i2c-0 or i2c-1 in the list, could you let us know which one it is please.

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

    Im going to try and re-write this script, rather than trying to determine the revision of the raspberry pi to workout which i2c port to address,

    it can be simplified to ls /dev | grep "i2c" This should get the device directly rather than guessing based on the model.

    • Cancel
    • Vote Up +2 Vote Down
    • Sign in to reply
    • Verify Answer
    • Reject 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 © 2026 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