Hey Graeme,

Thanks for the updated patch. I just tested and it now works fine with
the 3 slave setup (EK1100, EL6910, EK1110).
I did a quick tcpdump to verify, and it is as expected/patched:

mbg: -> 10 50 0a 00 e9 03 00 23 00 20 41 80 f9 02 00 00 00 00
ec:  ->       0a 00 e9 03 00 03 00 20 41 80 f9 02 00 00 00 00
ec:  <-       0a 00 e9 03 00 13 00 30 43 80 f9 02 ea 82 1e 00
mbg: <- 10 50 0a 00 e9 03 00 13 00 30 43 80 f9 02 ea 82 1e 00

mbg: -> 10 50 0a 00 e9 03 00 33 00 20 41 80 f9 01 00 00 00 00
ec:  ->       0a 00 e9 03 00 03 00 20 41 80 f9 01 00 00 00 00
ec:  <-       0a 00 e9 03 00 23 00 30 4b 80 f9 01 01 00 00 00
mbg: <- 10 50 0a 00 e9 03 00 23 00 30 4b 80 f9 01 01 00 00 00

mbg: -> 10 50 0a 00 e9 03 00 33 00 20 41 01 fe 00 00 00 00 00
ec:  ->       0a 00 e9 03 00 03 00 20 41 01 fe 00 00 00 00 00
ec:  <-       fa 00 e9 03 00 33 00 30 41 01 fe 00 00 08 .....
mbg: <- 00 51 fa 00 e9 03 00 33 00 30 41 01 fe 00 00 08 .....

Regards,
Mark

On Tue, Apr 6, 2021 at 3:51 AM Graeme Foot <graeme.f...@touchcut.com> wrote:
>
> Hi Mark,
>
>
>
> Thanks for checking out the EtherCAT comms side.  I didn’t find the 
> documentation particularly clear in quite a few areas so not surprised 
> there’s an issue or two.
>
>
>
> The ethercat_mbg implementation passed through the CoE header info exactly as 
> the TwinSAFE Loader requested.  For standard mailbox communications it looks 
> like the etherlab master always passes a value of 0 to the Cnt parameter, so 
> the slave will always respond.  I have updated the patch so that it will pass 
> through 0 for the Cnt parameter for the mbg requests also (attached).  Please 
> let me know if there is still an issue (I don’t have anything to test with at 
> the moment).
>
>
>
>
>
> Re the other items:
>
> - Yes.  TwinCAT starts its slave addressing at 1000 (0x03e8), whereas the 
> etherlab master starts its slave position addressing at 0.  I decided to 
> report slave addresses in the TwinCAT fashion (starting at 1000), plus it 
> helps distinguish the slaves mbg requests as per below.  Note: the TwinSAFE 
> loader isn’t interested in the first slave, so it starts talking to the 
> second slave first (1001, 0x03e9).
>
>
>
> I don’t think the mailbox header address is used by the slave.  It is the 
> datagram header that directs the CoE message to the slave.  The previous 
> ethercat_mbg implementation passed the mailbox header unchanged, using any 
> reply with the mailbox header request 0x03e8 and above, and also with the 
> datagram slave address offset from the mailbox header address by 0x03e7 
> (Note: the datagram slave address is the slave position + 1), to be an mbg 
> response.  With the extra datagram slave address vs CoE mailbox header 
> address check you shouldn’t have any problems with the mbg server if you have 
> more than 1000 slaves.  This remains the same, with the change that the Cnt 
> value in the header is now cleared.
>
>
>
> TwinCAT on the other hand looks like it is setting the Mailbox address to 
> 0xe000 so that the master knows that the request should be handled as an mbg 
> request.  Depending on implementation It may then mean you can have ~57344 
> slaves before TwinCAT has a problem with conflicting addresses.  Note: the 
> gateway can only access up to 4080 slaves.
>
>
>
>
>
> Regards,
>
> Graeme.
>
>
>
>
>
>
>
> From: Mark Verrijt <mark.verr...@vectioneer.com>
> Sent: Saturday, 3 April 2021 12:48 am
> To: Graeme Foot <graeme.f...@touchcut.com>
> Cc: etherlab-dev@etherlab.org
> Subject: Re: [Etherlab-dev] Ethercat mailbox gateway and TwinSAFE loader 
> issues
>
>
>
> Before I forget again, thanks Graeme (and all others involved) for this mbg 
> implementation in the first place.
>
> It saves us from a lot of hassle when deploying our safety projects. Only 
> recently we discovered the twinsafe loader didn't work in all cases.
>
>
>
> I finally got around to also looking at the mailbox traffic on the ethercat 
> side. I think I have found the cause.
>
> For twincat the counter used on the ethercat side is separate from the one 
> received by the mbg.
>
> For etherlab the counter in the message to the mbg is also seemed to be used 
> on the ethercat side, is that correct, or is something else happening here?
> Depending on the setup it can therefore become possible for two subsequent 
> requests to the same slave (with requests to others in between) to use the 
> same counter value.
> See data at the bottom of the email.
>
>
>
> What is your take on this?
>
>
> Some other things worth mentioning (for completeness/archive):
>
> - The addressing is done a bit differently:
>
>    .Twincat, Datagram header slave address: 0x03e9, Mailbox header address: 
> 0xe000
>
>    .Etherlab, Datagram header slave address: 0x0002, Mailbox header address: 
> 0x03e9
>
> - The counter in the mailbox reply of a slave is separate from the counter 
> value check in the (next) request.
>
>   Though logical, I mention it here explicitly because this messed up my 
> thinking quite a bit when I hadn't realized this yet.
>
>
>
> Regards,
>
> Mark
>
>
>
> *** Twincat ***
> mbg: ->   10 50 0a 00 e9 03 00 23 00 20 41 80 f9 02 00 00 00 00
> ec:  ->         0a 00 00 e0 00 13 00 20 41 80 f9 02 00 00 00 00
> ec:  <-         0a 00 00 e0 00 33 00 30 43 80 f9 02 ea 82 1e 00
> mbg: <-   10 50 0a 00 e9 03 00 33 00 30 43 80 f9 02 ea 82 1e 00
>
> mbg: ->   10 50 0a 00 e9 03 00 33 00 20 41 80 f9 01 00 00 00 00
> ec:  ->         0a 00 00 e0 00 23 00 20 41 80 f9 01 00 00 00 00
> ec:  <-         0a 00 00 e0 00 43 00 30 4b 80 f9 01 01 00 00 00
> mbg: <-   10 50 0a 00 e9 03 00 43 00 30 4b 80 f9 01 01 00 00 00
>
> .... other req/rep
>
> mbg: ->   10 50 0a 00 e9 03 00 33 00 20 41 01 fe 00 00 00 00 00
> ec:  ->         0a 00 00 e0 00 33 00 20 41 01 fe 00 00 00 00 00
> ec:  <-         fa 00 00 e0 00 53 00 30 41 01 fe 00 00 08 .....
> mbg: <-   00 51 fa 00 e9 03 00 53 00 30 41 01 fe 00 00 08 .....
>
> *** Etherlab ***
> mbg: ->   10 50 0a 00 e9 03 00 23 00 20 41 80 f9 02 00 00 00 00
> ec:  ->         0a 00 e9 03 00 23 00 20 41 80 f9 02 00 00 00 00
> ec:  <-         0a 00 e9 03 00 13 00 30 43 80 f9 02 ea 82 1e 00
> mbg: <-   10 50 0a 00 e9 03 00 13 00 30 43 80 f9 02 ea 82 1e 00
>
> mbg: ->   10 50 0a 00 e9 03 00 33 00 20 41 80 f9 01 00 00 00 00
> ec:  ->         0a 00 e9 03 00 33 00 20 41 80 f9 01 00 00 00 00  <---.
> ec:  <-         0a 00 e9 03 00 23 00 30 4b 80 f9 01 01 00 00 00      |
> mbg: <-   10 50 0a 00 e9 03 00 23 00 30 4b 80 f9 01 01 00 00 00      |
>                                                                      |
>                        Problem occurs due to two subsequent requests |
> .... other req/rep           to the same slave with the same counter |
>                                                                      |
> mbg: ->   10 50 0a 00 e9 03 00 33 00 20 41 01 fe 00 00 00 00 00      |
> ec:  ->         0a 00 e9 03 00 33 00 20 41 01 fe 00 00 00 00 00  <---'
> ec:  <-         No Reply
> mbg: <-   Timeout
-- 
Etherlab-dev mailing list
Etherlab-dev@etherlab.org
https://lists.etherlab.org/mailman/listinfo/etherlab-dev

Reply via email to