The ADuCM3029_demo_ad5592r_ad5593r project provides a solution to control a configurable input/output system using the EVAL-AD5592R-PMDZ or the EVAL-AD5593R-PMDZ and the EVAL-ADICUP3029. Both boards use a minimalist 8-channel, 12-bit, configurable ADC/DAC/GPIO device with either a SPI interface for EVAL-AD5592R-PMDZ and I2C interface for EVAL-AD5593R-PMDZ. The boards are SPI and I2C, respectively, PMOD form factor.
The ADuCM3029_demo_ad5592r_ad5593r project uses the EVAL-AD5592R-PMDZ or EVAL-AD5593R-PMDZ to provide a low-cost alternatives to the full-featured product evaluation boards, with terminal block connections and no extra signal conditioning. The application makes full use of the configurable 8 channels capability of the AD5592R and AD5593R, as every channel can be individually set to be either ADC, DAC, input GPIO or output GPIO. This provides a compact and highly flexible solution to signal acquisition and output control.
The application is controlled by the user with a CLI implemented using the serial UART core in the ADuCM3029 controller. The CLI is displayed on a connected PC using a serial terminal connection.
The program is divided in 2 parts: the setup part in which the present module is discovered and the main process. To do the discovery routine in the setup stage, the application first initializes the board SPI driver and tries to do a write and a read to a register to see if any device responds. If there is no SPI the application does the same test for the I2C device. If no device is found the application returns with an error message displayed on the serial connection. If any of the devices is found the program displays the active device and continues to the main process loop. If both PMODs are connected at the same time the one with SPI will be activated. The main process loop starts with the mirror mode. This mode sets up 4 channels as input and the other 4 as output, and then mirrors the inputs on the outputs. For example, if input channel 0 is driven externally to 1V the corresponding output channel, channel 7, will be driven to 1V as well by the application. The channels are linked as follows:
More information about the CLI commands can be found here.
The following is a list of items needed in order to replicate this demo.
The configuration parameters can be found in the config.h file.
AD5593R_A0_STATE - This define contains the logic state of the A0 pin of the AD5593R device. This pin factors in the device I2C address and is by default logic “0” so no change is necessary to the define. If the pin state is changed by moving the pull-down resistor to be a pull-up resistor, this define needs to be changed to logic “1” too for the program to work.
#define AD5593R_A0_STATE 0
A serial terminal is an application that runs on a PC or laptop that is used to display data and interact with a connected device (including many of the Circuits from the Lab reference designs). The device's UART peripheral is most often connected to a UART to USB interface IC, which appears as a traditional COM port on the host PC/ laptop. (Traditionally, the device's UART port would have been connected to an RS-232 line driver / receiver and connected to the PC via a 9-pin or 25-pin serial port.) There are many open-source applications, and while there are many choices, typically we use one of the following:
Before continuing, please make sure you download and install one of the above programs.
There are several parameters on all serial terminal programs that must be setup properly in order for the PC and the connected device to communicate. Below are the common settings that must match on both the PC side and the connected UART device.
In many instances there are other options that each of the different serial terminal applications provide, such as local line echo or local line editing, and features like this can be turned on or off depending on your preferences. This setup guide will not go over all the options of each tool, but just the minor features that will make it easier to read back data from the connected devices.
Example setup using Putty
Typing help or h after initial calibration sequence will display the list of commands and their short versions. Bellow is the short command list:
Command | Example | Description |
---|---|---|
General commands | ||
h | h | Display available commands. |
stts | stts | Display parameters of the application. |
Single channel commands | ||
ao <chan> <dac_code> | ao 0 2000 | Set a channel as analog output (DAC channel) and set the output code. <chan> = channel to be set (0-7); <dac_code> = DAC code in decimal integer format (0-4095). |
ai <chan> | ai 0 | Change the channel to analog input and read the ADC channel. <chan> = channel to be changed and read. (0-7). |
do <chan> <val> | do 7 1 | Change the channel to digital output and set it's state to HIGH or LOW. <chan> = channel to be changed (0-7). <val> = '0' or '1' for LOW or HIGH, respectively. |
di <chan> | di 5 | Change the channel to digital input and read it's state. <chan> = channel to be changed and read. (0-7). |
Mode commands | ||
m | m | Start mirror mode. This mode sets 4 channels as input and 4 channels as output. Then the application reads the input channels and drives the corresponding output channel to the value read on the input channel. For example, if channel 0 reads 1V then the corresponding channel, channel 7, will output 1V. The channels are linked the following way: * Channel 0 (ADC) → Channel 7 (DAC); * Channel 1 (ADC) → Channel 6 (DAC); * Channel 2 (input GPIO) → Channel 5 (output GPIO); * Channel 3 (input GPIO) → Channel 4 (output GPIO). |
t | t | Start production test mode. The following connections must be made: * Channel 0 → Channel 7; * Channel 1 → Channel 6; * Channel 2 → Channel 5; * Channel 3 → Channel 4. Test mode sets CH0:3 to DAC mode, CH4:7 to ADC mode. CH0:3 are set to 0.5V, 1V, 1.5V, 2V, and the voltages at CH4:7 are read back and compared to the expected value. A pass message is then displayed if all the values are read back correctly. |
ais <ch_no> | ais a | Start streaming mode. This mode reads the selected ADC channel twice a second and outputs the data to the terminal. <chan> = channel to be read (0-7) or all channels simultaneously (a). If the channel picked is not an ADC channel the terminal will show an appropriate message. This command does not change the setting of the channels. The desired channels need to be set as ADC separately. |
We recommend not opening the project directly, but rather import it into CrossCore Embedded Studios and make a local copy in your workspace.
The source code and include files of the ADuCM3029_demo_ad5592r_ad5593r can be found here:
The official tool we promote for use with the EVAL-ADICUP3029 is CrossCore Embedded Studio. For more information on downloading the tools and a quick start guide on how to use the tool basics, please check out the Tools Overview page.
For more detailed instructions on importing this application/demo example into the CrossCore Embedded Studios tools, please view our How to import existing projects into your workspace section.
For more detailed instructions on importing this application/demo example into the CrossCore Embedded Studios tools, please view our How to configure the debug session section.
Project structure includes:
End of Document
声明:本文内容及配图由入驻作者撰写或者入驻合作网站授权转载。文章观点仅代表作者本人,不代表电子发烧友网立场。文章及其配图仅供工程师学习之用,如有内容侵权或者其他违规问题,请联系本站处理。 举报投诉
全部0条评论
快来发表一下你的评论吧 !