This technical note shows how a SPI-based communication link can be established between the B-Board PRO and an external Analog-to-Digital Converter (ADC). The corresponding approach uses the user-programmable area inside the FPGA, also known as sandbox.
Information on how to set up the toolchain for the FPGA programming is available in PN120.
Quick-start information on how to use the sandbox is provided in PN116.
Another example of custom FPGA firmware development is presented in TN120, addressing the hysteresis current control of a three-phase system. The same application is also used in TN121, which addresses automated HDL code generation using Matlab HDL Coder.
Automated code generation using Xilinx Vivado HLS is addressed in TN133. This note uses the Direct Torque Control (DTC) of a synchronous motor as the application example.
This example implements a full-custom FPGA-based SPI driver for the LTC2314-14 serial sampling ADC.
It uses the LTC2314 SCK continuous mode (see next figure)
The SCK frequency is configurable using a postscaler (
The conversion is started upon the assertion of
LTC2314-14 Serial Interface Timing Diagram in SCK Continuous Mode (source LTC2314 datasheet)
A testbench modeling the LTC2314 behavior has been written in order to validate the driver behavior.
Deployment on the B-Board PRO
The SPI driver has been added to the B-Board firmware using the connections shown in the next figure.
spi_sckis connected to the physical pin
spi_cs_nis connected to the physical pin
spi_dinis connected to the physical pin
postscaler_inis connected to
data_outis connected to
Furthermore, the signals
sampling_pulse are also connected to an Integrated Logic Analyzer (ILA), allowing them to be observed during run-time.
The following C++ code has been used to test the LT2314 driver.
The following hardware has been used:
B-Board evaluation kit
LTC2314 demonstration circuit
Xilinx JTAG Platform Cable USB II
DSLogic Plus logic analyzer
The external SPI signals can be observed using a physical logic analyzer such as the DSLogic Plus:
Secondly, the Xilinx Integrated Logic Analyzer (ILA) allows to observe internal signals too:
Finally, the end result can be plotted in the BB Control datalogger, attesting that the SPI module works correctly.