| The Datasheet Archive - 100 Million Datasheets from 7500 Manufacturers. |
Scott Tater ABSTRACT This application report demonstrates procedure us
Top Searches for this datasheetProgramming TMS320VC5509 Peripheral Scott Tater ABSTRACT This application report demonstrates procedure used program TMS320VC5509 digital signal processor (DSP) Real Time Clock (RTC). Basic operations RTC, such reading writing time, well interrupt configuration, covered. interaction with peripheral accomplished using Chip Support Library (CSL) module. example that illustrates usage these routines also presented. Contents Introduction Basic Operation Initializing Time Alarm With DSP/BIOS Configuration Tool Reading Writing Using Embedded Chip Support Library Function Calls 2.2.1 Using ANSI Style Time Functions Configuring Real Time Clock Interrupts 2.3.1 Interrupts Using Dispatcher 2.3.2 Interrupts Using DSP/BIOS Module Without Dispatcher Examples: Programming Real Time Clock References Appendix Working With Spectrum Digital C5509 List Figures Figure Figure Figure Figure Figure Figure Figure Figure Block Diagram DSP/BIOS Configuration Tool With Module Data Structure Example Binary Coded Decimal Conversion Support Function Example Using RTC_setCallback() Bind Functions Manager Setup Example Interrupt Dispatcher Code List Tables Table Data Structures Table Utility Functions Table Binary Coded Decimal Example Table Basic Calls Table ANSI Style Calls Table Structures Functions Used With Interrupts Table JP10 Clock Input Source Trademarks property their respective owners. Applications Semiconductor Group SPRA384A Introduction module maintains time date information independent operation. achieves independent operation using separate external clock power source from DSP. Figure shows block diagram. tracks time following formats: Seconds (0-59) Minutes (0-59) Hours (0-23) Days week (1-7) Days month (1-31) Months (1-12) Years with leap year correction (0-99) provides three separate interrupt sources: periodic, alarm, update. periodic interrupt programmable period from minute. alarm interrupt flexible combination second, minute, hour, week. update interrupt associated with internal operation and, while interrupt originates under internal control, user enable disable transmission central processing unit (CPU) core. RTCX1 Clock Divider RTCX2 TCLK Clock Selector Peripheral Interface NRESET Control Status Registers DI[7:0] Write Buffer Time, Calendar, Alarm Read Buffer DO[7:0] Figure Block Diagram detailed information RTC, including hardware implementation operation, please refer chapter TMS320C55x Peripherals Reference Guide (SPRU317). Programming TMS320VC5509 Peripheral SPRA384A Basic Operation Program interaction with typically involves following three types operations: Initializing time alarm information using DSP/BIOS Configuration tool Reading writing using embedded function calls Configuring Interrupts with either embedded function calls with DSP/BIOS Configuration tool. DSP/BIOS Configuration tool used perform initialization start-up, code interface used during time interact with needed, then DSP/BIOS used implement interrupt capabilities device, desired. Initializing Time Alarm With DSP/BIOS Configuration Tool DSP/BIOS Configuration tool provides graphical interface initialize code start-up. Figure shows typical view Configuration tool with module expanded. module contains parts: Configuration Manager Resource Manager. Configuration Manager allows user create more configuration objects. Each object contains information needed initialize control registers. Resource Manager associates hardware with particular configuration object. time, DSP/BIOS will automatically load information stored configuration object into RTC. DSP/BIOS trademark Texas Instruments. Programming TMS320VC5509 Peripheral SPRA384A Figure DSP/BIOS Configuration Tool With Module more detailed information using DSP/BIOS Configuration tool, TMS320 DSP/BIOS User's Guide (SPRU423). Reading Writing Using Embedded Chip Support Library Function Calls collection C-callable functions, macros, symbols used control access on-chip peripherals that share standard interface. speeds development time reducing code reinvention, standardized interface reduces programming errors facilitates simple debugging. also provides level hardware abstraction facilitate porting software between different Texas Instruments DSPs. addition style interface, module includes support ANSI style time interface. This interface similar that provided standard include file time.h. complete description time.h implementation given section 2.2.1. Programming TMS320VC5509 Peripheral SPRA384A support consists types objects: specific data structures support functions. data structures pre-defined structures designed store register information. support functions automate interaction with utilize standard interface. Table shows data structures. Table Data Structures Data Structure Name RTC_Alarm RTC_Data RTC_Time used Store information setting alarm time Store information setting date Store information setting time data passed binary coded decimal form (BCD). Figure shows example code used declare RTC_Time structure store time format. Notice that supports 24-hour time format only. RTC_Time myTime 0x21, 0x58, 0x30, Hour (Note hour time notation) Minutes Seconds Figure Data Structure Example module includes functions used facilitate conversion between binary forms. These functions will reduce translation errors speed development. Table lists these utility functions, Figure shows example their use. Table provides decimal translation example. Table Utility Functions Utility Function Name RTC_bcdToDec() RTC_decToBcd() used Convert format decimal Convert decimal format minute second currentTime.minute RTC_decToBcd(minute); currentTime.second RTC_decToBcd(second); //Convert value from native //format decimal //Convert value from decimal //native format Figure Binary Coded Decimal Conversion Programming TMS320VC5509 Peripheral SPRA384A Table Binary Coded Decimal Example Decimal Binary Coded Decimal 0x10 0x11 0x12 0x13 0x14 majority program interaction with will make basic operations. These operations include performing reads writes time, date, alarm registers. Table lists each support functions used perform these operations. Table Basic Calls Support Function Name RTC_getDate() RTC_getTime() RTC_setAlarm() RTC_setDate() RTC_setTime() RTC_start() RTC_stop() RTC_reset() used Read current date from registers Read current time from registers alarm specific time calendar clock Start clock Stop clock initial state complete listing available operations CSL, TMS320C55x Chip Support Library Reference Guide (SPRU433). support functions work with data structures access RTC. Using example code shown Figure example Figure shows RTC_setTime() function used write data time registers. Time Real Time Clock RTC_setTime(&myTime); Figure Support Function Example Programming TMS320VC5509 Peripheral SPRA384A TMS320C55x Peripherals Reference Guide (SPRU317) describes certain access methods when working with register values. These methods designed ensure that data transferred from corrupted update cycle update cycle occurs when changes stored values reflect current time). incorporates these methods thus programmer need only concerned with provided interface, specific access methods. 2.2.1 Using ANSI Style Time Functions module provides ANSI style time functions addition standard style functions. These interfaces will benefit programmer familiar with time.h header wishes either maintain continuity with existing code, make rich time-related string manipulation provided header. Table lists each ANSI style time functions. Notice that each function identical counterpart, except addition module prefix. Table ANSI Style Calls ANSI Support Function Name RTC_asctime RTC_ctime RTC_difftime RTC_gmtime RTC_localtime RTC_mktime RTC_strftime RTC_time used Convert time ASCII string Convert calendar time local time Return difference between calendar times Convert calendar time Convert calendar time local time Convert local time calendar time Format time into character string Return current time date These functions maintain similar interface, data structure, functionality their ANSI counterparts. additional documentation these functions, please refer ANSI equivalent routines TMS320C55x Optimizing Compiler User's Guide (SPRU281). More information about ANSI routines found Programming Language [5]. Configuring Real Time Clock Interrupts Real Time Clock provide various interrupts addition keeping time. Three interrupt sources exist RTC: Alarm Interrupt Periodic Interrupt Update Cycle Interrupt Programming TMS320VC5509 Peripheral SPRA384A Each three interrupt sources share main interrupt line. enabled source trigger interrupt. alarm interrupt based alarm time RTC. occur with period second week. periodic interrupt does depend time alarm, occur with periods from minute Note that while alarm interrupt nearly continuous values because based time format, periodic interrupt pre-determined values inside period range. update cycle interrupt occurs once each second updates stored time. simplifies process interrupt interrupt service routine (ISR) configuration. Table summarizes data structures support functions used with interrupts. Table Structures Functions Used With Interrupts Data Structure Function Name RTC_IsrAddr RTC_eventDisable() RTC_eventEnable() RTC_setCallback() RTC_setPeriodicInterval() used Data structure, hold names Disable interrupt source main interrupt Enable interrupt source main interrupt Bind names interrupt handler interval periodic interrupt function RTC_setCallback() used associate interrupt service routine with each interrupt source (periodic, alarm, update). same binding between interrupt also accomplished with module DSP/BIOS. underlying method implementation each, important choose method binding interrupts ISRs entire project. solutions interrupt management presented sections 2.3.1 2.3.2, allow maximum flexibility code: 2.3.1 Using Dispatcher Using DSP/BIOS module without Dispatcher Interrupts Using Dispatcher function RTC_setCallback() supports interrupt service routines when module used. Configuration Dispatcher two-step process: Create each active interrupt source Bind individual ISRs Dispatcher data structure RTC_IsrAddr used hold names each specific ISR, function RTC_setCallback() binds function names structure interrupt. RTC_setCallback will configure dispatcher direct incoming interrupt correct automatically. Figure shows example using this function configure ISRs. Note that individual ISRs (myPeriodicIsr, etc.) should declared with interrupt keyword when they used with dispatcher. Programming TMS320VC5509 Peripheral SPRA384A Declare initialize interrupt callback function structure RTC_IsrAddr addr myPeriodicIsr, myAlarmIsr, myUpdateIsr //function name desired Period Interrupt //function name desired Alarm Interrupt //function name desired Update Interrupt Bind address each interrupt service routine interrupts RTC_setCallback(&addr); Figure Using RTC_setCallback() Bind Functions 2.3.2 Interrupts Using DSP/BIOS Module Without Dispatcher program that binds interrupt using module should also interrupt configuration objects. Instead, create associate with hardware interrupt signal manager. DSP/BIOS manager will configure system specified when interrupt signal occurs. Because most systems will only three sources trigger interrupt, recommended decode interrupt signal determine which three potential sources trigger. Instead, manager call directly. Figure shows example manager configured call ISR. Figure Manager Setup Programming TMS320VC5509 Peripheral SPRA384A Examples: Programming Real Time Clock accompanying file contains four separate example projects. These projects show program using the: Example DSP/BIOS Module Example Module Example Interrupt Dispatcher Example ANSI Style Routines Complete source code each example provided archive file that accompanies this report. have archive file, available website http://www.ti.com). source code Example Interrupt Dispatcher shown Figure code annotated with text callouts describe functionality step step. example shows configure service interrupt using RTC_setCallback() associated data structures. #include <csl.h> #include <csl_rtc.h> #include <stdio.h> void myPeriodicIsr(void); void myUpdateIsr(void); extern Uint32 myVec(); volatile Uint16 rtc_cnt volatile Uint16 counterPer counterUp sec; min0, min1 stop old_intm; eventId; RTC_Date myDate 0x02, Year 0x02, Month 0x28, Daym 0x05 Dayw RTC_Time myTime 0x1, Hour 0x4, Minutes 0x59, Seconds RTC_IsrAddr addr myPeriodicIsr, NULL, myUpdateIsr main() CSL_init(); Include headers. Declare initialize date time data structures. Declare initialize interrupt service routines periodic update interrupts (alarm interrupt unused). Figure Example Interrupt Dispatcher Code Programming TMS320VC5509 Peripheral SPRA384A Configure time date. RTC_setTime(&myTime); RTC_setDate(&myDate); old_intm IRQ_globalDisable(); IRQ_setVecs((Uint32)myVec); Clear pending interrupts eventId RTC_getEventId(); IRQ_clear(eventId); RTC_setCallback(&addr); Enable maskable interrupts IRQ_globalEnable(); RTC_start(); RTC_RGET(RTCSEC); while (sec RTC_RGET(RTCSEC); min0 RTC_RGET(RTCMIN); while (!stop) while (RTC_FGET(RTCPINTR,UIP) min1 RTC_RGET(RTCMIN); ((min1 min0) stop printf("\nRTC testing update periodic interrupts successful\n"); RTC_stop(); Stop STRC. Allow interrupts occur minute. Start RTC. Wait until seconds equals zero. Place interrupt service routine address associated vector location. periodic interval. interrupt table defined file vectors.asm. Enable alarm interrupt start second after clock started. Disable periodic update interrupts when minute passed. Figure Example Interrupt Dispatcher Code (Continued) Programming TMS320VC5509 Peripheral SPRA384A void myPeriodicIsr() ++counterPer; printf("\tPeriodic interrupt %x::%x::%x\n", RTC_FGET(RTCHOUR, HR), min1, RTC_RGET(RTCSEC)); void myUpdateIsr() ++counterUp; RTC_RGET(RTCSEC); printf("Update interrupt %x::%x::%x\n", RTC_FGET(RTCHOUR, HR), min1, sec); Figure Example Interrupt Dispatcher Code (Continued) References TMS320C55x Peripherals Reference Guide (SPRU317). TMS320 DSP/BIOS User's Guide (SPRU423). TMS320C55x Chip Support Library Reference Guide (SPRU433). TMS320C55x Optimizing Compiler User's Guide (SPRU281). Programming Language, Edition, Brian Kernighan Dennis Ritchie. TMS320VC5509 Fixed-Point (SPRS163). Programming TMS320VC5509 Peripheral SPRA384A Appendix Working With Spectrum Digital C5509 Spectrum Digital (www.spectrumdigital.com) provides hardware evaluation module (EVM) work with C5509 DSP. order peripheral examples included with this application report, input clock (RTCLK) source needs configured. Jumper JP10 used select source input clock. clock driven either timer output pin, TOUT, onboard crystal. When position selected, RTCLK driven TOUT. When position used, real-time clock driven 32.768K-hertz crystal. example programs this application report, JP10 should position 2-3. Note that square solder profile board's underside marks Table shows positions their functions. Table A-1. JP10 Clock Input Source JP10 Position Function TOUT Selected RTCLK Source 32.768K Selected RTCLK Source Programming TMS320VC5509 Peripheral IMPORTANT NOTICE Texas Instruments Incorporated subsidiaries (TI) reserve right make corrections, modifications, enhancements, improvements, other changes products services time discontinue product service without notice. Customers should obtain latest relevant information before placing orders should verify that such information current complete. products sold subject TI's terms conditions sale supplied time order acknowledgment. warrants performance hardware products specifications applicable time sale accordance with TI's standard warranty. Testing other quality control techniques used extent deems necessary support this warranty. Except where mandated government requirements, testing parameters each product necessarily performed. assumes liability applications assistance customer product design. Customers responsible their products applications using components. minimize risks associated with customer products applications, customers should provide adequate design operating safeguards. does warrant represent that license, either express implied, granted under patent right, copyright, mask work right, other intellectual property right relating combination, machine, process which products services used. Information published regarding third-party products services does constitute license from such products services warranty endorsement thereof. such information require license from third party under patents other intellectual property third party, license from under patents other intellectual property Reproduction information data books data sheets permissible only reproduction without alteration accompanied associated warranties, conditions, limitations, notices. Reproduction this information with alteration unfair deceptive business practice. responsible liable such altered documentation. Resale products services with statements different from beyond parameters stated that product service voids express implied warranties associated product service unfair deceptive business practice. responsible liable such statements. Mailing Address: Texas Instruments Post Office 655303 Dallas, Texas 75265 Copyright 2002, Texas Instruments Incorporated Other recent searchesWP7113SF6C - WP7113SF6C WP7113SF6C Datasheet M66273FP - M66273FP M66273FP Datasheet LP2954 - LP2954 LP2954 Datasheet LP2954A - LP2954A LP2954A Datasheet LMV321 - LMV321 LMV321 Datasheet LED0805 - LED0805 LED0805 Datasheet HERF1001G - HERF1001G HERF1001G Datasheet HERF1008G - HERF1008G HERF1008G Datasheet APG-66 - APG-66 APG-66 Datasheet
Privacy Policy | Disclaimer |