Thread: Raspberry Pi for System Interface?

  1. #1
    Registered User
    Join Date
    Jun 2011
    Posts
    4,509

    Raspberry Pi for System Interface?

    Hello all, long time no see.

    I do digital architecture and system interface design for high power amplifiers. All the system interfaces I've done to date have been parallel or basic serial (RS-232, etc). But lately we've seen customers wanting Ethernet interfaces for their amplifier systems.

    For my designs, I've always used basic microcontrollers. Though some Ethernet-capable versions of these kind of chips exist (e.g. PIC18F97J60), I was thinking about using the Raspberry Pi for such applications.

    I'm very new to the Pi (I recently got a Pi 3 running Raspbian), and to network programming, but so far the results seem promising. And our latest application will require data logging, which would be much easier to implement in an OS rather than discrete memory.

    My biggest concerns are based on using an OS in systems that can see frequent power cycles. Specifically, my concerns are:

    • Boot-up time: With basic microcontrollers, the digital circuitry is ready in milli-seconds. With the Pi, this can be as long as 30 seconds. (As long as the end user is okay with this, it shouldn't be an issue.)
    • Power off: Our systems are expected to be turned off with a front panel circuit breaker, and we can't expect the user to provide a "shutdown" command.
    • Quick power cycling: It's not uncommon during test to turn the system on and then off again in a matter of seconds. There is also no way to prevent the user from doing so.


    I have been researching ways to either allow safe immediate power-off without shutdown, or using batteries/charge circuits to keep the Pi on long enough to perform a shutdown (this thread seems the most interesting so far). The latter approach seems safer in the event of a fast power cycle, as the Pi can fully boot before executing a shutdown.

    Does anyone have any opinions on whether this is a practical application to use the Raspberry Pi?

  2. #2
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    37,530
    Hey Matticus, welcome back.

    A couple of suggestions.
    1. strip out all of the guff that comes with a standard Raspbian distribution. All manner of services get started at boot time, so removing anything non-essential should be a win.

    2. some kind of battery (or capacitor) power backup allows you to do some things.
    A capacitor would buy you a few mSec, long enough to deal with a "power fail interrupt" and sync the file system to a consistent state.
    A battery would keep you going for much longer. If mains power is removed, you could decide to wait a few minutes before performing an orderly shutdown. If it's just the user power cycling the box, then nothing is done and the OS is instantly ready.

    Preventing Filesystem Corruption in Embedded Linux | White Papers
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

  3. #3
    Registered User
    Join Date
    Jun 2011
    Posts
    4,509
    Hi Salem. Thank you for your response.

    Great idea about removing unnecessary services, this should help speed things up. Having only a casual familiarity with *nix, I will spend some time on research in this regard.

    Our systems typically use extremely large storage capacitors, which may be able to provide enough energy to power the Pi for one or two minutes after shutdown. I will look into regulating this voltage to power the Pi. If that's not feasible, I will consider using a rechargeable battery instead.

    Having a delay before shutdown is a really nice idea.

    The second link you posted was particularly useful. The first solution ("use a read-only root filesystem") was mentioned on several threads I came across during research. Funnily enough, it also addresses the non-volatile data logging situation, which was my original cause for concern with that approach.

    Thank you so much!

  4. #4
    Registered User
    Join Date
    Jun 2011
    Posts
    4,509
    I had another question, related to the code.

    I recently took my first steps into network programming using Beej's tutorial, and want to make sure I understand this correctly.

    Since the system would essentially be a slave, receiving commands and responding to queries from some host (i.e. it will not offer data unsolicited), I would assume the system should run a server program. Does this sound like a reasonable assumption?

  5. #5
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    37,530
    Yes, your PI would run as a server, waiting for connections.
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

  6. #6
    Registered User
    Join Date
    Jun 2011
    Posts
    4,509
    Thank you so much!

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Raspberry Pi soap client
    By straygrey in forum C Programming
    Replies: 1
    Last Post: 11-11-2013, 09:04 AM
  2. Raspberry Pi
    By phantomotap in forum Tech Board
    Replies: 12
    Last Post: 02-04-2013, 01:53 PM
  3. C raspberry pi
    By 0x47617279 in forum C Programming
    Replies: 2
    Last Post: 01-30-2013, 11:52 PM
  4. The UNIX System Interface
    By rrc55 in forum C Programming
    Replies: 1
    Last Post: 10-20-2009, 05:56 PM
  5. de/activate NIC by system interface/API calls?
    By joft in forum Windows Programming
    Replies: 1
    Last Post: 05-12-2004, 11:47 AM

Tags for this Thread