
54483351482386EE192| Application Note
Engineer To Engineer Note
EE-192
a
Contributed by Joe B.
Technical Notes on using Analog Devices' DSP components and development tools
Contact our technical support by phone: (800) ANALOG-D or e-mail: dsp.support@analog.com Or visit our on-line resources http://www.analog.com/dsp and http://www.analog.com/dsp/EZAnswers
Using C To Create Interrupt-Driven Systems On Blackfin Processors
May 28, 2003
Introduction
This Engineer-to-Engineer note will describe the process for implementing an interrupt-driven general-purpose timer routine for the Blackfin Processor family using the C programming language. The referenced code in this application note was verified using VisualDSP++TM 3.1 for Blackfin and the project was run on the EZ-KIT LiteTM evaluation systems for both the ADSP-BF535 and the ADSP-BF533 Blackfin Processors (ADDS-BF535-EZLITE, Rev 1.0 and ADDSBF533-EZLITE, Rev 1.0).
the ADDS-BF535-EZKIT, the four LEDs are mapped directly to the general purpose flag pins, whereas, on the ADDS-BF533-EZKIT, the six LEDs are accessible only through the on-board flash port, which requires an alternate set of instructions in the Interrupt Service Routine (ISR) in order to update the LED display. The differences in the software will be discussed later.
Using Features In VisualDSP++
VisualDSP++ 3.1 comes with a set of header files that makes programming the Blackfin processors in a C environment simpler. These headers can be found under the Blackfin include directory and are named using the "cdef" prefix to denote C definitions. Memory-mapped registers are accessed in C via a referencing-dereferencing scheme using casted pointers, like this:
volatile long *pIMASK = (long *)IMASK;
Timer Programming Model
When coding in a pure assembly environment, configuration of the timers and use of interrupts is fairly straightforward, as described in the Hardware Reference Manuals. However, when programming in C, using interrupts and accessing the timer registers requires knowledge of some of the system header files and an understanding of the C run-time environment as it relates to embedded system programming. The process explained herein describes how to implement an interrupt-driven timer routine in C, but the methods employed can be applied to any C-coded interrupt routines for the Blackfin processors. Two test platforms are necessary for this paper because the demonstration utilizes the on-board LEDs on the Blackfin evaluation platforms. On
IMASK is defined for the ADSP-BF535 in "defblackfin.h" and for the ADSP-BF533 in "def_LPblackfin.h" to be the address of the IMASK register in Blackfin address space (0xFFE02104). If the user wanted to set bit 0 of the IMASK register in C, a proper 32-bit readmodify-write would be performed indirectly through the pointer defined above:
*pIMASK |= 0x1;
Using this convention, the label "pIMASK" is a data element of type long int *, which
Copyright 2003, Analog Devices, Inc. All rights reserved. Analog Devices assumes no responsibility for customer product design or the use or application of customers' products or for any infringements of patents or rights of others which may result from Analog Devices assistance. All trademarks and logos are property of their respective holders. Information furnished by Analog Devices Applications and Development Tools Engineers is believed to be accurate and reliable, however no responsibility is assumed by Analog Devices regarding technical accuracy and topicality of the content provided in Analog Devices' Engineer-to-Engineer Notes.
54483351482386EE192 Application Note analog Download PDF
Add this permalink to your bookmarks for future download of 54483351482386EE192 ApplicationNote
Permalink: http://application.emcelettronica.com/analog/54483351482386EE192