diff --git a/.gitignore b/.gitignore index 1863de76b..36d27c507 100644 --- a/.gitignore +++ b/.gitignore @@ -23,3 +23,5 @@ *.i*86 *.x86_64 *.hex +# backups +*~ diff --git a/doc/appsFeatures/apps-featured/apps-featured.rst b/doc/appsFeatures/apps-featured/apps-featured.rst index 24a61a858..28a95bf04 100644 --- a/doc/appsFeatures/apps-featured/apps-featured.rst +++ b/doc/appsFeatures/apps-featured/apps-featured.rst @@ -2,54 +2,14 @@ Applications ############ -.. TODO zamenjaj linke z vsebino - -`Oscilloscope & Signal Generator `_ -****************************************************************************** - -`Spectrum Analyzer `_ -****************************************************************************** - -`Bode Analyzer `_ -****************************************************************************** - -`Logic Analyzer `_ -****************************************************************************** - -`LCR meter `_ -****************************************************************************** - -`Marketplace applications `_ -****************************************************************************** - - -.. (slike, opis, primer uporabe) - -.. osciloscope in signal generator isti tekst -.. TODO http://redpitaya.com/apps/oscilloscope/ - dodaj tabelo specsov - -.. logic analyzer -.. itd. - -.. Bode analyzer -.. ************* -.. -.. Bode analyzer enables measurements of Amplitude and Phase response of the desired [tippy title=”DUT”]Device Under Test[/tippy]. -.. The measurements are not in real time. -.. Frequency range and number of steps are adjustable. -.. How to connect DUT to the Red Pitaya when using Bode analyser is shown in picture below. -.. -.. .. image:: Bode_analyzer_connections.png -.. -.. Frequency Response analyzer -.. *************************** -.. -.. Frequency response analyzer enables measurements of frequency amplitude response of desired DUT (Device Under Test). -.. The measurements of frequency response are in range from 0Hz to 60MHz. -.. Measurements are in real time and the frequency range is NOT adjustable. -.. Measurement can be done for each channel independently, i.e it enables simultaneously measurements of two DUTs. -.. How to connect DUT to the Red Pitaya when using Frequency Response analyser is shown in picture below. -.. -.. .. image:: Frequency_response_analyzer_connections.png -.. +.. toctree:: + :maxdepth: 6 + :numbered: + + ./oscSigGen/osc.rst + ./spectrum/spectrum.rst + ./bode/bode.rst + ./logic/logic.rst + ./lcr_meter/lcr_meter.rst + ../marketplace/marketplace.rst + diff --git a/doc/appsFeatures/apps-featured/bode/01_iPad_Combo_Bode.jpg b/doc/appsFeatures/apps-featured/bode/01_iPad_Combo_Bode.jpg new file mode 100644 index 000000000..c9d702088 Binary files /dev/null and b/doc/appsFeatures/apps-featured/bode/01_iPad_Combo_Bode.jpg differ diff --git a/doc/appsFeatures/apps-featured/bode/BA_Slika_01.png b/doc/appsFeatures/apps-featured/bode/BA_Slika_01.png new file mode 100644 index 000000000..becb11039 Binary files /dev/null and b/doc/appsFeatures/apps-featured/bode/BA_Slika_01.png differ diff --git a/doc/appsFeatures/apps-featured/bode/BA_Slika_02.png b/doc/appsFeatures/apps-featured/bode/BA_Slika_02.png new file mode 100644 index 000000000..f06a97028 Binary files /dev/null and b/doc/appsFeatures/apps-featured/bode/BA_Slika_02.png differ diff --git a/doc/appsFeatures/apps-featured/bode/BA_Slika_03.png b/doc/appsFeatures/apps-featured/bode/BA_Slika_03.png new file mode 100644 index 000000000..ed41f21aa Binary files /dev/null and b/doc/appsFeatures/apps-featured/bode/BA_Slika_03.png differ diff --git a/doc/appsFeatures/apps-featured/bode/BA_Slika_04.png b/doc/appsFeatures/apps-featured/bode/BA_Slika_04.png new file mode 100644 index 000000000..561eac8fb Binary files /dev/null and b/doc/appsFeatures/apps-featured/bode/BA_Slika_04.png differ diff --git a/doc/appsFeatures/apps-featured/bode/BA_Slika_05.png b/doc/appsFeatures/apps-featured/bode/BA_Slika_05.png new file mode 100644 index 000000000..6d940736a Binary files /dev/null and b/doc/appsFeatures/apps-featured/bode/BA_Slika_05.png differ diff --git a/doc/appsFeatures/apps-featured/bode/bode.rst b/doc/appsFeatures/apps-featured/bode/bode.rst new file mode 100644 index 000000000..c759ce776 --- /dev/null +++ b/doc/appsFeatures/apps-featured/bode/bode.rst @@ -0,0 +1,90 @@ +Bode Analyzer +############# + +.. image:: 01_iPad_Combo_Bode.jpg + +This application will turn your STEMLab into an affordable Bode analyzer. It is the perfect tool for educators, +students, makers, hobbyists and professionals seeking affordable, highly functional test and measurement equipment. +The Bode analyzer is an ideal application for measuring frequency responses of the passive/active filters, complex +impedances and any other electronic circuit. The Gain/Phase frequency response can be used to characterize any device +under test completely, you can perform linear and logarithmic sweeps. Gain and Phase can be measured from 1Hz to +60MHz. The basic user interface enables quick interaction and parameter settings. The Bode analyzer can be used for +the measurement of Stability of control circuits such as the DC/DC converters in power supplies, Influence of +termination on amplifiers or filters, Ultrasonic and piezo electric systems and similar. All Red Pitaya applications +are web-based and don’t require the installation of any native software. Users can access them via a browser using +their smartphone, tablet or a PC running any popular operating system (MAC, Linux, Windows, Android and iOS). +The graphical user interface of the Bode analyzer application is shown below. + +The graphical interface is divided into 5 areas: + +.. image:: BA_Slika_01.png + +1. **Stop/Run button:** It is used to start and stop measurement. **Calibrate button:** When the selected calibration + of the setup is started. +2. **Measurement settings panel:** It is used for setting the measurement parameters such as the frequency range, + scale, number of steps, excitation signal amplitude, excitation signal DC bias and averaging number. + +.. image:: BA_Slika_02.png + +3. **Plot settings panel:** It is used to set the Gain and Phase graph ranges as also manual or auto scale mode. + +.. image:: BA_Slika_03.png + +4. **Gain graph:** The Gain frequency response of the DUT (device under test) is plotted for the selected frequency + range. +#. **Phase graph:** The Phase frequency response of the DUT (device under test) is plotted for the selected frequency + range. + +FEATURES +******** + +Main feature of the Bode analyzer application are described below: + + - Measured parameters: Gain, Phase + - The Bode analyzer application will enable you to measure the gain and phase frequency response for the desired + DUT (device under test) + - The frequency sweep range of the Bode analyzer application is from 1Hz to 60MHz with a 1Hz resolution + - Linear and Logarithmic Frequency sweep modes are available. The Logarithmic sweep mode (scale) enables + measurements in large frequencies range, while the linear sweep mode is used for measurement in the small + frequencies range. + - excitation signal parameters (amplitude and DC bias) can be adjusted to make measurements in different + sensitivities and conditions (amplifiers etc.). + - The calibration function enables calibrating long leads and to remove leads and cables effect on final + measurements. The calibration will also calibrate your STEMLab if any parasitics effects are present. + +.. image:: BA_Slika_05.png + + +Specifications +************** + ++--------------------------------------------+-------------------------------+--------------------------------+ +| | STEMlab 125 - 10 | STEMlab 125 - 14 | ++--------------------------------------------+-------------------------------+--------------------------------+ +| Frequency span | 1Hz-50MHz | 1Hz-60MHz | ++--------------------------------------------+-------------------------------+--------------------------------+ +| Frequency resolution | 1Hz | 1Hz | ++--------------------------------------------+-------------------------------+--------------------------------+ +| Excitation signal amplitude | 0 - 1 V | 0 - 1 V | ++--------------------------------------------+-------------------------------+--------------------------------+ +| Excitation signal DC bias | 0 - 0.5 V | 0 - 0.5 V | ++--------------------------------------------+-------------------------------+--------------------------------+ +| Resolution | 10bit | 14bit | ++--------------------------------------------+-------------------------------+--------------------------------+ +| Maximum number of steps per measurement | 1000 | 1000 | ++--------------------------------------------+-------------------------------+--------------------------------+ +| Max input amplitude | | ± 1 V (LV jumper settings), | | ± 1 V (LV jumper settings), | +| | | ± 20 V (HV jumper settings) | | ± 20 V (HV jumper settings) | ++--------------------------------------------+-------------------------------+--------------------------------+ +| Measured parameters | Gain, Phase | Gain, Phase | ++--------------------------------------------+-------------------------------+--------------------------------+ +| Frequency sweep modes | Linear/Logarithmic | Linear/Logarithmic | ++--------------------------------------------+-------------------------------+--------------------------------+ + +HW connections +************** + +When using the Bode analyzer application, please follow the connection diagram described below. Also use the 50 Ohm +termination on the OUT1. + +.. image:: BA_Slika_04.png diff --git a/doc/appsFeatures/apps-featured/lcr_meter/01_iPad_Combo_LCR.jpg b/doc/appsFeatures/apps-featured/lcr_meter/01_iPad_Combo_LCR.jpg new file mode 100644 index 000000000..47bfde48a Binary files /dev/null and b/doc/appsFeatures/apps-featured/lcr_meter/01_iPad_Combo_LCR.jpg differ diff --git a/doc/appsFeatures/apps-featured/lcr_meter/Slika_01_LCR_meter_WEB_page.png b/doc/appsFeatures/apps-featured/lcr_meter/Slika_01_LCR_meter_WEB_page.png new file mode 100644 index 000000000..e8f548fbb Binary files /dev/null and b/doc/appsFeatures/apps-featured/lcr_meter/Slika_01_LCR_meter_WEB_page.png differ diff --git a/doc/appsFeatures/apps-featured/lcr_meter/lcr_meter.rst b/doc/appsFeatures/apps-featured/lcr_meter/lcr_meter.rst index 42ddca3d2..7ea8c7fe6 100644 --- a/doc/appsFeatures/apps-featured/lcr_meter/lcr_meter.rst +++ b/doc/appsFeatures/apps-featured/lcr_meter/lcr_meter.rst @@ -2,6 +2,98 @@ LCR meter ********* +.. image:: 01_iPad_Combo_LCR.jpg + +This application will turn your STEMLab into an affordable LCR meter. It is the perfect tool for educators, students, +makers, hobbyists and professionals seeking affordable, highly functional test and measurement equipment. The +Resistor, Capacitors and Inductors are basic components of all electrical circuits and working on your projects you +will definitely need to measure some components laying around on your working bench. The STEMLab LCR meter will enable +you to do that quickly and accurately just by switching from one application to another. + +.. note:: + + To use the LCR meter application an additional extension module is needed. The LCR meter + `extension module `_ is available on our web store, + `http://store.redpitaya.com/ `. + +All Red Pitaya applications are web-based and don’t require the installation of any native software. Users can access +them via a browser using their smartphone, tablet or a PC running any popular operating system (MAC, Linux, Windows, +Android and iOS). The elements on the LCR meter application are arranged logically and offer a familiar user interface +similar to bench LCR meters. + +.. image:: Slika_01_LCR_meter_WEB_page.png + +The graphical interface is divided into 6 main areas: + + 1. **Hold/Run button:** It is used to start and stop measuring. Log data button: When selected, the measurements + of parameters selected in the “Data options” field are logged in the table shown in area 6. + + 2. **Data options panel:** It is used for selecting the desired parameter for which the measurement will be + displayed on the Main window panel shown on area 4. + + 3. **Measurement option panel:** It is used to select a measuring frequency, range mode and range value. The user + can select between the Parallel and Series measuring modes as well as between the Tolerance, Relative or Normal + modes (modes described in the features section) + + 4. **Main display:** On this panel the measurements of parameter selected in “Data option” field are shown. Where + the Primary parameter is shown with a larger font and the secondary parameter with smaller one. This is a very + common practice since by reading values from the display the user can automatically see the most important + results. + 5. **Secondary display:** On the secondary display the main settings are shown: current selected parameters, + measuring frequency and range mode. Also the Min, Max and Average value or Primary parameters are shown. + + 6. **Logging table:** Is used to log and export measured data. Logging is started by selecting the “Log data” + button. + + 7. **Option buttons field:** I used to manipulate with the table. The “Clear Min/Max” button will reset the Min + and Max value on the Secondary display. + + + +FEATURES +******** + +The main features of the LCR meter applications are described below: + +MEASURED PRIMARY PARAMETERS: Z, L, C, R +======================================= + +LCR meter application will enable you to measure basic parameters of the passive electrical components: +R – resistance, C – capacitance, L – inductance and Z – impedance. + +MEASURED SECONDARY PARAMETERS: P, D, Q, E +========================================= + +Alongside main parameters the secondary parameters are also measured and calculated. These parameters are common in +describing the properties and the quality of the passive components. P – phase of the impedance (phase between current +and voltage on measured component), D – dissipation factor (often used to quantify the quality of the capacitor), +Q – quality factor (often used to quantify the quality of the inductor), ESR – equivalent series resistance + +SELECTABLE FREQUENCIES: 100HZ, 1KHZ, 10KHZ, 100KHZ +================================================== + +LCR meter enables measurements at 4 different frequencies (100Hz, 1kHz, 10kHz, 100kHz). The user can select desired +frequency and the LCR application will use sine signals with the selected frequency to measure the impedance. + +RANGE MODES: AUTO, MANUAL +========================= + +Since the measured values are unknown, the LCR meter will adjust the measuring range providing the best accuracy. If +the user expects some value in creating ranges, then the Manual mode can be used. + + - Measurements modes: Tolerance, Relative, Normal The “Tolerance” and “Relative” buttons are used for measuring in + the Tolerance and Relative mode. When deselected, the LCR meter measures in the Normal mode. + - Tolerance mode: the last value measured before clicking the Tolerance button is saved and used to calculate the + percentage difference between the new value and the saved one. + - Relative mode: the last value measured before clicking the Relative button is saved and used to calculate + relative difference between the new value and the saved one. Equivalent Parameters calculation circuit: + Parallel, Series The Parallel and Series measuring modes refer to using the Series or Parallel equivalent + circuit for the parameters (R, C, L...) calculation from the measured Impedance Z \*. LCR meters will only + measure Z as the complex value Z=\|Z\|e^(jP) where P is the measured phase and \|Z\| is the impedance amplitude. + All other parameters are calculated from the Series or the Parallel equivalent circuit. + - Export of measured data in .csv format + - Min, Max, Average measurements + .. image:: LCR_range.png Frequency response analyzer enables measurements of frequency amplitude response of desired DUT (Device Under Test). @@ -24,4 +116,4 @@ Keysight precision LCR meter. From this plots you can extract basic Red Pitaya a Impedance analyzer application can be used without LCR Extension module using manual setting of shunt resistor. This option is described below. Notice that you will need to change “C_cable” parameter in the code when using your setup. -.. image:: Impedance_analyzer_manaul_R_Shunt.png +.. image:: Impedance_analyzer_manaul_R_Shunt.png \ No newline at end of file diff --git a/doc/appsFeatures/apps-featured/logic/01_iPad_Combo_Oscilloscope.jpg b/doc/appsFeatures/apps-featured/logic/01_iPad_Combo_Oscilloscope.jpg new file mode 100644 index 000000000..2f1e1e320 Binary files /dev/null and b/doc/appsFeatures/apps-featured/logic/01_iPad_Combo_Oscilloscope.jpg differ diff --git a/doc/appsFeatures/apps-featured/logic/Slika_01_LA.jpg b/doc/appsFeatures/apps-featured/logic/Slika_01_LA.jpg new file mode 100644 index 000000000..211e8881f Binary files /dev/null and b/doc/appsFeatures/apps-featured/logic/Slika_01_LA.jpg differ diff --git a/doc/appsFeatures/apps-featured/logic/Slika_02_LA.png b/doc/appsFeatures/apps-featured/logic/Slika_02_LA.png new file mode 100644 index 000000000..79ab0c918 Binary files /dev/null and b/doc/appsFeatures/apps-featured/logic/Slika_02_LA.png differ diff --git a/doc/appsFeatures/apps-featured/logic/Slika_03_LA.png b/doc/appsFeatures/apps-featured/logic/Slika_03_LA.png new file mode 100644 index 000000000..9829f075b Binary files /dev/null and b/doc/appsFeatures/apps-featured/logic/Slika_03_LA.png differ diff --git a/doc/appsFeatures/apps-featured/logic/Slika_04_LA.png b/doc/appsFeatures/apps-featured/logic/Slika_04_LA.png new file mode 100644 index 000000000..f9ca47e70 Binary files /dev/null and b/doc/appsFeatures/apps-featured/logic/Slika_04_LA.png differ diff --git a/doc/appsFeatures/apps-featured/logic/Slika_05_LA.png b/doc/appsFeatures/apps-featured/logic/Slika_05_LA.png new file mode 100644 index 000000000..a2aa562f0 Binary files /dev/null and b/doc/appsFeatures/apps-featured/logic/Slika_05_LA.png differ diff --git a/doc/appsFeatures/apps-featured/logic/Slika_06_LA.png b/doc/appsFeatures/apps-featured/logic/Slika_06_LA.png new file mode 100644 index 000000000..0f8d9baa9 Binary files /dev/null and b/doc/appsFeatures/apps-featured/logic/Slika_06_LA.png differ diff --git a/doc/appsFeatures/apps-featured/logic/Slika_07_LA.png b/doc/appsFeatures/apps-featured/logic/Slika_07_LA.png new file mode 100644 index 000000000..6e305e5d5 Binary files /dev/null and b/doc/appsFeatures/apps-featured/logic/Slika_07_LA.png differ diff --git a/doc/appsFeatures/apps-featured/logic/Slika_08_LA.png b/doc/appsFeatures/apps-featured/logic/Slika_08_LA.png new file mode 100644 index 000000000..f45619bb2 Binary files /dev/null and b/doc/appsFeatures/apps-featured/logic/Slika_08_LA.png differ diff --git a/doc/appsFeatures/apps-featured/logic/Slika_09_LA.png b/doc/appsFeatures/apps-featured/logic/Slika_09_LA.png new file mode 100644 index 000000000..b917d98e8 Binary files /dev/null and b/doc/appsFeatures/apps-featured/logic/Slika_09_LA.png differ diff --git a/doc/appsFeatures/apps-featured/logic/Slika_10_LA.png b/doc/appsFeatures/apps-featured/logic/Slika_10_LA.png new file mode 100644 index 000000000..5273c5a22 Binary files /dev/null and b/doc/appsFeatures/apps-featured/logic/Slika_10_LA.png differ diff --git a/doc/appsFeatures/apps-featured/logic/logic.rst b/doc/appsFeatures/apps-featured/logic/logic.rst new file mode 100644 index 000000000..7d70e8113 --- /dev/null +++ b/doc/appsFeatures/apps-featured/logic/logic.rst @@ -0,0 +1,162 @@ +Logic Analyzer +############## + +.. image:: Slika_01_LA.jpg + +The Logic Analyzer application enables the representation of the binary states of digital signals. The Logic Analyzer +can both deal with purely binary signals, such as GPIO outputs of the Raspberry Pi or Arduino board, as well as +analyze different bus (I2C, SPI, and UART) and decode the transmitted data. All Red Pitaya applications are web-based +and do not require the installation of any native software. Users can access them via a web browser using their +smartphone, tablet or a PC running any popular operating system (MAC, Linux, Windows, Android, and iOS). + + +Logic Analyzer application possibilities: + + 1. **Basic Logic Analyzer - Without the Logic Analyzer extension modul** – Using directly the GPIO expansion + connector of the STEMLab board. **Works only with STEMlab 125-10!** + 2. **Logic Analyzer PRO - With the Logic Analyzer extension module** – Enabling different logic levels, board + protection and higher performances. **Works with STEMlab 125-14 & STEMlab 125-10** + +The graphical user interface of the Logic Analyzer fits well into the overall design of the Red Pitaya applications +providing the same operating concept. The Logic Analyzer user interface is shown below. + +.. image:: Slika_02_LA.png + +Apart from the actual graph, there are again 5 key areas/elements, in which the surface is divided: + + 1. **Auto:** Resets the zoom and brings the trigger event in the middle of the graph. + #. **Run / Stop:** Starts recording the input signals, and interrupts it when the recording is active. + #. **Channels / trigger / Measuring Tools:** This menu provides controls for inputs, triggers, and guides. + #. **Axis control panel:** The horizontal +/- buttons enable you to select the scaling of the X axis and to change + it, and to select the time range displayed in the graph. The vertical +/- buttons change the Y axis, and thus + the height of the graph display. In addition, the setting for the time frame, trigger and sampling rate are + displayed. + #. **Status Display:** Displays information about the current state of the recording (stop, wait, ready). + +FEATURES +******** + +ANALYZING BINARY SIGNALS +======================== + +.. image:: Slika_03_LA.png + +By selecting the gear button behind the DIGITAL selection field you enter the menu for the channel configuration. In +the LINES register, the channels can be activated or deactivated by simply clicking the check mark. As long as no bus +systems have been configured, the channels operate as purely digital inputs and correspondingly show the progress. The +tab ACQ opens the selection field for the Sample rate settings. When selecting the values there is one thing to note: +the sample rate has a significant influence on the time section, which can be represented. The memory depth of the +Logic Analyzer applications is 1 MS, so it can store and display 1,000,000 binary values. From this it is clear that +the sampling rate determines how many values are recorded per second. If we choose the highest sampling rate +(125MS/s), 125,000,000 values would be recorded per second. Since 1,000,000 values can be stored is the time memory, +we get a 0.008 second time window. With a sampling rate of 1MS/s, the time window of the recorded signal will be one +full second. + +.. image:: Slika_04_LA.png + +When the Pre-sample data buffer value is set, at which point of the recording the trigger event is located. This makes +particular sense if you want to find out what happened before the defined trigger event. To illustrate with an +example: the sample rate is set to 4MS / s, the stored time segment thus amounts to approximately 0.25s = 250ms. If +the Pre-sample data buffer is set to 10ms, then the recorded signal shows what has happened 10ms before the event, and +240ms after the event. + +TRIGGER: +======== + +.. image:: Slika_05_LA.png + +By clicking the gear behind TRIG settings, the trigger menu is opened. Each channel can be set as a trigger source +with the desired condition. For acquisition to start, the Trigger source and Rising Edge needs to be defined. +The possible criteria for Trigger event are next: + +**X - Ignore** no event +**R - Rising** rising edge +**F - Falling** Falling edge +**E - Either** Edge change (rising or falling edge) + +By clicking the RUN button the recording is started. The status display informs you whether the process is still +running (WAITING) or has already been completed (DONE). After finishing the acquisition, the results are displayed in +a graph. Additional trigger options LOW and HIGH are used for the so called Patterned triggering. For example: If you +set the trigger source to be DIN0 – Rising edge (to have one channel defined as a trigger source with a rising or +falling edge is a mandatory condition for the acquisition to start), DIN1 to HIGH and DIN2 to LOW this will cause such +a behavior that the application logic will wait for the state where DIN0 goes from 0 to 1, DIN1 is 1 and DIN2 is 0 to +start the acquisition. + +DECODE BUS DATA: +================ + +In the DIGITAL → BUS menu the decoding of the desired lines can be selected. Up to 4 buses can be defined. The +available decoding protocols are I2C, UART, and SPI. By selecting the desired protocol, the setting menu for the +selected protocol is opened. + +.. image:: Slika_06_LA.png + +Two options are possible for the display of the decoded data: firstly, the data is placed as a separate layer in the +graph directly on the signal. Secondly, using the DIGITAL → DATA menu where the decoded data are represented in a +table format. You can select ASCII, DEC, BIN and HEX data formatting. With the EXPORT button the decoded data can be +packed into a CSV file. This then ends up directly in the download folder and can be used for further analysis. + +.. image:: Slika_07_LA.png + +CURSORS: +======== + +As with the Oscilloscope the Logic Analyze rApp also provides CURSORS for quick measurements. Because there are no +variable amplitude readings but only discrete signal levels, the cursors are available exclusively for the X axis. +When enabled, the cursors will show the relative time respectively to zero point (trigger event) and the difference +between the two. + +.. image:: Slika_08_LA.png + +SPECIFICATIONS +************** + ++-------------------------+----------------------+----------------------+ +| | Basic Logic Analyzer | Logic Analyzer PRO | ++-------------------------+----------------------+----------------------+ +| Channels | 8th | 8th | ++-------------------------+----------------------+----------------------+ +| Sampling rate (max.) | 12MS/s | 125ms/s | ++-------------------------+----------------------+----------------------+ +| Maximum Input Frequency | 3MHz | 50MHz | ++-------------------------+----------------------+----------------------+ +| Supported bus protocols | I2C, SPI, UART | I2C, SPI, UART | ++-------------------------+----------------------+----------------------+ +| Input voltage | 3.3V | 2.5 ... 5.5V | ++-------------------------+----------------------+----------------------+ +| Overload protection | - | integrated | ++-------------------------+----------------------+----------------------+ +| Level thresholds | - | | 0.8V (low) | +| | | | 2.0V (high) | ++-------------------------+----------------------+----------------------+ +| Input impedance | - | 100k, 3 pF | ++-------------------------+----------------------+----------------------+ +| Trigger types | Level, edge, pattern | Level, edge, pattern | ++-------------------------+----------------------+----------------------+ +| Memory depth | 1 MS (typical) | 1 MS (typical) | ++-------------------------+----------------------+----------------------+ +| Sampling interval | 84ns | 8ns | ++-------------------------+----------------------+----------------------+ +| Minimum pulse duration | 100ns | 10ns | ++-------------------------+----------------------+----------------------+ + + +Hardware/Connections +==================== + +Alongside the Logic analyzer application for maximal performance and protection of your STEMLab board the Logic +analyzer extension module (Logic Analyzer PRO) is recommended. Using the LA extension module is straightforward, just +plug it on your STEMLab and connect the leads to the desired measurement points. + +.. image:: Slika_09_LA.png + +To use the Logic analyzer without the extension module (Basic Logic Analyzer) you need to be more careful in +connecting the Logic analyzer probes to the extension connector E1 on the STEMLab board. The pins used for Logic +analyzer board are shown in picture below. + +.. note:: + + Using directly the GPIO expansion connector E1 pins of the STEMLab board w orks only with STEMlab 125-10! Picture + bellow(left) shows connection for the STEMlab 125 – 10 board. + +.. image:: Slika_10_LA.png diff --git a/doc/appsFeatures/apps-featured/oscSigGen/01_iPad_Combo_Oscilloscope.jpg b/doc/appsFeatures/apps-featured/oscSigGen/01_iPad_Combo_Oscilloscope.jpg new file mode 100644 index 000000000..2f1e1e320 Binary files /dev/null and b/doc/appsFeatures/apps-featured/oscSigGen/01_iPad_Combo_Oscilloscope.jpg differ diff --git a/doc/appsFeatures/apps-featured/oscSigGen/Slika_02_OSC.png b/doc/appsFeatures/apps-featured/oscSigGen/Slika_02_OSC.png new file mode 100644 index 000000000..5a9254fb2 Binary files /dev/null and b/doc/appsFeatures/apps-featured/oscSigGen/Slika_02_OSC.png differ diff --git a/doc/appsFeatures/apps-featured/oscSigGen/Slika_03_OSC_left.png b/doc/appsFeatures/apps-featured/oscSigGen/Slika_03_OSC_left.png new file mode 100644 index 000000000..fe98dcde7 Binary files /dev/null and b/doc/appsFeatures/apps-featured/oscSigGen/Slika_03_OSC_left.png differ diff --git a/doc/appsFeatures/apps-featured/oscSigGen/Slika_03_OSC_right.png b/doc/appsFeatures/apps-featured/oscSigGen/Slika_03_OSC_right.png new file mode 100644 index 000000000..e5489968e Binary files /dev/null and b/doc/appsFeatures/apps-featured/oscSigGen/Slika_03_OSC_right.png differ diff --git a/doc/appsFeatures/apps-featured/oscSigGen/Slika_04_OSC.png b/doc/appsFeatures/apps-featured/oscSigGen/Slika_04_OSC.png new file mode 100644 index 000000000..cb10de7a6 Binary files /dev/null and b/doc/appsFeatures/apps-featured/oscSigGen/Slika_04_OSC.png differ diff --git a/doc/appsFeatures/apps-featured/oscSigGen/Slika_05_OSC.png b/doc/appsFeatures/apps-featured/oscSigGen/Slika_05_OSC.png new file mode 100644 index 000000000..3d722236d Binary files /dev/null and b/doc/appsFeatures/apps-featured/oscSigGen/Slika_05_OSC.png differ diff --git a/doc/appsFeatures/apps-featured/oscSigGen/Slika_06_OSC.png b/doc/appsFeatures/apps-featured/oscSigGen/Slika_06_OSC.png new file mode 100644 index 000000000..10b9dfae5 Binary files /dev/null and b/doc/appsFeatures/apps-featured/oscSigGen/Slika_06_OSC.png differ diff --git a/doc/appsFeatures/apps-featured/oscSigGen/Slika_07_OSC.png b/doc/appsFeatures/apps-featured/oscSigGen/Slika_07_OSC.png new file mode 100644 index 000000000..d4f268d5b Binary files /dev/null and b/doc/appsFeatures/apps-featured/oscSigGen/Slika_07_OSC.png differ diff --git a/doc/appsFeatures/apps-featured/oscSigGen/Slika_08_OSC.png b/doc/appsFeatures/apps-featured/oscSigGen/Slika_08_OSC.png new file mode 100644 index 000000000..b97e3f459 Binary files /dev/null and b/doc/appsFeatures/apps-featured/oscSigGen/Slika_08_OSC.png differ diff --git a/doc/appsFeatures/apps-featured/oscSigGen/Slika_09_OSC.png b/doc/appsFeatures/apps-featured/oscSigGen/Slika_09_OSC.png new file mode 100644 index 000000000..1a5dda804 Binary files /dev/null and b/doc/appsFeatures/apps-featured/oscSigGen/Slika_09_OSC.png differ diff --git a/doc/appsFeatures/apps-featured/oscSigGen/Slika_10_OSC.png b/doc/appsFeatures/apps-featured/oscSigGen/Slika_10_OSC.png new file mode 100644 index 000000000..a35996ecd Binary files /dev/null and b/doc/appsFeatures/apps-featured/oscSigGen/Slika_10_OSC.png differ diff --git a/doc/appsFeatures/apps-featured/oscSigGen/osc.rst b/doc/appsFeatures/apps-featured/oscSigGen/osc.rst new file mode 100644 index 000000000..96f523629 --- /dev/null +++ b/doc/appsFeatures/apps-featured/oscSigGen/osc.rst @@ -0,0 +1,220 @@ +Oscilloscope & Signal Generator +############################### + +.. image:: 01_iPad_Combo_Oscilloscope.jpg + +This application will turn your STEMlab board into a 2-channel Oscilloscope and 2-channel Signal generator. It is the +perfect tool for educators, students, makers, hobbyists and professionals seeking affordable, highly functional test +and measurement equipment. It enables generating and measuring electrical signals up to 50MHz. The simple and +intuitive user interface provides all the necessary tools for signal analysis and measurements. High end +specifications will satisfy more demanding users looking for powerful tools for their working benches. The application +is web-based and doesn’t require installation of any native software. Users can access them via any web browser +(Google Chrome is recommended) using their smartphone, tablet or a PC running any popular operating system (MAC, +Linux, Windows, Android and iOS). The elements on the Oscilloscope&Sig. Generator application are arranged logically +and offer a familiar user interface. + +.. image:: Slika_02_OSC.png + +Apart from the graph there are five areas in which the surface is divided: + + 1. Autoscale: Automatically sets up the Oscilloscope settings for the optimal display of the input signals. By + pressing the button the voltage axis and time axis are set so that at least one full period of the signal will + fill the screen. + #. Channels / Trigger / Measuring Tools: This menu provides controls for inputs / outputs, Trigger, guides, and + measurements. + #. Axis control panel: By pressing the horizontal ± buttons the scaling of the X axis is changed and thus the + selected time range which is displayed in the graph. The vertical ± buttons change the Y axis, and thus the + displayed voltage range of the signal. In addition, the setting for the time frame, trigger, zero point of the + X axis and the sampling rate are displayed. + #. Channel Setting display: Indicates the scale of the Y axis for all channels that are switched. + + +Fatures +******* + +Oscilloscope & signal generator main features are listed below: + - Run/stop and auto set functionality + - Signals position and scale controls + - Trigger controls (source, level, slope) + - Trigger modes: auto, normal and single triggering + - Input calibration wizard + - Cursors + - Measurements + - Math operations + - Signal generator controls (waveform, amplitude, frequency, phase) + +Autoscale +========= + +Automatically sets up the Oscilloscope to best display the input signal. By pressing this button, the voltage axis and +the time axis are set so that at least one full period of the signal will fill the screen. + +.. image:: Slika_03_OSC_left.png + :width: 49% + +.. image:: Slika_03_OSC_right.png + :width: 49% + +Inputs +====== + +.. image:: Slika_05_OSC.png + :width: 30% + :align: right + +On the right side of the Oscilloscope&Sig. Generator application interface the IN1 and IN2 channels are listed. By a +simple click on the name of a channel (not the gear) the channel gets highlighted and you can simply control all the +settings of the respective channel. + + +The available settings are the following: + + - **SHOW:** Shows or hides the curve associated with the channel. + - **INVERT:** Reflects the graph on the X axis. + - **Probe attenuation:** (must be selected manually) The division that was set on the probe. + - **Vertical offset:** Moves the curve up or down. + - **LV and HV:** Must be selected according to the jumper position on each channel. + + +Outputs +======= + + + +On the right side of the Oscilloscope&Sig. Generator application interface the OUT1 and OUT2 channels are listed. By a +simple click on the name of a channel (not the gear) the channel gets highlighted and you can simply control all the +settings of the respective channel. The available settings are the following: ON, SHOW, Type, Trigger, Frequency, +Amplitude, Offset, Phase, and Duty cycle. Various waveforms are available for output: SINE (sinus), SQUARE (rectangle) +TRIANGLE (triangle), SAWU (rising sawtooth), SAWD (falling sawtooth), DC and PWM (Pulse Width Modulation). + +.. image:: Slika_06_OSC.png + +Trigger +======= + +.. image:: Slika_07_OSC.png + :width: 30% + :align: right + +The Trigger is used to enable the scope to display changing waveforms to be displayed on the screen of the scope in a +steady fashion. The parameter Source defines the trigger source used for this. The trigger source can be input channel +1 (IN1) or input channel 2 (IN2) or an external source. The available settings are the following: + + - **LEVEL** Trigger level value is used to determinate at which value of signal amplitude the trigger condition will be + satisfied(true). When signal amplitude achieves/cross this value the trigger state is set to “true”. Following “true” + trigger condition the acquisition and signal plotting will be executed. + - **EGDE** Since during the time sweep(acquisition) signal amplitude can cross trigger level from higher value to the + lowest one or vice versa. The edge setting will determinate at which case the trigger condition will be set to “true”. + - **NORMAL** The acquisition(trace (re)plotting) is executed only if the trigger state is “true”. In other words; signal + needs to satisfy trigger condition in order to be acquired and (re)plotted by the Oscilloscope. + - **SINGLE** After trigger conditions are satisfied by the observed signal the acquisition is executed only once and + trace re-plotting is stopped regardless of the repetitive “true” trigger states. + - **AUTO** Trigger state and conditions are disregarded. Signal acquisition and signal trace re-plotting are executed in + repetitive(continuous) manner. This setting is default one. + - **STOP** Pause triggers. + - **RUN** Starts/continues triggering. + +The Source parameter defines the source used for this purpose. With the IN1 or the IN2 the signal at the respective input is selected; with the EXT you can invoke the trigger from outside through Pin 3 on the header row E1. + +Math +===== + +Among the more interesting features of a digital oscilloscope is the "math" channel. The available settings are the following: + + - **\+** Adds the selected channels. + - **\-** Subtract the selected channels. + - **\*** Multiply selected channels. + - **ABS** Gives an absolute value of the selected signal. + - **dy/dt** Gives an time derivation of the selected signal. + - **ydt** Gives an time integration of the selected signal. + - **INVERT** Inverts the signal. + +.. image:: Slika_08_OSC.png + +Cursor +====== + +This feature enables the user to easily get the data of relevant basic measurements such is: signal period, amplitude, +time delay, amplitude difference between two points, time difference between two points and etc. + +.. image:: Slika_09_OSC.png + + +Navigate +======== + +When you have a lot of data to analyze, it is very important to get through them easily. Navigate left and right by +dragging the data where you want and effortlessly zoom in and out by using your mouse scroll wheel. + +.. image:: Slika_04_OSC.png + +Measurements +============ + +The menu can be found under the MEAS button. Here you can select up to 4 measured values in total, then provide the +corresponding values. In the Operator field select the desired measurement and then set the Signal from which channel +the value should be taken. One click on DONE shows the value in the bottom of the channel settings. You may choose +among the following: + + - **P2P:** The difference between the lowest and the highest measured voltage value. + - **MEAN:** The calculated average of the signal. + - **MAX:** The highest measured voltage value. + - **MIN:** The lowest measured voltage value. + - **RMS:** The calculated RMS (root mean square) of the signal. + - **DUTY CYCLE:** The Signal’s duty cycle (ratio of the pulse duration and period length). + - **PERIOD:** Displays the period length, the time length of a vibration. + - **FREQ:** The frequency of the signal. + +.. image:: Slika_10_OSC.png + +Specifications +************** + +Oscilloscope +============ + ++-----------------------------+-------------------------------+------------------------------+ +| | STEMlab 125 - 10 | STEMlab 125 - 14 | ++-----------------------------+-------------------------------+------------------------------+ +| Input channels | 2 | 2 | ++-----------------------------+-------------------------------+------------------------------+ +| Bandwidth | 40MHz | 40MHz | ++-----------------------------+-------------------------------+------------------------------+ +| Resolution | 10bit | 14bit | ++-----------------------------+-------------------------------+------------------------------+ +| Memory depth | 16k samples | 16k samples | ++-----------------------------+-------------------------------+------------------------------+ +| Input range | ± 1V (LV) and ± 20V (HV) | ± 1V (LV) and ± 20V (HV) | ++-----------------------------+-------------------------------+------------------------------+ +| Input coupling | DC | DC | ++-----------------------------+-------------------------------+------------------------------+ +| Minimal Voltage Sensitivity | ± 0.244mV / ± 2.44mV | | ++-----------------------------+-------------------------------+------------------------------+ +| External Trigger | Yes | Yes | ++-----------------------------+-------------------------------+------------------------------+ + + +Signal generator +================ + ++------------------+-------------------+------------------+ +| | STEMlab 125 - 10 | STEMlab 125 - 14 | ++------------------+-------------------+------------------+ +| Output channels | 2 | 2 | ++------------------+-------------------+------------------+ +| Frequency Range | 0-50MHz | 0-50MHz | ++------------------+-------------------+------------------+ +| Resolution | 10bit | 14bit | ++------------------+-------------------+------------------+ +| Signal buffer | 16k samples | 16k samples | ++------------------+-------------------+------------------+ +| Output range | ± 1V | ± 1V | ++------------------+-------------------+------------------+ +| Input coupling | DC | DC | ++------------------+-------------------+------------------+ +| External Trigger | Yes | Yes | ++------------------+-------------------+------------------+ +| Output load | 50Ω | 50 Ω | ++------------------+-------------------+------------------+ + + diff --git a/doc/appsFeatures/apps-featured/spectrum/01_iPad_Combo_Spectrum.jpg b/doc/appsFeatures/apps-featured/spectrum/01_iPad_Combo_Spectrum.jpg new file mode 100644 index 000000000..7bc896c18 Binary files /dev/null and b/doc/appsFeatures/apps-featured/spectrum/01_iPad_Combo_Spectrum.jpg differ diff --git a/doc/appsFeatures/apps-featured/spectrum/Slika_02_SA.png b/doc/appsFeatures/apps-featured/spectrum/Slika_02_SA.png new file mode 100644 index 000000000..45e7d775b Binary files /dev/null and b/doc/appsFeatures/apps-featured/spectrum/Slika_02_SA.png differ diff --git a/doc/appsFeatures/apps-featured/spectrum/Slika_03_SA.png b/doc/appsFeatures/apps-featured/spectrum/Slika_03_SA.png new file mode 100644 index 000000000..438cfc182 Binary files /dev/null and b/doc/appsFeatures/apps-featured/spectrum/Slika_03_SA.png differ diff --git a/doc/appsFeatures/apps-featured/spectrum/Slika_04_SA.png b/doc/appsFeatures/apps-featured/spectrum/Slika_04_SA.png new file mode 100644 index 000000000..e9df4d5e2 Binary files /dev/null and b/doc/appsFeatures/apps-featured/spectrum/Slika_04_SA.png differ diff --git a/doc/appsFeatures/apps-featured/spectrum/Slika_05_SA.png b/doc/appsFeatures/apps-featured/spectrum/Slika_05_SA.png new file mode 100644 index 000000000..38c97f2fa Binary files /dev/null and b/doc/appsFeatures/apps-featured/spectrum/Slika_05_SA.png differ diff --git a/doc/appsFeatures/apps-featured/spectrum/Slika_06_SA.png b/doc/appsFeatures/apps-featured/spectrum/Slika_06_SA.png new file mode 100644 index 000000000..c8f0f0447 Binary files /dev/null and b/doc/appsFeatures/apps-featured/spectrum/Slika_06_SA.png differ diff --git a/doc/appsFeatures/apps-featured/spectrum/Slika_07_SA.png b/doc/appsFeatures/apps-featured/spectrum/Slika_07_SA.png new file mode 100644 index 000000000..2f6e67636 Binary files /dev/null and b/doc/appsFeatures/apps-featured/spectrum/Slika_07_SA.png differ diff --git a/doc/appsFeatures/apps-featured/spectrum/spectrum.rst b/doc/appsFeatures/apps-featured/spectrum/spectrum.rst new file mode 100644 index 000000000..9cfc5b7bd --- /dev/null +++ b/doc/appsFeatures/apps-featured/spectrum/spectrum.rst @@ -0,0 +1,119 @@ +Spectrum Analyzer +################# + +.. image:: 01_iPad_Combo_Spectrum.jpg + +This application will turn your STEMLab board into a 2-channel DFT Spectrum Analyzer. It is the perfect tool for +educators, students, makers, hobbyists and professionals seeking affordable, highly functional test and measurement +equipment. The DFT Spectrum analyzer application enables a quick and powerful spectrum analysis using a DFT algorithm. +Frequency span is form DC up to 62.5MHz where the frequency range can be arbitrarily selected. You can easily measure +the quality of your signals, signal harmonics, spurious and power. All Red Pitaya applications are web-based and do +not require the installation of any native software. Users can access them via a web browser using their smartphone, +tablet or a PC running any popular operating system (MAC, Linux, Windows, Android, and iOS). The elements on the DFT +Spectrum analyzer application are arranged logically and offer a familiar user interface. + +The graphical interface is divided into 4 main areas: + + 1. **Run/Stop** and **Export button:** The “Run/Stop” button is used to start and stop measurements. With the + “Export” button you can select in which format you want to download the measured data (plotted spectrum). Two + formats are available: .png and .csv. + #. **Inputs / Cursors / Range / Axis control panel:** This menu provides controls for inputs, cursors, and + frequency range settings. Horizontal +/- buttons are used to select the span of the X (frequency) axis (zooming + in/out). The vertical +/- buttons change the Y (amplitude)-axis range. + + #. **Graph area:** Here, the currently calculated signal spectrum is plotted in the selected frequency range. + #. **Waterfall plots:** Waterfall plots are a different way of the signal spectrum representation where the color + on the plot defines the signal amplitude for a certain frequency. The waterfall plot is also useful to enable + the representation of a signal spectrum in a time dependency. + +.. image:: Slika_02_SA.png + +FEATURES +******** + +The main features of the DFT Spectrum analyzer are described below: + +INPUTS: +======= + +Inputs controls are shown in the picture below. With the “SHOW” select button displaying the spectrum of the selected +input can be enabled or disabled. The “FREEZE” button is used for stopping the measurements of the selected input. The +“MIN” and “MAX” select buttons are used to enable/disable the persist mode for the spectrum plot. The “MIN” signal +spectrum plot will show the lowest values of the signal spectrum taken after enabling the “MIN” button. The same logic +is used for the “MAX” signal where the MAX values of the signal spectrum are shown. This feature is mostly used for +detecting signal glitches and the max/min spectrum amplitude values during the measurement. + +.. image:: Slika_03_SA.png + +CURSORS: +======== + +The cursors are an additional vertical and horizontal pair of lines useful for extracting the values of the spectrum +plots. + +The cursors are interactive and they can be set on any part of the graph while the frequency value is shown +corresponding to the place where the X cursors are set, and the amplitude value where the Y cursors are set. Cursor +delta values are useful for measuring signal harmonics and relative ratios between amplitudes and frequencies. + +.. image:: Slika_04_SA.png + +RANGE: +====== + +The range settings are used to set a frequency span. This feature is useful when the frequency range of interest is +smaller than the full frequency range of the Spectrum analyzer application. + +.. image:: Slika_05_SA.png + +PEAK DETECTION: +=============== + +During the measurement, peak values of the signal spectrum are measured and shown on the “Peak Values” field. Peak +values are max values of the signals spectrum regardless of the selected frequency range. This peak finding prevents +not seeing peak values which are outside the selected frequency span. + +.. image:: Slika_06_SA.png + +WATERFALL PLOTS: +================ + +Waterfall plots are a different way of the signal spectrum representation where the color on the plot defines the +signal amplitude for a certain frequency. The waterfall plot is also useful when enabling the representation of the +signal spectrum in a time dependency. + + +AXIS CONTROLS: +============== + +Horizontal +/- buttons are used to select the span of the X (frequency) axis (zooming in/out). The vertical +/- +buttons change the Y (amplitude)-axis range. Reset button when selected reset frequency and amplitude span do default +values. + +.. image:: Slika_07_SA.png + +SPECIFICATIONS +************** + ++-------------------------------+----------------------+----------------------+ +| | STEMlab 125 - 10 | STEMlab 125 - 14 | ++-------------------------------+----------------------+----------------------+ +| Input channels | 2 | 2 | ++-------------------------------+----------------------+----------------------+ +| Bandwidth | 0 - 50MHz | 0 - 62MHz | ++-------------------------------+----------------------+----------------------+ +| Resolution | 10 bit | 14 bit | ++-------------------------------+----------------------+----------------------+ +| DFT buffer | 16384 | 16384 | ++-------------------------------+----------------------+----------------------+ +| Dynamic Range | - 70 dBm | - 80 dBm | ++-------------------------------+----------------------+----------------------+ +| Input noise level | < -100 dBm/Hz | < -119 dBm/Hz | ++-------------------------------+----------------------+----------------------+ +| Input range | 10dBm | 10dBm | ++-------------------------------+----------------------+----------------------+ +| Input impedance | 1 MΩ / 10 pF | 1 MΩ / 10 pF | ++-------------------------------+----------------------+----------------------+ +| Input coupling | DC | DC | ++-------------------------------+----------------------+----------------------+ +| Spurious frequency components | < -70 dBFS Typically | < -90 dBFS Typically | ++-------------------------------+----------------------+----------------------+ diff --git a/doc/appsFeatures/appsFeatures.rst b/doc/appsFeatures/appsFeatures.rst index c60a50bd4..b36df2626 100644 --- a/doc/appsFeatures/appsFeatures.rst +++ b/doc/appsFeatures/appsFeatures.rst @@ -7,7 +7,7 @@ Applications and Features slika glavne applikacije z razlagami ( desktop app ) .. toctree:: - :maxdepth: 5 + :maxdepth: 6 :numbered: apps-featured/apps-featured diff --git a/doc/appsFeatures/examples/Bar-graph-with-LEDs_LV.png b/doc/appsFeatures/examples/Bar-graph-with-LEDs_LV.png new file mode 100644 index 000000000..370dcd1ce Binary files /dev/null and b/doc/appsFeatures/examples/Bar-graph-with-LEDs_LV.png differ diff --git a/doc/appsFeatures/examples/Blink_LV.png b/doc/appsFeatures/examples/Blink_LV.png new file mode 100644 index 000000000..49499837b Binary files /dev/null and b/doc/appsFeatures/examples/Blink_LV.png differ diff --git a/doc/appsFeatures/examples/Custom-wavefrom-signal-generator_LV.png b/doc/appsFeatures/examples/Custom-wavefrom-signal-generator_LV.png new file mode 100644 index 000000000..e1a0488c6 Binary files /dev/null and b/doc/appsFeatures/examples/Custom-wavefrom-signal-generator_LV.png differ diff --git a/doc/appsFeatures/examples/Generate-continuous-signal_LV.png b/doc/appsFeatures/examples/Generate-continuous-signal_LV.png new file mode 100644 index 000000000..c60839046 Binary files /dev/null and b/doc/appsFeatures/examples/Generate-continuous-signal_LV.png differ diff --git a/doc/appsFeatures/examples/Generate-signal-on-external-trigger_LV.png b/doc/appsFeatures/examples/Generate-signal-on-external-trigger_LV.png new file mode 100644 index 000000000..a44630242 Binary files /dev/null and b/doc/appsFeatures/examples/Generate-signal-on-external-trigger_LV.png differ diff --git a/doc/appsFeatures/examples/Generate-signal-pulses_LV.png b/doc/appsFeatures/examples/Generate-signal-pulses_LV.png new file mode 100644 index 000000000..682b44918 Binary files /dev/null and b/doc/appsFeatures/examples/Generate-signal-pulses_LV.png differ diff --git a/doc/appsFeatures/examples/Interactive-LED-bar-graph_LV.png b/doc/appsFeatures/examples/Interactive-LED-bar-graph_LV.png new file mode 100644 index 000000000..af3509755 Binary files /dev/null and b/doc/appsFeatures/examples/Interactive-LED-bar-graph_LV.png differ diff --git a/doc/appsFeatures/examples/Interactive-voltage-setting-on-slow-analog-output_LV.png b/doc/appsFeatures/examples/Interactive-voltage-setting-on-slow-analog-output_LV.png new file mode 100644 index 000000000..807843021 Binary files /dev/null and b/doc/appsFeatures/examples/Interactive-voltage-setting-on-slow-analog-output_LV.png differ diff --git a/doc/appsFeatures/examples/On-trigger-signal-acquisition_LV.png b/doc/appsFeatures/examples/On-trigger-signal-acquisition_LV.png new file mode 100644 index 000000000..3c5e03ff8 Binary files /dev/null and b/doc/appsFeatures/examples/On-trigger-signal-acquisition_LV.png differ diff --git a/doc/appsFeatures/examples/Push-button-and-turn-on-LED_LV.png b/doc/appsFeatures/examples/Push-button-and-turn-on-LED_LV.png new file mode 100644 index 000000000..de8a3f08f Binary files /dev/null and b/doc/appsFeatures/examples/Push-button-and-turn-on-LED_LV.png differ diff --git a/doc/appsFeatures/examples/RP-circuit-e1421258707736-300x212.png b/doc/appsFeatures/examples/RP-circuit-e1421258707736-300x212.png new file mode 100644 index 000000000..640171c66 Binary files /dev/null and b/doc/appsFeatures/examples/RP-circuit-e1421258707736-300x212.png differ diff --git a/doc/appsFeatures/examples/Read-analog-voltage-on-slow-analog-input_LV.png b/doc/appsFeatures/examples/Read-analog-voltage-on-slow-analog-input_LV.png new file mode 100644 index 000000000..6a452e26b Binary files /dev/null and b/doc/appsFeatures/examples/Read-analog-voltage-on-slow-analog-input_LV.png differ diff --git a/doc/appsFeatures/examples/Read_analog_voltage_on_Red_Pitaya_analog_input.png b/doc/appsFeatures/examples/Read_analog_voltage_on_Red_Pitaya_analog_input.png new file mode 100644 index 000000000..c4ad37d4d Binary files /dev/null and b/doc/appsFeatures/examples/Read_analog_voltage_on_Red_Pitaya_analog_input.png differ diff --git a/doc/appsFeatures/examples/Read_analog_voltage_on_Red_Pitaya_analog_input_circuit.png b/doc/appsFeatures/examples/Read_analog_voltage_on_Red_Pitaya_analog_input_circuit.png new file mode 100644 index 000000000..c1a1e66ad Binary files /dev/null and b/doc/appsFeatures/examples/Read_analog_voltage_on_Red_Pitaya_analog_input_circuit.png differ diff --git a/doc/appsFeatures/examples/RedPitaya_Push_button.png b/doc/appsFeatures/examples/RedPitaya_Push_button.png new file mode 100644 index 000000000..f72834881 Binary files /dev/null and b/doc/appsFeatures/examples/RedPitaya_Push_button.png differ diff --git a/doc/appsFeatures/examples/RedPitaya_Push_button_circuit.png b/doc/appsFeatures/examples/RedPitaya_Push_button_circuit.png new file mode 100644 index 000000000..4708c9269 Binary files /dev/null and b/doc/appsFeatures/examples/RedPitaya_Push_button_circuit.png differ diff --git a/doc/appsFeatures/examples/Set-analog-voltage-on-slow-analog-output_LV.png b/doc/appsFeatures/examples/Set-analog-voltage-on-slow-analog-output_LV.png new file mode 100644 index 000000000..722c141c4 Binary files /dev/null and b/doc/appsFeatures/examples/Set-analog-voltage-on-slow-analog-output_LV.png differ diff --git a/doc/appsFeatures/examples/Set_analog_voltage_on_slow_analog_input1.png b/doc/appsFeatures/examples/Set_analog_voltage_on_slow_analog_input1.png new file mode 100644 index 000000000..355b00d14 Binary files /dev/null and b/doc/appsFeatures/examples/Set_analog_voltage_on_slow_analog_input1.png differ diff --git a/doc/appsFeatures/examples/Set_analog_voltage_on_slow_analog_input_circuit1.png b/doc/appsFeatures/examples/Set_analog_voltage_on_slow_analog_input_circuit1.png new file mode 100644 index 000000000..9bfa2913d Binary files /dev/null and b/doc/appsFeatures/examples/Set_analog_voltage_on_slow_analog_input_circuit1.png differ diff --git a/doc/appsFeatures/examples/Signal-acquisition-on-external-trigger_LV.png b/doc/appsFeatures/examples/Signal-acquisition-on-external-trigger_LV.png new file mode 100644 index 000000000..c8ad803da Binary files /dev/null and b/doc/appsFeatures/examples/Signal-acquisition-on-external-trigger_LV.png differ diff --git a/doc/appsFeatures/examples/Synchronised-one-pulse-signal-generation-and-acquisition_LV.png b/doc/appsFeatures/examples/Synchronised-one-pulse-signal-generation-and-acquisition_LV.png new file mode 100644 index 000000000..83f3d4f9a Binary files /dev/null and b/doc/appsFeatures/examples/Synchronised-one-pulse-signal-generation-and-acquisition_LV.png differ diff --git a/doc/appsFeatures/examples/acqRF-exm1.rst b/doc/appsFeatures/examples/acqRF-exm1.rst index fad12c75e..5e51cdb6b 100644 --- a/doc/appsFeatures/examples/acqRF-exm1.rst +++ b/doc/appsFeatures/examples/acqRF-exm1.rst @@ -1,6 +1,298 @@ On trigger signal acquisition ############################# -.. TODO zamenjaj linke z vsebino +.. http://blog.redpitaya.com/examples-new/single-buffer-acquire/ -`Signal Acquiring at 125 Msps > On given trigger acquire signal on fast analog input `_ + +Description +*********** + +This example shows how to acquire 16k samples of signal on fast analog inputs. Signal will be acquired when the +internal trigger condition is meet. Time length of the acquired signal depends on the time scale of a buffer that can +be set with a decimation factor. Decimations and time scales of a buffer are given in the table below. Voltage range +of fast analog inputs on the Red Pitaya depends on gain setting that can be set by jumpers. HV setting is for input +range to ±20V, while LV sets input range to ±1V. + ++-------------+----------------+-------------------------------+--------------------------+--------------------------+ +| Decimation | Sampling Rate | Time scale/length of a buffer | Trigger delay in samples | Trigger delay in seconds | ++-------------+----------------+-------------------------------+--------------------------+--------------------------+ +| 1 | 125 MS/s | 131.072 us | from - 8192 to x | -6.554E-5 to x | ++-------------+----------------+-------------------------------+--------------------------+--------------------------+ +| 8 | 15.6 MS/s | 1.049 ms | from - 8192 to x | -5.243E-4 to x | ++-------------+----------------+-------------------------------+--------------------------+--------------------------+ +| 64 | 1.9 MS/s | 8.389 ms | from - 8192 to x | -4.194E-3 to x | ++-------------+----------------+-------------------------------+--------------------------+--------------------------+ +| 1024 | 122.0 MS/s | 134.218 ms | from - 8192 to x | -6.711E-2 to x | ++-------------+----------------+-------------------------------+--------------------------+--------------------------+ +| 8192 | 15.2 kS/s | 1.074 s | from - 8192 to x | -5.369E-1 to x | ++-------------+----------------+-------------------------------+--------------------------+--------------------------+ +| 65536 | 7.6 kS/s | 8.590 s | from - 8192 to x | -4.295E+0 to x | ++-------------+----------------+-------------------------------+--------------------------+--------------------------+ + +Required hardware +***************** + + - Red Pitaya + - Signal (function) generator + +.. image:: on_given_trigger_acquire_signal_on_fast_analog_input.png + +Cicuit +****** + +.. image:: on_given_trigger_acquire_signal_on_fast_analog_input_circuit.png + +Code - MATLAB® +************** + +The code is written in MATLAB. In the code we use SCPI commands and TCP/IP communication. Copy code to MATLAB editor +and press run. + +.. code-block:: matlab + + %% Define Red Pitaya as TCP/IP object + clear all + close all + clc + IP= '192.168.178.111'; % Input IP of your Red Pitaya... + port = 5000; + tcpipObj = tcpip(IP, port); + tcpipObj.InputBufferSize = 16384*32; + + %% Open connection with your Red Pitaya + + fopen(tcpipObj); + tcpipObj.Terminator = 'CR/LF'; + + flushinput(tcpipObj); + flushoutput(tcpipObj); + + % Set decimation vale (sampling rate) in respect to you + % acquired signal frequency + + fprintf(tcpipObj,'ACQ:RST'); + fprintf(tcpipObj,'ACQ:DEC 1'); + fprintf(tcpipObj,'ACQ:TRIG:LEV 0'); + + % Set trigger delay to 0 samples + % 0 samples delay set trigger to center of the buffer + % Signal on your graph will have trigger in the center (symmetrical) + % Samples from left to the center are samples before trigger + % Samples from center to the right are samples after trigger + + fprintf(tcpipObj,'ACQ:TRIG:DLY 0'); + + %% Start & Trigg + % Trigger source setting must be after ACQ:START + % Set trigger to source 1 positive edge + + fprintf(tcpipObj,'ACQ:START'); + % After acquisition is started some time delay is needed in order to acquire fresh samples in to buffer + % Here we have used time delay of one second but you can calculate exact value taking in to account buffer + % length and smaling rate + pause(1) + + fprintf(tcpipObj,'ACQ:TRIG CH1_PE'); + % Wait for trigger + % Until trigger is true wait with acquiring + % Be aware of while loop if trigger is not achieved + % Ctrl+C will stop code executing in Matlab + + while 1 + trig_rsp=query(tcpipObj,'ACQ:TRIG:STAT?') + + if strcmp('TD',trig_rsp(1:2)) % Read only TD + + break + + end + end + + + % Read data from buffer + signal_str=query(tcpipObj,'ACQ:SOUR1:DATA?'); + signal_str_2=query(tcpipObj,'ACQ:SOUR2:DATA?'); + + % Convert values to numbers.% First character in string is “{“ + % and 2 latest are empty spaces and last is “}”. + + signal_num=str2num(signal_str(1,2:length(signal_str)-3)); + signal_num_2=str2num(signal_str_2(1,2:length(signal_str_2)-3)); + + plot(signal_num) + hold on + plot(signal_num_2,'r') + grid on + ylabel('Voltage / V') + xlabel('samples') + + fclose(tcpipObj) + +Code - C +******** + +.. code-block:: c + + /* Red Pitaya C API example Acquiring a signal from a buffer + * This application acquires a signal on a specific channel */ + + #include + #include + #include + #include "redpitaya/rp.h" + + int main(int argc, char **argv){ + + /* Print error, if rp_Init() function failed */ + if(rp_Init() != RP_OK){ + fprintf(stderr, "Rp api init failed!\n"); + } + + /*LOOB BACK FROM OUTPUT 2 - ONLY FOR TESTING*/ + rp_GenReset(); + rp_GenFreq(RP_CH_1, 20000.0); + rp_GenAmp(RP_CH_1, 1.0); + rp_GenWaveform(RP_CH_1, RP_WAVEFORM_SINE); + rp_GenOutEnable(RP_CH_1); + + + uint32_t buff_size = 16384; + float *buff = (float *)malloc(buff_size * sizeof(float)); + + rp_AcqReset(); + rp_AcqSetDecimation(1); + rp_AcqSetTriggerLevel(0.1); //Trig level is set in Volts while in SCPI + rp_AcqSetTriggerDelay(0); + + rp_AcqStart(); + + /* After acquisition is started some time delay is needed in order to acquire fresh samples in to buffer*/ + /* Here we have used time delay of one second but you can calculate exact value taking in to account buffer*/ + /*length and smaling rate*/ + + sleep(1); + rp_AcqSetTriggerSrc(RP_TRIG_SRC_CHA_PE); + rp_acq_trig_state_t state = RP_TRIG_STATE_TRIGGERED; + + while(1){ + rp_AcqGetTriggerState(&state); + if(state == RP_TRIG_STATE_TRIGGERED){ + break; + } + } + + rp_AcqGetOldestDataV(RP_CH_1, &buff_size, buff); + int i; + for(i = 0; i < buff_size; i++){ + printf("%f\n", buff[i]); + } + /* Releasing resources */ + free(buff); + rp_Release(); + return 0; + } + +Code - Python +************* + +.. code-block:: python + + #!/usr/bin/python + + import sys + import redpitaya_scpi as scpi + import matplotlib.pyplot as plot + + rp_s = scpi.scpi(sys.argv[1]) + + rp_s.tx_txt('ACQ:START') + rp_s.tx_txt('ACQ:TRIG NOW') + + while 1: + rp_s.tx_txt('ACQ:TRIG:STAT?') + if rp_s.rx_txt() == 'TD': + break + + rp_s.tx_txt('ACQ:SOUR1:DATA?') + buff_string = rp_s.rx_txt() + buff_string = buff_string.strip('{}\n\r').replace(" ", "").split(',') + buff = list(map(float, buff_string)) + + plot.plot(buff) + plot.ylabel('Voltage') + plot.show() + view rawacquire_trigger_posedge.py + +Code - Scilab +************* + +Scilab socket input buffer can read approximately 800 samples from Red Pitaya. This is the problem in contributed code +for Scilab sockets. How to set socket is described on Blink example. + +.. code-block:: scilab + + clear all + clc + + // Load SOCKET Toolbox. + exec(SCI+'contribsocket_toolbox_2.0.1loader.sce'); + SOCKET_init(); + + // Define Red Pitaya as TCP/IP object + IP= '192.168.178.56'; // Input IP of your Red Pitaya... + port = 5000; // If you are using WiFi then IP is: + tcpipObj='RedPitaya'; // 192.168.128.1 + + // Open connection with your Red Pitaya + + SOCKET_open(tcpipObj,IP,port); + + // Set decimation value (sampling rate) in respect to you + // acquired signal frequency + + SOCKET_write(tcpipObj,'ACQ:DEC 8'); + + // Set trigger level to 100 mV + + SOCKET_write(tcpipObj,'ACQ:TRIG:LEV 0'); + + // Set trigger delay to 0 samples + // 0 samples delay set trigger to center of the buffer + // Signal on your graph will have trigger in the center (symmetrical) + // Samples from left to the center are samples before trigger + // Samples from center to the right are samples after trigger + + SOCKET_write(tcpipObj,'ACQ:TRIG:DLY 0'); + + //// Start & Trigg + // Trigger source setting must be after ACQ:START + // Set trigger to source 1 positive edge + + SOCKET_write(tcpipObj,'ACQ:START'); + SOCKET_write(tcpipObj,'ACQ:TRIG NOW'); + + // Wait for trigger + // Until trigger is true wait with acquiring + // Be aware of while loop if trigger is not achieved + // Ctrl+C will stop code executing + + xpause(1E+6) + + // Read data from buffer + + signal_str=SOCKET_query(tcpipObj,'ACQ:SOUR1:DATA:OLD:N? 800'); + + // Convert values to numbers.// First character in string is “{“ + // and 2 latest are empty spaces and last is “}”. + signal_str=part(signal_str, 2:length(signal_str)-3) + signal_num=strtod(strsplit(signal_str,",",length(signal_str)))'; + + plot(signal_num) + + SOCKET_close(tcpipObj); + +Code - LabVIEW + +.. image:: On-trigger-signal-acquisition_LV.png + +`Download `_ diff --git a/doc/appsFeatures/examples/acqRF-exm2.rst b/doc/appsFeatures/examples/acqRF-exm2.rst index a00dd2ef4..44291e972 100644 --- a/doc/appsFeatures/examples/acqRF-exm2.rst +++ b/doc/appsFeatures/examples/acqRF-exm2.rst @@ -1,6 +1,169 @@ Signal acquisition on external trigger ###################################### -.. TODO zamenjaj linke z vsebino +.. http://blog.redpitaya.com/examples-new/on-given-external-trigger-acquire-signal-on-fast-analog-input/ -`Signal Acquiring at 125 Msps > On given external trigger acquire signal on fast analog input `_ +Description +*********** + +This example shows how to acquire 16k samples of signal on fast analog inputs. Signal will be acquired when the +external trigger condition is meet. Time length of the acquired signal depends on the time scale of a buffer that can +be set with a decimation factor. Decimations and time scales of a buffer are given in the table below. Voltage range +of fast analog inputs on the Red Pitaya depends on gain setting that can be set by jumpers. HV setting is for input +range to ±20V, while LV sets input range to ±1V. + ++-------------+----------------+-------------------------------+--------------------------+--------------------------+ +| Decimation | Sampling Rate | Time scale/length of a buffer | Trigger delay in samples | Trigger delay in seconds | ++-------------+----------------+-------------------------------+--------------------------+--------------------------+ +| 1 | 125 MS/s | 131.072 us | from - 8192 to x | -6.554E-5 to x | ++-------------+----------------+-------------------------------+--------------------------+--------------------------+ +| 8 | 15.6 MS/s | 1.049 ms | from - 8192 to x | -5.243E-4 to x | ++-------------+----------------+-------------------------------+--------------------------+--------------------------+ +| 64 | 1.9 MS/s | 8.389 ms | from - 8192 to x | -4.194E-3 to x | ++-------------+----------------+-------------------------------+--------------------------+--------------------------+ +| 1024 | 122.0 MS/s | 134.218 ms | from - 8192 to x | -6.711E-2 to x | ++-------------+----------------+-------------------------------+--------------------------+--------------------------+ +| 8192 | 15.2 kS/s | 1.074 s | from - 8192 to x | -5.369E-1 to x | ++-------------+----------------+-------------------------------+--------------------------+--------------------------+ +| 65536 | 7.6 kS/s | 8.590 s | from - 8192 to x | -4.295E+0 to x | ++-------------+----------------+-------------------------------+--------------------------+--------------------------+ + +Required hardware +***************** + + - Red Pitaya + - Signal (function) generator + +.. image:: on_given_external_trigger_acquire_signal_on_fast_analog_input.png + +Circuit +******* + +.. image:: on_given_external_trigger_acquire_signal_on_fast_analog_input_circuit.png + + +Code - MATLAB® +************** + +.. code-block:: matlab + + The code is written in MATLAB. In the code we use SCPI commands and TCP/IP communication. Copy code to MATLAB editor + and press run. + + %% Define Red Pitaya as TCP/IP object + clear all + close all + clc + IP= '192.168.178.111'; % Input IP of your Red Pitaya... + port = 5000; + tcpipObj = tcpip(IP, port); + tcpipObj.InputBufferSize = 16384*32; + + %% Open connection with your Red Pitaya + + fopen(tcpipObj); + tcpipObj.Terminator = 'CR/LF'; + + flushinput(tcpipObj); + flushoutput(tcpipObj); + + % Set decimation vale (sampling rate) in respect to you + % acquired signal frequency + + fprintf(tcpipObj,'ACQ:RST'); + fprintf(tcpipObj,'ACQ:DEC 1'); + fprintf(tcpipObj,'ACQ:TRIG:LEV 0'); + + % Set trigger delay to 0 samples + % 0 samples delay set trigger to center of the buffer + % Signal on your graph will have trigger in the center (symmetrical) + % Samples from left to the center are samples before trigger + % Samples from center to the right are samples after trigger + + fprintf(tcpipObj,'ACQ:TRIG:DLY 0'); + + %% Start & Trigg + % Trigger source setting must be after ACQ:START + % Set trigger to source 1 positive edge + + fprintf(tcpipObj,'ACQ:START'); + % After acquisition is started some time delay is needed in order to acquire fresh samples in to buffer + % Here we have used time delay of one second but you can calculate exact value taking in to account buffer + % length and smaling rate + pause(1) + + fprintf(tcpipObj,'ACQ:TRIG EXT_PE'); + % Wait for trigger + % Until trigger is true wait with acquiring + % Be aware of while loop if trigger is not achieved + % Ctrl+C will stop code executing in Matlab + + while 1 + trig_rsp=query(tcpipObj,'ACQ:TRIG:STAT?') + + if strcmp('TD',trig_rsp(1:2)) % Read only TD + + break + + end + end + + + % Read data from buffer + signal_str=query(tcpipObj,'ACQ:SOUR1:DATA?'); + signal_str_2=query(tcpipObj,'ACQ:SOUR2:DATA?'); + + % Convert values to numbers.% First character in string is “{“ + % and 2 latest are empty spaces and last is “}”. + + signal_num=str2num(signal_str(1,2:length(signal_str)-3)); + signal_num_2=str2num(signal_str_2(1,2:length(signal_str_2)-3)); + + plot(signal_num) + hold on + plot(signal_num_2,'r') + grid on + ylabel('Voltage / V') + xlabel('samples') + + fclose(tcpipObj) + +Code - Python +************* + +.. code-block:: python + + #!/usr/bin/python + + import sys + import redpitaya_scpi as scpi + import matplotlib.pyplot as plot + + rp_s = scpi.scpi(sys.argv[1]) + + rp_s.tx_txt('ACQ:DEC 8') + rp_s.tx_txt('ACQ:TRIG:LEVEL 100') + rp_s.tx_txt('ACQ:START') + rp_s.tx_txt('ACQ:TRIG EXT_PE') + + while 1: + rp_s.tx_txt('ACQ:TRIG:STAT?') + if rp_s.rx_txt() == 'TD': + break + + rp_s.tx_txt('ACQ:SOUR1:DATA?') + buff_string = rp_s.rx_txt() + buff_string = buff_string.strip('{}\n\r').replace(" ", "").split(',') + buff = list(map(float, buff_string)) + + plot.plot(buff) + plot.ylabel('Voltage') + plot.show() + view rawacquire_trigger_external.py + +Code - LabVIEW +************** + +.. image:: Signal-acquisition-on-external-trigger_LV.png + +`Download `_ diff --git a/doc/appsFeatures/examples/acqRF-exm3.rst b/doc/appsFeatures/examples/acqRF-exm3.rst index 13f16285f..d03865b52 100644 --- a/doc/appsFeatures/examples/acqRF-exm3.rst +++ b/doc/appsFeatures/examples/acqRF-exm3.rst @@ -1,6 +1,112 @@ Synchronised one pulse signal generation and acquisition ######################################################## -.. TODO zamenjaj linke z vsebino -`Signal Acquiring at 125 Msps > Synchronized one pulse generating and acquiring `_ +.. http://blog.redpitaya.com/examples-new/synchronized-one-pulse-generating-and-acquiring/ + +Description + +This example shows how to acquire 16k samples of signal on fast analog inputs. Signal will be acquired simultaneously +with generated signal. Time length of the acquired signal depends on the time scale of a buffer that can be set with a +decimation factor. Decimations and time scales of a buffer are given in the table below. Voltage range of fast analog +inputs on the Red Pitaya depends on gain setting that can be set by jumpers. HV setting is for input range to ±20V, +while LV sets input range to ±1V. + +Decimation Sampling Rate Time scale/length of a buffer Trigger delay in samples Trigger delay in seconds +1 125 MS/s 131.072 us from - 8192 to x -6.554E-5 to x +8 15.6 MS/s 1.049 ms from - 8192 to x -5.243E-4 to x +64 1.9 MS/s 8.389 ms from - 8192 to x -4.194E-3 to x +1024 122.0 MS/s 134.218 ms from - 8192 to x -6.711E-2 to x +8192 15.2 MS/s 1.074 s from - 8192 to x -5.369E-1 to x +65536 7.6 MS/s 8.590 s from - 8192 to x -4.295E+0 to x + +Required hardware +***************** + + - Red Pitaya + +.. image:: generate_continous_signal_on_fast_analog_output.png + +Circuit +******* + +.. image:: generate_continous_signal_on_fast_analog_output_circuit1.png + +Code - MATLAB® +************** + +.. code-block:: matlab + + The code is written in MATLAB. In the code we use SCPI commands and TCP/IP communication. Copy code to MATLAB editor + and press run. + + clc + clear all + close all + + IP= '192.168.178.111'; % Input IP of your Red Pitaya... + port = 5000; + tcpipObj=tcpip(IP, port); + tcpipObj.InputBufferSize = 16384*32; + tcpipObj.OutputBufferSize = 16384*32; + + %% Open connection with your Red Pitaya + fopen(tcpipObj); + tcpipObj.Terminator = 'CR/LF'; + flushinput(tcpipObj) + flushoutput(tcpipObj) + + %% Loop back for testing Generate + + %% The example generate sine bursts every 0.5 seconds indefinety + fprintf(tcpipObj,'GEN:RST'); + fprintf(tcpipObj,'ACQ:RST'); + + fprintf(tcpipObj,'SOUR1:FUNC SINE'); + fprintf(tcpipObj,'SOUR1:FREQ:FIX 1000'); % Set frequency of output signal + fprintf(tcpipObj,'SOUR1:VOLT 1'); % Set amplitude of output signal + + fprintf(tcpipObj,'SOUR1:BURS:STAT ON'); % Set burst mode to ON + fprintf(tcpipObj,'SOUR1:BURS:NCYC 1'); % Set 1 pulses of sine wave + fprintf(tcpipObj,'OUTPUT1:STATE ON'); % Set output to ON + + %% Set Acquire + + fprintf(tcpipObj,'ACQ:DEC 64'); + fprintf(tcpipObj,'ACQ:TRIG:LEV 0'); + fprintf(tcpipObj,'ACQ:TRIG:DLY 0'); + + + %% Start gen % acq + + fprintf(tcpipObj,'ACQ:START'); + pause(1); + fprintf(tcpipObj,'ACQ:TRIG AWG_PE'); + fprintf(tcpipObj,'SOUR1:TRIG:IMM'); % Set generator trigger to immediately + + %% Wait for trigger + while 1 + trig_rsp=query(tcpipObj,'ACQ:TRIG:STAT?') + if strcmp('TD',trig_rsp(1:2)) + break + end + end + + %% Read & plot + + signal_str=query(tcpipObj,'ACQ:SOUR1:DATA?'); + signal_num=str2num(signal_str(1,2:length(signal_str)-3)); + plot(signal_num) + hold on + grid on + + %% Close connection with Red Pitaya + fclose(tcpipObj); + view rawacquire_trigger_from_generator.m + +Code - LabVIEW +************** + +.. image:: Synchronised-one-pulse-signal-generation-and-acquisition_LV.png + +`Download `_ diff --git a/doc/appsFeatures/examples/acqRF.rst b/doc/appsFeatures/examples/acqRF.rst index d0b2f8b0d..dbf97cd41 100644 --- a/doc/appsFeatures/examples/acqRF.rst +++ b/doc/appsFeatures/examples/acqRF.rst @@ -2,7 +2,7 @@ Acquiring signals at RF inputs (125 MS/s) ######################################### .. toctree:: - :maxdepth: 5 + :maxdepth: 6 :numbered: acqRF-exm1 diff --git a/doc/appsFeatures/examples/ana-exm1.rst b/doc/appsFeatures/examples/ana-exm1.rst index 5cd60a4b0..c8f51bd7d 100644 --- a/doc/appsFeatures/examples/ana-exm1.rst +++ b/doc/appsFeatures/examples/ana-exm1.rst @@ -1,6 +1,187 @@ Read analog voltage on slow analog input ######################################## -.. TODO zamenjaj linke z vsebino +.. http://blog.redpitaya.com/examples-new/read-analog-voltage-on-slow-analog-input/ -`Read analog voltage at slow analog inputs `_ +Description +*********** + +This example shows how to measure analog voltage of slow analog inputs on Red Pitaya extension connector. Analog +inputs on Red Pitaya are rated from 0-3.3 Volts. + +Required hardware +***************** + + - Red Pitaya + - R1 10K potentiometer + +.. image:: Read_analog_voltage_on_Red_Pitaya_analog_input.png + +Circuit +******* + +.. image:: Read_analog_voltage_on_Red_Pitaya_analog_input_circuit.png + +Code - MATLAB® +************** + +The code is written in MATLAB. In the code we use SCPI commands and TCP/IP communication. Copy code from below to +MATLAB editor, save project and press run. + +.. code-block:: matlab + + %% Define Red Pitaya as TCP/IP object + + IP= '192.168.178.108'; % Input IP of your Red Pitaya... + port = 5000; + tcpipObj=tcpip(IP, port); + + %% Open connection with your Red Pitaya + + fopen(tcpipObj); + tcpipObj.Terminator = 'CR/LF'; + + volts0=str2num(query(tcpipObj,'ANALOG:PIN? AIN0')) + volts1=str2num(query(tcpipObj,'ANALOG:PIN? AIN1')) + volts2=str2num(query(tcpipObj,'ANALOG:PIN? AIN2')) + volts3=str2num(query(tcpipObj,'ANALOG:PIN? AIN3')) + + %% Close connection with Red Pitaya + + fclose(tcpipObj); + +Code - C +******** + +.. code-block:: c + + /* Read analog voltage on slow analog input */ + + #include + #include + + #include "redpitaya/rp.h" + + int main (int argc, char **argv) { + float value [4]; + + // Initialization of API + if (rp_Init() != RP_OK) { + fprintf(stderr, "Red Pitaya API init failed!\n"); + return EXIT_FAILURE; + } + + // Measure each XADC input voltage + for (int i=0; i<4; i++) { + rp_AIpinGetValue(i, &value[i]); + printf("Measured voltage on AI[%i] = %1.2fV\n", i, value[i]); + } + + // Releasing resources + rp_Release(); + + return EXIT_SUCCESS; + } + + +Code - Python +************* + +.. code-block:: python + + #!/usr/bin/python + + import sys + import redpitaya_scpi as scpi + + rp_s = scpi.scpi(sys.argv[1]) + + for i in range(4): + rp_s.tx_txt('ANALOG:PIN? AIN' + str(i)) + value = float(rp_s.rx_txt()) + print ("Measured voltage on AI["+str(i)+"] = "+str(value)+"V") + +Code - Scilab +************* + +How to set sockets is described on Blink example + +.. code-block:: scilab + + clc + + // Load SOCKET Toolbox + exec(SCI+'contribsocket_toolbox_2.0.1loader.sce'); + SOCKET_init(); + + + // Define Red Pitaya as TCP/IP object + + IP= '192.168.178.56'; // Input IP of your Red Pitaya... + port = 5000; // If you are using WiFi then IP is: + tcpipObj='RedPitaya'; // 192.168.128.1 + + // Open connection with your Red Pitaya + + SOCKET_open(tcpipObj,IP,port); + + // Red value on analog input 3 + + volts=strtod(SOCKET_query(tcpipObj,'ANALOG:PIN? AIN3')); + disp(volts) + + // Define value p from 0 - 100 // + + p = volts *(100/3.3) ; // Set value of p in respect to readed voltage + + if p >=(100/7) + SOCKET_write(tcpipObj,'DIG:PIN LED1,1') + else + SOCKET_write(tcpipObj,'DIG:PIN LED1,0') + end + + if p >=(100/7)*2 + SOCKET_write(tcpipObj,'DIG:PIN LED2,1') + else + SOCKET_write(tcpipObj,'DIG:PIN LED2,0') + end + + if p >=(100/7)*3 + SOCKET_write(tcpipObj,'DIG:PIN LED3,1') + else + SOCKET_write(tcpipObj,'DIG:PIN LED3,0') + end + + if p >=(100/7)*4 + SOCKET_write(tcpipObj,'DIG:PIN LED4,1') + else + SOCKET_write(tcpipObj,'DIG:PIN LED4,0') + end + + if p >=(100/7)*5 + SOCKET_write(tcpipObj,'DIG:PIN LED5,1') + else + SOCKET_write(tcpipObj,'DIG:PIN LED5,0') + end + + if p >=(100/7)*6 + SOCKET_write(tcpipObj,'DIG:PIN LED6,1') + else + SOCKET_write(tcpipObj,'DIG:PIN LED6,0') + end + + if p >=(100/7)*7 + SOCKET_write(tcpipObj,'DIG:PIN LED7,1') + else + SOCKET_write(tcpipObj,'DIG:PIN LED7,0') + end + + // Close connection with Red Pitaya + + SOCKET_close(tcpipObj); + +Code - LabVIEW + +.. image:: Read-analog-voltage-on-slow-analog-input_LV.png + +`Download `_ diff --git a/doc/appsFeatures/examples/ana-exm2.rst b/doc/appsFeatures/examples/ana-exm2.rst index e70d41928..45ee2a44c 100644 --- a/doc/appsFeatures/examples/ana-exm2.rst +++ b/doc/appsFeatures/examples/ana-exm2.rst @@ -1,7 +1,122 @@ Set analog voltage on slow analog output ######################################## -.. TODO zamenjaj linke z vsebino +.. http://blog.redpitaya.com/examples-new/set-analog-voltage-on-slow-analog-output-4/ -`Set analog voltage on slow analog outputs `_ +Description +*********** + +This example shows how to set analog voltage of slow analog outputs on Red Pitaya extension connector. Slow analog +outputs on Red Pitaya are in range from 0 to 1.8 Volts. + +Required hardware +***************** + + - Red Pitaya + - Voltmeter + +.. image:: Set_analog_voltage_on_slow_analog_input1.png + +Circuit +******* + +.. image:: Set_analog_voltage_on_slow_analog_input_circuit1.png + +Code - MATLAB® +************** + +The code is written in MATLAB. In the code we use SCPI commands and TCP/IP communication. Copy code from below to +MATLAB editor, save project and press run. + +.. code-block:: matlab + + %% Define Red Pitaya as TCP/IP object + IP= '192.168.178.108'; % Input IP of your Red Pitaya... + port = 5000; + tcpipObj=tcpip(IP, port); + + %% Open connection with your Red Pitaya + + fopen(tcpipObj); + tcpipObj.Terminator = 'CR/LF'; + + fprintf(tcpipObj,'ANALOG:PIN AOUT0,0.3'); % 0.3 Volts is set on output 0 + fprintf(tcpipObj,'ANALOG:PIN AOUT1,0.9'); + fprintf(tcpipObj,'ANALOG:PIN AOUT2,1'); + fprintf(tcpipObj,'ANALOG:PIN AOUT3,1.5'); + + fclose(tcpipObj); + view rawanalog_outputs.m + Code - C + + /* Set analog voltage on slow analog output */ + + #include + #include + + #include "redpitaya/rp.h" + + int main (int argc, char **argv) { + float value [4]; + + // Voltages can be provided as an argument (default is 1V) + for (int i=0; i<4; i++) { + if (argc > (1+i)) { + value [i] = atof(argv[1+i]); + } else { + value [i] = 1.0; + } + printf("Voltage setting for AO[%i] = %1.1fV\n", i, value [i]); + } + + // Initialization of API + if (rp_Init() != RP_OK) { + fprintf(stderr, "Red Pitaya API init failed!\n"); + return EXIT_FAILURE; + } + + // Setting a voltage for each ananlog output + for (int i=0; i<4; i++) { + int status = rp_AOpinSetValue(i, value[i]); + if (status != RP_OK) { + printf("Could not set AO[%i] voltage.\n", i); + } + } + + // wait for user input + getchar(); + + // Releasing resources + rp_Release(); + + return EXIT_SUCCESS; + } + +Code - Python +************* + +.. code-block:: python + + #!/usr/bin/python + + import sys + import redpitaya_scpi as scpi + + rp_s = scpi.scpi(sys.argv[1]) + + value = [1,1,1,1] + for i in range(4): + if len(sys.argv) > (i+2): + value[i] = sys.argv[i+2] + print ("Voltage setting for AO["+str(i)+"] = "+str(value[i])+"V") + + for i in range(4): + rp_s.tx_txt('ANALOG:PIN AOUT' + str(i) + ',' + str(value[i])) + +Code - LabVIEW +************** + +.. image:: Set-analog-voltage-on-slow-analog-output_LV.png + +`Download `_ diff --git a/doc/appsFeatures/examples/ana-exm3.rst b/doc/appsFeatures/examples/ana-exm3.rst index 0078e216f..7e38c9096 100644 --- a/doc/appsFeatures/examples/ana-exm3.rst +++ b/doc/appsFeatures/examples/ana-exm3.rst @@ -1,6 +1,98 @@ Interactive voltage setting on slow analog output ################################################# -.. TODO zamenjaj linke z vsebino +.. http://blog.redpitaya.com/examples-new/interactive-voltage-setting-on-slow-analog-output-2/ + +Description +*********** + +This example shows how to set analog voltage on slow analog Red Pitaya outputs using MATLAB slider. Slow analog +outputs on Red Pitaya are in range from 0 to 1.8 Volts. + +Required hardware +***************** + + - Red Pitaya + - Voltmeter + +.. image:: Set_analog_voltage_on_slow_analog_input1.png + +Circuit +******* + +.. image:: Set_analog_voltage_on_slow_analog_input_circuit1.png + +Code - MATLAB® +************** + +The code is written in MATLAB. In the code we use SCPI commands and TCP/IP communication. Copy code from below to +MATLAB editor, save project and press run. + +.. code-block:: matlab + + function sliderDemo + + f = figure(1); + global p + + + %// initialize the slider + h = uicontrol(... + 'parent' , f,... + 'units' , 'normalized',... %// pixels settings + 'style' , 'slider',... + 'position', [0.05 0.05 0.9 0.05],... + 'min' , 1,... %// Make the "value" between min ... + 'max' , 100,... %// max 10, with initial value + 'value' , 10,... %// as set. + 'callback', @sliderCallback); %// This is called when using the + %// arrows + %// and/or when clicking the slider bar + + hLstn = handle.listener(h,'ActionEvent',@sliderCallback); + %// (variable appears unused, but not assigning it to anything means that + %// the listener is stored in the 'ans' variable. If "ans" is overwritten, + %// the listener goes out of scope and is thus destroyed, and thus, it no + %// longer works. + + function sliderCallback(~,~) + + p =(get(h,'value')) + + + %% Define Red Pitaya as TCP/IP object + + IP= '192.168.178.108'; % Input IP of your Red Pitaya... + port = 5000; + tcpipObj=tcpip(IP, port); + + %% Open connection with your Red Pitaya + + fopen(tcpipObj); + tcpipObj.Terminator = 'CR/LF'; + + %% Set your output voltage value and pin + + out_voltage = num2str((1.8/100)*p) % From 0 - 1.8 volts + out_num = '2'; % Analog outputs 0,1,2,3 + %% Set your SCPI command with strcat function + + scpi_command = strcat('ANALOG:PIN AOUT',out_num,',',out_voltage); + + %% Send SCPI command to Red Pitaya + + fprintf(tcpipObj,scpi_command); + + %% Close connection with Red Pitaya + + fclose(tcpipObj); + end + end + +Code - LabVIEW +************** + +.. image:: Interactive-voltage-setting-on-slow-analog-output_LV.png + +`Download `_ -`Interactive voltage setting on slow analog output `_ diff --git a/doc/appsFeatures/examples/analog.rst b/doc/appsFeatures/examples/analog.rst index 2eb7b19b6..ceb2c1363 100644 --- a/doc/appsFeatures/examples/analog.rst +++ b/doc/appsFeatures/examples/analog.rst @@ -2,7 +2,7 @@ Analog ###### .. toctree:: - :maxdepth: 5 + :maxdepth: 6 :numbered: ana-exm1 diff --git a/doc/appsFeatures/examples/dig-exm1.rst b/doc/appsFeatures/examples/dig-exm1.rst index 675ec214a..21e196ba8 100644 --- a/doc/appsFeatures/examples/dig-exm1.rst +++ b/doc/appsFeatures/examples/dig-exm1.rst @@ -1,6 +1,152 @@ Blink ##### -.. TODO zamenjaj linke z vsebino +.. http://blog.redpitaya.com/examples-new/blink/ + +Description +*********** + +This example shows how to control one of the Red Pitaya on board LEDs and make it blink. + +Required hardware +***************** + + - Red Pitaya + +.. image:: output_y49qDi.gif + +Code - MATLAB ® +*************** + +The code is written in MATLAB. In the code we use SCPI commands and TCP/IP communication. Copy code from below to +MATLAB editor, save project and press run. + +.. code-block:: matlab + + %% Define Red Pitaya as TCP/IP object + + IP= '192.168.178.56'; % Input IP of your Red Pitaya... + port = 5000; + tcpipObj=tcpip(IP, port); + + %% Open connection with your Red Pitaya + + fopen(tcpipObj); + tcpipObj.Terminator = 'CR/LF'; + + %% Send SCPI command to Red Pitaya to turn ON LED1 + + fprintf(tcpipObj,'DIG:PIN LED1,1'); + + pause(5) % Set time of LED ON + + %% Send SCPI command to Red Pitaya to turn OFF LED1 + + fprintf(tcpipObj,'DIG:PIN LED1,0'); + + %% Close connection with Red Pitaya + + fclose(tcpipObj); + view rawdigital_led_blink.m + Code - C + + #include + #include + #include + + #include "redpitaya/rp.h" + + int main (int argc, char **argv) { + int unsigned period = 1000000; // uS + int unsigned led; + + // index of blinking LED can be provided as an argument + if (argc > 1) { + led = atoi(argv[1]); + // otherwise LED 0 will blink + } else { + led = 0; + } + printf("Blinking LED[%u]\n", led); + led += RP_LED0; + + // Initialization of API + if (rp_Init() != RP_OK) { + fprintf(stderr, "Red Pitaya API init failed!\n"); + return EXIT_FAILURE; + } + + int unsigned retries = 1000; + while (retries--){ + rp_DpinSetState(led, RP_HIGH); + usleep(period/2); + rp_DpinSetState(led, RP_LOW); + usleep(period/2); + } + + // Releasing resources + rp_Release(); + + return EXIT_SUCCESS; + } + +Code - Python +************* + +.. code-block:: python + + #!/usr/bin/python + + import sys + import time + import redpitaya_scpi as scpi + + rp_s = scpi.scpi(sys.argv[1]) + + if (len(sys.argv) > 2): + led = int(sys.argv[2]) + else: + led = 0 + + print ("Blinking LED["+str(led)+"]") + + period = 1 # seconds + + while 1: + time.sleep(period/2.0) + rp_s.tx_txt('DIG:PIN LED' + str(led) + ',' + str(1)) + time.sleep(period/2.0) + rp_s.tx_txt('DIG:PIN LED' + str(led) + ',' + str(0)) + + +Code - Scilab +************* + +.. code-block:: scilab + + clc + + // Load SOCKET Toolbox. Steps 7&8 + exec(SCI+'contribsocket_toolbox_2.0.1loader.sce'); + SOCKET_init(); + + IP= '192.168.128.1'; + port = 5000; + tcpipObj='RedPitaya'; + + SOCKET_open(tcpipObj,IP,port); + + SOCKET_write(tcpipObj,'DIG:PIN LED1,1'); + xpause(5*1E+6) + SOCKET_write(tcpipObj,'DIG:PIN LED1,0'); + + SOCKET_close(tcpipObj); + +Code - LabVIEW +************** + +.. image:: Blink_LV.png + + +`Download `_ -`Blink `_ diff --git a/doc/appsFeatures/examples/dig-exm2.rst b/doc/appsFeatures/examples/dig-exm2.rst index 613e9576b..02c40f052 100644 --- a/doc/appsFeatures/examples/dig-exm2.rst +++ b/doc/appsFeatures/examples/dig-exm2.rst @@ -1,6 +1,115 @@ Bar graph with LEDs ################### -.. TODO zamenjaj linke z vsebino +.. `Bar graph with LEDs `_ -`Bar graph with LEDs `_ + +Description +*********** + +This example shows how to make a bar graph by controlling Red Pitaya on board LEDs. +The number of LEDs that will be turned ON, corresponds to the value of variable p. + +Required hardware +***************** + + - Red Pitaya + +.. image:: RP-circuit-e1421258707736-300x212.png + +Code - MATLAB® +************** + +The code is written in MATLAB. In the code we use SCPI commands and TCP/IP communication. Copy code from below to +MATLAB editor, input value p save project and press run. Change p from 0-100 and press run. + + .. code-block:: matlab + + IP= '192.168.178.56'; % Input IP of your Red Pitaya... + port = 5000; + tcpipObj=tcpip(IP, port); + + %% Open connection with your Red Pitaya + + fopen(tcpipObj); + tcpipObj.Terminator = 'CR/LF'; + + + %% Define value p from 0 - 100 % + p = 67; % Set value of p + + if p >=(100/7) + fprintf(tcpipObj,'DIG:PIN LED1,1') + else + fprintf(tcpipObj,'DIG:PIN LED1,0') + end + + if p >=(100/7)*2 + fprintf(tcpipObj,'DIG:PIN LED2,1') + else + fprintf(tcpipObj,'DIG:PIN LED2,0') + end + + if p >=(100/7)*3 + fprintf(tcpipObj,'DIG:PIN LED3,1') + else + fprintf(tcpipObj,'DIG:PIN LED3,0') + end + + if p >=(100/7)*4 + fprintf(tcpipObj,'DIG:PIN LED4,1') + else + fprintf(tcpipObj,'DIG:PIN LED4,0') + end + + if p >=(100/7)*5 + fprintf(tcpipObj,'DIG:PIN LED5,1') + else + fprintf(tcpipObj,'DIG:PIN LED5,0') + end + + if p >=(100/7)*6 + fprintf(tcpipObj,'DIG:PIN LED6,1') + else + fprintf(tcpipObj,'DIG:PIN LED6,0') + end + + if p >=(100/7)*7 + fprintf(tcpipObj,'DIG:PIN LED7,1') + else + fprintf(tcpipObj,'DIG:PIN LED7,0') + end + + fclose(tcpipObj); + +Code - Python +************* + +.. code-block:: python + + #!/usr/bin/python + + import sys + import redpitaya_scpi as scpi + + rp_s = scpi.scpi(sys.argv[1]) + + if (len(sys.argv) > 2): + percent = int(sys.argv[2]) + else: + percent = 50 + + print ("Bar showing "+str(percent)+"%") + + for i in range(8): + if (percent > (i * (100.0/8))): + rp_s.tx_txt('DIG:PIN LED' + str(i) + ',' + str(1)) + else: + rp_s.tx_txt('DIG:PIN LED' + str(i) + ',' + str(0)) + +Code - LabVIEW +************** + +.. image:: Bar-graph-with-LEDs_LV.png + +`Download `_ diff --git a/doc/appsFeatures/examples/dig-exm3.rst b/doc/appsFeatures/examples/dig-exm3.rst index 47c0bc842..61b985a27 100644 --- a/doc/appsFeatures/examples/dig-exm3.rst +++ b/doc/appsFeatures/examples/dig-exm3.rst @@ -1,6 +1,143 @@ Push button and turn on LED diode ################################# -.. TODO zamenjaj linke z vsebino +.. `Push button and turn on LED diode `_ -`Push button and turn on LED diode `_ + +Description +*********** + +This example shows how to control Red Pitaya on board LEDs and read states of extension connector GPIOs. +LED will turn ON, when button is pressed. + +Required hardware +***************** + + - Red Pitaya + - Push button + - Resistor 1K + - RedPitaya_Push_button + +.. image:: RedPitaya_Push_button.png + +Circuit + +.. image:: RedPitaya_Push_button_circuit.png + +Code - MATLAB® +************** + +The code is written in MATLAB. In the code we use SCPI commands and TCP/IP communication. Copy code from below to +MATLAB editor, save project and press run. + +.. code-block:: matlab + + %% Define Red Pitaya as TCP/IP object + + IP= '192.168.178.56'; % Input IP of your Red Pitaya... + port = 5000; + tcpipObj=tcpip(IP, port); + + %% Open connection with your Red Pitaya + + fopen(tcpipObj); + tcpipObj.Terminator = 'CR/LF'; + + + fprintf(tcpipObj,'DIG:PIN:DIR IN,DIO5_N'); % Set DIO5_N to be input + + i=1; + + while i<1000 % You can set while 1 for continuous loop + + state=str2num(query(tcpipObj,'DIG:PIN? DIO5_N')); + + if state==1 + + fprintf(tcpipObj,'DIG:PIN LED5,0'); + + end + + if state==0 + + fprintf(tcpipObj,'DIG:PIN LED5,1'); + + end + + pause(0.1) % Set time delay for Red Pitaya response + + i=i+1 + + end + + %% Close connection with Red Pitaya + fclose(tcpipObj); + +Code - C +******** + +.. code-block:: c + + #include + #include + + #include "redpitaya/rp.h" + + int main (int argc, char **argv) { + rp_pinState_t state; + + // Initialization of API + if (rp_Init() != RP_OK) { + fprintf(stderr, "Red Pitaya API init failed!\n"); + return EXIT_FAILURE; + } + + // configure DIO[0:7]_N to inputs + for (int i=0; i<8; i++) { + rp_DpinSetDirection (i+RP_DIO0_N, RP_IN); + } + + // transfer each input state to the corresponding LED state + while (1) { + for (int i=0; i<8; i++) { + rp_DpinGetState (i+RP_DIO0_N, &state); + rp_DpinSetState (i+RP_LED0, state); + } + } + + // Releasing resources + rp_Release(); + + return EXIT_SUCCESS; + } + +Code - Python +************* + +.. code-block:: python + + #!/usr/bin/python + + import sys + import redpitaya_scpi as scpi + + rp_s = scpi.scpi(sys.argv[1]) + + # set all DIO*_N pins to inputs + for i in range(8): + rp_s.tx_txt('DIG:PIN:DIR IN,DIO'+str(i)+'_N') + + # copy DIOi_N pin state to LEDi state fir each i [0:7] + while 1: + for i in range(8): + rp_s.tx_txt('DIG:PIN? DIO'+str(i)+'_N') + state = rp_s.rx_txt() + rp_s.tx_txt('DIG:PIN LED'+str(i)+','+str(state)) + +Code - LabVIEW +************** + +.. image:: Push-button-and-turn-on-LED_LV.png + +`Dowload file 1 `_ +`Dowload file 2 `_ diff --git a/doc/appsFeatures/examples/dig-exm4.rst b/doc/appsFeatures/examples/dig-exm4.rst index 30f151160..501c459e5 100644 --- a/doc/appsFeatures/examples/dig-exm4.rst +++ b/doc/appsFeatures/examples/dig-exm4.rst @@ -1,6 +1,128 @@ Interactive LED bar graph ######################### -.. TODO zamenjaj linke z vsebino +.. http://blog.redpitaya.com/examples-new/interactive-led-bar-graph/ -`Interactive LED bar graph `_ +Description +*********** + +This example shows how to make a bar graph by controlling Red Pitaya on board LEDs. +The number of LEDs that will be turned ON, corresponds to the value of variable p +that can be set by MATLAB® slider bar. + +Required hardware +***************** + + - Red Pitaya + +.. image:: RP-circuit-e1421258707736-300x212.png + +Code - MATLAB® + +The code is written in MATLAB. In the code we use SCPI commands and TCP/IP communication. Copy code from below to +MATLAB editor, input value p save project and press run. Change p with slider bar from 0-100. + +.. code-block:: matlab + + function sliderDemo + + f = figure(1); + global p + + %// initialize the slider + h = uicontrol(... + 'parent' , f,... + 'units' , 'normalized',... %// pixels settings + 'style' , 'slider',... + 'position', [0.05 0.05 0.9 0.05],... + 'min' , 1,... %// Make the "value" between min ... + 'max' , 100,... %// max 10, with initial value + 'value' , 10,... %// as set. + 'callback', @sliderCallback); %// This is called when using the + %// arrows + %// and/or when clicking the slider bar + + + + hLstn = handle.listener(h,'ActionEvent',@sliderCallback); + %// (variable appears unused, but not assigning it to anything means that + %// the listener is stored in the 'ans' variable. If "ans" is overwritten, + %// the listener goes out of scope and is thus destroyed, and thus, it no + %// longer works. + + + function sliderCallback(~,~) + + p =(get(h,'value')) + + + % Define Red Pitaya as TCP/IP object + + IP= '192.168.178.56'; % Input IP of your Red Pitaya... + port = 5000; + tcpipObj=tcpip(IP, port); + + %% Open connection with your Red Pitaya + + fopen(tcpipObj); + tcpipObj.Terminator = 'CR/LF'; + + + if p >=(100/7) + fprintf(tcpipObj,'DIG:PIN LED1,1') + else + fprintf(tcpipObj,'DIG:PIN LED1,0') + end + + if p >=(100/7)*2 + fprintf(tcpipObj,'DIG:PIN LED2,1') + else + fprintf(tcpipObj,'DIG:PIN LED2,0') + end + + if p >=(100/7)*3 + fprintf(tcpipObj,'DIG:PIN LED3,1') + else + fprintf(tcpipObj,'DIG:PIN LED3,0') + end + + if p >=(100/7)*4 + fprintf(tcpipObj,'DIG:PIN LED4,1') + else + fprintf(tcpipObj,'DIG:PIN LED4,0') + end + + if p >=(100/7)*5 + fprintf(tcpipObj,'DIG:PIN LED5,1') + else + fprintf(tcpipObj,'DIG:PIN LED5,0') + end + + if p >=(100/7)*6 + fprintf(tcpipObj,'DIG:PIN LED6,1') + else + fprintf(tcpipObj,'DIG:PIN LED6,0') + end + + if p >=(100/7)*7 + fprintf(tcpipObj,'DIG:PIN LED7,1') + else + fprintf(tcpipObj,'DIG:PIN LED7,0') + end + + if p >=(100/8)*7 + fprintf(tcpipObj,'DIG:PIN LED8,1') + else + fprintf(tcpipObj,'DIG:PIN LED8,0') + end + + fclose(tcpipObj); + end + end + +Code - LabVIEW +************** + +.. image:: Interactive-LED-bar-graph_LV.png + +`Download `_ diff --git a/doc/appsFeatures/examples/digcomIF.rst b/doc/appsFeatures/examples/digcomIF.rst index 2d29c4810..31f532ff7 100644 --- a/doc/appsFeatures/examples/digcomIF.rst +++ b/doc/appsFeatures/examples/digcomIF.rst @@ -2,7 +2,7 @@ Digital communication interfaces ################################ .. toctree:: - :maxdepth: 5 + :maxdepth: 6 :numbered: i2c diff --git a/doc/appsFeatures/examples/digital.rst b/doc/appsFeatures/examples/digital.rst index 71076090d..833e84371 100644 --- a/doc/appsFeatures/examples/digital.rst +++ b/doc/appsFeatures/examples/digital.rst @@ -2,7 +2,7 @@ Digital ####### .. toctree:: - :maxdepth: 5 + :maxdepth: 6 :numbered: dig-exm1 diff --git a/doc/appsFeatures/examples/examples.rst b/doc/appsFeatures/examples/examples.rst index 525e3dd67..07af5d184 100644 --- a/doc/appsFeatures/examples/examples.rst +++ b/doc/appsFeatures/examples/examples.rst @@ -6,7 +6,7 @@ We believe in enpowering individuals to conduct their own education, discover th ideas with other passionate people. .. toctree:: - :maxdepth: 5 + :maxdepth: 6 :numbered: digital diff --git a/doc/appsFeatures/examples/genRF-exm1.rst b/doc/appsFeatures/examples/genRF-exm1.rst index 0f6eb5579..dc70561c6 100644 --- a/doc/appsFeatures/examples/genRF-exm1.rst +++ b/doc/appsFeatures/examples/genRF-exm1.rst @@ -1,4 +1,113 @@ Generate continuous signal ########################## -`Generate continuous signal `_ +.. http://blog.redpitaya.com/examples-new/generate-continuous-signal-on-fast-analog-outputs/ + +Description +*********** + +This example shows how to program Red Pitaya to generate analog 2kHz sine wave signal with 1V amplitude. Red Pitaya is +able to generate signals in range from DC to 50 MHz with output voltage range from -1 to 1 Volt. Generated signal can +be observed by an Oscilloscope. + +Required hardware +***************** + + - Red Pitaya + +.. image:: output_y49qDi.gif + +Code - MATLAB® +************** + +The code is written in MATLAB. In the code we use SCPI commands and TCP/IP communication. Copy code from below to +MATLAB editor, save project and press run. + +.. code-block:: matlab + + %% Define Red Pitaya as TCP/IP object + + IP= '192.168.178.111'; % Input IP of your Red Pitaya... + port = 5000; + tcpipObj=tcpip(IP, port); + + %% Open connection with your Red Pitaya + + fopen(tcpipObj); + tcpipObj.Terminator = 'CR/LF'; + + fprintf(tcpipObj,'GEN:RST'); + fprintf(tcpipObj,'SOUR1:FUNC SINE'); % Set function of output signal + % {sine, square, triangle, sawu,sawd, pwm} + fprintf(tcpipObj,'SOUR1:FREQ:FIX 2000'); % Set frequency of output signal + fprintf(tcpipObj,'SOUR1:VOLT 1'); % Set amplitude of output signal + fprintf(tcpipObj,'OUTPUT1:STATE ON'); % Set output to ON + + %% Close connection with Red Pitaya + + fclose(tcpipObj); + view rawgenerate_continuous.m + Code - C + + /* Red Pitaya C API example Generating continuous signal + * This application generates a specific signal */ + + #include + #include + #include + #include + + #include "redpitaya/rp.h" + + int main(int argc, char **argv){ + + /* Print error, if rp_Init() function failed */ + if(rp_Init() != RP_OK){ + fprintf(stderr, "Rp api init failed!\n"); + } + + /* Generating frequency */ + rp_GenFreq(RP_CH_1, 10000.0); + + /* Generating amplitude */ + rp_GenAmp(RP_CH_1, 1.0); + + /* Generating wave form */ + rp_GenWaveform(RP_CH_1, RP_WAVEFORM_SINE); + + /* Enable channel */ + rp_GenOutEnable(RP_CH_1); + + /* Releasing resources */ + rp_Release(); + + return 0; + } + view rawgenerate_continuous.c + Code - Python + + #!/usr/bin/python + + import sys + import redpitaya_scpi as scpi + + rp_s = scpi.scpi(sys.argv[1]) + + wave_form = 'sine' + freq = 10000 + ampl = 1 + + rp_s.tx_txt('GEN:RST') + rp_s.tx_txt('SOUR1:FUNC ' + str(wave_form).upper()) + rp_s.tx_txt('SOUR1:FREQ:FIX ' + str(freq)) + rp_s.tx_txt('SOUR1:VOLT ' + str(ampl)) + + #Enable output + rp_s.tx_txt('OUTPUT1:STATE ON') + +Code - LabVIEW +************** + +.. image:: Generate-continuous-signal_LV.png + +`Download `_ diff --git a/doc/appsFeatures/examples/genRF-exm2.rst b/doc/appsFeatures/examples/genRF-exm2.rst index d7b24d03f..3ecac8664 100644 --- a/doc/appsFeatures/examples/genRF-exm2.rst +++ b/doc/appsFeatures/examples/genRF-exm2.rst @@ -1,4 +1,129 @@ Generate signal pulses ###################### -`Generate signal pulses `_ +.. http://blog.redpitaya.com/examples-new/generate-signal-pulses/ + + +Description +*********** + +This example shows how to generate signal pulses of predefined signal waveforms like sine, triangle, square, ramp up, +ramp down or pwm). Generated signal can be observed by an Oscilloscope. + +Required hardware +***************** + + - Red Pitaya + +.. image:: output_y49qDi.gif + + +Code - MATLAB® +************** + +The code is written in MATLAB. In the code we use SCPI commands and TCP/IP communication. Copy code from below to +MATLAB editor, save project and press run. + +.. code-block:: matlab + + %% Define Red Pitaya as TCP/IP object + clc + clear all + close all + IP= '192.168.178.111'; % Input IP of your Red Pitaya... + port = 5000; % If you are using WiFi then IP is: + tcpipObj=tcpip(IP, port); % 192.168.128.1 + + fopen(tcpipObj); + tcpipObj.Terminator = 'CR/LF'; + + %% The example generate sine bursts every 0.5 seconds indefinety + %fprintf(tcpipObj,'GEN:RST'); + + fprintf(tcpipObj,'SOUR1:FUNC SINE'); + fprintf(tcpipObj,'SOUR1:FREQ:FIX 1000'); % Set frequency of output signal + fprintf(tcpipObj,'SOUR1:VOLT 1'); % Set amplitude of output signal + + fprintf(tcpipObj,'SOUR1:BURS:STAT ON'); % Set burst mode to ON + fprintf(tcpipObj,'SOUR1:BURS:NCYC 1'); % Set 1 pulses of sine wave + fprintf(tcpipObj,'SOUR1:BURS:NOR 1000'); % Infinity number of sine wave pulses + fprintf(tcpipObj,'SOUR1:BURS:INT:PER 5000'); % Set time of burst period in microseconds = 5 * 1/Frequency * 1000000 + fprintf(tcpipObj,'SOUR1:TRIG:IMM'); % Set generator trigger to immediately + fprintf(tcpipObj,'OUTPUT1:STATE ON'); % Set output to ON + + + %% Close connection with Red Pitaya + + fclose(tcpipObj); + +Code - C +******** + +.. code-block:: c + + /* Red Pitaya C API example Generating signal pulse on an external trigger + * This application generates a specific signal */ + + #include + #include + #include + + #include "redpitaya/rp.h" + + int main(int argc, char **argv){ + + /* Burst count */ + + + /* Print error, if rp_Init() function failed */ + if(rp_Init() != RP_OK){ + fprintf(stderr, "Rp api init failed!\n"); + } + + rp_GenWaveform(RP_CH_1, RP_WAVEFORM_SINE); + rp_GenFreq(RP_CH_1, 1000); + rp_GenAmp(RP_CH_1, 1.0); + + rp_GenMode(RP_CH_1, RP_GEN_MODE_BURST); + rp_GenBurstCount(RP_CH_1, 1); + rp_GenBurstRepetitions(RP_CH_1, 10000); + rp_GenBurstPeriod(RP_CH_1, 5000); + rp_GenTrigger(1); + sleep(1); + rp_GenOutEnable(RP_CH_1); + rp_Release(); + } + + +Code - Python +************* + +.. code-block:: python + + #!/usr/bin/python + + import sys + import redpitaya_scpi as scpi + + rp_s = scpi.scpi(sys.argv[1]) + + wave_form = 'sine' + freq = 10000 + ampl = 1 + + rp_s.tx_txt('GEN:RST') + rp_s.tx_txt('SOUR1:FUNC ' + str(wave_form).upper()) + rp_s.tx_txt('SOUR1:FREQ:FIX ' + str(freq)) + rp_s.tx_txt('SOUR1:VOLT ' + str(ampl)) + rp_s.tx_txt('SOUR1:BURS:NCYC 2') + rp_s.tx_txt('OUTPUT1:STATE ON') + rp_s.tx_txt('SOUR1:BURS:STAT ON') + rp_s.tx_txt('SOUR1:TRIG:SOUR INT') + rp_s.tx_txt('SOUR1:TRIG:IMM') + +Code - LabVIEW +************** + +.. image:: Generate-signal-pulses_LV.png + +`Downloads `_ diff --git a/doc/appsFeatures/examples/genRF-exm3.rst b/doc/appsFeatures/examples/genRF-exm3.rst index a71542081..dffcfba87 100644 --- a/doc/appsFeatures/examples/genRF-exm3.rst +++ b/doc/appsFeatures/examples/genRF-exm3.rst @@ -1,4 +1,129 @@ Generate signal on external trigger ################################### -`Generate signal on external trigger `_ +.. http://blog.redpitaya.com/examples-new/generate-signal-on-fast-analog-outputs-with-external-triggering/ + +Description +*********** + +This example shows how to program Red Pitaya to generate analog signal on external trigger. Red Pitaya will first wait +for trigger from external source and start generating desired signal right after trigger condition is met. Red Pitaya +is able to generate signals in range from DC to 50 MHz with output voltage range from -1 to 1 Volt. Generated signal +can be observed by an Oscilloscope. + +Required hardware +***************** + + - Red Pitaya + +.. image:: output_y49qDi.gif + +Code - MATLAB® +************** + +The code is written in MATLAB. In the code we use SCPI commands and TCP/IP communication. Copy code to MATLAB editor +and press run. + +.. code-block:: matlab + + %% Define Red Pitaya as TCP/IP object + clc + clear all + close all + + IP= '192.168.178.56'; % Input IP of your Red Pitaya... + port = 5000; + tcpipObj=tcpip(IP, port); + + + %% Open connection with your Red Pitaya + fopen(tcpipObj); + tcpipObj.Terminator = 'CR/LF'; + flushinput(tcpipObj) + flushoutput(tcpipObj) + + %% Generate + + fprintf(tcpipObj,'SOUR1:FUNC SINE'); % Set function of output signal {sine, square, triangle,sawu,sawd, pwm} + fprintf(tcpipObj,'SOUR1:FREQ:FIX 200'); % Set frequency of output signal + fprintf(tcpipObj,'SOUR1:VOLT 1'); % Set amplitude of output signal + + fprintf(tcpipObj,'SOUR1:BURS:NCYC 1'); % Set 1 pulses of sine wave + fprintf(tcpipObj,'OUTPUT1:STATE ON'); % Set output to ON + fprintf(tcpipObj,'SOUR1:BURS:STAT ON'); % Set burst mode to ON + + fprintf(tcpipObj,'SOUR1:TRIG:SOUR EXT_PE'); % Set generator trigger to external + + % For generating signal pulses you trigger signal frequency must be less than + % frequency of generating signal pulses. If you have trigger signal frequency + % higher than frequency of generating signal pulses + % on output you will get continuous signal instead of pulses + + + fclose(tcpipObj); + view rawgenerate_burst_trigger_external.m + Code - C + + /* Red Pitaya external trigger pulse generation Example */ + + #include + #include + #include + + #include "redpitaya/rp.h" + + + int main(int argc, char **argv){ + + /* Print error, if rp_Init() function failed */ + if(rp_Init() != RP_OK){ + fprintf(stderr, "Rp api init failed!\n"); + } + + rp_GenWaveform(RP_CH_1, RP_WAVEFORM_SINE); + rp_GenFreq(RP_CH_1, 200); + rp_GenAmp(RP_CH_1, 1); + + rp_GenBurstCount(RP_CH_1, 1); + /* Enable output channel */ + rp_GenOutEnable(RP_CH_1); + rp_GenMode(RP_CH_1, RP_GEN_MODE_BURST); + rp_GenTriggerSource(RP_CH_1, RP_GEN_TRIG_SRC_EXT_PE); + + /* Release rp resources */ + rp_Release(); + + return 0; + } + +Code - Python +************* + +.. code-block:: python + + #!/usr/bin/python + + import sys + import redpitaya_scpi as scpi + + rp_s = scpi.scpi(sys.argv[1]) + + wave_form = 'sine' + freq = 10000 + ampl = 1 + + rp_s.tx_txt('GEN:RST') + rp_s.tx_txt('SOUR1:FUNC ' + str(wave_form).upper()) + rp_s.tx_txt('SOUR1:FREQ:FIX ' + str(freq)) + rp_s.tx_txt('SOUR1:VOLT ' + str(ampl)) + rp_s.tx_txt('SOUR1:BURS:NCYC 2') + rp_s.tx_txt('OUTPUT1:STATE ON') + rp_s.tx_txt('SOUR1:BURS:STAT ON') + rp_s.tx_txt('SOUR1:TRIG:SOUR EXT_PE') + +Code - LabVIEW +************** + +.. image:: Generate-signal-on-external-trigger_LV.png + +`Download `_ diff --git a/doc/appsFeatures/examples/genRF-exm4.rst b/doc/appsFeatures/examples/genRF-exm4.rst index 34cdfc571..36d591a2d 100644 --- a/doc/appsFeatures/examples/genRF-exm4.rst +++ b/doc/appsFeatures/examples/genRF-exm4.rst @@ -1,4 +1,150 @@ Custom waveform signal generation ################################# -`Custom waveform signal generation `_ +.. http://blog.redpitaya.com/examples-new/custom-signal-generating + +Description +*********** + +This example shows how to program Red Pitaya to generate custom waveform signal. Red Pitaya is able to generate +signals in range from DC to 50 MHz with output voltage range from -1 to 1 Volt. Generated signal can be observed by an +Oscilloscope. + + +Required hardware +***************** + + - Red Pitaya + +.. image:: output_y49qDi.gif + +Code - MATLAB® +************** + +The code is written in MATLAB. In the code we use SCPI commands and TCP/IP communication. Copy code to MATLAB editor +and press run. + +.. code-block:: matlab + + %% Define Red Pitaya as TCP/IP object + clc + clear all + close all + IP= '192.168.178.102'; % Input IP of your Red Pitaya... + port = 5000; + tcpipObj=tcpip(IP, port); + + tcpipObj.InputBufferSize = 16384*64; + tcpipObj.OutputBufferSize = 16384*64; + flushinput(tcpipObj) + flushoutput(tcpipObj) + + %% Open connection with your Red Pitaya and close previous + x=instrfind; + fclose(x); + fopen(tcpipObj); + tcpipObj.Terminator = 'CR/LF'; + + %% Calcualte arbitrary waveform with 16384 samples + % Values of arbitrary waveform must be in range from -1 to 1. + N=16383; + t=0:(2*pi)/N:2*pi; + x=sin(t)+1/3*sin(3*t); + y=1/2*sin(t)+1/4*sin(4*t); + plot(t,x,t,y) + grid on + + %% Convert waveforms to string with 5 decimal places accuracy + waveform_ch_1_0 =num2str(x,'%1.5f,'); + waveform_ch_2_0 =num2str(y,'%1.5f,'); + + % latest are empty spaces “,”. + waveform_ch_1 =waveform_ch_1_0(1,1:length(waveform_ch_1_0)-3); + waveform_ch_2 =waveform_ch_2_0(1,1:length(waveform_ch_2_0)-3); + + %% + + fprintf(tcpipObj,'GEN:RST') % Reset to default settings + + fprintf(tcpipObj,'SOUR1:FUNC ARBITRARY'); % Set function of output signal + fprintf(tcpipObj,'SOUR2:FUNC ARBITRARY'); % {sine, square, triangle, sawu, sawd} + + fprintf(tcpipObj,['SOUR1:TRAC:DATA:DATA ' waveform_ch_1]) % Send waveforms to Red Pitya + fprintf(tcpipObj,['SOUR2:TRAC:DATA:DATA ' waveform_ch_2]) + + fprintf(tcpipObj,'SOUR1:VOLT 0.7'); % Set amplitude of output signal + fprintf(tcpipObj,'SOUR2:VOLT 1'); + + fprintf(tcpipObj,'SOUR1:FREQ:FIX 4000'); % Set frequency of output signal + fprintf(tcpipObj,'SOUR2:FREQ:FIX 4000'); + + + fprintf(tcpipObj,'OUTPUT1:STATE ON'); + fprintf(tcpipObj,'OUTPUT2:STATE ON'); + + fclose(tcpipObj); + +Code - C +******** + +.. code-block:: c + + #include + #include + #include + + #include "redpitaya/rp.h" + + #define M_PI 3.14159265358979323846 + + int main(int argc, char **argv){ + + int i; + int buff_size = 16384; + + /* Print error, if rp_Init() function failed */ + if(rp_Init() != RP_OK){ + fprintf(stderr, "Rp api init failed!\n"); + } + + float *t = (float *)malloc(buff_size * sizeof(float)); + float *x = (float *)malloc(buff_size * sizeof(float)); + float *y = (float *)malloc(buff_size * sizeof(float)); + + for(i = 1; i < buff_size; i++){ + t[i] = (2 * M_PI) / buff_size * i; + } + + for (int i = 0; i < buff_size; ++i){ + x[i] = sin(t[i]) + ((1.0/3.0) * sin(t[i] * 3)); + y[i] = (1.0/2.0) * sin(t[i]) + (1.0/4.0) * sin(t[i] * 4); + } + + rp_GenWaveform(RP_CH_1, RP_WAVEFORM_ARBITRARY); + rp_GenWaveform(RP_CH_2, RP_WAVEFORM_ARBITRARY); + + rp_GenArbWaveform(RP_CH_1, x, buff_size); + rp_GenArbWaveform(RP_CH_2, y, buff_size); + + rp_GenAmp(RP_CH_1, 0.7); + rp_GenAmp(RP_CH_2, 1.0); + + rp_GenFreq(RP_CH_1, 4000.0); + rp_GenFreq(RP_CH_2, 4000.0); + + rp_GenOutEnable(RP_CH_1); + rp_GenOutEnable(RP_CH_2); + + /* Releasing resources */ + free(y); + free(x); + free(t); + rp_Release(); + } + +Code - LabVIEW +************** + +.. image:: Custom-wavefrom-signal-generator_LV.png + +`Download `_ diff --git a/doc/appsFeatures/examples/genRF.rst b/doc/appsFeatures/examples/genRF.rst index 1ecf8a808..7b777fe3c 100644 --- a/doc/appsFeatures/examples/genRF.rst +++ b/doc/appsFeatures/examples/genRF.rst @@ -2,7 +2,7 @@ Generating signals at RF outputs (125 MS/s) ########################################### .. toctree:: - :maxdepth: 5 + :maxdepth: 6 :numbered: genRF-exm1 diff --git a/doc/appsFeatures/examples/generate_continous_signal_on_fast_analog_output.png b/doc/appsFeatures/examples/generate_continous_signal_on_fast_analog_output.png new file mode 100644 index 000000000..db42f44c6 Binary files /dev/null and b/doc/appsFeatures/examples/generate_continous_signal_on_fast_analog_output.png differ diff --git a/doc/appsFeatures/examples/generate_continous_signal_on_fast_analog_output_circuit1.png b/doc/appsFeatures/examples/generate_continous_signal_on_fast_analog_output_circuit1.png new file mode 100644 index 000000000..b267287fb Binary files /dev/null and b/doc/appsFeatures/examples/generate_continous_signal_on_fast_analog_output_circuit1.png differ diff --git a/doc/appsFeatures/examples/i2c.rst b/doc/appsFeatures/examples/i2c.rst index 1cac60c63..d0d0cb352 100644 --- a/doc/appsFeatures/examples/i2c.rst +++ b/doc/appsFeatures/examples/i2c.rst @@ -1,6 +1,240 @@ I2C ### -.. TODO zamenjaj linke z vsebino +.. http://blog.redpitaya.com/examples-new/i2c/ -`I2C `_ +Description + +This example demonstrates communication with the EEPROM memory on red pitaya using the I2C protocol. The code below +writes a message to a given address inside the EEPROM and then prints the entire EEPROM contents. + + +Required hardware +***************** + + - Red Pitaya + +.. image:: output_y49qDi.gif + +Code - C +******** + +.. code-block:: c + + /* @brief This is a simple application for testing IIC communication on a RedPitaya + * @Author Luka Golinar + * + * (c) Red Pitaya http://www.redpitaya.com + * + * This part of code is written in C programming language. + * Please visit http://en.wikipedia.org/wiki/C_(programming_language) + * for more details on the language used herein. + */ + + + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + + + #define I2C_SLAVE_FORCE 0x0706 + #define I2C_SLAVE 0x0703 /* Change slave address */ + #define I2C_FUNCS 0x0705 /* Get the adapter functionality */ + #define I2C_RDWR 0x0707 /* Combined R/W transfer (one stop only)*/ + + + #define EEPROM_ADDR 0x50 + + /* + * Page size of the EEPROM. This depends on the type of the EEPROM available + * on board. + */ + #define PAGESIZE 32 + /* eeprom size on a redpitaya */ + #define EEPROMSIZE 64*1024/8 + + + /* Inline functions definition */ + static int iic_read(char *buffer, int offset, int size); + static int iic_write(char *data, int offset, int size); + + /* + * File descriptors + */ + int fd; + + int main(int argc, char *argv[]) + { + int status; + + /* Read buffer to hold the data */ + char *buffer = (char *)malloc(EEPROMSIZE * sizeof(char)); + + char data[] = "THIS IS A TEST MESSAGE FOR THE I2C PROTOCOL COMMUNICATION WITH A EEPROM. IT WAS WRITTEN FOR A + REDPITAYA MEASURMENT TOOL."; + size_t size = strlen(data); + + /* Sample offset inside an eeprom */ + int offset = 0x100; + + /* + * Open the device. + */ + fd = open("/dev/i2c-0", O_RDWR); + + if(fd < 0) + { + printf("Cannot open the IIC device\n"); + return 1; + } + + status = ioctl(fd, I2C_SLAVE_FORCE, EEPROM_ADDR); + if(status < 0) + { + printf("Unable to set the EEPROM address\n"); + return -1; + } + + /* Write to redpitaya eeprom */ + status = iic_write((char *)data, offset, size); + if(status){ + fprintf(stderr, "Cannot Write to EEPROM\n"); + close(fd); + return -1; + } + + /* Read from redpitaya eeprom */ + status = iic_read(buffer, EEPROM_ADDR, EEPROMSIZE); + if (status) + { + printf("Cannot Read from EEPROM \n"); + close(fd); + return 1; + } + + printf("eerprom test successfull.\n"); + + /* Release allocations */ + close(fd); + free(buffer); + + return 0; + } + + /* Read the data from the EEPROM. + * + * @param read buffer -- input buffer for data storage + * @param off set -- eeprom memory space offset + * @param size -- size of read data + * @return iicRead status + * + * @note None. */ + + static int iic_read(char *buffer, int offset, int size) + { + ssize_t bytes_written; + ssize_t bytes_read; + uint8_t write_buffer[2]; + + /* + * Load the offset address inside EEPROM where data need to be written. + * Supported for BigEndian and LittleEndian CPU's + */ + write_buffer[0] = (uint8_t)(offset >> 8); + write_buffer[1] = (uint8_t)(offset); + + /* Write the bytes onto the bus */ + bytes_written = write(fd, write_buffer, 2); + if(bytes_written < 0){ + fprintf(stderr, "EEPROM write address error.\n"); + return -1; + } + + /* + * Read the bytes. + */ + printf ("Performing Read operation.\n"); + + /* Read bytes from the bus */ + bytes_read = read(fd, buffer, size); + if(bytes_read < 0){ + fprintf(stderr, "EEPROM read error.\n"); + return -1; + } + + printf("Read EEPROM Succesful\n"); + + return 0; + } + + + static int iic_write(char *data, int offset, int size){ + + /* variable declaration */ + int bytes_written; + int write_bytes; + int index; + + /* Check for limits */ + if(size > PAGESIZE){ + write_bytes = PAGESIZE; + }else{ + write_bytes = size; + } + + /* Number of needed loops to send all the data. + * Limit data size per transmission is PAGESIZE */ + int loop = 0; + + while(size > 0){ + + /* buffer size is PAGESIZE per transmission */ + uint8_t write_buffer[32 + 2]; + + /* + * Load the offset address inside EEPROM where data need to be written. + * Supported for BigEndian and LittleEndian CPU's + */ + write_buffer[0] = (uint8_t)(offset >> 8); + write_buffer[1] = (uint8_t)(offset); + + for(index = 0; index < PAGESIZE; index++){ + write_buffer[index + 2] = data[index + (PAGESIZE * loop)]; + } + + /* Write the bytes onto the bus */ + bytes_written = write(fd, write_buffer, write_bytes + 2); + /* Wait till the EEPROM internally completes the write cycle */ + sleep(2); + + if(bytes_written != write_bytes+2){ + fprintf(stderr, "Failed to write to EEPROM\n"); + return -1; + } + + /* written bytes minus the offset addres of two */ + size -= bytes_written - 2; + /* Increment offset */ + offset += PAGESIZE; + + /* Check for limits for the new message */ + if(size > PAGESIZE){ + write_bytes = PAGESIZE; + }else{ + write_bytes = size; + } + + loop++; + } + + printf("\nWrite EEPROM Succesful\n"); + + return 0; + } diff --git a/doc/appsFeatures/examples/on_given_external_trigger_acquire_signal_on_fast_analog_input.png b/doc/appsFeatures/examples/on_given_external_trigger_acquire_signal_on_fast_analog_input.png new file mode 100644 index 000000000..55e9be730 Binary files /dev/null and b/doc/appsFeatures/examples/on_given_external_trigger_acquire_signal_on_fast_analog_input.png differ diff --git a/doc/appsFeatures/examples/on_given_external_trigger_acquire_signal_on_fast_analog_input_circuit.png b/doc/appsFeatures/examples/on_given_external_trigger_acquire_signal_on_fast_analog_input_circuit.png new file mode 100644 index 000000000..45cc214ff Binary files /dev/null and b/doc/appsFeatures/examples/on_given_external_trigger_acquire_signal_on_fast_analog_input_circuit.png differ diff --git a/doc/appsFeatures/examples/on_given_trigger_acquire_signal_on_fast_analog_input.png b/doc/appsFeatures/examples/on_given_trigger_acquire_signal_on_fast_analog_input.png new file mode 100644 index 000000000..5ec5e07e9 Binary files /dev/null and b/doc/appsFeatures/examples/on_given_trigger_acquire_signal_on_fast_analog_input.png differ diff --git a/doc/appsFeatures/examples/on_given_trigger_acquire_signal_on_fast_analog_input_circuit.png b/doc/appsFeatures/examples/on_given_trigger_acquire_signal_on_fast_analog_input_circuit.png new file mode 100644 index 000000000..cf96ce24d Binary files /dev/null and b/doc/appsFeatures/examples/on_given_trigger_acquire_signal_on_fast_analog_input_circuit.png differ diff --git a/doc/appsFeatures/examples/output_y49qDi.gif b/doc/appsFeatures/examples/output_y49qDi.gif new file mode 100644 index 000000000..46371566e Binary files /dev/null and b/doc/appsFeatures/examples/output_y49qDi.gif differ diff --git a/doc/appsFeatures/examples/spi.rst b/doc/appsFeatures/examples/spi.rst index 788afe81a..4bbcd9f36 100644 --- a/doc/appsFeatures/examples/spi.rst +++ b/doc/appsFeatures/examples/spi.rst @@ -1,6 +1,212 @@ SPI ### -.. TODO zamenjaj linke z vsebino +http://blog.redpitaya.com/examples-new/spi/ -`SPI `_ +Description +*********** + +This example shows communication with the red pitaya SPI Micron flash chip. The code below simulates a simple loop +back writing and then getting the flash ID of red pitaya SPI flash chip operation. + + +Required hardware +***************** + + - Red Pitaya + +.. image:: output_y49qDi.gif + +Code - C +******** + +.. code-block:: c + + /* @brief This is a simple application for testing SPI communication on a RedPitaya + * @Author Luka Golinar + * + * (c) Red Pitaya http://www.redpitaya.com + * + * This part of code is written in C programming language. + * Please visit http://en.wikipedia.org/wiki/C_(programming_language) + * for more details on the language used herein. + */ + + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + + /* Inline functions definition */ + static int init_spi(); + static int release_spi(); + static int read_flash_id(int fd); + static int write_spi(char *write_data, int size); + + /* Constants definition */ + int spi_fd = -1; + + int main(void){ + + /* Sample data */ + char *data = "REDPITAYA SPI TEST"; + + /* Init the spi resources */ + if(init_spi() < 0){ + printf("Initialization of SPI failed. Error: %s\n", strerror(errno)); + return -1; + } + + /* Write some sample data */ + if(write_spi(data, strlen(data)) < 0){ + printf("Write to SPI failed. Error: %s\n", strerror(errno)); + return -1; + } + + /* Read flash ID and some sample loopback data */ + if(read_flash_id(spi_fd) < 0){ + printf("Error reading from SPI bus : %s\n", strerror(errno)); + return -1; + } + + /* Release resources */ + if(release_spi() < 0){ + printf("Relase of SPI resources failed, Error: %s\n", strerror(errno)); + return -1; + } + + return 0; + } + + static int init_spi(){ + + /* MODES: mode |= SPI_LOOP; + * mode |= SPI_CPHA; + * mode |= SPI_CPOL; + * mode |= SPI_LSB_FIRST; + * mode |= SPI_CS_HIGH; + * mode |= SPI_3WIRE; + * mode |= SPI_NO_CS; + * mode |= SPI_READY; + * + * multiple possibilities possible using | */ + int mode = 0; + + /* Opening file stream */ + spi_fd = open("/dev/spidev1.0", O_RDWR | O_NOCTTY); + + if(spi_fd < 0){ + printf("Error opening spidev0.1. Error: %s\n", strerror(errno)); + return -1; + } + + /* Setting mode (CPHA, CPOL) */ + if(ioctl(spi_fd, SPI_IOC_WR_MODE, &mode) < 0){ + printf("Error setting SPI_IOC_RD_MODE. Error: %s\n", strerror(errno)); + return -1; + } + + /* Setting SPI bus speed */ + int spi_speed = 1000000; + + if(ioctl(spi_fd, SPI_IOC_WR_MAX_SPEED_HZ, &spi_speed) < 0){ + printf("Error setting SPI_IOC_WR_MAX_SPEED_HZ. Error: %s\n", strerror(errno)); + return -1; + } + + return 0; + } + + static int release_spi(){ + + /* Release the spi resources */ + close(spi_fd); + + return 0; + } + + /* Read data from the SPI bus */ + static int read_flash_id(int fd){ + + int size = 2; + + /*struct spi_ioc_transfer { + __u64 tx_buf; + __u64 rx_buf; + + __u32 len; + __u32 speed_hz; + + __u16 delay_usecs; + __u8 bits_per_word; + __u8 cs_change; + __u32 pad; + }*/ + /* If the contents of 'struct spi_ioc_transfer' ever change + * incompatibly, then the ioctl number (currently 0) must change; + * ioctls with constant size fields get a bit more in the way of + * error checking than ones (like this) where that field varies. + * + * NOTE: struct layout is the same in 64bit and 32bit userspace.*/ + struct spi_ioc_transfer xfer[size]; + + unsigned char buf0[1]; + unsigned char buf1[3]; + int status; + + memset(xfer, 0, sizeof xfer); + + /* RDID command */ + buf0[0] = 0x9f; + /* Some sample data */ + buf1[0] = 0x01; + buf1[1] = 0x23; + buf1[2] = 0x45; + + /* RDID buffer */ + xfer[0].tx_buf = (__u64)((__u32)buf0); + xfer[0].rx_buf = (__u64)((__u32)buf0); + xfer[0].len = 1; + + /* Sample loopback buffer */ + xfer[1].tx_buf = (__u64)((__u32)buf1); + xfer[1].rx_buf = (__u64)((__u32)buf1); + xfer[1].len = 3; + + /* ioctl function arguments + * arg[0] - file descriptor + * arg[1] - message number + * arg[2] - spi_ioc_transfer structure + */ + status = ioctl(fd, SPI_IOC_MESSAGE(2), xfer); + if (status < 0) { + perror("SPI_IOC_MESSAGE"); + return -1; + } + + /* Print read buffer */ + for(int i = 0; i < 3; i++){ + printf("Buffer: %d\n", buf1[i]); + } + + return 0; + } + + /* Write data to the SPI bus */ + static int write_spi(char *write_buffer, int size){ + + int write_spi = write(spi_fd, write_buffer, strlen(write_buffer)); + + if(write_spi < 0){ + printf("Failed to write to SPI. Error: %s\n", strerror(errno)); + return -1; + } + + return 0; + } diff --git a/doc/appsFeatures/examples/uart.rst b/doc/appsFeatures/examples/uart.rst index 580278854..6c55cc354 100644 --- a/doc/appsFeatures/examples/uart.rst +++ b/doc/appsFeatures/examples/uart.rst @@ -1,6 +1,201 @@ UART #### -.. TODO zamenjaj linke z vsebino +.. http://blog.redpitaya.com/examples-new/uart/ -`UART `_ +Description +*********** + +This example demonstrates communication using the red pitaya uart protocol. The code below simulates a loop back +sending a message from the uart TX connector to the uart RX connector on red pitaya. + + +Required hardware +***************** + + - Red Pitaya + +.. image:: output_y49qDi.gif + +Code - C +******** + +.. code-block:: c + + /* @brief This is a simple application for testing UART communication on a RedPitaya + * @Author Luka Golinar + * + * (c) Red Pitaya http://www.redpitaya.com + * + * This part of code is written in C programming language. + * Please visit http://en.wikipedia.org/wiki/C_(programming_language) + * for more details on the language used herein. + */ + + + #include + #include + #include + #include //Used for UART + #include //Used for UART + #include //Used for UART + #include + + + /* Inline function definition */ + static int uart_init(); + static int release(); + static int uart_read(int size); + static int uart_write(); + + /* File descriptor definition */ + int uart_fd = -1; + + static int uart_init(){ + + uart_fd = open("/dev/ttyPS1", O_RDWR | O_NOCTTY | O_NDELAY); + + if(uart_fd == -1){ + fprintf(stderr, "Failed to open uart.\n"); + return -1; + } + + struct termios settings; + tcgetattr(uart_fd, &settings); + + /* CONFIGURE THE UART + * The flags (defined in /usr/include/termios.h - see http://pubs.opengroup.org/onlinepubs/007908799/xsh/termios.h.html): + * Baud rate:- B1200, B2400, B4800, B9600, B19200, B38400, B57600, B115200, B230400, B460800, B500000, B576000, B921600, B1000000, B1152000, B1500000, B2000000, B2500000, B3000000, B3500000, B4000000 + * CSIZE:- CS5, CS6, CS7, CS8 + * CLOCAL - Ignore modem status lines + * CREAD - Enable receiver + * IGNPAR = Ignore characters with parity errors + * ICRNL - Map CR to NL on input (Use for ASCII comms where you want to auto correct end of line characters - don't use for bianry comms!) + * PARENB - Parity enable + * PARODD - Odd parity (else even) */ + + /* Set baud rate - default set to 9600Hz */ + speed_t baud_rate = B9600; + + /* Baud rate fuctions + * cfsetospeed - Set output speed + * cfsetispeed - Set input speed + * cfsetspeed - Set both output and input speed */ + + cfsetspeed(&settings, baud_rate); + + settings.c_cflag &= ~PARENB; /* no parity */ + settings.c_cflag &= ~CSTOPB; /* 1 stop bit */ + settings.c_cflag &= ~CSIZE; + settings.c_cflag |= CS8 | CLOCAL; /* 8 bits */ + settings.c_lflag = ICANON; /* canonical mode */ + settings.c_oflag &= ~OPOST; /* raw output */ + + /* Setting attributes */ + tcflush(uart_fd, TCIFLUSH); + tcsetattr(uart_fd, TCSANOW, &settings); + + return 0; + } + + static int uart_read(int size){ + + /* Read some sample data from RX UART */ + + /* Don't block serial read */ + fcntl(uart_fd, F_SETFL, FNDELAY); + + while(1){ + if(uart_fd == -1){ + fprintf(stderr, "Failed to read from UART.\n"); + return -1; + } + + unsigned char rx_buffer[size]; + + int rx_length = read(uart_fd, (void*)rx_buffer, size); + + if (rx_length < 0){ + + /* No data yet avaliable, check again */ + if(errno == EAGAIN){ + fprintf(stderr, "AGAIN!\n"); + continue; + /* Error differs */ + }else{ + fprintf(stderr, "Error!\n"); + return -1; + } + + }else if (rx_length == 0){ + fprintf(stderr, "No data waiting\n"); + /* Print data and exit while loop */ + }else{ + rx_buffer[rx_length] = '\0'; + printf("%i bytes read : %s\n", rx_length, rx_buffer); + break; + + } + } + + return 0; + } + + static int uart_write(char *data){ + + /* Write some sample data into UART */ + /* ----- TX BYTES ----- */ + int msg_len = strlen(data); + + int count = 0; + char tx_buffer[msg_len+1]; + + strncpy(tx_buffer, data, msg_len); + tx_buffer[msg_len++] = 0x0a; //New line numerical value + + if(uart_fd != -1){ + count = write(uart_fd, &tx_buffer, (msg_len)); + } + if(count < 0){ + fprintf(stderr, "UART TX error.\n"); + return -1; + } + + return 0; + } + + static int release(){ + + tcflush(uart_fd, TCIFLUSH); + close(uart_fd); + + return 0; + } + + int main(int argc, char *argv[]){ + + char *data = "HELLO WOLRD!"; + + /* uart init */ + if(uart_init() < 0){ + printf("Uart init error.\n"); + return -1; + } + + /* Sample write */ + if(uart_write(data) < 0){ + printf("Uart write error\n"); + return -1; + } + + /* Sample read */ + if(uart_read(strlen(data)) < 0){ + printf("Uart read error\n"); + return -1; + } + + /* CLOSING UART */ + release(); + + return 0; + } diff --git a/doc/appsFeatures/marketplace/marketplace.rst b/doc/appsFeatures/marketplace/marketplace.rst index 993c29c01..a6c1925ea 100644 --- a/doc/appsFeatures/marketplace/marketplace.rst +++ b/doc/appsFeatures/marketplace/marketplace.rst @@ -236,7 +236,8 @@ Manually downloading and installing free applications ***************************************************** If you have problems with installing free applications via -Bazaar web page or your Red Pitaya doesn’t have an internet access, +`Bazaar web page `_ +or your Red Pitaya doesn’t have an internet access, here are the instructions on how to install free applications manually. #. Download ``appname.zip`` file of the desired application from diff --git a/doc/appsFeatures/newtworkManager.rst b/doc/appsFeatures/newtworkManager.rst index 54984c189..b4ada6e31 100644 --- a/doc/appsFeatures/newtworkManager.rst +++ b/doc/appsFeatures/newtworkManager.rst @@ -2,7 +2,7 @@ Network Manager - how to connect ################################ .. toctree:: - :maxdepth: 5 + :maxdepth: 6 :numbered: ../quickStart/connect/connect.rst diff --git a/doc/appsFeatures/remoteControl/SCPI_commands.rst b/doc/appsFeatures/remoteControl/SCPI_commands.rst index 520ed2a26..3e7bc91ea 100644 --- a/doc/appsFeatures/remoteControl/SCPI_commands.rst +++ b/doc/appsFeatures/remoteControl/SCPI_commands.rst @@ -106,11 +106,11 @@ Parameter options: | | ``SOUR2:FUNC TRIANGLE`` | | | +--------------------------------------+----------------------------+--------------------------------------------------------------------------+ | | ``SOUR:VOLT `` | ``rp_GenAmp`` | | Set amplitude voltage of fast analog outputs. | -| | Examples: | | | Amplitude + offset value must be less than maximum output range +/- 1V | +| | Examples: | | | Amplitude + offset value must be less than maximum output range ± 1V | | | ``SOUR2:VOLT 0.5`` | | | +--------------------------------------+----------------------------+--------------------------------------------------------------------------+ | | ``SOUR:VOLT:OFFS `` | ``rp_GenOffset`` | | Set offset voltage of fast analog outputs. | -| | Examples: | | | Amplitude + offset value must be less than maximum output range +/- 1V | +| | Examples: | | | Amplitude + offset value must be less than maximum output range ± 1V | | | ``SOUR1:VOLT:OFFS 0.2`` | | | +--------------------------------------+----------------------------+--------------------------------------------------------------------------+ | | ``SOUR:PHAS `` | ``rp_GenPhase`` | Set phase of fast analog outputs. | diff --git a/doc/appsFeatures/remoteControl/remoteControl.rst b/doc/appsFeatures/remoteControl/remoteControl.rst index 4a86849e4..13c2734cb 100644 --- a/doc/appsFeatures/remoteControl/remoteControl.rst +++ b/doc/appsFeatures/remoteControl/remoteControl.rst @@ -30,9 +30,9 @@ Features - Incorporate your STEMLab and Labview into testing and production lines - Take quick measurements directly with your PC -******** -Examples -******** +****** +How to +****** In order to execute your Matlab, Labview, Scilab or Python scripts on the STEMLab board first you need to start SCPI server. diff --git a/doc/appsFeatures/visualProgramming/visualProgramming.rst b/doc/appsFeatures/visualProgramming/visualProgramming.rst index 826385897..4e20d6f05 100644 --- a/doc/appsFeatures/visualProgramming/visualProgramming.rst +++ b/doc/appsFeatures/visualProgramming/visualProgramming.rst @@ -183,9 +183,9 @@ This set of connectors is partially compatible with the Arduino shield connector Sensors ******* -======================================================================================== ========== +======================================================================================== ============ Sensor information Connector -======================================================================================== ========== +======================================================================================== ============ `Temperature sensor `_ AI `Motion sensor `_ DIO `Touch sensor `_ DIO @@ -204,31 +204,31 @@ Barometer ``not supported at the moment`` `Sound sensor `_ AI `UV sensor `_ AI Accelerometer ``not supported at the moment`` I2C -======================================================================================== ========== +======================================================================================== ============ -======================================================================================== ========== +======================================================================================== ============ Actuators Connector -======================================================================================== ========== +======================================================================================== ============ `Relay `_ DIO -======================================================================================== ========== +======================================================================================== ============ -======================================================================================== ========== +======================================================================================== ============ Indicators Connector -======================================================================================== ========== +======================================================================================== ============ `Buzzer `_ DIO `LED `_ DIO 7 segment display Digital pins LED bar Digital pins Groove LCD Digital pins LCD Digital pins -======================================================================================== ================== +======================================================================================== ============ ******** Examples ******** .. toctree:: - :maxdepth: 5 + :maxdepth: 6 :numbered: visualExamples/example_1/example diff --git a/doc/developerGuide/125-14/fastIO.rst b/doc/developerGuide/125-14/fastIO.rst index 349031f55..b0efffd09 100644 --- a/doc/developerGuide/125-14/fastIO.rst +++ b/doc/developerGuide/125-14/fastIO.rst @@ -63,6 +63,49 @@ Start your Red Pitaya and connect to it via Terminal. redpitaya> calib + Usage: calib [OPTION]... + + OPTIONS: + -r Read calibration values from eeprom (to stdout). + -w Write calibration values to eeprom (from stdin). + -f Use factory address space. + -d Reset calibration values in eeprom with factory defaults. + -v Produce verbose output. + -h Print this info. + +The EEPROM is a non-volatile memory, therefore the calibration coefficients +will not change during Red Pitaya power cycles, +nor will they change with software upgrades via Bazaar +or with manual modifications of the SD card content. +Example of calibration parameters readout from EEPROM with verbose output: + +.. code-block:: shell-session + + redpitaya> calib -r -v + FE_CH1_FS_G_HI = 45870551 # IN1 gain coefficient for LV (± 1V range) jumper configuration. + FE_CH2_FS_G_HI = 45870551 # IN2 gain coefficient for LV (± 1V range) jumper configuration. + FE_CH1_FS_G_LO = 1016267064 # IN1 gain coefficient for HV (± 20V range) jumper configuration. + FE_CH2_FS_G_LO = 1016267064 # IN2 gain coefficient for HV (± 20V range) jumper configuration. + FE_CH1_DC_offs = 78 # IN1 DC offset in ADC samples. + FE_CH2_DC_offs = 25 # IN2 DC offset in ADC samples. + BE_CH1_FS = 42755331 # OUT1 gain coefficient. + BE_CH2_FS = 42755331 # OUT2 gain coefficient. + BE_CH1_DC_offs = -150 # OUT1 DC offset in DAC samples. + BE_CH2_DC_offs = -150 # OUT2 DC offset in DAC samples. + +Example of the same calibration parameters readout from EEPROM with non-verbose output, suitable for editing within +scripts:: + + redpitaya> calib -r + 45870551 45870551 1016267064 1016267064 + +You can write changed calibration parameters using **calib -w** command: +1. Type calib -w in to command line (terminal) +2. Press enter +3. Paste or write new calibration parameters +4. Press enter + + Usage: calib [OPTION]... OPTIONS: @@ -140,9 +183,9 @@ INPUTS Parameter Jumper settings Value =========================== =============== =========== DC GAIN ACCURACY @ 122 kS/s LV 0.2% -DC OFFSET @ 122 kS/s LV +/- 0.5 mV +DC OFFSET @ 122 kS/s LV ± 0.5 mV DC GAIN ACCURACY @ 122 kS/s HV 0.5% -DC OFFSET @ 122 kS/s HV +/- 5 mV +DC OFFSET @ 122 kS/s HV ± 5 mV =========================== =============== =========== AC gain accuracy can be extracted form Frequency response - Bandwidth. @@ -163,7 +206,7 @@ classical Oscilloscopes. To achieve calibration results given below, Red Pitaya Parameter Value ================= ========== DC GAIN ACCURACY 0.4% -DC OFFSET +/- 4 mV +DC OFFSET ± 4 mV RIPPLE(@ 0.5V DC) 0.4 mVpp ================= ========== diff --git a/doc/developerGuide/125-14/top.rst b/doc/developerGuide/125-14/top.rst index 9a5f2115d..bea448394 100644 --- a/doc/developerGuide/125-14/top.rst +++ b/doc/developerGuide/125-14/top.rst @@ -4,7 +4,7 @@ STEM 125-14 .. TODO overview .. toctree:: - :maxdepth: 5 + :maxdepth: 6 fastIO extent diff --git a/doc/developerGuide/console/console.rst b/doc/developerGuide/console/console.rst index 974892558..e6bb7ad82 100644 --- a/doc/developerGuide/console/console.rst +++ b/doc/developerGuide/console/console.rst @@ -47,9 +47,9 @@ Connect your Red Pitaya and PC with micro USB B to USB A cable and follow the in Windows ------- -Download and install the `FTD driver `_ to your PC. After installation, a new -COM port will appear in the Device Manager you can use in Hyperterminal or another terminal utility to connect to Red -Pitaya. +Download and install the `FTD driver `_ to your PC. After installation, a +new COM port will appear in the Device Manager you can use in Hyperterminal or another terminal utility to connect to +Red Pitaya. ----- Linux diff --git a/doc/developerGuide/devGuideTop.rst b/doc/developerGuide/devGuideTop.rst index efaefd714..3fcd77bb6 100644 --- a/doc/developerGuide/devGuideTop.rst +++ b/doc/developerGuide/devGuideTop.rst @@ -5,7 +5,7 @@ Developers guide .. webApp .. toctree:: - :maxdepth: 5 + :maxdepth: 6 :numbered: hardware diff --git a/doc/developerGuide/hardware.rst b/doc/developerGuide/hardware.rst index 1ef7bb14c..ab293b5d7 100644 --- a/doc/developerGuide/hardware.rst +++ b/doc/developerGuide/hardware.rst @@ -2,7 +2,7 @@ Hardware ######## .. toctree:: - :maxdepth: 5 + :maxdepth: 6 :numbered: 125-10/top.rst diff --git a/doc/developerGuide/software.rst b/doc/developerGuide/software.rst index fa0668df1..3fb4b9a7d 100644 --- a/doc/developerGuide/software.rst +++ b/doc/developerGuide/software.rst @@ -2,7 +2,7 @@ Software ######## .. toctree:: - :maxdepth: 5 + :maxdepth: 6 :numbered: software/fpga diff --git a/doc/developerGuide/ssh/ssh.rst b/doc/developerGuide/ssh/ssh.rst index bac4630db..03ae07036 100644 --- a/doc/developerGuide/ssh/ssh.rst +++ b/doc/developerGuide/ssh/ssh.rst @@ -11,13 +11,11 @@ Access information for SSH connection: Connection instructions are available for: -* :ref:`Windows `, -* :ref:`Linux `, -* :ref:`macOS `. - - -.. _windows: - +.. contents:: + :local: + :backlinks: none + :depth: 1 + ======= Windows ======= @@ -40,9 +38,6 @@ Command prompt pops-up after login is successful. Figure: SSH connection via PuTTy - -.. _linux: - ===== Linux ===== @@ -56,9 +51,6 @@ Start Terminal and type (replace IP address with the right one): Red Pitaya GNU/Linux/Ecosystem version 0.90-299 redpitaya> - -.. _macos: - ===== macOS ===== diff --git a/doc/quickStart/SDcard/SDcard.rst b/doc/quickStart/SDcard/SDcard.rst index ecd1587e0..418e8173e 100644 --- a/doc/quickStart/SDcard/SDcard.rst +++ b/doc/quickStart/SDcard/SDcard.rst @@ -58,9 +58,10 @@ The next procedure will create a clean SD card. #. Write the image onto a SD card. Instructions are available for various operating systems: - * :ref:`Windows ` (GUI), - * :ref:`Linux ` (:ref:`GUI `/:ref:`CLI `), - * :ref:`macOS ` (:ref:`GUI `/:ref:`CLI `). +.. contents:: + :local: + :backlinks: none + :depth: 1 This instructions are based on similar instructions for `Raspberry Pi `_. @@ -70,8 +71,6 @@ The next procedure will create a clean SD card. .. image:: pitaya-quick-start-insert-sd-card.png -.. _windows: - ======= Windows ======= @@ -114,9 +113,6 @@ Windows .. image:: SDcard_Win_Exit.png - -.. _linux: - ===== Linux ===== @@ -184,8 +180,6 @@ Command line #. Wait until the process has finished. -.. _macos: - ===== macOS ===== diff --git a/doc/quickStart/alucase/alucase.rst b/doc/quickStart/alucase/alucase.rst index 702e6763d..b261213b7 100644 --- a/doc/quickStart/alucase/alucase.rst +++ b/doc/quickStart/alucase/alucase.rst @@ -18,7 +18,7 @@ In the aluminum case, we want to take a look here. delivery ******** -.. image:: rp_alucase_02.jpg +.. figure:: rp_alucase_02.jpg Red Pitaya Aluminum Case: delivery @@ -39,7 +39,7 @@ A property that was, today, hardly anywhere is mentioned and given the heat that the Red Pitaya generates, seems extremely useful, I was a bit surprised: The entire case acts as a heat sink. -.. image:: rp_alucase_03.jpg +.. figure:: rp_alucase_03.jpg Red Pitaya Aluminum Case: Interior diff --git a/doc/quickStart/quickStart.rst b/doc/quickStart/quickStart.rst index b46ba5cbc..b0e87dcfc 100644 --- a/doc/quickStart/quickStart.rst +++ b/doc/quickStart/quickStart.rst @@ -3,7 +3,7 @@ Quick start ########### .. toctree:: - :maxdepth: 5 + :maxdepth: 1 :numbered: needs diff --git a/doc/quickStart/troubleshooting/blinking-all-led-on.png b/doc/quickStart/troubleshooting/blinking-all-led-on.png new file mode 100644 index 000000000..c8a125887 Binary files /dev/null and b/doc/quickStart/troubleshooting/blinking-all-led-on.png differ diff --git a/doc/quickStart/troubleshooting/troubleshooting.rst b/doc/quickStart/troubleshooting/troubleshooting.rst index 6c0f5606d..c52d4174b 100644 --- a/doc/quickStart/troubleshooting/troubleshooting.rst +++ b/doc/quickStart/troubleshooting/troubleshooting.rst @@ -23,9 +23,9 @@ What if this doesn't help? Connecting to Red Pitaya ************************ -#. First check the LEDs: +.. image:: blinking-all-led-on.png -.. image:: +#. First check the LEDs: If Green LED is not ON or it is blinking. Seems like something is wrong with the power supply or maybe it’s USB cable. @@ -47,7 +47,7 @@ Connecting to Red Pitaya #. Make sure your Red Pitaya and computer are connected to same local network -#. If you are Windows users make sure you have installed bonjur. +#. If you are a Windows users make sure you have installed bonjur. ******************** Slow WIFI connection @@ -60,6 +60,7 @@ please check the following: * check the wifi signal strength on your PC/tablet/smartphone * check the wifi signal strength of your Red Pitaya. + .. TODO dodaj link do direktorija #. Connect to your Red Pitaya via SSH connection. `How? <>`_ #. Enter ``cat /proc/net/wireless`` command in order to get