The bridge

Hans had been spending too much time inside coding. So this morning he went for a wander down by the stream. As he neared the town he saw the new bridge that had been put in so that the children could cross the stream to get to the school. The bridge was made of iron and had gates so that cattle did not wander across. There was a solar powered telephone box so that the kids could make calls and send emails and notice board so that the school could leave important bulletins for them to read. The bridge also had a system of bells and whistles to give warning alerts.
Hans spotted the Uart twins, Tex and Rex with their little sister Parity. The three children approached bridge but rather than going through the gates they headed down the side of the bridge and hopped over the stepping stones. Hans remembered how he and Matilda had hopped over those same stones when he was younger.

 

The other bridge

Hans looked at the Arduino code and noticed that the size was 10% bigger when he compiled in the Bridge libraries. Looking at the code it was obvious why. There was code for handling web servers, email and code to start and stop the bridge and check it was running. Following Ambrogio Galbusera's idea, he decided to drop the bridge and use a simple serial communication instead. The Linino side could start up his Python code directly rather than provide a console with root access listening on the serial pins.

 

Are you ready yet?

One of the problems of turning off the Linino portion of the Arduino Yún is that it takes some time to restart and you need to know when it's ready for action.

 

This problem is compounded by the fact that whilst that side is booting the serial connection which is normally used for messaging between the Linino and ATmega sides is used as a console for the Uboot and Linux boot processes. If the ATmega was to send anything across the bridge at that point then it could stop the booting process. The way the Bridge code works is to delay starting until that console has not produced any content for over 1s, however this timing based approach is a little unreliable so some people on the Arduino Forum have suggested adding further delays into the code to ensure that Linux has fully booted.

BridgeBlockDiag.png

Luckily the system has a hand shaking line installed and that can be used to signal that the process is complete. This is connected up via a level shifter which can be turned on and off via one of the AR 9331's GPIOs.

Handshaking

Eberhard Fahle has produced an article that explains what is needed to configure the handshaking line for the Arduino Yún we can then use that either as a digital line or via the interrupts to signal when the boot process is complete.

 

Code

Eberhard's code was combined with the YunSerialTermial code to allow the boot process to be monitored visually as well as via the handshaking line.

 

Code: https://github.com/Workshopshed/EnchantedObjects/tree/master/Code/Examples/HandshakingMonitor

 

Setup

The boot status script was uploaded to the init.d folder and configured for execution.

Shell.png

As suggested in the article the init script was tested with

 

/etc/init.d/boot-status start

Boot On

and with

 

/etc/init.d/boot-status stop

Boot Off

The serial monitor was started and the boot process watched. Shortly after the last message in the console the red #13 light turned on. The boot-status message does not show in the log.

 

Reference


https://gist.github.com/wayoda/db3c023417757f726088

https://www.kernel.org/doc/Documentation/gpio/sysfs.txt

http://www.arduino.cc/en/uploads/Main/arduino-Yun-schematic.pdf

Access GPIO from Linux user space | FalsinSoft

http://wiki.openwrt.org/doc/techref/initscripts