Skip to content

Commit

Permalink
Added Tutorials 1 and 2 from PandaBlocks-FPGA repo
Browse files Browse the repository at this point in the history
  • Loading branch information
tomtrafford committed Dec 15, 2023
1 parent 7c4ec5e commit dac2f30
Show file tree
Hide file tree
Showing 12 changed files with 3,360 additions and 0 deletions.
Binary file added docs/images/tutorial1_bits.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/images/tutorial1_layout.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/images/tutorial1_pulse.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/images/tutorial2_layout.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/images/tutorial2_pcap.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/images/tutorial2_positions.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1,351 changes: 1,351 additions & 0 deletions docs/user/tutorials/template_tutorial1_leds.json

Large diffs are not rendered by default.

1,363 changes: 1,363 additions & 0 deletions docs/user/tutorials/template_tutorial2_pcap.json

Large diffs are not rendered by default.

94 changes: 94 additions & 0 deletions docs/user/tutorials/tutorial1_blinking_leds.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
.. _blinking_leds_tutorial:

Blinking LEDs Tutorial
======================

This tutorial will introduce you to the basics of PandABlocks, how to wire
Blocks together to make different LEDs flash at different rates


Opening the GUI
---------------

Point your web browser at the ip address or hostname of the PandA and you will
be greeted with a welcome page. At the bottom of this page will be links for
Docs, Control and Admin. You can use the Control link to open the Web Control
page that we will use in these tutorials. For more information on the Web
Control, see its entry in the Docs section.


Loading the tutorial design
---------------------------

The Design dropdown box allows you to select from saved designs stored on the
PandA. Selecting an item from this list will load the saved design over the
current Block settings. You can use the Save method to save your current
design if you wish to keep it.

Select "template_tutorial1_leds" from the box and the settings and wiring of
the Blocks in the PandA will be changed to the following:

.. image:: ../../images/tutorial1_layout.png

If you now look at the front panel of the PandA you should see the first 4
TTL output LEDs turn on sequentially, then turn off in the opposite order.


How the design works
--------------------

The CLOCKS Block is creating a 50% duty cycle pulse train with a period of 1s.
PULSE1..4 are taking this as an input trigger, and producing a different width
pulse with a different delay for each PULSE Block. These PULSE Blocks work as a
delay line, queuing a series of pulses up to be sent out when the delay expires.

If you click on one of them you can see its settings:

.. image:: ../../images/tutorial1_pulse.png

If you increase the delay beyond the 1s period you will notice that the
``Queued`` field will increase, but the PULSE Block will still continue
outputting pulses after the desired delay. However if you increase the width
beyond the pulse period the Block will drop the pulse, reporting it via the
``Dropped`` field. This is so it avoids merging them together.

You can also try clicking on the CLOCKS Block to modify the period of the input
pulse train.

You can also try wiring these outputs to different TTLOUT Blocks by clicking
the Palette icon, dragging a TTLOUT Block onto the canvas, and connecting it
up by dragging the PULSE out port to the TTLOUT val port.


The Bit Bus
-----------

All ports on the visible Blocks are blue. They represent bits, single boolean
values that can propagate through the system by connecting Blocks together.
These outputs can be viewed on their respective Blocks by clicking them on the
design, or all together by clicking the Bits field in the left hand pane:

.. image:: ../../images/tutorial1_bits.png

If you scroll down to the section with the Pulse blocks you will see the
same pattern of flashing lights as on the front of the PandA

.. note::

The web GUI polls the PandA at 10Hz, receiving the current value of each bit
and whether it has changed. The web GUI uses this information to reflect the
current value of each bit if pulsing at less than 5Hz, and displaying a 5Hz
pulsing value if faster than 5Hz. This means that you will see even short
pulses reflected on the web GUI. The front panel LEDs have a similar
behaviour but with a maximum rate of 10Hz.


Conclusion
----------

This tutorial has shown how to load a saved design and modify some parameters.
It has also introduced the PULSE delay block that is useful for delaying and
stretching trigger signals. It has introduced bit outputs and shown how they
can be connected to the outside world using the TTLOUT Blocks. In the next
tutorial we will read about position outputs, how they can be set and how they
can be captured.
97 changes: 97 additions & 0 deletions docs/user/tutorials/tutorial2.timing.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
[.]
description: Timing diagrams for tutorial 2

[Trigger Only]
1000 : PCAP.ACTIVE=1
1002 : CLOCK1.OUT=1, CLOCK2.OUT=1
1004 : COUNTER1.OUT=1
1502 : CLOCK1.OUT=0, CLOCK2.OUT=0
1505 : PCAP.TRIG=1
1506 : PCAP.TRIG=0
2002 : CLOCK1.OUT=1, CLOCK2.OUT=1
2004 : COUNTER1.OUT=2
2502 : CLOCK1.OUT=0, CLOCK2.OUT=0
2505 : PCAP.TRIG=1
2506 : PCAP.TRIG=0
3002 : CLOCK1.OUT=1, CLOCK2.OUT=1
3004 : COUNTER1.OUT=3
3502 : CLOCK1.OUT=0, CLOCK2.OUT=0
3505 : PCAP.TRIG=1
3506 : PCAP.TRIG=0
4002 : CLOCK1.OUT=1, CLOCK2.OUT=1
4004 : COUNTER1.OUT=4
4502 : CLOCK1.OUT=0, CLOCK2.OUT=0
4505 : PCAP.TRIG=1
4506 : PCAP.TRIG=0
4690 : PCAP.ACTIVE=0
5000 :

[Trigger Counter 5x faster]
1000 : PCAP.ACTIVE=1
1002 : CLOCK1.OUT=1, CLOCK2.OUT=1
1004 : COUNTER1.OUT=1
1102 : CLOCK2.OUT=0
1202 : CLOCK2.OUT=1
1204 : COUNTER1.OUT=2
1302 : CLOCK2.OUT=0
1402 : CLOCK2.OUT=1
1404 : COUNTER1.OUT=3
1502 : CLOCK1.OUT=0, CLOCK2.OUT=0
1505 : PCAP.TRIG=1
1506 : PCAP.TRIG=0
1602 : CLOCK2.OUT=1
1604 : COUNTER1.OUT=4
1702 : CLOCK2.OUT=0
1802 : CLOCK2.OUT=1
1804 : COUNTER1.OUT=5
1902 : CLOCK2.OUT=0
2002 : CLOCK1.OUT=1, CLOCK2.OUT=1
2004 : COUNTER1.OUT=6
2102 : CLOCK2.OUT=0
2202 : CLOCK2.OUT=1
2204 : COUNTER1.OUT=7
2302 : CLOCK2.OUT=0
2402 : CLOCK2.OUT=1
2404 : COUNTER1.OUT=8
2502 : CLOCK1.OUT=0, CLOCK2.OUT=0
2505 : PCAP.TRIG=1
2506 : PCAP.TRIG=0
2602 : CLOCK2.OUT=1
2604 : COUNTER1.OUT=9
2702 : CLOCK2.OUT=0
2802 : CLOCK2.OUT=1
2804 : COUNTER1.OUT=10
2902 : CLOCK2.OUT=0
3002 : CLOCK1.OUT=1, CLOCK2.OUT=1
3004 : COUNTER1.OUT=11
3102 : CLOCK2.OUT=0
3202 : CLOCK2.OUT=1
3204 : COUNTER1.OUT=12
3302 : CLOCK2.OUT=0
3402 : CLOCK2.OUT=1
3404 : COUNTER1.OUT=13
3502 : CLOCK1.OUT=0, CLOCK2.OUT=0
3505 : PCAP.TRIG=1
3506 : PCAP.TRIG=0
3602 : CLOCK2.OUT=1
3604 : COUNTER1.OUT=14
3702 : CLOCK2.OUT=0
3802 : CLOCK2.OUT=1
3804 : COUNTER1.OUT=15
3902 : CLOCK2.OUT=0
4002 : CLOCK1.OUT=1, CLOCK2.OUT=1
4004 : COUNTER1.OUT=16
4102 : CLOCK2.OUT=0
4202 : CLOCK2.OUT=1
4204 : COUNTER1.OUT=17
4302 : CLOCK2.OUT=0
4402 : CLOCK2.OUT=1
4404 : COUNTER1.OUT=18
4502 : CLOCK1.OUT=0, CLOCK2.OUT=0
4505 : PCAP.TRIG=1
4506 : PCAP.TRIG=0
4602 : CLOCK2.OUT=1
4604 : COUNTER1.OUT=19
4690 : PCAP.ACTIVE=0
4691 : CLOCK2.OUT=0
5000 :
Loading

0 comments on commit dac2f30

Please sign in to comment.