×

EVAD592R/AD593R PMDZ软件参考手册

消耗积分:2 | 格式:pdf | 大小:3.42MB | 2021-03-23

tr12345

分享资料个

This version (31 Mar 2020 20:34) was approved by Brandon Bushey.The Previously approved version (01 Oct 2019 15:34) is available.Diff

AD5592/AD5593 PMOD Demo

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.

General Description/Overview

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.  Main flow chart 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:

  • 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).

More information about the CLI commands can be found here.

Demo Requirements

The following is a list of items needed in order to replicate this demo.

  • Hardware
    • EVAL-ADICUP3029
    • EVAL-AD5592R-PMDZ or EVAL-AD5593R-PMDZ
    • Mirco USB to USB cable
    • PC or Laptop with a USB port
  • Software

Setting up the Hardware

  1. Connect EVAL-AD5592R-PMDZ or EVAL-AD5593R-PMDZ board to the EVAL-ADICUP3029 as seen in the pictures below: AD5592R-PMDZ connect AD5593R-PMDZ connect
    EVAL-AD5593R-PMDZ conforms to Pmod spec 1.1.0. This is physically compatible with Pmod platforms conforming to earlier Pmod specifications, provided that the VCC, GND, SDA, SCL pins are aligned with the corresponding signals on the platform board, leaving INT and RESET disconnected as shown.
  2. Connect a micro-USB cable to P10 connector of the EVAL-ADICUP3029 and connect it to a computer. PC connect
    Refer to https://blog.digilentinc.com/announcing-the-digilent-pmod-interface-specification-1-1-0/ for details on the Pmod specification.

Configuring the Software

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

Outputting Data

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.

  1. COM Port - This is the physical connection made to your PC or Laptop, typically made through a USB cable but can be any serial communications cable. You can determine the COM port assigned to your device by visiting the device manager on your computer. Another method for identifying which COM port is associated with a USB-based device is to look at which COM ports are present before plugging in your device, then plug in your device, and look for a new COM port.
  2. Baud Rate - This is the speed at which data is being transferred from the connected device to your PC. These parameters must be the same on both devices or data will be corrupted. The default setting for most of the reference designs in 115200.
  3. Data Bits - The number of data bits per transfer. Typically UART transmits ASCII codes back to the serial port so by default this is almost always set to 8-Bits.
  4. Stop Bits - The number of “stop” conditions per transmission. This usually set to 1, but can be set to 2 for redundancy.
  5. Parity - Is a way to check for errors during the UART transmission. Unless otherwise specified, set parity to “none”.
  6. Flow Control - Is a way to ensure that data lose between fast and slow devices on the same UART bus are not lost during transmission. This is typically not implemented in a simple system, and unless otherwise specified, set to “none”.

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

  1. Plug in your connected device using a USB cable or other serial cable.
  2. Wait for the device driver of the connected device to install on your PC or Laptop.
  3. Open your device manager, and find out which COM port was assigned to your device.
  4. Open up your serial terminal program (Putty for this example)
  5. Click on the serial configuration tab or window, and input the settings to match the requirements of your connected device. The default baud rate for most of the reference designs is 115200. Make sure that is the selected baud rate as well.
  6. Ensure that local echo and line editing are enabled, so that you can see what you type and are able to correct mistakes. (Some devices may echo typed characters - if so, you will see each typed character twice. If this happens, turn off local echo.)
  7. Click on the open button, and as long as your connected device and serial terminal program are setup the same, than you should see data displaying.
Hint: If you see nothing in the serial terminal, try hitting the reset button on the embedded development board.

Available commands

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.
  • For the “h”, “stts”, “m” and “t” commands press Enter without inserting any space afterwards.
  • For the “ao”, “ai”, “do” and “di” commands, to invoke in application instructions, write just the command without parameters, insert a space afterwards and press Enter.


Obtaining the Source Code

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:

How to use the Tools

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.

Importing

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.

Debugging

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

Project structure includes:

  • AD559xR driver module with files: ad5592r-base.c, ad5592r-base.h, ad5592r.c, ad5592r.h, ad5593r.c, ad5593r.h;
  • Main file ADuCM3029_demo_aiodiopdmz.c
  • Application module with files: aio_dio_pdmz.c, aio_dio_pdmz.h;
  • CLI module with files: cli.c, cli.h;
  • Configuration file config.h
  • Communication and GPIO driver module with files: platform_drivers.c, platform_drivers.h;
  • Power core initialization module with files: power.c, power.h;
  • Timer and delay driver module with files: timer.c, timer.h.

End of Document

声明:本文内容及配图由入驻作者撰写或者入驻合作网站授权转载。文章观点仅代表作者本人,不代表电子发烧友网立场。文章及其配图仅供工程师学习之用,如有内容侵权或者其他违规问题,请联系本站处理。 举报投诉

评论(0)
发评论

下载排行榜

全部0条评论

快来发表一下你的评论吧 !

'+ '

'+ '

'+ ''+ '
'+ ''+ ''+ '
'+ ''+ '' ); $.get('/article/vipdownload/aid/'+webid,function(data){ if(data.code ==5){ $(pop_this).attr('href',"/login/index.html"); return false } if(data.code == 2){ //跳转到VIP升级页面 window.location.href="//m.obk20.com/vip/index?aid=" + webid return false } //是会员 if (data.code > 0) { $('body').append(htmlSetNormalDownload); var getWidth=$("#poplayer").width(); $("#poplayer").css("margin-left","-"+getWidth/2+"px"); $('#tips').html(data.msg) $('.download_confirm').click(function(){ $('#dialog').remove(); }) } else { var down_url = $('#vipdownload').attr('data-url'); isBindAnalysisForm(pop_this, down_url, 1) } }); }); //是否开通VIP $.get('/article/vipdownload/aid/'+webid,function(data){ if(data.code == 2 || data.code ==5){ //跳转到VIP升级页面 $('#vipdownload>span').text("开通VIP 免费下载") return false }else{ // 待续费 if(data.code == 3) { vipExpiredInfo.ifVipExpired = true vipExpiredInfo.vipExpiredDate = data.data.endoftime } $('#vipdownload .icon-vip-tips').remove() $('#vipdownload>span').text("VIP免积分下载") } }); }).on("click",".download_cancel",function(){ $('#dialog').remove(); }) var setWeixinShare={};//定义默认的微信分享信息,页面如果要自定义分享,直接更改此变量即可 if(window.navigator.userAgent.toLowerCase().match(/MicroMessenger/i) == 'micromessenger'){ var d={ title:'EVAD592R/AD593R PMDZ软件参考手册',//标题 desc:$('[name=description]').attr("content"), //描述 imgUrl:'https://'+location.host+'/static/images/ele-logo.png',// 分享图标,默认是logo link:'',//链接 type:'',// 分享类型,music、video或link,不填默认为link dataUrl:'',//如果type是music或video,则要提供数据链接,默认为空 success:'', // 用户确认分享后执行的回调函数 cancel:''// 用户取消分享后执行的回调函数 } setWeixinShare=$.extend(d,setWeixinShare); $.ajax({ url:"//www.obk20.com/app/wechat/index.php?s=Home/ShareConfig/index", data:"share_url="+encodeURIComponent(location.href)+"&format=jsonp&domain=m", type:'get', dataType:'jsonp', success:function(res){ if(res.status!="successed"){ return false; } $.getScript('https://res.wx.qq.com/open/js/jweixin-1.0.0.js',function(result,status){ if(status!="success"){ return false; } var getWxCfg=res.data; wx.config({ //debug: true, // 开启调试模式,调用的所有api的返回值会在客户端alert出来,若要查看传入的参数,可以在pc端打开,参数信息会通过log打出,仅在pc端时才会打印。 appId:getWxCfg.appId, // 必填,公众号的唯一标识 timestamp:getWxCfg.timestamp, // 必填,生成签名的时间戳 nonceStr:getWxCfg.nonceStr, // 必填,生成签名的随机串 signature:getWxCfg.signature,// 必填,签名,见附录1 jsApiList:['onMenuShareTimeline','onMenuShareAppMessage','onMenuShareQQ','onMenuShareWeibo','onMenuShareQZone'] // 必填,需要使用的JS接口列表,所有JS接口列表见附录2 }); wx.ready(function(){ //获取“分享到朋友圈”按钮点击状态及自定义分享内容接口 wx.onMenuShareTimeline({ title: setWeixinShare.title, // 分享标题 link: setWeixinShare.link, // 分享链接 imgUrl: setWeixinShare.imgUrl, // 分享图标 success: function () { setWeixinShare.success; // 用户确认分享后执行的回调函数 }, cancel: function () { setWeixinShare.cancel; // 用户取消分享后执行的回调函数 } }); //获取“分享给朋友”按钮点击状态及自定义分享内容接口 wx.onMenuShareAppMessage({ title: setWeixinShare.title, // 分享标题 desc: setWeixinShare.desc, // 分享描述 link: setWeixinShare.link, // 分享链接 imgUrl: setWeixinShare.imgUrl, // 分享图标 type: setWeixinShare.type, // 分享类型,music、video或link,不填默认为link dataUrl: setWeixinShare.dataUrl, // 如果type是music或video,则要提供数据链接,默认为空 success: function () { setWeixinShare.success; // 用户确认分享后执行的回调函数 }, cancel: function () { setWeixinShare.cancel; // 用户取消分享后执行的回调函数 } }); //获取“分享到QQ”按钮点击状态及自定义分享内容接口 wx.onMenuShareQQ({ title: setWeixinShare.title, // 分享标题 desc: setWeixinShare.desc, // 分享描述 link: setWeixinShare.link, // 分享链接 imgUrl: setWeixinShare.imgUrl, // 分享图标 success: function () { setWeixinShare.success; // 用户确认分享后执行的回调函数 }, cancel: function () { setWeixinShare.cancel; // 用户取消分享后执行的回调函数 } }); //获取“分享到腾讯微博”按钮点击状态及自定义分享内容接口 wx.onMenuShareWeibo({ title: setWeixinShare.title, // 分享标题 desc: setWeixinShare.desc, // 分享描述 link: setWeixinShare.link, // 分享链接 imgUrl: setWeixinShare.imgUrl, // 分享图标 success: function () { setWeixinShare.success; // 用户确认分享后执行的回调函数 }, cancel: function () { setWeixinShare.cancel; // 用户取消分享后执行的回调函数 } }); //获取“分享到QQ空间”按钮点击状态及自定义分享内容接口 wx.onMenuShareQZone({ title: setWeixinShare.title, // 分享标题 desc: setWeixinShare.desc, // 分享描述 link: setWeixinShare.link, // 分享链接 imgUrl: setWeixinShare.imgUrl, // 分享图标 success: function () { setWeixinShare.success; // 用户确认分享后执行的回调函数 }, cancel: function () { setWeixinShare.cancel; // 用户取消分享后执行的回调函数 } }); }); }); } }); } function openX_ad(posterid, htmlid, width, height) { if ($(htmlid).length > 0) { var randomnumber = Math.random(); var now_url = encodeURIComponent(window.location.href); var ga = document.createElement('iframe'); ga.src = 'https://www1.elecfans.com/www/delivery/myafr.php?target=_blank&cb=' + randomnumber + '&zoneid=' + posterid+'&prefer='+now_url; ga.width = width; ga.height = height; ga.frameBorder = 0; ga.scrolling = 'no'; var s = $(htmlid).append(ga); } } openX_ad(828, '#berry-300', 300, 250);