Skip to content

Commit

Permalink
Fix error. Update FPGA info
Browse files Browse the repository at this point in the history
  • Loading branch information
n.danilyuk committed Mar 7, 2023
1 parent 2b4cab7 commit f65b579
Show file tree
Hide file tree
Showing 4 changed files with 78 additions and 46 deletions.
16 changes: 8 additions & 8 deletions appsFeatures/remoteControl/SCPI_commands.rst
Original file line number Diff line number Diff line change
Expand Up @@ -84,25 +84,25 @@ Parameter options:
| | ``DAISY:ENable ON`` | | |
+-------------------------------------------+------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------+
| | ``DAISY:ENable?`` > ``<state>`` | ``rp_GetEnableDaisyChainSync`` | | Returns the current state of the SATA daisy chain mode. |
| | Examples: | | | |
| | Examples: | | |
| | ``DAISY:ENable?`` > ``ON`` | | |
+-------------------------------------------+-------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------+
+-------------------------------------------+------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------+
| | ``DAISY:TRIG_O:ENable <state>`` | ``rp_SetDpinEnableTrigOutput`` | | Turns GPION_0 into trigger output for selected source - acquisition or generation. |
| | Examples: | | | |
| | Examples: | | |
| | ``DAISY:TRIG_O:ENable ON`` | | |
+-------------------------------------------+------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------+
| | ``DAISY:TRIG_O:ENable?`` > ``<state>`` | ``rp_GetDpinEnableTrigOutput`` | | Returns the current mode state for GPION_0. If true, then the pin mode works as a source. |
| | Examples: | | | |
| | Examples: | | |
| | ``DAISY:TRIG_O:ENable?`` > ``ON`` | | |
+-------------------------------------------+-------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------+
+-------------------------------------------+------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------+
| | ``DAISY:TRIG_O:SOUR <mode>`` | ``rp_SetSourceTrigOutput`` | | Sets the trigger source mode ADC/DAC. |
| | Examples: | | | |
| | Examples: | | |
| | ``DAISY:TRIG_O:SOUR DAC`` | | |
+-------------------------------------------+------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------+
| | ``DAISY:TRIG_O:SOUR?`` > ``<mode>`` | ``rp_GetSourceTrigOutput`` | | Returns the trigger source mode. |
| | Examples: | | | |
| | Examples: | | |
| | ``DAISY:TRIG_O:SOUR?`` > ``DAC`` | | |
+-------------------------------------------+-------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------+
+-------------------------------------------+------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------+



Expand Down
22 changes: 16 additions & 6 deletions developerGuide/software/build/comC.rst
Original file line number Diff line number Diff line change
Expand Up @@ -36,23 +36,33 @@ In order to compile one example just use the source file name without the `.c` e
.. code-block:: shell-session
cd Examples/C
make digital_led_blink # for 250-12 run 'make MODEL=Z20_250_12 digital_led_blink'
make digital_led_blink
Applications based on the API require a specific FPGA image to be loaded:

.. code-block:: shell-session

cat /opt/redpitaya/fpga/fpga_0.94.bit > /dev/xdevcfg
.. tabs::

.. group-tab:: OS version 1.04 or older

.. code-block:: shell-session
redpitaya> cat /opt/redpitaya/fpga/fpga_0.94.bit > /dev/xdevcfg
.. group-tab:: OS version 2.00

.. code-block:: shell-session
redpitaya> overlay.sh v0.94
Execute the application.

Note that the path to Red Pitaya shared libraries must be provided explicitly.

.. code-block:: shell-session
LD_LIBRARY_PATH=/opt/redpitaya/lib ./digital_led_blink
Some of the applications run in a continuous loop - press `CTRL+C` to stop them.

More examples about how to control Red Pitaya using APIs can be found :ref:`here <examples>`.

64 changes: 38 additions & 26 deletions developerGuide/software/build/webapp/webexamples/addLEDbut.rst
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,20 @@ Pitaya using parameters.

Requierment for manipulating leds using api is to first load fpga_0.94.bit fpga bitstream image.
That can be done using next command line instruction:
"cat /opt/redpitaya/fpga/fpga_0.94.bit > /dev/xdevcfg"

.. tabs::

.. group-tab:: OS version 1.04 or older

.. code-block:: shell-session
redpitaya> cat /opt/redpitaya/fpga/fpga_0.94.bit > /dev/xdevcfg
.. group-tab:: OS version 2.00

.. code-block:: shell-session
redpitaya> overlay.sh v0.94
******
Web UI
Expand All @@ -21,14 +33,14 @@ Web UI
Let’s start with UI, in index.html file we have to add a button that will be used to control LED::

<button id='led_state'>Turn on</button>

and LED state label that will tell us if LED is On or Off. ::

< div id='led_off'>LED Off</div>
< div id='led_on'>LED On</div>
.. note::

.. note::

**led_on** div is not visible by default because when app starts all leds are off.

Also make some changes in **style.css** to set properties of these elements
Expand All @@ -48,9 +60,9 @@ Also make some changes in **style.css** to set properties of these elements
margin-top: 20px;
padding: 10px;
}
Then we have to add some logic in app.js, that will be executed when user clicks on the button with the mouse. This
logic should change local led_state each time button is clicked and send current led_state value to backend so that

Then we have to add some logic in app.js, that will be executed when user clicks on the button with the mouse. This
logic should change local led_state each time button is clicked and send current led_state value to backend so that
Red Pitaya can update real LED state.

.. code-block:: html
Expand All @@ -77,11 +89,11 @@ Red Pitaya can update real LED state.
local['LED_STATE'] = { value: APP.led_state };
APP.ws.send(JSON.stringify({ parameters: local }));
});

.. note::
Parameter that transfers local LED state to Red Pitaya backend is called LED_STATE. You can change name of this
Parameter that transfers local LED state to Red Pitaya backend is called LED_STATE. You can change name of this
parameter, but don’t forget to use the same name also in controller.

**********
Controller
**********
Expand All @@ -93,36 +105,36 @@ After we send parameters we should read them in our controller. Controller sourc
This global variable is our parameter, that we should read from server.

.. code-block:: c
CBooleanParameter ledState("LED_STATE", CBaseParameter::RW, false, 0);
Parameter is a variable that connected with NGINX. Initialization has 4 arguments - parameter's name, access mode,
initial value, and FPGA update flag. Pay attention - name of parameter LED_STATE should be the same as in app.js and
CBooleanParameter ledState("LED_STATE", CBaseParameter::RW, false, 0);
Parameter is a variable that connected with NGINX. Initialization has 4 arguments - parameter's name, access mode,
initial value, and FPGA update flag. Pay attention - name of parameter LED_STATE should be the same as in app.js and
type(bool - CBooleanParameter, int - CIntParameter, etc...) too.
This parameter updates in OnNewParams() function. This function is calling when new parameters arrived. In our case
they will arrive each time you press the button in UI.
This parameter updates in OnNewParams() function. This function is calling when new parameters arrived. In our case
they will arrive each time you press the button in UI.

.. code-block:: c
ledState.Update();
if (ledState.Value() == false)
{
rp_DpinSetState(RP_LED0, RP_LOW);
rp_DpinSetState(RP_LED0, RP_LOW);
}
else
{
rp_DpinSetState(RP_LED0, RP_HIGH);
rp_DpinSetState(RP_LED0, RP_HIGH);
}
**ledState.Update()** - updates value of parameter. It takes value from NGINX by parameter's name. That's why names
of parameters in **controller** and **app.js** should be the same.
**rp_DpinSetState** - is a Red Pitaya API function, which sets state of some pin. Its’ arguments are **rp_dpin_t** pin
and **rp_pinState_t *state**. In our program we control **RP_LED0**. There are 8 leds, thad we can control
**RP_LED0 - RP_LED7**.
and **rp_pinState_t *state**. In our program we control **RP_LED0**. There are 8 leds, thad we can control
**RP_LED0 - RP_LED7**.

There are two states of a LED - **RP_HIGH** (turned on) and **RP_LOW** (turned off).

Don’t forget to init **rpApp** and release it in **rp_app_init()** and **rp_app_exit()**.

Compile the controller, start app and try to push the button.
Compile the controller, start app and try to push the button.
22 changes: 16 additions & 6 deletions developerGuide/software/other_info/gpio/gpio.rst
Original file line number Diff line number Diff line change
Expand Up @@ -15,18 +15,28 @@ There are two interfaces legacy sysfs interface and new character device based o
PINS
====

Pins connected to the PL block require FPGA code to function. If the pin signals are wired directly (in the FPGA sources) from PS based EMIO signals to the FPGA pads,
Pins connected to the PL block require FPGA code to function. If the pin signals are wired directly (in the FPGA sources) from PS based EMIO signals to the FPGA pads,
then they can be managed using Linux drivers intended for the PS block. This is currently done with two fpga projects: classic and mercury.

Apropriate fpga bitstream can be applied using bash command.

.. code-block:: shell-session
.. tabs::

.. group-tab:: OS version 1.04 or older

.. code-block:: shell-session
redpitaya> cat /opt/redpitaya/fpga/fpga_0.94.bit > /dev/xdevcfg
cat /opt/redpitaya/fpga/classic/fpga.bit > /dev/xdevcfg
.. group-tab:: OS version 2.00

.. code-block:: shell-session
redpitaya> overlay.sh v0.94
There are 54+64=118 GPIO provided by ZYNQ PS, MIO provides 54 GPIO,
and EMIO provide additional 64 GPIO and only 16 out of those are accesible on board.
and EMIO provide additional 64 GPIO and only 16 out of those are accesible on board.
On Extension connector E1; pins from DIO0_N to DIO7_N and DIO0_P to DIO7_P.

The next formula is used to calculate the ``gpio_base`` index.
Expand Down Expand Up @@ -97,8 +107,8 @@ Bash example for writing to and reading from gpio value for pins from 968(DIO0_P
$ cat /sys/class/gpio/gpio968/value
#when done with pin you should unexport it with
$ echo 968 > /sys/class/gpio/unexport
SYSFS GPIO C example is available at github: https://github.com/RedPitaya/RedPitaya/tree/master/Examples/gpio_sysfs

Expand Down

0 comments on commit f65b579

Please sign in to comment.