Trenz Electronic Jupyter Demo User manual

TEI0016 - Jupyter Demo
Revision:
Exported on: 03/05/2020

TEI0016 - Jupyter Demo
Copyright © 2020Trenz Electronic GmbH
2 of 16
http://www.trenz-electronic.de
1 Table of Contents
1 Table of Contents................................................................................................................................................... 2
2 Documentation ...................................................................................................................................................... 3
3 Download ............................................................................................................................................................... 4
4 TEI0016 - Installation guide for Jupyter................................................................................................................ 5
4.1 Installation of Jupyter ........................................................................................................................................... 5
4.2 Installation of Anaconda respectively Jupyter..................................................................................................... 6
4.3 Installation of Pyserial ........................................................................................................................................... 6
4.4 Making the demos accessible for Jupyter ............................................................................................................ 6
4.5 Starting Jupyter ..................................................................................................................................................... 6
4.6 Opening a demo..................................................................................................................................................... 7
4.7 Alter the comport to yours .................................................................................................................................... 8
4.8 Running the demo.................................................................................................................................................. 9
4.9 Annotations............................................................................................................................................................ 9
5 TEI0016 - Demo ADC data acquisition and Fourier transformation .................................................................. 10
5.1 Using the demo .................................................................................................................................................... 12
5.2 Communicating with module:............................................................................................................................. 13
5.3 Using the ADC for high speed consecutive measurements ............................................................................... 13
5.3.1 Module TEI0015 - AD4003BCPZ-RL7.................................................................................................................... 13
5.3.2 Module TEI0016 - ADAQ7988 / ADAQ7980 ........................................................................................................... 14
5.3.3 Module TEI0023 - ADAQ4003BBCZ ...................................................................................................................... 14
6 TEI0016 - Communication Interface and Commands ........................................................................................ 15

TEI0016 - Jupyter Demo
Copyright © 2020Trenz Electronic GmbH
5 of 16
http://www.trenz-electronic.de
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
4 TEI0016 - Installation guide for Jupyter
Installation of Jupyter
Installation of Anaconda respectively Jupyter
Installation of Pyserial
Making the demos accessible for Jupyter
Starting Jupyter
Opening a demo
Alter the comport to yours
Running the demo
Annotations
4.1 Installation of Jupyter
Example
picture
The modules TEI0015, TEI0016 and TEI0023 offer software demonstrations of their basic functionality and
communication interface. This manual provides a step by step guide for installing the required software and
running the demos in general.
For the ease of accessibility and programmability the language Python (since version 3.5) has been chosen.
The project Jupyter provides an excellent and open source entry for beginners and professionals.
Jupyter files are called Notebooks and have the ending fileName.ipynb, this manual refers to them as demo.
The following description of steps applies in its details to computers running windows 10, for other
operation systems, the steps are in general similar.
So running and editing the Demos requires the following steps:
Step 1 - Installation of Anaconda respectively jupyter
Step 2 - Installation of "pyserial"
Step 3 - Making the demos accessible for Jupyter
Step 4 - Starting Jupyter
Step 5 - Opening a demo
Step 6 - Alter the comport to yours
Step 7 - Running the demo
Annotations

TEI0016 - Jupyter Demo
Copyright © 2020Trenz Electronic GmbH
6 of 16
http://www.trenz-electronic.de
4.2 Installation of Anaconda respectively Jupyter
The simplest way to execute the demos in Jupyter is accomplished through the installation of Anaconda.
This will install more than is needed but nearly all requirements in one step.
The Anaconda website provides detailed instructions on how to install the application, just follow this link.
If the installer offers you the installation of optional applications, just skip those, they are
not needed to run the demos or edit their code.
4.3 Installation of Pyserial
At least with Anaconda installation on Windows, pyserial (python serial port support library) is not
included and has to be installed. This can be done from the Anaconda command prompt. To open the
Anaconda command prompt, just press the windows key, type Anaconda prompt and open it. Enter
conda install -c anaconda pyserial
into the command prompt an press enter. This starts the search for software dependencies of pyserial,
you are asked to confirm the installation,to proceed press Y.
The console shows a message when pyserial is installed and thereafter the console is no longer needed
and can be closed.
4.4 Making the demos accessible for Jupyter
The demo is available through a link in the parent page. The download is a folder, containing all the necessary
files and documents. The download folder is compressed into a zip archive and need to be extracted, to be
accessible for
Jupyter.
Jupyter has access to the user folder, so a convenient way is to copy the extracted demo folder
(TEI001X-0x-08-C8A_Jupyter-ADC-demo_Vx.y_quartusxy.z_...) into your users folder, for example:
C:\Users\Username\download-folder
4.5 Starting Jupyter
To open Jupyter, press the windows key and typeJupyter, this presents "Jupyter Notebook (AnacondaX)" to you,
from which one can start Jupyter.
Jupyter is based on the server client structure, the server is executed in the background, and the client is a webpage
inside your default browser.
So opening it starts the server, which opens a console displaying status messages of the server.
The console must be open all the time, you want Jupyter to run. You can minimize it.

TEI0016 - Jupyter Demo
Copyright © 2020Trenz Electronic GmbH
7 of 16
http://www.trenz-electronic.de
•
•
•
4.6 Opening a demo
Generally, the Jupyter tab inside your browser is in itself a file browser. Jupyter has access only to
your user or home folder which it displays after the program start. To start a notebook, one has to
navigate to the folder containing the notebook file.
Left clicking on a folder opens it. Going back or a level up is accomplished by clicking the back button
of your browser.
The path to this demo or notebook is:
Jupyter tab - Home folder
→ Download folder - TEI001X-0x-08-C8A_Jupyter-ADC-demo_Vx.y_quartusxy.z_...
Download folder - TEI001X-0x-08-C8A_Jupyter-ADC-demo_Vx.y_quartusxy.z_...
→ Demo folder - TE0015_&_TEI0016-Jupyter-ADC-demo_Vx.y
Demo folder - TE0015_&_TEI0016-Jupyter-ADC-demo_Vx.y
→ Demo or notebook - TE0015_&_TEI0016-Jupyter-ADC-demo_Vx.y .ipynb
In the picture below these steps are shown.

TEI0016 - Jupyter Demo
Copyright © 2020Trenz Electronic GmbH
8 of 16
http://www.trenz-electronic.de
4.7 Alter the comport to yours
Every demo communicates with the module by a serial communication port. This port has been assigned
a number during the driver installation. In our case it is COM5.
In dependency to the code of a demo, there are two variants.
Variant 1:
At the beginning of the Notebook is a line:
ser = serial.Serial('COM5', 115200)
or
comport = 'COM5'
Replace the comport number in red with yours and save this change by pressing "s" whilst holding the
control key (Ctrl + s).

TEI0016 - Jupyter Demo
Copyright © 2020Trenz Electronic GmbH
9 of 16
http://www.trenz-electronic.de
•
•
•
•
Variant 2:
Some demos contain a graphical user interface. The available comports will be presented
automatically and can be selected trough the GUI.
As an option, a default comport can be set at the beginning of the notebook.
4.8 Running the demo
A notebook consists of cells, in which its content resides. Demos so far only contain one cell, to run the demo,
the PC's focus must be upon the cell, left clicking into the cells source code focuses this cell.
Now the demo can be run through pressing the run button,
stopped by the button with the black rectangular,
reloaded through the circular arrow and lastly
reloaded and rerun by the two arrowed button.
The notebook can be closed either by closing the tab or via File →"Close and Halt".
Often demos gather data from the module and display them in graph plots.
All output of a notebooks cell is displayed below the cell.
4.9 Annotations
The demos are linked to Jupyter through the import and use of only the following modules:
IPython - Interacting from within the Notebook with its output / plots
ipywidgets - Interactive Widgets/GUI elements for the Jupyter Notebook
Show line numbers inside a notebook: View →Toggle Line Numbers
Autocomplete is available when pressing the Tab key
Variables of a notebook cell are not encapsulated from other cells inside the same notebook

TEI0016 - Jupyter Demo
Copyright © 2020Trenz Electronic GmbH
10 of 16
http://www.trenz-electronic.de
5 TEI0016 - Demo ADC data acquisition and Fourier
transformation
This demo provides an example on how to use the communication interface provided in the modules firmware
to setup the pre-amplification and trigger an ADC measurement. This measurement is converted to show
its value over time, and Fourier transformed, showing its frequency spectrum.

TEI0016 - Jupyter Demo
Copyright © 2020Trenz Electronic GmbH
12 of 16
http://www.trenz-electronic.de
The download of the demo contains the demo in a separate folder and the FPGA Design file.
The demo consist of two files, one is the notebook which contains the GUI and the other is a code module,
containing the functional part of the demo. These files must be in the same folder when running the demo.
The modules ADC is controlled via the Intel Max 10 FPGA. In shipment condition, the FPGA is programmed with
the necessary FPGA Design to run this demo.
5.1 Using the demo
This demo is designed with the focus of capturing signals. Therefore the module works like a storage
oscilloscope. After a trigger event, the module saves 1 million samples of ADC measurement in its SDRAM.
The demo scans for existing comports in its initialisation phase. So the module needs to be connected
to the computer prior to running the demo.
When this demo runs, it displays a graphical user interface, setup the comport, the demo automatically selects
the module. After this, the demo and the module can communicate.
The module offers a Non inverted input and an inverted input. The inputs are accessible through either
a SMA connection or a breakout connection.
Inverted inputs are J5 and -J8
Non inverted inputs are J6 and +J8
Now supply a signal to the inputs.
An other option is to use the modules square wave signal output. Connect the digital outputs D5 and D6 to
the inputs as you like and activate the signal through the checkbox.
Be careful, do not shorten the outputs D5 or D6 to ground.
One can set up a pre amplification gain of the input signal and the amount of samples to be processed.
By pressing the button Capture FFT data, the input signal will be plotted and shown.

TEI0016 - Jupyter Demo
Copyright © 2020Trenz Electronic GmbH
13 of 16
http://www.trenz-electronic.de
•
•
•
•
•
•
•
•
•
•
•
•
5.2 Communicating with module:
To communicate with the module, a serial comport port with a speed set to 115200 bits needs to be opened.
Commands consists of a single character in UTF-8 encoding.
It is good practice to communication with the module following these steps:
Open a serial comport
Clear the PCs serial comport input buffer of the opened comport
Send the desired commands, each one in a single write operation to the comport
Close the serial comport as soon as possible
These steps apply also for read operations.
5.3 Using the ADC for high speed consecutive measurements
The module provides a method to gather highly accurate consecutive ADC measurements in a single event.
In this mode of operation, one mega sample of ADC values are performed and stored inside the modules
SD-RAM.
The following step should be taken in this mode:
Open a serial comport
For TEI0015 and TEI0016: Send the command "1", "2", "4" or "8" for the ADC pre-amplification of 1, 2, 4, 8
For TEI0023: Send the command "1", "2", "3", "4", "5", "6" or "7" for the ADC pre-amplification of
0.25, 0.5, 1, 2, 4, 8 and 16
Send the command "t" to trigger the consecutive measurement.
(The module always measures 1 MSample of data into its SD-RAM)
Clear the PCs serial comport input buffer of the opened comport
Send the command "+" or "*"to the module, it then transmits 128 or16384 Samples of ADC values
Read the amount of ADC values in one chunk of 128 or 16384 samples from the PCs serial input buffer
(Otherwise there is a high possibility of a misalignment of nibbles)
Repeat the reading of chunks to a maximum of 1 mega sample
Close the comport
After a trigger event, the one mega sample of data is stored until your retrigger. So processing the data can
be done for each chunk individually or the whole one mega sample.
Information to convert the RAW ADC data into standard integer values.
5.3.1 Module TEI0015 - AD4003BCPZ-RL7
Resolution: 18-bit in 5 nibbles
Maximum sampling rate: 2 MSPS
Order of Values:
Hex Dec Hex Dec
Mid scale 0x00000 0
Positive 1 LSB 0x00001 1 to full scale -1 LSB 0x1ffff 131071
Negative full scale 0x20000 131072 to -1 LSB 0x3FFFF 262143
The layout of the ADC circuit is further described in the Analog Devices circuit note CN-0385.

TEI0016 - Jupyter Demo
Copyright © 2020Trenz Electronic GmbH
14 of 16
http://www.trenz-electronic.de
5.3.2 Module TEI0016 - ADAQ7988 / ADAQ7980
Resolution: 16-bit in 4 nibbles
Maximum sampling rate: 0.5 MSps / 1 MSps
Order of Values:
Hex Dec Hex Dec
Negative full scale is 0x0000 0 to -1 LSB 0x7fff 32767
Mid scale is 0x8000 32768
Positive 1 LSB 0x8001 32769 to full scale 0xffff 65536
The layout of the ADC circuit is further described in the Analog Devices circuit note CN-0393.
5.3.3 Module TEI0023 - ADAQ4003BBCZ
Resolution: 18-bit in 5 nibbles
Maximum sampling rate: 2 MSPS
Order of Values:
Hex Dec Hex Dec
Mid scale 0x00000 0
Positive 1 LSB 0x00001 1 to full scale -1 LSB 0x1ffff 131071
Negative full scale 0x20000 131072 to -1 LSB 0x3FFFF 262143

TEI0016 - Jupyter Demo
Copyright © 2020Trenz Electronic GmbH
15 of 16
http://www.trenz-electronic.de
6 TEI0016 - Communication Interface and Commands
The modules TEI0015, TEI0016 and TEI0023 implement a handler for executing commands. The serial interface
speed
must be set to 115200 bits, commands consists of a single character in UTF-8 encoding.
Each command must be transmitted individually.
All commands are identical for all tree modules, except commands for setting the gain.
The modules TEI0015 and TEI0016 recognizes the following gain commands since module revision 02:
"1" Sets the pre-amplification of the ADC's input to 1
"2" Sets the pre-amplification of the ADC's input to 2
"4" Sets the pre-amplification of the ADC's input to 4
"8" Sets the pre-amplification of the ADC's input to 8
The following gain commands are recognized by all TEI0023 modules in every module revision:
"0" Deactivates the pre-amplifier
"1" Sets the pre-amplification of the ADC's input to 0.25
"2" Sets the pre-amplification of the ADC's input to 0.5
"3" Sets the pre-amplification of the ADC's input to 1
"4" Sets the pre-amplification of the ADC's input to 2
"5" Sets the pre-amplification of the ADC's input to 4
"6" Sets the pre-amplification of the ADC's input to 8
"8" Sets the pre-amplification of the ADC's input to 16
These commands are recognized by every module:
"t" The ADC measures 1 mega samples and saves the values into its SD-RAM
"x" Instead of ADC values, the value "12345" is stored 1M times into its SD-RAM, values are transmitted via ".", "+"
and "*"
"y" Instead of ADC value, hexadecimal values, in ascending order, are generated and stored into the SD-RAM,
the values are transmitted in via "." , "+" and "*"
"z" The value "12345" is generated and direct transmitted 256 times
"r" The ADC measure once and transmits this value
"." A single value of stored ADC or generated measurement is transmitted
"+" 128 values of stored ADC or generated measurements are transmitted
"*" 16 kbit values of stored ADC or generated measurements are transmitted

TEI0016 - Jupyter Demo
Copyright © 2020Trenz Electronic GmbH
16 of 16
http://www.trenz-electronic.de
"?" The module returns its ID:
TEI0015 with ADC AD4003 / 2 MSps returns "1"
TEI0016-0x-08-C8Awith ADC ADAQ7988 / 0.5 MSps returns "2"
TEI0016-0x-08-C8Bwith ADC ADAQ7980 / 1 MSps returns "3"
TEI0023A with ADC AD4003 / 2 MSps returns "4"
"F" The module activates a square wave signal,
frequency = 10 kHz and amplitude is +3,3 V / ground
the signal is accessible on the pads
- D5 in normal mode and
- D6 in time inverted mode
"f" Deactivation of the square wave signal
This manual suits for next models
1
Table of contents