Close

Software

A project log for DSKY

Create a working DSKY using a 3D printer and my AGC simulator running on a Raspberry Pi and slave Arduino Nanos.

wglasfordwglasford 07/05/2022 at 19:180 Comments

I have tested the three Arduino's software with test code on the Raspberry Pi.  The Arduino code is out on my GitHub website.  https://github.com/bglasford1 

There are 3 Arduinos: Display, Indicators and Keyboard.  The display and indicators wait for a command from the Raspberry Pi, execute the command and then wait for another command.  The first command for all three is an Identify command in which they respond with who they are.  This allows me to map the port to purpose as I am not guaranteed each Arduino will connect to a specific port name.  The Keyboard periodically scans the matrix waiting for a key press.  When a key is pressed it sends a notification to the Raspberry Pi.  I used a matrix scheme versus connecting each switch to a digital input because the Arduino has 13 digital input pins and I need 19.  The switches are arranged in a 3x7 configuration.  This requires 10 pins.  I could have configured them into a 4x5 configuration that would have used one less pin but I kept the matrix simple and logical, keeping the keys as they relate to the matrix in their physical configuration.  

An initial version of Java is out there on GitHub for the Raspberry Pi.  The software has a completely functioning Arduino interface.  The interface to the AGC has been fleshed out but not tested.  In its place is a test class that runs the Arduinos through their paces.

The DSKY code interfaces with either an internal simulated software AGC or via the 26-pin connector.  The 26-pin connector is used to connect a hardware AGC implementation or a hardware simulator.  There is also an internal test program which can be executed by providing an argument of "--TEST".  

I am now working on getting Ron's simulator working with the DSKY.  His simulator has a separate DSKY module with a software protocol based on the real interface.  The real interface has a 15-bit Channel bus and various control lines directing where the data should be routed based on channel number.  I view it as memory mapped I/O.  The DSKY deals with five channels (as defined by NASA).

Channel 10: AGC to DSKY: Used to send display updates 2 characters at a time plus indicators.

Channel 11: AGC to DSKY: Used to send indicator status.  Not sure why 1/2 are here and 1/2 in ch10.

Channel 13: AGC to DSKY: Test lights and STBY indicator.  (Ron put this into his fictitious ch163.

Channel 15/16: DSKY to AGC: Sends one key code at a time when a key is pressed.

Channel 32: DSKY to AGC: Used to send a PRO key press.  

Channels 13 and 32 have other functions as well that the DSKY doesn't care about.  Note that Channels 15 & 16 are the same format.  The Command Module had two DSKYs, hence two channels for key presses.  I am implementing DSKY #1, therefore I only use ch15.

Ron's interface combines the 15 bits of the channel register along with a 7-bit channel number plus a "u" and "t" code that are set to zero for the DSKY.  He packs this into four bytes with the first two MSBs of each byte used to define the sequence of four bytes.  The following is the format of the four bytes (both directions).  "p" denotes channel number and "d" denotes the channel data.

00utpppp 01pppddd 10dddddd 11dddddd

The details of all this can be found at https://www.ibiblio.org/apollo/developer.html or at my GitHub site in the AGCBlockIIComputer wiki pages.

The code using Ron's simulator is now working and code updates have been made to GitHub.

Here is how to load, compile and run Ron's simulator.  The instructions on his site are a bit old and the version of wxWidgets has changed.

1) Install these packages: sudo apt-get install wx3.0-headers libwxgtk3.0-gtk3-dev libwxgtk3.0-gtk-0v5 libncurses5-dev liballegro4-dev git

2) Load his code: git clone https://github.com/virtualagc/virtualagc

3) cd virtualagc

4) make install or make clean install

This takes quite a while on a little Pi to compile all this.  Once it is compiled, cd into the yaAGC directory and run the simulator. This command runs the code for the Apollo 11 LEM.  You can run other versions as well.

> ./yaAGC ../Luminary131/Luminary131.bin

The simulator will start and give you a prompt of (agc).  Type run to start the simulation.

Here is how to load, compile and run my DSKY code.  The code is java.  I strongly suggest you use an IDE.  I personally use the free version of IntelliJ Idea but Eclipse is just as good.  Load the software into the IDE and set it up to create a jar file.  Copy the jar file over to the Raspberry Pi and execute it with this command.

> java -jar DSKY.jar --AGC-SWSIM

The Arduinos will have already displayed the initial state on the LCDs.  Running the DSKY simulator will reset the Arduinos so the displays will redraw and you are ready to go.  Start typing in commands.  I would suggest starting with the lam test: V35E.  What is this?  It is NASA shorthand for the following keys: Verb, 3, 5, Enter.  You should see the 3 and then the 5 being displayed under Verb.  When you hit enter all the indicators light up and all the digits are set to "8".  The verb and noun values flash along with the KEY REL and OPR ERR indicators.  

Discussions