Gwyscope documentation

open hardware SPM controller with advanced sampling support

User Tools

Site Tools


hwboxtest

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
hwboxtest [2025/02/20 10:07] adminhwboxtest [2025/02/25 14:43] (current) pklapetek
Line 1: Line 1:
 +====== Basic testing ======
 +
 +
 After successful login to Red Pitaya's OS a set of simple programs was provided for testing of basic functionalities. By default all these programs were installed to ''/root/gwyhwserver_gwyscope'' directory. Change to this directory and open e.g. ''test_spi.c'' using e.g. ''nano'' or ''vim'' text editors. After successful login to Red Pitaya's OS a set of simple programs was provided for testing of basic functionalities. By default all these programs were installed to ''/root/gwyhwserver_gwyscope'' directory. Change to this directory and open e.g. ''test_spi.c'' using e.g. ''nano'' or ''vim'' text editors.
  
-{{ :wiki:hw:mobaxterm_edit.png?400 }}+{{ :wiki:hw:mobaxterm_edit1.png?400 }}
  
-The programs are written in plain C programming language and are quite self explanatory. Documentation of functions can be found on [[https://gwyscope.net/library|Gwyscope websites]].+The programs are written in plain C programming language and are quite self explanatory. The documentation of functions can be found on [[https://gwyscope.net/library|Gwyscope websites]].
  
-{{ :wiki:hw:mobaxterm_vim.png?400 }}+{{ :wiki:hw:mobaxterm_vim1.png?400 }}
  
 Analog inputs and outputs can be easily tested with the mentioned ''test_spi'' utility. Important variables are listed here:  Analog inputs and outputs can be easily tested with the mentioned ''test_spi'' utility. Important variables are listed here:
   * hrdac1, hrdac2, hrdac3 - values that are to be set on the 20-bit DACs   * hrdac1, hrdac2, hrdac3 - values that are to be set on the 20-bit DACs
-  * lrdac[i] - field with values for 16-bit DACs. Note that //i// variable goes from 0 to 15.   +  * lrdac[i] - field with values for 16-bit DACs. Note that //i// variable goes from 0 to 15. Values stored in lrdac[0], lrdac[1],... correspond to AO1, AO2,... on the Gwyscope box. 
 +  * adc[] - field with values for 18-bit ADCs. Values stored in adc[0], adc[1],... correspond to AI1, AI2,... on the Gwyscope box. 
 +  * read_adc1, read_adc2 - boolean variables that control whether first or second 8-channel 18-bit ADC should be read. Value of 1 means yes, we should read it. 
 +  * muxA, muxB - setting of multiplexers, for instance muxA = 1 means that first analog input (adc[0] or AI1) is connected to first (fast) Red Pitaya's analog input; muxB = 4 connects adc[3] (or AI4) to RP's second input. 
 +  * adc1, adc2 - store values for Red Pitaya's (fast) analog inputs 
 + 
 +Important functions are the following ones: 
 +  * librp_SetHRDAC1() - sets voltage on the first (most left) 20-bit DAC; Note that the SPI communication is implemented on the FPGA, so this is hardware specific and it won't work on PCB V4 and older; similar functions exist for the other two DACs 
 +  * librp_SetDAC() - sets voltage on Red Pitaya's fast analog outputs (RP FO1 & RP FO2 on Gwyscope box); note that LIBRP_CH_1 corresponds to the first output, LIBRP_CH_2 to the second 
 +  * librp_SPICycle() - SPI communication between CPU and other devices. Up to PCB V4 this is used for communication with all ADCs and DACs. Since version V5 the 20-bit DACs are controlled by dedicated functions, see above. 
 +  * librp_ReadADC() - reads voltages from RP's fast analog inputs. 
 + 
 +{{ :wiki:hw:mobaxterm_testspi1.png?400 }} 
 + 
 +If ''vim'' was used for editing, note that ''i'' has to be pressed to switch to insert mode. After the changes have been made, switch back to command mode by pressing ''Escape'' and write changes to disk using '':wq''. Now create new binary by calling ''make'' and execute the updated program by ''./test_spi'' as shown below. 
 + 
 +{{ :wiki:hw:mobaxterm_run.png?400 }}
  
-{{ :wiki:hw:mobaxterm_testspi.png?400 }}+To test the functionality of the SPI communication, simply connect different DACs to ADCs and see, if the values match.
hwboxtest.1740042440.txt.gz · Last modified: 2025/02/20 10:07 by admin