Re: [etherlab-users] Error flag after requesting SAFEOP

2018-10-03 Thread Mohsen Alizadeh Noghani
Activating the master resolved this issue. ecrt_master_activate takes care
of state transitions from PREOP to OP.
Best,
Mohsen


On Fri, Sep 28, 2018 at 3:56 PM Mohsen Alizadeh Noghani <
m.aliza...@gmail.com> wrote:

> Having read EtherCAT and EtherLab documentation a bit more,
>
> 1- I should set the first bit of the sync manager's status register to 1.
> According to EtherCAT's Register Documentation, for sync manager 2 for
> instance, I have to set the first bit of byte at 0x081B to 1.
>
> 2-  I don't think using ecrt_slave_config_sync_manager will help me, since
> it only sets the direction of sync manager (as pointed out by comments in
> ecrt.h).
>
> Now, my question is, how can I modify a specific bit in a slave's address
> space?
>
> Best,
> Mohsen
>
>
> On Thu, Sep 27, 2018 at 3:19 AM Gavin Lambert 
> wrote:
>
>> EC_WD_ENABLE enables the SM watchdog; it’s a separate thing from enabling
>> the SM itself.  In general you should only activate it on one SM per slave
>> – usually the output SM if the slave has outputs or the input SM
>> otherwise.  If you don’t need the slave to drop from OP to SAFEOP when it
>> loses communication with the master then you can leave the watchdog
>> entirely disabled – though using the watchdog is usually recommended for
>> output slaves for safety reasons.
>>
>>
>>
>> Using erct_slave_config_sync_manager by itself is fairly pointless.  You
>> need to specify the PDOs contained in the SM and then also actually use at
>> least one PDO from each SM in your domain mapping.  Typically you use
>> ecrt_slave_config_pdos to do the former and ecrt_domain_reg_pdo_entry_list
>> for the latter.  See the example code.
>>
>>
>>
>> *From:* Mohsen Alizadeh Noghani
>> *Sent:* Wednesday, 26 September 2018 22:32
>> *To:* etherlab-users@etherlab.org
>> *Subject:* [etherlab-users] Error flag after requesting SAFEOP
>>
>>
>>
>> Hello everyone.
>>
>>
>>
>> When I request SAFEOP state for my slave (Mecapion L7N) using shell
>> command
>>
>>
>>
>> $ ethercat state --position 0 SAFEOP
>>
>>
>>
>> the slave's flag changes from + to E, and the state stays at PREOP.
>>
>>
>>
>> *Additional Info:*
>>
>> In a previous project, I used SOEM library and had to deal with the same
>> issue, which was fixed by manually enabling sync managers 2 & 3.
>>
>>
>>
>> ec_slave[1].SM[2].SMflags |= 0x0001;
>>
>> ec_slave[2].SM[3].SMflags |= 0x0001;
>>
>>
>>
>> I tried to do the same by the adding following lines in my a simple code
>>
>>
>>
>> ret1 = erct_slave_config_sync_manager(sc, 2, EC_DIR_INPUT, EC_WD_ENABLE)
>>
>> ret2 =  erct_slave_config_sync_manager(sc, 3, EC_DIR_OUTPUT,
>> EC_WD_ENABLE)
>>
>>
>>
>> Both function calls are successful (ret1=ret2=0) but the slave won't
>> reach SAFEOP.
>>
>>
>>
>>
>>
>
___
etherlab-users mailing list
etherlab-users@etherlab.org
http://lists.etherlab.org/mailman/listinfo/etherlab-users


Re: [etherlab-users] Error flag after requesting SAFEOP

2018-09-28 Thread Mohsen Alizadeh Noghani
Having read EtherCAT and EtherLab documentation a bit more,

1- I should set the first bit of the sync manager's status register to 1.
According to EtherCAT's Register Documentation, for sync manager 2 for
instance, I have to set the first bit of byte at 0x081B to 1.

2-  I don't think using ecrt_slave_config_sync_manager will help me, since
it only sets the direction of sync manager (as pointed out by comments in
ecrt.h).

Now, my question is, how can I modify a specific bit in a slave's address
space?

Best,
Mohsen


On Thu, Sep 27, 2018 at 3:19 AM Gavin Lambert 
wrote:

> EC_WD_ENABLE enables the SM watchdog; it’s a separate thing from enabling
> the SM itself.  In general you should only activate it on one SM per slave
> – usually the output SM if the slave has outputs or the input SM
> otherwise.  If you don’t need the slave to drop from OP to SAFEOP when it
> loses communication with the master then you can leave the watchdog
> entirely disabled – though using the watchdog is usually recommended for
> output slaves for safety reasons.
>
>
>
> Using erct_slave_config_sync_manager by itself is fairly pointless.  You
> need to specify the PDOs contained in the SM and then also actually use at
> least one PDO from each SM in your domain mapping.  Typically you use
> ecrt_slave_config_pdos to do the former and ecrt_domain_reg_pdo_entry_list
> for the latter.  See the example code.
>
>
>
> *From:* Mohsen Alizadeh Noghani
> *Sent:* Wednesday, 26 September 2018 22:32
> *To:* etherlab-users@etherlab.org
> *Subject:* [etherlab-users] Error flag after requesting SAFEOP
>
>
>
> Hello everyone.
>
>
>
> When I request SAFEOP state for my slave (Mecapion L7N) using shell command
>
>
>
> $ ethercat state --position 0 SAFEOP
>
>
>
> the slave's flag changes from + to E, and the state stays at PREOP.
>
>
>
> *Additional Info:*
>
> In a previous project, I used SOEM library and had to deal with the same
> issue, which was fixed by manually enabling sync managers 2 & 3.
>
>
>
> ec_slave[1].SM[2].SMflags |= 0x0001;
>
> ec_slave[2].SM[3].SMflags |= 0x0001;
>
>
>
> I tried to do the same by the adding following lines in my a simple code
>
>
>
> ret1 = erct_slave_config_sync_manager(sc, 2, EC_DIR_INPUT, EC_WD_ENABLE)
>
> ret2 =  erct_slave_config_sync_manager(sc, 3, EC_DIR_OUTPUT, EC_WD_ENABLE)
>
>
>
> Both function calls are successful (ret1=ret2=0) but the slave won't reach
> SAFEOP.
>
>
>
>
>
___
etherlab-users mailing list
etherlab-users@etherlab.org
http://lists.etherlab.org/mailman/listinfo/etherlab-users


Re: [etherlab-users] Error flag after requesting SAFEOP

2018-09-26 Thread Gavin Lambert
EC_WD_ENABLE enables the SM watchdog; it’s a separate thing from enabling the 
SM itself.  In general you should only activate it on one SM per slave – 
usually the output SM if the slave has outputs or the input SM otherwise.  If 
you don’t need the slave to drop from OP to SAFEOP when it loses communication 
with the master then you can leave the watchdog entirely disabled – though 
using the watchdog is usually recommended for output slaves for safety reasons.

Using erct_slave_config_sync_manager by itself is fairly pointless.  You need 
to specify the PDOs contained in the SM and then also actually use at least one 
PDO from each SM in your domain mapping.  Typically you use 
ecrt_slave_config_pdos to do the former and ecrt_domain_reg_pdo_entry_list for 
the latter.  See the example code.

From: Mohsen Alizadeh Noghani
Sent: Wednesday, 26 September 2018 22:32
To: etherlab-users@etherlab.org
Subject: [etherlab-users] Error flag after requesting SAFEOP

Hello everyone.

When I request SAFEOP state for my slave (Mecapion L7N) using shell command

$ ethercat state --position 0 SAFEOP

the slave's flag changes from + to E, and the state stays at PREOP.

Additional Info:
In a previous project, I used SOEM library and had to deal with the same issue, 
which was fixed by manually enabling sync managers 2 & 3.

ec_slave[1].SM[2].SMflags |= 0x0001;
ec_slave[2].SM[3].SMflags |= 0x0001;

I tried to do the same by the adding following lines in my a simple code

ret1 = erct_slave_config_sync_manager(sc, 2, EC_DIR_INPUT, EC_WD_ENABLE)
ret2 =  erct_slave_config_sync_manager(sc, 3, EC_DIR_OUTPUT, EC_WD_ENABLE)

Both function calls are successful (ret1=ret2=0) but the slave won't reach 
SAFEOP.


___
etherlab-users mailing list
etherlab-users@etherlab.org
http://lists.etherlab.org/mailman/listinfo/etherlab-users