[etherlab-users] Problems using Beckhoff EL3162 with Etherlab Simulink blockset - does not switch from PREOP to OP

Richard Hacker ha at igh.de
Tue Mar 3 10:29:48 CET 2015


That is wierd. el3162 is a function that returns a struct. Matlab 
automatically places the return value of the last command into the 
variable "ans", so you would not like to do that for your Simulink 
model. Typing anything on Matlab's command prompt (e.g. 2(enter)) will 
change ans and your model will not build.

Try to find out why it doesn't work. You sould be able to put anything 
callable into the line. I am not familiar with 2014b. Maybe you need braces?
el3162()
Please send me your .m script.

- Richard

> Hi,
>
> Thank you for the fast help. However inserting "el3162" (without quotation marks) did not work. I'm using R2014b.
> I called the function from the Matlab command line and put the returned answer "ans" (without quotation marks) in the blocks field for the configuration struct. The device then turned operational after building&executing the new Simulink application.
>
> Kind regards,
> Sebastian
>
> -----Ursprüngliche Nachricht-----
> Von: Richard Hacker [mailto:ha at igh.de]
> Gesendet: Montag, 2. März 2015 11:44
> An: Sebastian Rehberger; etherlab-users at etherlab.org
> Betreff: Re: [etherlab-users] Problems using Beckhoff EL3162 with Etherlab Simulink blockset - does not switch from PREOP to OP
>
> Sorry, I was a little unclear in the first message.
>
> Now you have a function el3162() which resides in the file el3162.m.
> Type
> el3162
> on Matlab's command line and you will see the output.
>
> Type exactly
> el3162
> into the space for "EtherCAT Slave Configuration struct", i.e. the result of calling el3162() is required in that field. No [] (empty matrix, or even ['el3162'], which is a matlab string.
>
>
> Am 2015-03-02 11:36, schrieb Richard Hacker:
>> Use "el3162" instead of "el3162.m" (without .m). The rest looks fine.
>>
>> If you like vector output ports, you can use:
>>
>> PortConfig.output(1).pdo = [3, 0, 0, 0; 3, 1, 0, 0];
>> PortConfig.output(1).pdo_data_type = 1008;
>>
>> PortConfig.output(2).pdo = [3, 0, 1, 0; 3, 1, 1, 0];
>> PortConfig.output(2).pdo_data_type = 1016;
>>
>> There are even more options, read the help for the generic slave.
>>
>> - Richard
>>
>>
>> Am 2015-03-02 11:20, schrieb Sebastian Rehberger:
>>> Dear Mr. Hacker,
>>>
>>> Thank you for your immediate response. Indeed the slave is Revision
>>> EL3162-0000-0000 and rather old (2005).
>>> I generated the .m file with "--skin" option, the modified result is
>>> attached below. I simply added the function head.
>>>
>>> I tried the generic slave block and added ['el3162.m'] to the Struct
>>> Configuration field in the mask.
>>> However it compiles/checks diagram without error, but the block does
>>> not add outputs or changes its mask description in Simulink.
>>> After running the executable again, the slave stays in PREOP without
>>> error flag - so I guess the slave block does not work properly. Have
>>> I missed a step?
>>>
>>> Besides, I ran a test with CoDeSys where the EL3162 seems running
>>> properly.
>>>
>>> Kind regards,
>>> Sebastian Rehberger
>>>
>>>
>>> % Slave configuration
>>> function rv = el3162()
>>> rv.SlaveConfig.vendor = 2;
>>> rv.SlaveConfig.product = hex2dec('0c5a3052');
>>> rv.SlaveConfig.description = 'EL3162'; rv.SlaveConfig.sm = { ...
>>>       {0, 0, {
>>>           }}, ...
>>>       {1, 1, {
>>>           }}, ...
>>>       {2, 0, {
>>>           }}, ...
>>>       {3, 1, {
>>>           {hex2dec('1a00'), [
>>>               hex2dec('3101'), hex2dec('01'),   8; ...
>>>               hex2dec('3101'), hex2dec('02'),  16; ...
>>>               ]}, ...
>>>           {hex2dec('1a01'), [
>>>               hex2dec('3102'), hex2dec('01'),   8; ...
>>>               hex2dec('3102'), hex2dec('02'),  16; ...
>>>               ]}, ...
>>>           }}, ...
>>>       };
>>>
>>> % Port configuration
>>>
>>> rv.PortConfig.output(1).pdo = [3, 0, 0, 0];
>>> rv.PortConfig.output(1).pdo_data_type = 1008;
>>>
>>> rv.PortConfig.output(2).pdo = [3, 0, 1, 0];
>>> rv.PortConfig.output(2).pdo_data_type = 1016;
>>>
>>> rv.PortConfig.output(3).pdo = [3, 1, 0, 0];
>>> rv.PortConfig.output(3).pdo_data_type = 1008;
>>>
>>> rv.PortConfig.output(4).pdo = [3, 1, 1, 0];
>>> rv.PortConfig.output(4).pdo_data_type = 1016;
>>>
>>> end
>>> -----Ursprüngliche Nachricht-----
>>> Von: Richard Hacker [mailto:ha at igh.de]
>>> Gesendet: Sonntag, 1. März 2015 20:20
>>> An: Sebastian Rehberger; etherlab-users at etherlab.org
>>> Betreff: Re: [etherlab-users] Problems using Beckhoff EL3162 with
>>> Etherlab Simulink blockset - does not switch from PREOP to OP
>>>
>>> Hi,
>>>
>>> you may be using an old version of the slave. What version are you
>>> using? (ethercat slave -v -p?)
>>>
>>> You will need to use the generic slave in this case. Run the
>>> following command ethercat pdos -pX --skin etherlab and save it in el3162.m.
>>> Then insert this function for "EtherCAT Slave Configuration struct".
>>>
>>> Attached is a function I used for another slave. You may use it for
>>> comparison.
>>>
>>> - Richard Hacker
>>>
>>>
>>> On 01.03.2015 17:28, Sebastian Rehberger wrote:
>>>> Hi,
>>>>
>>>> We're trying to read analog output signals from a EL3162 input device.
>>>> The Master is up and running, and other EL1004/EL2004 devices are
>>>> functioning properly. Also two EL4102 analog output devices are
>>>> working and behave normally.
>>>>
>>>>
>>>> The EL3162 does not switch from PREOP to SAFEOP or OP, neither by
>>>> command line ("sudo ./ethercat states -p 9 SAFEOP"), nor during
>>>> execution of the simulink generated Etherlab application. However,
>>>> Syslog gives the following debugging information:
>>>>
>>>> Mar  1 17:18:50 ubuntu kernel: [ 4960.647334] EtherCAT ERROR 0-9:
>>>> SDO download 0x8000:06 (1 bytes) aborted.
>>>>
>>>> Mar  1 17:18:50 ubuntu kernel: [ 4960.647338] EtherCAT ERROR 0-9:
>>>> SDO abort message 0x06020000: "This object does not exist in the
>>>> object directory".
>>>>
>>>> Mar  1 17:18:50 ubuntu kernel: [ 4960.647340] EtherCAT ERROR 0-9:
>>>> SDO configuration failed.
>>>>
>>>> In the slave list ("sudo. /ethercat slaves -p 9"), the EL3162
>>>> immediately sets the error flag after execution of the Simulink
>>>> application.
>>>>
>>>> Has anyone experienced similar problems or may support with further
>>>> debugging methods?
>>>>
>>>> Kind Regards,
>>>>
>>>> Sebastian
>>>>
>>>>
>>>>
>>>> _______________________________________________
>>>> etherlab-users mailing list
>>>> etherlab-users at etherlab.org
>>>> http://lists.etherlab.org/mailman/listinfo/etherlab-users
>>>>
>> _______________________________________________
>> etherlab-users mailing list
>> etherlab-users at etherlab.org
>> http://lists.etherlab.org/mailman/listinfo/etherlab-users



More information about the Etherlab-users mailing list