Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Some additions for Linux users and boards w/o ftdi chip #1

Open
wants to merge 14 commits into
base: master
Choose a base branch
from
76 changes: 66 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,18 +1,20 @@
# serial2ti83
A program for Arduino Uno that makes it possible to connect a TI-83 calculator to a computer
# serial2ti83 / ArduGrayLink
A program for Arduinos that makes it possible to connect a Texas Instruments calculator to a computer

## Introduction
This program turns an Arduino Uno board into an adapter between a TI-83 graphing calculator and a computer. In order to use it upload `serial2ti83.ino` to an Arduino board using the standard Arduino IDE and connect the 2.5mm jack port on the bottom of TI-83 to Arduino according to the following table:
This program turns an Arduino board into an adapter between a TI graphing calculator and a computer. In order to use it upload `serial2ti83.ino` to an Arduino board using the standard Arduino IDE and connect the 2.5mm jack port on the bottom of the TI calculator to the Arduino according to the following table:

| Jack port | Arduino |
|:-------------:|:-------------:|
| sleeve | GND pin |
| tip | pin 2 |
| ring | pin 3 |
| tip | Analog pin 0 |
| ring | Analog pin 1 |

**For additional reliability**, add a 10–220 μF capacitor between the RESET pin and GROUND, as shown in the schematic. This prevents the Arduino from resetting when a program opens and closes the serial port, which TI Connect and TI GRAPH-LINK do often. If the program sends data while the Arduino is rebooting, it is likely to be lost. This is absolutely essential if you want to use TI GRAPH-LINK for Windows 3.1 under DOSBox.

You can now run some linking program, e.g. **TiLP** and start exchanging data (upload programs, take screenshots, dump ROM, manage variables, etc.). In case of TiLP make sure to go to File->Change Device first and choose **GrayLink** cable and TI-83 calc.
If you use Windows, you can now run some linking program, e.g. **TiLP** and start exchanging data (upload programs, take screenshots, dump ROM, manage variables, etc.). In case of TiLP make sure to go to File->Change Device first and choose **GrayLink** cable and TI-83 calc.

_Optional_: before uploading `serial2ti83.ino` it is recommended to increase the size of hardware serial buffers to make the connection more reliable. Open `HardwareSerial.h` from you Arduino installation folder (usually `C:\Program Files (x86)\Arduino\hardware\arduino\avr\cores\arduino`) and change these 2 lines:
The latest revision of ArduGrayLink will turn the Arduino board's builtin LED (connected to pin 13 on the Uno) if the serial buffer fills up past 50 bytes. The LED will then remain on until the Arduino is reset. If you notice this occurring, or if you'd like to take an extra precaution, you may wish to increase the size of hardware serial buffers before uploading the sketch. This _might_ benefit particularly slow calculators, but after switching to direct port access (instead of `digitalRead()`/`digitalWrite()`) I no longer found this necessary even while transferring a several-kilobyte program to a TI-86. If you decide to make this modification, open `HardwareSerial.h` from your Arduino installation folder (usually `C:\Program Files (x86)\Arduino\hardware\arduino\avr\cores\arduino` on Windows and `/usr/share/arduino/hardware/<distro>-arduino/avr/cores/arduino` on Linux) and change these 2 lines:

#define SERIAL_TX_BUFFER_SIZE 64
#define SERIAL_RX_BUFFER_SIZE 64
Expand All @@ -21,10 +23,63 @@ to:

#define SERIAL_TX_BUFFER_SIZE 256
#define SERIAL_RX_BUFFER_SIZE 256

## Patching libticables to support this under Linux with boards that use ttyACM

### Background

The original Gray Cable from Texas Instruments used a 25-pin RS-232 serial connector. At the time, most computers had built-in RS-232 serial ports as part of the motherboard. These ports were connected to UART chips that connected directly to the CPU. Since few people have serial ports nowadays though, Arduino boards include chips that provide access to serial over USB, but because there is no standard way of telling the operating system that a USB device is a serial-over-USB bridge, most Arduino boards emulate an Abstract Control Model USB modem. This means that the OS creates a serial device for the Arduino, but because the serial-over-USB bridge is technically a modem, Linux assigns it a device name starting with "ttyACM", and libticables is programmed to only use built-in serial ports.

### Patching

**This isn't recommended, but it works.**

First, get **libticables** from here: https://github.com/debrouxl/tilibs/ (`git clone https://github.com/debrouxl/tilibs.git`)

Then you need to run **autoreconf** and **configure** in the libticables/trunk folder (`autoreconf -i -f && ./configure`)

After that you need to patch some stuff @ libticables/trunk/src/linux

1. detect.c: Comment out (using C block comments) the entire if statement block that starts with `if(serinfo.type == PORT_UNKNOWN || serinfo.type == PORT_MAX)`. As of July 31, 2018, that corresponds to lines 314 through 346.

This allows libticables to work even though this isn't a "normal" serial port.

2. detect.c: Replace

`ticables_info(_(" is useable: yes"));`

under the commented block of 1. with

`ticables_info(_(" is useable: 'yes' :) [PATCHED LIBRARY INSTALLED!]"));`

This is useful, if you want to see if your library was installed successfully.

3. link_gry.c: Change **#define DEVNAME "ttyS"** to **#define DEVNAME "ttyACM"**

This causes libticables to search for USB CDC-ACM (Communications Device Class Abstract Control Model) serial devices instead of serial ports on your computer's motherboard. Some Arduinos (perhaps those with FTDI chips?) use ttyUSB*n*, so use ttyUSB instead of ttyACM if that applies. The only difference is that ttyACM means the Arduino is pretending to be a modem and follows the Communications Device Class standard, while ttyUSB means that the serial-to-usb converter uses a vendor-specific class.

4. Also for link_gry.c, change

#elif defined(__LINUX__)
flags = O_RDWR | O_SYNC;
#endif

to

#elif defined(__LINUX__)
flags = O_RDWR | O_SYNC | O_NOCTTY;
#endif

And then run `make` and `(sudo) make install`.

If it doesnt get installed properly (because of x86 os?) replace `/usr/lib/libticables2.so.x(.x.x)` and `/usr/lib/x86_64-linux-gnu/libticables2.so.x(.x.x)` with the one from `libticables/trunk/src/.libs/`
Be careful, dont overwrite the symlinks and rename the file to the original one from `/usr/lib...` if the numbers are different!

(Sometimes the log gets spammed with ioctl errors if the link device is too slow, just try again)

## Schematic

![schematic](images/s.png)
![schematic](images/s.svg)

## Putting it in a box
Here is an example of how you can put an Arduino board inside a box and attach a 3.5mm jack socket to the box to make a device that is convenient to use.
Expand All @@ -46,6 +101,7 @@ Here is an example of how you can put an Arduino board inside a box and attach a
*Note: not every 2.5mm jack plug fits TI-83 smoothly. You may need to file away bits of plug's plastic housing so it goes all the way into the socket*

* some jumper cables
* capacitor between 10 and 220 microfarrads.
* basic tools (soldering iron, philips screwdriver, dremel tool, drill, files, etc.)

### Assembling the device
Expand Down Expand Up @@ -82,11 +138,11 @@ Connect the jumper cables to the Arduino (see schematic above).

![a09](images/a09.jpg)

Assemble the box. Use the 4 screws included with it.
Assemble the box. Use the 4 screws included with it. *Note: These instructions were created by the original author of this program and differ slightly from the most up-to-date setup. This picture shows pins 2 and 3 in use, but now pins A0 and A1 are used. This picture also does not show the capacitor.*

![a10](images/a10.jpg)

Insall 4 rubber feet:
Install 4 rubber feet:

![a11](images/a11.jpg)

Expand Down
Loading