Giter Site home page Giter Site logo

Comments (12)

mbuesch avatar mbuesch commented on May 20, 2024

Hi. Thanks for your question.
I think you can just set your master-output-data to None in your first iteration.
Hope that helps.

from pyprofibus.

mczerski avatar mczerski commented on May 20, 2024

if toSlaveData is not None:

Doesn't the above "if" prevent any data exchange when master data out is None?

from pyprofibus.

mbuesch avatar mbuesch commented on May 20, 2024

No, I don't think so. It should only suppress the sending of the data. The receiving is done here:

for telegram in slave.getRxQueue():

from pyprofibus.

mczerski avatar mczerski commented on May 20, 2024

To my understanding the slave will not send anything without any request from master, but as i said i'm profibus noob :) so if master will not send any data how it receive data from slave. Could you clarify ?

from pyprofibus.

mbuesch avatar mbuesch commented on May 20, 2024

I'm not sure what your question is anymore.
There are only two possibilities. Either you send data, or you don't. Both can be done with pyprofibus, as I described.

So, if your slave needs some data, then send some data.

from pyprofibus.

mczerski avatar mczerski commented on May 20, 2024

Ok, so how do master read data from slave? To my understanding, master has to SEND data exchange request to do that. But that involves writing to slave as well.

from pyprofibus.

mbuesch avatar mbuesch commented on May 20, 2024

Well, of course the slave may require some input data to send a reply.
I don't know your slave.

But there is no fundamental requirement on the bus level for the master to send data to a slave to be able to receive data from a slave.

I would suggest to simply try it out. It's trivial to not send the first frame.

from pyprofibus.

mczerski avatar mczerski commented on May 20, 2024

unfortunately i'm not in possession of real device now and im only using dumny phy to simulate that. I'll try your suggestion when i'll have the device.
The thing i dont understand here is how profibus allow for slave devices to send data whenever they want without collisions ?

from pyprofibus.

mbuesch avatar mbuesch commented on May 20, 2024

They can't send whenever they want. There is bus arbitration.

But pyprofibus does not implement any of that. It does only support single-slave operation. Therefore, there can never be a slave collision.

from pyprofibus.

mbuesch avatar mbuesch commented on May 20, 2024

To be clear: I don't think it is normal behavior for a slave to send data without receiving a request from the master.
Just saying, that in theory, this would be supported by pyprofibus, unless it transmits at the same time as the cyclic master.
And under the premise, that your slave does such things, pyprofibus would support it.

I still think that your slave probably doesn't actually do this behavior.
However, there are many strangely behaving slaves. Therefore, I wouldn't be surprised either.

from pyprofibus.

mczerski avatar mczerski commented on May 20, 2024

It does only support single-slave operation.

That is interesting. I did not see such info anywhere in the docs and when looking at code it seemed to me that multiple slaves are supported. There is even an example script example_dummy_twoslaves.py which has two slaves :) What is missing in pyprofibus to be able to handle multiple slaves ?

Regarding the topic issue, I do not believe that the slave I'm working with will send anything without any request - it is designed to work with multiple slaves on one bus.
When reading the profibus documentation I believe that there are two options to solve my issue:

  • DDLM_Data_Exchange request with 0 length input data (but there is explicit check in the code for that case slave.slaveDesc.inputSize == 0 in __runSlave_dataExchange method - what is missing to handle that case in pyprofibus ?)
  • DDLM_RD_Outp request but that is not implemented in pyprofibus

from pyprofibus.

mbuesch avatar mbuesch commented on May 20, 2024

Hm, yes. The pyprofibus software architecture does include all elements needed for multi-slave support.
However, pyprofibus doesn't implement the required bus timing and arbitration mechanisms.

In the branch https://github.com/mbuesch/pyprofibus/tree/bustiming there is an initial attempt to define the relevant timings. But they are not used, yet.

I agree that this should be documented more clearly.

DDLM_Data_Exchange request with 0 length input data [..] what is missing to handle that case in pyprofibus ?)

Well, mostly that I was not aware such a thing exists.
Please feel free to implement support for this.
I would suggest to signal this situation to dp_master.py with a zero length bytes/bytearray as master-out-data. (While 'None' meaning "don't send a telegram at all")

from pyprofibus.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.