×

AD5449-微控制器无操作系统驱动程序

消耗积分:2 | 格式:pdf | 大小:810.07KB | 2021-05-23

cherry1989

分享资料个

This version (25 Jan 2021 05:41) was approved by Robin Getz.The Previously approved version (25 Jan 2021 05:23) is available.Diff

AD5449 - Microcontroller No-OS Driver

Supported Devices

Evaluation Boards

Overview

The AD5449 is a CMOS, 12-bit, dual-channel, current output digital-to-analog converter (DAC). This device operates from a 2.5 V to 5.5 V power supply, making it suited to battery-powered applications and other applications. As a result of being manufactured on a CMOS submicron process, this part offers excellent 4-quadrant multiplication characteristics, with large-signal multiplying bandwidths of 10 MHz. The applied external reference input voltage (VREF) determines the full-scale output current. An integrated feedback resistor (RFB) provides temperature tracking and full-scale voltage output when combined with an external current-to-voltage precision amplifier. This DAC uses a double buffered, 3-wire serial interface that is compatible with SPI®, QSPI™, MICROWIRE™, and most DSP interface standards. In addition, a serial data out pin (SDO) allows daisy-chaining when multiple packages are used. Data readback allows the user to read the contents of the DAC register via the SDO pin. On power-up, the internal shift register and latches are filled with 0s, and the DAC outputs are at zero scale.

The goal of this project (Microcontroller No-OS) is to be able to provide reference projects for lower end processors, which can't run Linux, or aren't running a specific operating system, to help those customers using microcontrollers with ADI parts. Here you can find a generic driver which can be used as a base for any microcontroller platform and also specific drivers for Renesas platforms.

HW Platform(s):

Driver Description

The driver contains two parts:

  • The driver for the AD5449 part, which may be used, without modifications, with any microcontroller.
  • The Communication Driver, where the specific communication functions for the desired type of processor and communication protocol have to be implemented. This driver implements the communication with the device and hides the actual details of the communication protocol to the ADI driver.

The Communication Driver has a standard interface, so the AD5449 driver can be used exactly as it is provided.

There are three functions which are called by the AD5449 driver:

  • SPI_Init() – initializes the communication peripheral.
  • SPI_Write() – writes data to the device.
  • SPI_Read() – reads data from the device.

SPI driver architecture

The following functions are implemented in this version of AD5449 driver:

Function Description
unsigned char AD5449_Init(void) Initialize the communication with the device.
void AD5449_SetRegisterValue(unsigned short command, unsigned short dataWord) Sends a 16-bit value to the Input Shift Register of the device.
unsigned short AD5449_GetRegisterValue(unsigned char dacChannel) Reads 12-bit data form DAC register A or DAC register B.
void AD5449_Setup(unsigned short setupWord) Enables specific options available for the device.

Downloads

Renesas RL78G13 Quick Start Guide

This section contains a description of the steps required to run the AD5449 demonstration project on a Renesas RL78G13 platform.

Required Hardware

Required Software

Hardware Setup

An EVAL-AD5449SDZ has to be interfaced with the Renesas Demonstration Kit (RDK) for RL78G13:

  EVAL-AD5449SDZ Pin /SYNC (CS)      → YRDKRL78G13 J11 connector Pin 1
  EVAL-AD5449SDZ Pin SDIN  (MOSI)    → YRDKRL78G13 J11 connector Pin 2
  EVAL-AD5449SDZ Pin SDO   (MISO)    → YRDKRL78G13 J11 connector Pin 3
  EVAL-AD5449SDZ Pin SCLK  (SCLK)    → YRDKRL78G13 J11 connector Pin 4
  EVAL-AD5449SDZ Pin LDAC  (LDAC)    → YRDKRL78G13 J11 connector Pin 9  
  EVAL-AD5449SDZ Pin /CLR  (CLR)     → YRDKRL78G13 J11 connector Pin 10

Software Setup

With the Applilet3 for RL78G13 tool the following peripherals have to be configured:

CSI10 (Clocked Serial Interface 10) – For the AD5449 part and the ST7579 LCD

Choose to generate the Transmit/receive function for the CSI10 and configure the interface with the following settings:

  • Transfer mode setting: Single transfer mode
  • Data length setting : 8 bits
  • Transfer direction setting: MSB
  • Specification of data timing: Type 3
  • Transfer rate setting – Clock mode: Internal clock (master)
  • Transfer rate setting – Baudrate: 1000000 (bps)
  • Interrupt setting – Transfer interrupt priority (INTCSI10): Low
  • Uncheck the callback functions.

TM00 (Timer 00) – For the DelayMs() function

Configure TM00 as an interval timer:

  • Interval timer setting - Interval value(16 bits): 1 ms
  • Interval timer setting - Uncheck Generates INTM00 when counting is started
  • Interrupt setting - Uncheck End of timer channel 0 count, generate an interrupt (INTM00)

Watchdog Timer

Disable the watchdog timer:

  • Choose for the Watchdog timer operation setting: Unused option.

Reference Project Overview

The reference project initializes the device, sets the DAC output to middle scale and continuously writes values to DAC register, generating a signal. The values that are written to the device are also displayed on LCD.

Software Project Setup

This section presents the steps for developing a software application that will run on the Renesas Demo Kit for RL78G13 for controlling and monitoring the operation of the ADI part.

Two software applications have to be used: Applilet3 for RL78G13 (a tool that automatically generates device drivers for MCU peripheral functions) and IAR Embedded Workbench for Renesas RL78 (the integrated development environment).

Step 1 - Applilet3 for RL78G13

  • Run the Applilet3 for RL78G13 tool and create a new project for R5F100LE processor. Select IAR Compiler build tool, a project name, a location for the new project and press OK.

  • Keep the default Pin assignment setting and click Fix settings.

  • Now the desired peripherals can be configured and the code can be generated. For example, if the clocked serial interface 10 (CSI10) has to be configured, select the Serial peripheral, choose for the Channel 2 of Serial Array Unit 0 (SAU0) the CSI10 interface, Transmit/receive function option and then go to CSI10 tab.

  • To configure the CSI10 interface for serial transmissions of 8 bits, with MSB first, with the data captured on clock's rising edge, with a frequency of the clock of 1 MHz and the idle state high, the settings from the following image have to be made.

  • After all the desired peripherals are configured click on the Generate Code button and a new workspace and a new project for the IAR Embedded Workbench will be generated. After the code was generated close the Applilet3 for RL78G13 tool.

Step 2 - IAR Embedded Workbench for Renesas RL78

  • Run the IAR Embedded Workbench and open the workspace created with the Applilet3 tool.

  • Copy the files extracted from the zip file into the user_src folder, located in the project’s folder.

  • The new source files have to be included into the project. Add in the user_src group the files from the corresponding folder (Right click on the group and select Add – Add Files…). Because a new Main file was included the r_main.c file from the applilet_src group has to be deleted (Right click on the file and select Remove).

  • Now the debugger driver has to be selected from the project’s options. Right click on the project name and select Options. From the Debugger category choose the TK Debugger Driver.

  • Now, the project is ready to be compiled and downloaded on the board. Press the F7 key to compile it. Press CTRL + D to download and debug the project.

29 Feb 2012 17:01 · Dragos Bogdan

More information

01 Jun 2012 12:21

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

评论(0)
发评论

下载排行榜

全部0条评论

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