NOTICE: The Processors Wiki will End-of-Life in December of 2020. It is recommended to download any files or other content you may need that are hosted on processors.wiki.ti.com. The site is now set to read only.

PROFIBUS DP slave demo setup on AM335x

From Texas Instruments Wiki
Jump to: navigation, search

Introduction[edit]

This article describes how to set up the AM335x PROFIBUS DP slave with PROFIBUS master software running on a PC.

1. Master Configuration:
[edit]

We use ProfiTrace  (Version 2.6.1 or Later) from Procentec as Profibus master. This software can be run on Windows machine and the 'ProfiCore Ultra' hardware should be connected between the PC and the EVM running Profibus slave application. The ProfiTrace configuration should be done as follows-

1.1 Copy PRU_OCDA.gsd file provided in the SDK package [(ISDK_HOME)\examples\profibus_slave\GSD] into master GSD library (ProfiCaptain- Settings->Add/Copy GSD to catalog)

                                                          Copy GSD to catalog.jpg
                                                                               Fig 1 - Adding GSD file to ProfiTrace and generating the catalog

1.2  Use 'Generate Catalog' option to regenerate the catalog when the GSD file is modified (ProfiCaptain- Settings-> Generate catalog).

1.3 ProfiCore Initialization: Once the Proficore Ultra is connected to EVM, initialize the proficore using 'Init ProfiCore Ultra' (ProfiTrace-> Init ProfiCore Ultra). If profiTrace shows 'Unable to detect Baud Rate', proceed by clicking 'OK'.

1.4 Load/Save Project: Configure the ProfiCaptian Project by drag-dropping the "AM335x Evaluation Module (EVM)" slave into the ProfiCore slave Network.Verify that the module parameters are correctly configured using 'Setup Modules and Parameters'. Save this project in ProfiCaptain Project File (*.ppf) format (File->Save Project). This project files can be used in future for the easy reloading (File->Load Project)

1.5 Operate Master: By default, the master will not be active on the bus. When the master goes to 'Operate' state, it will become active by transmitting tokens in the bus.


2. Slave Configuration:
[edit]

2.1EVM Configuration:

Set up the board in which Profibus Slave application is running as shown below:

2.1.1 ICE V2 Setup

NOTE 1 -  Set Jumpers between pins 2 & 3 on J18 and J19 to select ICSS mode

NOTE 2 - Set jumper on J7, J8 ( pin 1 and 2) and J10. Remove Jumper on J6 as shown in Fig 2


                 ICEv2 with Rotary switch.jpg

                                                                                       Fig 2 - ICEv2 Setup for running Profibus Slave


2.1.2 ICE Setup:

NOTE 1 - Set Jumper on J6 (pin 1 and 2), J7,J5 and remove Jumper J4 as shown in Fig 3.

Profibus Slave Jumper Settings ICEv1.jpg

Fig 3 - ICE Setup for running Profibus Slave


2.1.3 IDK Setup:

NOTE 1 - Connect the Proficore Ultra Serial interface to J13 of IDK as shown in Fig 4

IDK profibus.jpg

Fig 4 - IDK Setup for running Profibus Slave


3. Running/ Configuring the Profibus Slave application:
[edit]

3.1 After powering on the board, the bootloader will load the APP from SDMMC/SPI flash/NOR flash into DDR/Internal RAM/Cache

3.2 The boot logs can be seen on serial console (Connect the JTAG in case of ICE boards and use DB9 serial cable to 'J10' in case of IDK)

3.3 Configuring the Station Address:

                  The procedure for configuring the station address depends on the EVM type in which the application is running.

3.3.1 ICE/ IDK:

The application waits for 5 sec to so that the station address can be configured from serial console. Hit 'Enter' key to change station address, then enter the valid station address (0 to 126) and hit 'Enter' again so that the application will start running with the configured station address. If there is no user defined station address specified, then the application will be running with default station address 5.

Console ICE.JPG
Fig 5 - UART console view for application running on ICE

3.3.2 ICE2:

The application will detect the board type. In case of ICEv2, the station address are read based on the 'Rotary Switch Position' (Refer Fig 2). The rotary switch can be positioned to 0 to 9 and the application will be running with a station address which is read based on the rotary switch position as shown in Fig 6

                                                               ICE2 UART console.jpg

                                                                                           Fig 6 - UART console view for application running on ICE2

4. Communication between ProfiTrace and the Profibus Slave using the UART console Menu:
[edit]

4.1 Once the application started running with a configured station address, the master can detect the slaves in the network. Operate the master and the active slaves which are online will be detected and displayed with a green icon in the ProfiTrace Console as shown in Fig 7 and 8


Profibus master go online.jpg

                                                                                      Fig 7 - Profibus Master in Operate state and detects the slave device.

                                                                   Profibus master.JPG

                                                                                    Fig 8 - Active slave devices displayed in ProfiTrace console                               

4.2 UART Console Menu:

UART console menu supports different options for the communication between master and slave. They are as follows-

4.2.1 Change Inputs:

Inputs can be changed from the slave side by pressing 'I' on UART console. The input changes will be communicated to the master. In the 'Inputs and Outputs window', input changes are reflected.

Screenshot 1 - 240 byte inputs.jpg

                                                                                         Fig 9 - Input changes are communicated to master

The input change from the slave side can be monitored via profibus DP data exachange through ProfiTrace message window (ProfiTrace-> Start Message Recording->Messages with view filter applied). Check the option 'Stick to bottom' to see the latest messages as shown in Fig 10

Profibus DP data exchange.jpg

                                                                                      Fig 10 - Profibus DP data exchange


4.2.2 Send Static Diagnosis:

Profibus slave application will send the static diagnostic data to the master via using the UART console option 'S'. We can see the diagnostic data in the message window as shown in Fig 11.


Send static diagnostics.jpg

                                                                                                        Fig 11 - Send Static Diagnostics - Data exchange view

Also we can see the 'Static Diagnostics' bit set in the 'Diagnostic and Status Information' (Launch Slave setup dialog by double clicking the slave station -> Info and setup Tab) as shown in Fig 12

                                          Send static diagnostics Diag info.jpg

                                                                                                          Fig 12 - Send Static diagnostics - Diagnostics information

4.2.3 Send Extended Diagnosis:

The slave application will send the Extended static diagnostic data to the master via using the UART console option 'E'. The extended diagnostic message can be found in the message window (Stop message recording to see the data)

Send extended diagnostics.jpg

                                                                                          Fig 13 - Send Extended diagnostic data - Data exchange view


It contains more data than the normal diagnostics data. The extended diagnostics data can be decoded in the Diagnostics window. (Launch Slave setup dialog by double clicking the slave station -> Diagnostics Tab) as shown in Fig 14

                                    Extended diagnostic data.jpg

                                                                                        Fig 14 - Extended Diagnostic data - Diagnostics window

4.2.4 Clear Diagnosis:

The slave application will stop sending the Diagnostic data (Static as well as Extended) using the console option 'C'. In the data exchange message window, we can see normal input data changes.

4.2.5DP Status:

DP Status indicates the operational state/ Communication data excahnge status between master and slave. 'D' gives the DP status - 0x80 or 0x81 indicates the data exchanges, 0x0 indicates that data exchange is stopped. The DP status value can be decoded as shown in Fig 15

                                         DP status.jpg

                                                                                                    Fig 15 - DP Status Bits

4.3 Controlling the Outputs from the Master:
Profibus Master can control the output bytes in the slave by writing values to it. This is done using 'Watch/Modify I/O' (ProfiCaptain-> Watch/Modify/IO). Master output updates are seen on serial console and output Address 3 toggles the LEDs on top of J17 (in IDK) or below J9 (in ICE) in a pattern sent by the master on Address 3.

 
                              Screenshot 2 - Controlling 240 byte outputs.jpg

                                                                                            Fig 16 - Controlling the output from Profibus master


4.4Configuring User Defined Input/ Ouput length
  To configure User defined length for input/output bytes, follow the procedure-

4.4.1 Change the INPUT_LEN and OUTPUT_LEN in main.c accordingly
4.4.2 Configure the 'myCfg1' array with character string corresponding to the number of inut/output length. As a general configuration, refer Fig 17-
                                                                                  Input output length configuration.jpg

                                                                                              Fig 17 - Configuration bytes representation

4.4.3 In Fig 17, the table can be intepreted as follows-

0x5F : represents input and 32 bytes
0x6F : represents output and 32 bytes
Input 150 bytes => 4*32+22 => 0x5F, 0x5F, 0x5F, 0x5F, 0x5A (11 words)
Output 146 bytes => 4*32+18 => 0x6F, 0x6F, 0x6F, 0x6F, 0x68 (9 words)

4.4.5 Configure the GSD file matching the application
4.4.6 Add the updated GSD file to the master GSD library

4.5 Sample changes for configuring 150 Bytes input and 146 bytes output


4.5.1 In main.c make the following changes,
   #define INPUT_LEN 150
   #define OUTPUT_LEN 146
   const unsigned char myCfg1[] = { 0x5F,0x5F,0x5F,0x5F,0x5A,0x6F,0x6F,0x6F,0x6F,0x68 };


4.5.2 In the GSD file, use Module = "150 Byte Out, 146 Byte In " 0x5F,0x5F,0x5F,0x5F,0x5A,0x6F,0x6F,0x6F,0x6F,0x68  and add to ProfiTrace GSD library.
4.5.3 Go offline in master side, Drag a AM335X EVM to the ProfiCore slave network.Verify that the module parameters are correctly configured using 'Setup Modules and Parameters'.


Setup modules and parameters.jpg
                                                                   

                                                                         Fig 18 - Configuring the module parameters when there is a change in Input/Output data length

4.5.4 If the added slave is preconfigured with some wrong station address, edit the station address by double clicking the station.


Configuring the station address.jpg

                                                                                         Fig 19 - Configuring the correct Station address in Master.


4.5.5 Verify that the input chages are communicated to the master. Also the master should be able to control the outputs. For the 150 bytes inputs,146 bytes outputs the input/output configuration looks as follows-

150 byte inputs 146 byte outputs.jpg

                                                                          Fig 20 - Input/Output changes shown simultaneously






E2e.jpg {{
  1. switchcategory:MultiCore=
  • For technical support on MultiCore devices, please post your questions in the C6000 MultiCore Forum
  • For questions related to the BIOS MultiCore SDK (MCSDK), please use the BIOS Forum

Please post only comments related to the article PROFIBUS DP slave demo setup on AM335x here.

Keystone=
  • For technical support on MultiCore devices, please post your questions in the C6000 MultiCore Forum
  • For questions related to the BIOS MultiCore SDK (MCSDK), please use the BIOS Forum

Please post only comments related to the article PROFIBUS DP slave demo setup on AM335x here.

C2000=For technical support on the C2000 please post your questions on The C2000 Forum. Please post only comments about the article PROFIBUS DP slave demo setup on AM335x here. DaVinci=For technical support on DaVincoplease post your questions on The DaVinci Forum. Please post only comments about the article PROFIBUS DP slave demo setup on AM335x here. MSP430=For technical support on MSP430 please post your questions on The MSP430 Forum. Please post only comments about the article PROFIBUS DP slave demo setup on AM335x here. OMAP35x=For technical support on OMAP please post your questions on The OMAP Forum. Please post only comments about the article PROFIBUS DP slave demo setup on AM335x here. OMAPL1=For technical support on OMAP please post your questions on The OMAP Forum. Please post only comments about the article PROFIBUS DP slave demo setup on AM335x here. MAVRK=For technical support on MAVRK please post your questions on The MAVRK Toolbox Forum. Please post only comments about the article PROFIBUS DP slave demo setup on AM335x here. For technical support please post your questions at http://e2e.ti.com. Please post only comments about the article PROFIBUS DP slave demo setup on AM335x here.

}}

Hyperlink blue.png Links

Amplifiers & Linear
Audio
Broadband RF/IF & Digital Radio
Clocks & Timers
Data Converters

DLP & MEMS
High-Reliability
Interface
Logic
Power Management

Processors

Switches & Multiplexers
Temperature Sensors & Control ICs
Wireless Connectivity