mbuesch / pyprofibus

PROFIBUS-DP stack

Home Page:https://bues.ch/a/profibus

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Help with WAGO 750-343

TadyTheFish opened this issue · comments

Hello
I'm trying to get the WAGO 750-343 module with I/O modules to work, but I lack knowledge of Profibus
The Pyprofibus is talking to the module but the slave only reports Configuration error
I went trough the .conf file but i'm stuck
I used the et200s example and modified it. I downloaded the GSD file for the 750-343 module and defined the connected I/O modules but it still does not work.

The .conf file:

; ----------------------------------------------- ;
;                                                 ;
; PROFIBUS configuration                          ;
;                                                 ;
; This file configures a pyprofibus instance.     ;
;                                                 ;
; ----------------------------------------------- ;


; General settings
[PROFIBUS]

; Enable/disable debug mode.
; 0 -> no debugging.
; 1 -> DP debugging.
; 2 -> DP and PHY debugging.
debug=2


; PHY protocol layer configuration
[PHY]

; The PHY layer driver type.
type=serial
;type=fpga
;type=dummy_slave

; Only for type=serial:
; The PHY device name/path.
; Can be a device like /dev/ttyS0 or /dev/ttyAMA0
dev=/dev/ttyAMA0

; Only for type=serial:
; Serial line flow control and handshaking
rtscts=False
dsrdtr=False

; Only for type=fpga:
; SPI bus (to PHY FPGA) configuration.
spiBus=0
spiCS=0
spiSpeedHz=2500000

; The Profibus on-wire baud rate.
;baud=9600
baud=19200
;baud=45450
;baud=93750
;baud=187500
;baud=500000
;baud=1500000
;baud=3000000
;baud=6000000
;baud=12000000


; FDL protocol layer configuration
[FDL]


; DP protocol layer configuration
[DP]

; The master device class. Either 1 or 2.
master_class=1

; The Profibus address of this device.
master_addr=2


; ---
; Slave configurations
; Add as many [SLAVE_xxx] sections as needed.
; ---

; First slave configuration
[SLAVE_0]

; Optional slave name. Will be stored in slaveConf.name and slaveDesc.name.
; pyprofibus does not use the name internally.
name=750-343

; This slave's Profibus address
addr=8

; The path to the GSD file.
gsd=b757_p23.gsd

; Boolean: Sync mode enabled/available?
sync_mode=1

; Boolean: Freeze mode enabled/available?
freeze_mode=1

; 8 bit integer specifying the Profibus group ident mask.
group_mask=1

; This slave's watchdog timeout, in milliseconds.
watchdog_ms=300

; Module configuration.
; For each module plugged into the slave, add a module_xxx
; entry with the name of the module.
; The module name must match the name from the GSD file (approximately).
; The modules are used in the order of the index number.
module_0=750-610 P-Einsp. 24V DC/DIA
module_1=75x-430 8DI/24V DC/3.0ms
module_2=75x-430 8DI/24V DC/3.0ms 
;module_3=75x-430 8DI/24V DC/3.0ms 
;module_4=75x-430 8DI/24V DC/3.0ms 
;module_5=75x-430 8DI/24V DC/3.0ms 
;module_6=75x-430 8DI/24V DC/3.0ms 
;module_7=75x-530 8DO/24V DC/0.5A
;module_8=75x-530 8DO/24V DC/0.5A 
;module_9=75x-530 8DO/24V DC/0.5A 
;module_10=75x-530 8DO/24V DC/0.5A 
;module_11=75x-530 8DO/24V DC/0.5A 
;module_12=75x-530 8DO/24V DC/0.5A 
;module_13=75x-530 8DO/24V DC/0.5A 

; The number of output bytes this slave transmits to the
; master in Data_Exchange.
; This usually depends on the modules plugged into the slave.
output_size=2

; The number of input bytes this slave expects to receive
; in Data_Exchange.
; This usually depends on the modules plugged into the slave.
input_size=2

; Request and interpret a slave diagnosis every n Data_Exchange telegrams.
; n defaults to 0, which means: Never periodically request diagnosis.
; If periodic diagnosis is switched off, then diagnostic information will only be requested on faults.
; Note that input-only slaves (output_size=0) probably need a non-zero diag_period.
diag_period=0

Terminal output:

DPM1: Trying to initialize slave 8...
PHY-serial: TX   10 08 02 49 53 16
PHY-serial: TX   10 08 02 49 53 16
PHY-serial: TX   10 08 02 49 53 16
PHY-serial: TX   10 08 02 49 53 16
PHY-serial: TX   10 08 02 49 53 16
PHY-serial: RX   10 02 08 00 0A 16
DPM1: slave[08].state --> 'Wait for diag'
DPM1: Requesting Slave_Diag from slave 8...
PHY-serial: TX   68 05 05 68 88 82 6D 3C 3E F1 16
PHY-serial: RX   68 1B 1B 68 82 88 08 3E 3C 4A 05 00 FF B7 57 49 00 00 00 00 00 00 00 00 07 A0 00 00 82 02 00 5C 16
DPM1: slave[08].state --> 'Wait for Prm'
DPM1: Sending Set_Prm to slave 8...
PHY-serial: TX   68 28 28 68 88 82 5D 3D 3E B8 1E 01 00 B7 57 01 40 01 00 00 00 00 00 02 00 C3 43 00 00 00 01 00 00 00 00 20 00 00 23 01 00 23 01 00 7A 16
PHY-serial: RX   E5
DPM1: slave[08].state --> 'Wait for Cfg'
DPM1: Sending Chk_Cfg to slave 8...
PHY-serial: TX   68 08 08 68 88 82 7D 3E 3E 00 10 10 23 16
PHY-serial: RX   E5
DPM1: slave[08].state --> 'Request diag and wait for DX-ready'
DPM1: Requesting Slave_Diag (WDXRDY) from slave 8...
PHY-serial: TX   68 05 05 68 88 82 5D 3C 3E E1 16
PHY-serial: RX   68 1B 1B 68 82 88 08 3E 3C 4A 05 00 FF B7 57 49 00 00 00 00 00 00 00 00 07 A0 00 00 82 02 00 5C 16
DPM1:  >ERROR<  Slave 8 reports a faulty parameterization (Set_Prm).
DPM1: Slave 8 requests a new parameterization (Set_Prm).
DPM1: slave[08].state --> 'Init'
DPM1: Trying to initialize slave 8...
PHY-serial: TX   10 08 02 49 53 16
PHY-serial: RX   10 02 08 00 0A 16
DPM1: slave[08].state --> 'Wait for diag'
DPM1: Requesting Slave_Diag from slave 8...
PHY-serial: TX   68 05 05 68 88 82 7D 3C 3E 01 16
PHY-serial: RX   68 1B 1B 68 82 88 08 3E 3C 4A 05 00 FF B7 57 49 00 00 00 00 00 00 00 00 07 A0 00 00 82 02 00 5C 16
DPM1: slave[08].state --> 'Wait for Prm'
DPM1: Sending Set_Prm to slave 8...
PHY-serial: TX   68 28 28 68 88 82 5D 3D 3E B8 1E 01 00 B7 57 01 40 01 00 00 00 00 00 02 00 C3 43 00 00 00 01 00 00 00 00 20 00 00 23 01 00 23 01 00 7A 16
PHY-serial: RX   E5
DPM1: slave[08].state --> 'Wait for Cfg'
DPM1: Sending Chk_Cfg to slave 8...
PHY-serial: TX   68 08 08 68 88 82 7D 3E 3E 00 10 10 23 16
PHY-serial: RX   E5
DPM1: slave[08].state --> 'Request diag and wait for DX-ready'
DPM1: Requesting Slave_Diag (WDXRDY) from slave 8...
PHY-serial: TX   68 05 05 68 88 82 5D 3C 3E E1 16
PHY-serial: RX   68 1B 1B 68 82 88 08 3E 3C 4A 05 00 FF B7 57 49 00 00 00 00 00 00 00 00 07 A0 00 00 82 02 00 5C 16
DPM1:  >ERROR<  Slave 8 reports a faulty parameterization (Set_Prm).
DPM1: Slave 8 requests a new parameterization (Set_Prm).
DPM1: slave[08].state --> 'Init'
DPM1: Trying to initialize slave 8...

I would appreciate any help

Thank you

Thanks for your question.

In general it's not easy to tell why a slave doesn't like a Cfg or Prm telegram.
In your case it doesn't like your Prm telegram. Therefore, there is some option set that your slave doesn't expect or some option is missing that your slave expects. And this includes the user-part of the Prm telegram, that you define in your user code that calls into pyprofibus. In general slaves are very picky about the contents of the Cfg and Prm telegram.

The only real way forward now is to learn about the Prm telegram and its format and then see what's wrong. The actual Prm telegram sent to the device is shown as hex dump in the logs.

I got it to work
First I pulled the GSD file of a project that the modules were working.
Next it seems I misunderstood the config file comment in section modules.
It says to define the modules that are plugged IN TO THE SLAVE
So for me it was

module_0=750-610  Supply 24 V DC/DIA
module_1=750-430  8 DI/24 V DC/3.0 ms
module_2=750-430  8 DI/24 V DC/3.0 ms
module_3=750-430  8 DI/24 V DC/3.0 ms
module_4=750-430  8 DI/24 V DC/3.0 ms
module_5=750-430  8 DI/24 V DC/3.0 ms
module_6=750-430  8 DI/24 V DC/3.0 ms
module_7=75x-530 8DO/24V DC/0.5A
module_8=75x-530 8DO/24V DC/0.5A
module_9=75x-530 8DO/24V DC/0.5A
module_10=75x-530 8DO/24V DC/0.5A
module_11=75x-530 8DO/24V DC/0.5A
module_12=75x-530 8DO/24V DC/0.5A
module_13=75x-530 8DO/24V DC/0.5A

But in the end I defined also the interface module and it started working
Like this:

module_0=750-343 No PI Channel
module_1=750-610  Supply 24 V DC/DIA
module_2=750-430  8 DI/24 V DC/3.0 ms
module_3=750-430  8 DI/24 V DC/3.0 ms
module_4=750-430  8 DI/24 V DC/3.0 ms
module_5=750-430  8 DI/24 V DC/3.0 ms
module_6=750-430  8 DI/24 V DC/3.0 ms
module_7=750-430  8 DI/24 V DC/3.0 ms
module_8=75x-530 8DO/24V DC/0.5A
module_9=75x-530 8DO/24V DC/0.5A
module_10=75x-530 8DO/24V DC/0.5A
module_11=75x-530 8DO/24V DC/0.5A
module_12=75x-530 8DO/24V DC/0.5A
module_13=75x-530 8DO/24V DC/0.5A
module_14=75x-530 8DO/24V DC/0.5A

Like I said I am a noob regarding profibus and I thought the 750-343 is considered as slave device and not the first module

If you like I can send you the files and you can include them for someone else

I'm very sorry for the confusion.

PB slaves are highly individual and therefore the Prm of these devices naturally also are individual.
This is a perfect example of special slave behavior that we can't really predict or prevent in the pyprofibus documentation and configuration.

Thank you very much for sharing your solution to the problem.
This will help other people. :)

If you like, please attach your files to this issue.

I will just give me a few days so I can obtain a analog input and output module. So I can add them to the configuration to make it easier for other people.

Hello
Sorry for the delay, I had a busy two weeks :)
Anyway here is a ZIP file containing the .py .conf and .gsd
I hope this helps someone
examples_wago.zip

Thanks! :)

No problem😁