1197 views|1 replies

62

Posts

0

Resources
The OP
 

Digital Signal Processing_DSP Teaching Experiment Box: 2-19 Digital-to-Analog Conversion Experiment (SPI Bus Output Voltage Value) [Copy link]

52 2-19 数模转换实验(SPI总线输出电压值)

Purpose

The purpose of this video is to master the use of the SPI bus, understand the chip characteristics and use of AD5724, and implement the output voltage value based on AD5724.

Experimental Principle

Hardware Schematic

Find DAC and view the relevant control pins of DAC

SPI

SPI is a Serial Peripheral Interface, a high-speed, full-duplex, synchronous communication bus that occupies three wires (one-to-one communication), four wires, or five wires on the chip pins. Generally, it is four wires.

SPI is commonly used for communication between devices and external devices. Typical applications include shift registers, display drivers, and analog-to-digital converters via external I/O or peripheral expansion.

SPI Functional Block Diagram

.The left side is connected to external devices, and the right side is connected to the CPU

SPI data transmission

The SPI interface is actually two simple shift registers, which are transmitted bit by bit under the enable signal and shift pulse generated by the master device. The rising edge is sent and the falling edge is received. Or the falling edge is sent and the rising edge is received.

D/A Conversion

D/A conversion, or digital-to-analog conversion, refers to converting the input binary digital quantity into analog quantity and outputting it in the form of DC voltage or DC current. The D/A converter is essentially a decoder. The D/A converter is generally composed of a digital buffer register, an analog electronic switch, a reference voltage, and a summing circuit.

AD5724 chip

The DA output on the TL6748-PlusTEB experiment box is designed based on the ADI AD5724 chip. The specific features are as follows:

12;

4 channels;

SPI serial reading mode;

Software adjustable output range: 0+5V, 0+10V, 0~+10.8V, ±5V, ±10V, ±10.8V.

Program flow design

In the program flow design, the peripheral enable configuration must be performed first, then the UART2 serial port must be initialized, the pins must be configured as SPI pins, and then the SPI and DAC must be initialized. Finally, the DAC outputs the voltage value and prints the value in the UART2 window terminal.

Direction configuration source code

Pin direction configuration

Use the StarterWare library functions to configure the GPIO port to output mode. The related functions are referenced through the "gpio.h" file.

StarterWare API

GPIODirModeSet(SOC_GPIO_0_REGS, 1, GPIO_DIR_OUTPUT);

The source code and instructions for configuring GPIO as output can be found in gpio.c. The first parameter is the base address of the GPIO, the second parameter is the number of the GPIO, and the third parameter sets the direction of the GPIO.

Operational phenomenon

Laboratory equipment

Hardware Hookup

(1) Use an RS232 crossover female cable and a USB to RS232 serial cable to connect the UART2 of the experiment board and the USB port of the computer.

(2) Connect the emulator to the computer's USB port.

(3) Set the DIP switch to DEBUG mode 01111.

(4) Connect the power supply of the experimental box and turn on the power switch.

Software Operation

Set up the serial port debugging tool

(1) First check the serial port number in the device manager;

(2) Set up the serial port debugging tool and set the baud rate to 115200.

After setting up the serial port debugging tool, perform related operations in CCS.

(1) Import the project and select the corresponding project in the Demo folder

(2) Compilation project

(3) Connect CCS to the experiment box and load the program

(4) Click Run Program

(5) The serial debugging terminal will print the data read back from the corresponding output register of the TL5724 module.

(6) After conversion, we can get: Channel A voltage = 3V; Channel B voltage = 5V; Channel C voltage = 7V; Channel D voltage = 10V.

(7) The four channels of TDAC output a constant voltage and the corresponding LED is lit. The higher the output voltage, the brighter the LED.

(8) Touch the positive pole of the multimeter to each channel of the DAC and measure the voltage value in turn, and touch the ground to the GND test point on the experimental board. It can be seen that the data read by the multimeter is consistent with the calculated value within the allowable error range.

(9) After the experiment is over, first click the yellow button to pause the program, then click the red button to exit the connection between CCS and the experimental box, and finally turn off the power to the experimental box.

DAC voltage calculation method

Since TL5724 is a 4-channel 12-bit DAC, the first 3 bits of the above data are used.

CHA=0x4cc=1228

CHB=0x7ff=2047

CHC=0xb32=2866

CHD=0xfff=4095

Here we take channel A as an example. The first three digits of channel A are 0x4cc, which is converted to a decimal value of 1228.

Then through the conversion formula

V: output voltage

N: value (the terminal displays the valid data read back from the output register)

R: Range (this program defaults to 10)

CON40 (channel A) voltage = 1228/4095*10 = 3

CON39 (channel B) voltage = 2047/4095*10 = 5

CON38 (channel C) voltage = 2866/4095*10 = 7

CON37 (channel D) voltage = 4095/4095*10 = 10

Calculation shows that the output voltage of channel A is 3V, which is consistent with the output voltage set by the program.

This post is from DSP and ARM Processors

Latest reply

Learned it, thank you   Details Published on 2023-12-1 13:52
 

37

Posts

1

Resources
2
 

Learned it, thank you

This post is from DSP and ARM Processors
 
 

Just looking around
Find a datasheet?

EEWorld Datasheet Technical Support

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京B2-20211791 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号
快速回复 返回顶部 Return list