[etherlab-users] Adapting 'user' example for FB1111-014x

Maarten Burghout m.m.burghout at student.utwente.nl
Mon Nov 8 10:25:21 CET 2010


Hello,

I'm currently working a small setup which involves a Beckhoff 
FB1111-0141 piggyback module (PDI type: SPI). Eventually, I would like 
to run a real-time control loop over this setup, by writing a PWM value 
to a register, and reading an encoder value from another on. For a first 
proof-of-concept, I'm trying to adapt the 'user' example to my likes.

(console output is between +++ and --- lines)

In short, I'm trying to write the blinking value (alternating 0x0606 and 
0x0909) to the output register (0x1a00). I've adapted the PDO 
declarations etcetera. Observing the output, I guess the master works 
correctly:

+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Configuring PDOs...
Activating master...
pd: 0
Starting timer...
Started.
Blink is 1
1 slave(s).
AL states: 0x01.
Link is up.
SPI: State 0x01.
SPI: online.
---------------------------------------------------------------

Yet when I manually check (over Ethercat, not via the PDI) what values 
are written into the output registers, they do not seem correct (and 
even random).

Furthermore, the slave board always reports itself as being in the INIT 
state, with error flag set:

+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
burghout at ethercat-master:~$ sudo ethercat slaves -v
=== Master 0, Slave 0 ===
State: INIT
Flag: E
Identity:
   Vendor Id:       0x00000002
   Product code:    0x04570862
   Revision number: 0x0258008d
   Serial number:   0x00000000
DL information:
   FMMU bit operation: no
   Distributed clocks: yes, 64 bit
   DC system time transmission delay: 0 ns
Port  Type  Link  Loop    Signal  NextSlave  RxTime [ns]  Diff [ns] 
NextDc [ns]
    0  MII   up    open    yes             -   3409590130           0 
         0
    1  MII   down  closed  no              -            -           - 
         -
    2  N/A   down  closed  no              -            -           - 
         -
    3  N/A   down  closed  no              -            -           - 
         -
Mailboxes:
   Bootstrap RX: 0x0000/0, TX: 0x0000/0
   Standard  RX: 0x1000/128, TX: 0x1080/128
   Supported protocols: CoE
General:
   Group: FB1XXX
   Image name:
   Order number: FB1111 SPI-Slave
   Device name: FB1111 SPI-Slave 2xMII
   CoE details:
     Enable SDO: yes
     Enable SDO Info: no
     Enable PDO Assign: no
     Enable PDO Configuration: no
     Enable Upload at startup: no
     Enable SDO complete access: no
   Flags:
     Enable SafeOp: no
     Enable notLRW: no
   Current consumption: 0 mA
---------------------------------------------------------------

AL registers however report no error and also do not mention the error 
state being set!
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
burghout at ethercat-master:~$ sudo ethercat reg_read -p0 -tuint16 0x0120
0x0001 1

burghout at ethercat-master:~$ sudo ethercat reg_read -p0 -tuint16 0x0130
0x0001 1

burghout at ethercat-master:~$ sudo ethercat reg_read -p0 -tuint16 0x0134
0x0000 0
---------------------------------------------------------------


Worse, the system log also gets it's share of error messages:
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
[ 2797.475308] EtherCAT: Requesting master 0...
[ 2797.475313] EtherCAT: Successfully requested master 0.
[ 2797.475385] EtherCAT 0: Domain0: Logical address 0x00000000, 4 byte, 
expected working counter 3.
[ 2797.475389] EtherCAT 0:   Datagram domain0-0: Logical offset 
0x00000000, 4 byte, type LRW.
[ 2797.475410] EtherCAT 0: Master thread exited.
[ 2797.475413] EtherCAT 0: Starting EtherCAT-OP thread.
[ 2797.475465] EtherCAT WARNING 0: 1 datagram UNMATCHED!
[ 2797.776049] EtherCAT 0: Releasing master...
[ 2797.776057] EtherCAT 0: Master thread exited.
[ 2797.776064] EtherCAT 0: Starting EtherCAT-IDLE thread.
[ 2797.776090] EtherCAT 0: Released.
[ 2800.524012] EtherCAT ERROR 0-0: Failed to set state INIT: No response.
---------------------------------------------------------------

I've attached the adapted main.c code; most of the original example code 
is still in there, usually commented out.

Could anyone point me to a solution for the following questions:
- why does the slave report to be in error state?
- why doesn't the blink-data get written to the correct registers?
- why does the slave fail to go into PREOP/OP state?

Any help is greatly appreciated!

Kind regards,
Maarten Burghout

University of Twente
Department of Control Engineering
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: main.c
URL: <http://lists.etherlab.org/pipermail/etherlab-users/attachments/20101108/587dd82b/attachment-0002.c>


More information about the Etherlab-users mailing list