Design of PROFIBUS-DP slave station based on 16-bit DSP

Publisher:atech123Latest update time:2014-09-24 Source: 互联网Keywords:SPC3 Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere

  Selection of core components

  SPC3 protocol chip

  SPC3  is an intelligent communication chip specially developed for slave stations. It supports PROFIBUS-DP protocol. Figure 1 shows the structure of SPC3. Its main features are as follows: 44-pin, PQFP package; automatic detection of baud rate on PROFIBUS, from 9.6kbps to 12Mbps; RS-485 transmission; complete PROFIBUS-DP protocol; internal integrated monitoring timer; 5V DC power supply.

SPC3 structure diagram

Figure 1 SPC3 structure diagram

  SPC3 integrates 1.5KB dual-port RAM, and its address space is from 00H to 5FFH. It is divided into 192 segments with 8 bytes as a unit. It can be divided into 3 areas according to function:

  00H to 015H is the mode setting and status indication register area. 016H to 03FH is the parameter configuration area, where the pointers and lengths of various BUFs are set. 040H to 5FFH is the user area, which is used to receive data from IO applications and master stations. The configuration of these BUFs, including the length and initial address of the BUF, must be completed in the "offline" state of SPC3; during operation, except for the variable length of the input and output BUFs, other configurations cannot be changed. In addition, a watchdog timer is integrated inside the SPC3, which can work in 3 different states: baud rate monitoring, baud rate control and DP control.

  TMS320F206

  

TMS320F206 is a 16-bit fixed-point DSP with an operation rate of 40MIPS. It is manufactured using static CMOS integrated circuit technology, and its structure is based on 'C5x, using an improved Harvard structure, with a program bus and 3 data buses, pipeline operation, parallel 32-bit arithmetic logic unit, 16×16-bit parallel hardware multiplier, on-chip memory, on-chip peripherals and highly specialized instruction set. The on-chip resources include: an internal clock generator, which can be connected to an external clock source to generate the CPU clock with ×1, ×2, ×4 and /2; there are also 4.5KB RAM and 32KB FLASH on the chip, which are suitable for many engineering applications. The 32KB FLASH can be used as a program memory, which greatly facilitates system design and program debugging; 3 external interrupts INT1, INT2, INT; 1 synchronous serial port and one asynchronous serial port; 1 software programmable timer; 4 independently programmable I/O pins, 1 output pin XF and 1 input pin B IO; JTAG scan simulation interface, which is used to realize online simulation testing.

  Hardware system composition

  Figure 2 is the hardware block diagram of the PROFIBUS-DP slave station. The system consists of MAX125, TMS320F206, SPC3, EPM7128SQC100, DS1286, HK1225, external RAM and address dial switch to form a PROFIBUS-DP slave station for railway signal power supply fault diagnosis. The three-phase AC voltage and current signals are synchronously sampled by MAX125, and the DSP performs data processing and data calculation through a certain algorithm, and then makes a diagnosis based on the relevant switch signal conditions to control the power equipment. At the same time, according to the requirements of the PROFIBUS master station, the necessary data and fault information will be transmitted to the master station through the protocol chip SPC3. The master station also uses SPC3 to set the slave station and remotely control the power equipment.

Hardware Circuit Diagram

Figure 2 Hardware circuit diagram

  In the design, the 8-bit SPC3 uses the lower 8-bit data line of TMS320F206 and maps it to the global data space; at the same time, the digital input and digital output of DS1286 and HK1225 are also mapped to the global data space. In this way, the DSP can operate them as easily as operating external RAM. In the program design, when the 16-bit DSP writes to SPC3, DS1286, and HK1225, it writes the lower 8 bits first and then the upper 8 bits.

  System software implementation

  The PROFIBUS-DP slave station (i.e., the terminal unit for fault diagnosis ) mainly completes data acquisition, data processing, fault judgment, and transmits the necessary power parameters and fault information to the master station according to the requirements of the master station. At the same time, the master station can assign values ​​to the slave station.

  Design of SPC3 communication software

  In the design, the electric energy parameters are regarded as the input data of the slave station, the assignment of the master station to the slave station is regarded as the output data, and the fault information is treated as external diagnosis. The SPC3 interrupt method is used to process the master station assignment so that real-time performance can be achieved. In addition, the processing of parameterization messages and configuration messages is also completed in the SPC3 interrupt program. The flow chart of the SPC3 interrupt program is shown in Figure 3.

SPC3 interrupt program flow chart  3 SPC3 interrupt program flow chart 

  Since SPC3 integrates the complete DP protocol, standard diagnostic information is automatically generated and transmitted by SPC3, so the user only needs to store the information communicated with the DP master station in the specified buffer; when the user needs to receive information from the master station, he only needs to access the specified buffer.

  Design of Intelligent Software for TMS320F206

  Data collection, data processing, fault judgment, and recording of necessary information are completed in the TMS320F206 program. In order to continuously monitor the system, data collection uses the interrupt method to continuously collect data. For fault information, the soft interrupt method is used to send the fault alarm information to the diagnostic buffer of SPC3 as soon as possible so that it can wait for the polling of the master station in time. Figure 4 shows the main program flow chart of the system.

Main program flow chart

Figure 4 Main program flow chart

  SPC3 Software Operation

  Since TMS320F206 is fast, the speed must be consistent when exchanging data with SPC3. We set the waiting time of F206 through software to match the speed of the two. In the design, the method of register of structure type is used to operate SPC3. First, define a structure type data "SPC3" corresponding to 1.5KB dual-port RAM, and then define a register "spc3" of type "SPC3" in the header file of F206 register, so that it can be operated conveniently and flexibly. The software is written in C language, and the initialization part of SPC3 is as follows:

  The "spc3" register is defined in the header file

  . 
#define spc3 ( * ( ( volatile SPC3) 0xE800) ) 
      /*SPC3 is mapped to 0xE800 of the global data space* / 

Initialization operation: 
GREG = GLOBAL 16K; /*Map to 16KB global data space* / 

spc3. mode_ reg0_ L = 0x00d3; 
spc3. mode _reg0 _H = 0x0003; /*Set the working mode of SPC3* / 
spc3. is reg. mask[ 0 ] = 0x001e;
spc3. is reg. mask[ 1 ] = 0x002d; /*Set the interrupt source of SPC3 and set the output
data processing to SPC3 hardware interrupt* /
spc3. r len diag buf[ 0 ] = 16;
spc3. r len diag buf[ 1 ]

= 16;
spc3. r len prm buf = 10;
spc3. r len cfg buf = 2;
spc3. r len read cfg buf = 2;
spc3. r len din buf = 244;
spc3. r len dout buf = 244; /* Initialize the length of each buffer/*
UserInputBufferPtr = DPS2 GET D IN BUF PTR ( ) ; /* Get the address of the first input buffer*/
UserDiagBufferPtr = DPS2 GET D IAG BUF PTR ( ) ; /* Get the address of the first diagnostic buffer*/
UserDiagFlag = TRUE;
......

  This paper uses a 16-bit DSP with fast computing speed to design a PROF IBUS2DP intelligent slave station , which makes the application of fieldbus more extensive.

Keywords:SPC3 Reference address:Design of PROFIBUS-DP slave station based on 16-bit DSP

Previous article:Parallel Processing Methods of DSP
Next article:Comment: DSP is everywhere, but the name is going out of fashion

Latest Embedded Articles
Change More Related Popular Components

EEWorld
subscription
account

EEWorld
service
account

Automotive
development
circle

About Us Customer Service Contact Information Datasheet Sitemap LatestNews


Room 1530, 15th Floor, Building B, No.18 Zhongguancun Street, Haidian District, Beijing, Postal Code: 100190 China Telephone: 008610 8235 0740

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京ICP证060456号 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号