# Sinara 2245 LVDS DIO card

* [Wiki](https://github.com/sinara-hw/DIO_LVDS_RJ45/wiki)
* [Datasheet](https://m-labs.hk/docs/sinara-datasheets/2245.pdf)

## JSON

Be aware of the reversed EEM order on the card:

```json
[
  {
    "type": "dio",
    "board": "DIO_LVDS",
    "ports": [1],
    "bank_direction_low": "input",
    "bank_direction_high": "input",
    "edge_counter": false // or true
  }, 
  {
    "type": "dio",
    "board": "DIO_LVDS",
    "ports": [0],
    "bank_direction_low": "output",
    "bank_direction_high": "output"
  }
]
```

## Setup

Switch DIPs in required position per each channel individually. Each RJ45 have 4 channels.

![](../img/lvds_ttl_switches.jpg)

## Testing

```bash
*** Testing TTL inputs.
TTL device to use as stimulus (default: ttl0): ttl0

Connect ttl0 to ttl4. Press ENTER when done.

PASSED  # <--------
Connect ttl0 to ttl5. Press ENTER when done.

FAILED
Connect ttl0 to ttl6. Press ENTER when done.

FAILED
Connect ttl0 to ttl7. Press ENTER when done.

FAILED
...

*** Testing TTL inputs.
TTL device to use as stimulus (default: ttl0): ttl1

Connect ttl1 to ttl4. Press ENTER when done.

FAILED
Connect ttl1 to ttl5. Press ENTER when done.

PASSED  # <--------
Connect ttl1 to ttl6. Press ENTER when done.

FAILED
Connect ttl1 to ttl7. Press ENTER when done.

FAILED
...
```
1. Connect a RJ45 output port to a input port
2. Run `artiq_sinara_tester`  
3. One TTL will pass while other will fail
4. Run `artiq_sinara_tester` again and increment the stimulus (e.g. `ttl0->ttl1->ttl2->ttl3`) until all channels on the input port passed at least once
5. Plug into to another input port and repeat 2-4 until all input ports are tested

It is incompatible with other TTL cards, so you will need to use same or other LVDS card for proper testing.