mbuesch / pyprofibus

PROFIBUS-DP stack
https://bues.ch/a/profibus
GNU General Public License v2.0
132 stars 51 forks source link

Siemens ET200B and FTDI USB-RS485-WE-1800-BT Support #4

Closed ctbenergy closed 5 years ago

ctbenergy commented 6 years ago

Add enable or disable hardware (DSR/DTR) flow control hardware flow control in config file. If using an FTDI USB-RS485-WE-1800-BT you must disable hardware (DSR/DTR) flow control.

Add VSCode and GSD-Files folder to .gitignore

Changes for for in/out-only slaves in file "dp_master.py" Line 494 "if dataExInData is not None:" to "if dataExInData is not None or slave.shortAckReceived == True:" It works on ET200B DI and DO Modul, but I'm not sure if this is correct.

Add examples for Siemens ET200B and B&R X20IF1063

If i start the example_et200b_di.py or example_et200b_do.py with one Slave its all ok. But wenn i start the example_et200b.py with two Slaves, no slave switch to 'Data_Exchange' Do you have any suggestions?

DPM1: Trying to initialize slave 8... PHY-serial: TX 10 08 02 49 53 16 DPM1: Trying to initialize slave 9... 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 10 09 02 49 54 16 DPM1: slave[08].state --> 'init' DPM1: Trying to initialize slave 8... PHY-serial: RX 10 02 09 00 0B 16 DPM1: slave[09].state --> 'wait for diag' DPM1: Requesting Slave_Diag from slave 9... PHY-serial: TX 68 05 05 68 88 82 6D 3C 3E F1 16 DPM1: slave[09].state --> 'init' DPM1: Trying to initialize slave 9... PHY-serial: RX 68 12 12 68 82 88 08 3E 3C 02 05 00 FF 00 04 07 00 00 00 00 00 00 9D 16 DPM1: slave[08].state --> 'wait for diag' DPM1: Requesting Slave_Diag from slave 8... PHY-serial: TX 10 08 02 49 53 16 DPM1: slave[08].state --> 'init' DPM1: Trying to initialize slave 8... PHY-serial: RX 10 02 08 00 0A 16 PHY-serial: TX 68 05 05 68 89 82 6D 3C 3E F2 16 DPM1: slave[08].state --> 'wait for diag' DPM1: Requesting Slave_Diag from slave 8... PHY-serial: RX 68 12 12 68 82 89 08 3E 3C 02 05 00 FF 00 0D 07 00 00 00 00 00 00 A7 16 DPM1: slave[09].state --> 'wait for diag' DPM1: Requesting Slave_Diag from slave 9... DPM1: slave[08].state --> 'init' DPM1: Trying to initialize slave 8... DPM1: slave[09].state --> 'init' DPM1: Trying to initialize slave 9... PHY-serial: TX 10 09 02 49 54 16 PHY-serial: RX 10 02 09 00 0B 16 PHY-serial: TX 68 05 05 68 88 82 5D 3C 3E E1 16 DPM1: slave[09].state --> 'wait for diag' DPM1: Requesting Slave_Diag from slave 9... PHY-serial: RX 68 12 12 68 82 88 08 3E 3C 02 05 00 FF 00 04 07 00 00 00 00 00 00 9D 16 DPM1: slave[08].state --> 'wait for diag' DPM1: Requesting Slave_Diag from slave 8... DPM1: slave[09].state --> 'init' DPM1: Trying to initialize slave 9... 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 PHY-serial: TX 68 05 05 68 88 82 7D 3C 3E 01 16 DPM1: slave[08].state --> 'wait for diag' DPM1: Requesting Slave_Diag from slave 8... PHY-serial: RX 68 12 12 68 82 88 08 3E 3C 02 05 00 FF 00 04 07 00 00 00 00 00 00 9D 16 PHY-serial: TX 68 05 05 68 89 82 5D 3C 3E E2 16 DPM1: slave[08].state --> 'wait for Prm' DPM1: Sending Set_Prm to slave 8... PHY-serial: RX 68 12 12 68 82 89 08 3E 3C 02 05 00 FF 00 0D 07 00 00 00 00 00 00 A7 16 DPM1: slave[09].state --> 'wait for diag' DPM1: Requesting Slave_Diag from slave 9... DPM1: slave[08].state --> 'init' DPM1: Trying to initialize slave 8... DPM1: slave[09].state --> 'init' DPM1: Trying to initialize slave 9... 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 10 09 02 49 54 16 DPM1: slave[08].state --> 'init' DPM1: Trying to initialize slave 8... PHY-serial: RX 10 02 09 00 0B 16 DPM1: slave[09].state --> 'wait for diag' DPM1: Requesting Slave_Diag from slave 9... PHY-serial: TX 68 05 05 68 89 82 7D 3C 3E 02 16 DPM1: slave[09].state --> 'init' DPM1: Trying to initialize slave 9... PHY-serial: RX 68 12 12 68 82 89 08 3E 3C 02 05 00 FF 00 0D 07 00 00 00 00 00 00 A7 16 PHY-serial: TX 68 05 05 68 88 82 5D 3C 3E E1 16 DPM1: slave[09].state --> 'wait for diag' DPM1: Requesting Slave_Diag from slave 9... PHY-serial: RX 68 12 12 68 82 88 08 3E 3C 02 05 00 FF 00 04 07 00 00 00 00 00 00 9D 16 DPM1: slave[08].state --> 'wait for diag' DPM1: Requesting Slave_Diag from slave 8... DPM1: slave[09].state --> 'init' DPM1: Trying to initialize slave 9... DPM1: slave[08].state --> 'init' DPM1: Trying to initialize slave 8... PHY-serial: TX 10 09 02 49 54 16 PHY-serial: RX 10 02 09 00 0B 16 DPM1: slave[09].state --> 'wait for diag' DPM1: Requesting Slave_Diag from slave 9... PHY-serial: TX 10 08 02 49 53 16 DPM1: slave[09].state --> 'init' DPM1: Trying to initialize slave 9... 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 DPM1: slave[08].state --> 'init'

mbuesch commented 6 years ago

Thanks a lot for this pull request! There are quite a few nice things in there that I'd like to take. The addition of the flow control looks good. I would like to take this as an isolated commit. Also the addition of the examples seems like a good idea. I would also like to have them as separate commits without further code changes in the same commits.

The change for the out-only slave I need to think about. We clearly need such a thing, but I'm also unsure what the correct thing to do is. Do we make this configurable? Or can we somehow get from GSD whether we have an out-only device?

Also the merge commit can be avoided by use of git rebase. That makes a cleaner history and is usually preferred. Thanks for your work.

ctbenergy commented 5 years ago

I revert my master branch to upstream and will make separate commits as you suggested.

ctbenergy commented 5 years ago

Do we make this configurable? Or can we somehow get from GSD whether we have an out-only device?

We can get this from the GSD. Module = "6ES7 134-4FB50-0AB0 2AI U" 0x51 0x51 = 2 word inputs - consistency per word

https://www.felser.ch/profibus-manual/definition_der_konfiguration.html