Jump to content
OMRON Forums

Determining when PPMAC is fully booted


Recommended Posts



I have a machine that uses a PPMAC and a windows based computer for HMI/GUI (custom program I wrote). My software connects to the PPMAC through telnet and starts GPASCII. It also connects to another telnet instance and starts a background C application through the telnet/bash shell. Finally once my C program is started it connects to a socket (port 3000 in my case).


I'm having issues determining when the PPMAC system is fully up and running. Some of my connections are failing to connect even after the network and telnet server are running (Sometimes GPASCII fails to start, other times my program won't start correctly). If I connect to an already booted system there are no problems.


So my question is, what is the best way to determine that all PPMAC services are fully operational before I attempt to start up my C program and GPASCII connections? (Preferably through a shell interface like telnet)?


I will add that there is a reason I'm starting up my C app remotely and have chosen not to use the "auto start" feature of the PPMAC IDE.




Link to comment
Share on other sites

  • Replies 6
  • Created
  • Last Reply

Top Posters In This Topic



How about something like this:


1. Wait until you can get a ping response from the Power PMAC --> Linux is running

2. Over telnet check dmesg for "PPmacInit Done" message (dmesg | grep "PPmacInit Done") --> Power PMAC APIs are loaded

3. Start your background program, etc.


Here is the relevant output of "dmesg" after the Power PMAC finishes booting up:

initializing module rtpmaclib
DetectProcessor: Clock = 1000000012
DetectProcessor: CPU Model = PowerPC,460EX
DetectProcessor: cores = 1
irq: irq 18 on host /interrupt-controller0 mapped to virtual irq 38
Phase IRQ= 38
irq: irq 9 on host /interrupt-controller0 mapped to virtual irq 39
CaptComp IRQ= 39

 Program buffer: 16777216
    User buffer: 1048576
   Table buffer: 1048576
LookAhead buffer: 16777216
PPmacInit Done
rtpmac started

InitSharedMemory(1): 0c65d8b8 0c661aa8

Link to comment
Share on other sites

That makes a lot of sense. I'm already doing the ping check and then giving excessive retries on the telnet connection. It would seem that on my system the telnet daemon takes some number of seconds to init after ping is established (I think I give telnet 30-60 seconds worth of retry and sleep iterations on failed connections before issuing an exception). So it would seem that if I waited for the dmesg output that this would provide another layer of startup sanity check. I'll play around with a manual telnet connection to see what grep command works best and then code that into my startup code in the HMI/GUI (C#.NET)


As always you have good ideas, thanks!



Link to comment
Share on other sites

I'm still having issues. I am waiting for the following grep command, which corresponds to the last dmesg line I see after a PPMAC has been fully functional:


dmesg | grep -i "initsharedmemory(1):"


This seems to wait properly and detect this message but I'm still having issues with my program starting up. My program is crashing immediately with errors related to shared memory. I've put a 5 second sleep before my program start and it helps but I just hate to rely on time delays if I can avoid it. I think I'm heading in the right direction, which is good.


Anyone have any other ideas?




Link to comment
Share on other sites

KEJR, on our systems we use a modified startup script to launch applications almost immediately after the Delta Tau code starts, and we haven't had any issues. Our script starts in run level 2. Maybe there is something that still isn't loaded after that "InitSharedMemory(1)" statement is printed?


As an easy test set up a script that will write a file to disk at the end of run level 2:


#! /bin/sh
# save this file to /.readonly/etc/init.d/ppmacboottest
touch /var/test


Then create a symlink from /.readonly/etc/rc2.d/S99test to /.readonly/etc/init.d/ppmacboottest. Now reboot the PPMAC and wait to connect until "ls /var | grep test" returns positive.

Link to comment
Share on other sites

I did something similar to the last post and now my startup is working well. What I did was put a line in /etc/rc.local which executes after all of the init scripts for any particular runlevel.


touch /var/log/runlevelcomplete


Then I am using the test and echo command to inspect for this file through my telnet connection:


           while (!str.Contains("0\r\n"))
               TelnetCmd.WriteLine("test -f /var/log/runlevelcomplete; echo $?");
               str = TelnetCmd.Read();

               if (retry > 20) throw new Exception("There was a timeout waiting for the PPMAC system to start. Response:\n" + str);


This seems to work well and I am having success starting my program and connecting to everything after this.


Thanks for the help.



Link to comment
Share on other sites

  • 1 year later...
This topic is now closed to further replies.

  • Create New...