# Sinara 4456 synthesizer Mirny / Sinara 4457 Almazny Mezzanine card

* [Wiki Mirny](https://github.com/sinara-hw/mirny/wiki)
* [Wiki Almazny](https://github.com/sinara-hw/Almazny/wiki)

## JSON

```json
{
  "type": "mirny",
  "almazny": true, // for mirny with almazny only 
  "ports": [<port num>]
}
```

## Testing

### Without Almazny

```text
*** Testing Mirny PLLs.
Initializing CPLDs...
mirny0_cpld...
...done
All mirny channels active.
Frequencies:
mirny0_ch0	1000MHz
mirny0_ch0 info: {'f_outA': 1000000000.0, 'f_outB': 8000000000, 'output_divider': 4, 'f_vco': 4000000000, 'pll_n': 40, 'pll_frac1': 0, 'pll_frac2': 0, 'pll_mod2': 1, 'prescaler': '4/5', 'sysclk': 100000000.0, 'ref_doubler': False, 'ref_divider': False, 'ref_counter': 1, 'f_pfd': 100000000}
mirny0_ch1	1100MHz
mirny0_ch1 info: {'f_outA': 1100000000.0, 'f_outB': 8800000000, 'output_divider': 4, 'f_vco': 4400000000, 'pll_n': 44, 'pll_frac1': 0, 'pll_frac2': 0, 'pll_mod2': 1, 'prescaler': '4/5', 'sysclk': 100000000.0, 'ref_doubler': False, 'ref_divider': False, 'ref_counter': 1, 'f_pfd': 100000000}
mirny0_ch2	1200MHz
mirny0_ch2 info: {'f_outA': 1200000000.0, 'f_outB': 9600000000, 'output_divider': 4, 'f_vco': 4800000000, 'pll_n': 48, 'pll_frac1': 0, 'pll_frac2': 0, 'pll_mod2': 1, 'prescaler': '4/5', 'sysclk': 100000000.0, 'ref_doubler': False, 'ref_divider': False, 'ref_counter': 1, 'f_pfd': 100000000}
mirny0_ch3	1300MHz
mirny0_ch3 info: {'f_outA': 1300000000.0, 'f_outB': 10400000000, 'output_divider': 4, 'f_vco': 5200000000, 'pll_n': 52, 'pll_frac1': 0, 'pll_frac2': 0, 'pll_mod2': 1, 'prescaler': '4/5', 'sysclk': 100000000.0, 'ref_doubler': False, 'ref_divider': False, 'ref_counter': 1, 'f_pfd': 100000000}
```

After running `artiq_sinara_test`:

1. Install gqrx `nix-shell -p gqrx`
2. Connect bladeRF via USB cable only
3. Run gqrx and choose `BladeRF #<number>...`
4. Default settings
5. When gqrx loaded, start DSP processing with frequency at mirnyN_chM freq
6. Connect the probe through attenuator to the Mirny's port
7. You should see significant signal emission on choosen freq compared to nearby freqs (see image below)
8. Repeat 5-7 for every channel

![](../img/mirny_gqrx.png)

### With Almazny

At first, `artiq_sinara_test` will prompt you for testing Mirnies as the would be without Almazny.
After that, it will prompt you with testing the Almazny:

```text
*** Testing Almaznys.
mirny1_almazny...
Initializing Mirny CPLDs...
mirny0_cpld...
mirny1_cpld...
...done
Testing attenuators. Frequencies:
mirny0_ch0	4000MHz
mirny0_ch0 info: {'f_outA': 2000000000.0, 'f_outB': 8000000000, 'output_divider': 2, 'f_vco': 4000000000, 'pll_n': 40, 'pll_frac1': 0, 'pll_frac2': 0, 'pll_mod2': 1, 'prescaler': '4/5', 'sysclk': 100000000.0, 'ref_doubler': False, 'ref_divider': False, 'ref_counter': 1, 'f_pfd': 100000000}
mirny0_ch1	4100MHz
mirny0_ch1 info: {'f_outA': 2050000000.0, 'f_outB': 8200000000, 'output_divider': 2, 'f_vco': 4100000000, 'pll_n': 41, 'pll_frac1': 0, 'pll_frac2': 0, 'pll_mod2': 1, 'prescaler': '4/5', 'sysclk': 100000000.0, 'ref_doubler': False, 'ref_divider': False, 'ref_counter': 1, 'f_pfd': 100000000}
mirny0_ch2	4200MHz
mirny0_ch2 info: {'f_outA': 2100000000.0, 'f_outB': 8400000000, 'output_divider': 2, 'f_vco': 4200000000, 'pll_n': 42, 'pll_frac1': 0, 'pll_frac2': 0, 'pll_mod2': 1, 'prescaler': '4/5', 'sysclk': 100000000.0, 'ref_doubler': False, 'ref_divider': False, 'ref_counter': 1, 'f_pfd': 100000000}
mirny0_ch3	4300MHz
mirny0_ch3 info: {'f_outA': 2150000000.0, 'f_outB': 8600000000, 'output_divider': 2, 'f_vco': 4300000000, 'pll_n': 43, 'pll_frac1': 0, 'pll_frac2': 0, 'pll_mod2': 1, 'prescaler': '4/5', 'sysclk': 100000000.0, 'ref_doubler': False, 'ref_divider': False, 'ref_counter': 1, 'f_pfd': 100000000}
mirny1_ch0	4500MHz
mirny1_ch0 info: {'f_outA': 2250000000.0, 'f_outB': 9000000000, 'output_divider': 2, 'f_vco': 4500000000, 'pll_n': 45, 'pll_frac1': 0, 'pll_frac2': 0, 'pll_mod2': 1, 'prescaler': '4/5', 'sysclk': 100000000.0, 'ref_doubler': False, 'ref_divider': False, 'ref_counter': 1, 'f_pfd': 100000000}
mirny1_ch1	4600MHz
mirny1_ch1 info: {'f_outA': 2300000000.0, 'f_outB': 9200000000, 'output_divider': 2, 'f_vco': 4600000000, 'pll_n': 46, 'pll_frac1': 0, 'pll_frac2': 0, 'pll_mod2': 1, 'prescaler': '4/5', 'sysclk': 100000000.0, 'ref_doubler': False, 'ref_divider': False, 'ref_counter': 1, 'f_pfd': 100000000}
mirny1_ch2	4700MHz
mirny1_ch2 info: {'f_outA': 2350000000.0, 'f_outB': 9400000000, 'output_divider': 2, 'f_vco': 4700000000, 'pll_n': 47, 'pll_frac1': 0, 'pll_frac2': 0, 'pll_mod2': 1, 'prescaler': '4/5', 'sysclk': 100000000.0, 'ref_doubler': False, 'ref_divider': False, 'ref_counter': 1, 'f_pfd': 100000000}
mirny1_ch3	4800MHz
mirny1_ch3 info: {'f_outA': 2400000000.0, 'f_outB': 9600000000, 'output_divider': 2, 'f_vco': 4800000000, 'pll_n': 48, 'pll_frac1': 0, 'pll_frac2': 0, 'pll_mod2': 1, 'prescaler': '4/5', 'sysclk': 100000000.0, 'ref_doubler': False, 'ref_divider': False, 'ref_counter': 1, 'f_pfd': 100000000}
RF ON, all attenuators ON. Press ENTER when done.

RF ON, half power attenuators ON. Press ENTER when done.

RF ON, all attenuators OFF. Press ENTER when done.

SR outputs are OFF. Press ENTER when done.

RF ON, all attenuators are ON. Press ENTER when done.

RF OFF. Press ENTER when done.
```

Similar to _Without Almazny_, check mirnies' channels emissions on defined frequencies.
You should also see differences in various modes, but that may require disabling the gain.


### Tips

Mirnies often fail `ValueError: MUXOUT not high`, in that case restart the tests or reboot the board(s).