Welcome to our new forum
All users of the legacy CODESYS Forums, please create a new account at account.codesys.com. But make sure to use the same E-Mail address as in the old Forum. Then your posts will be matched. Close

Problems reading an entire entry via CoE

Pysin
2018-09-06
2018-09-07
  • Pysin - 2018-09-06

    Hello everybody,

    I trying to read a whole entry from the object directory using CANopen-Over-EtherCAT (CoE). The Slave is a FAULHABER MC5005S-ET Motion Controller. For a first test, I have used a simple entry with four UINT8 parameters (addr: 0x2300 / 4 subindices) as you can see in the codeboxes below. But every time I run the reading process, an error is output by the ETC_CO_SdoRead_Access function-block. The output parameter "eError" contains "ETC_CO_FIRST_ERROR". Unfortunately I can't find any further descriptions for that error message. I have also tried to use different lengths and datatypes for the byteArr array as well as other entries from the object directory.

    Reading single parameters using index and subindex works fine. Could it be possible that the motion controller doesn't support that operation? Does anybody know how ETC_CO_SdoRead_Access is implemented? Is it a special CoE feature or does this function just invoke ETC_CO_sdoRead successively?

    PROGRAM ComTest
    VAR
       (* MotionController *)
       (* In *)
       statusword                : UINT;
       velocity_actual_value      : DINT;
       (* Out *)
       controlword               : UINT;
       target_velocity            : DINT;
       
       (* EtherCAT Communication (CoE) / SDO-Traffic *)
       ethercat_ready       : BOOL;
       ethercat_error      : BOOL;
       ethercat_request_restart : BOOL;
       // Multi-Read
       ReadAccess         : ETC_CO_SdoRead_Access; (* Function block to Read a the complete SDO entry into a byte array.*)
       multiRead         : SDO_RW;
    END_VAR
    
    (* CoE *)
    // Call EtherCAT-Master
    // Check if a restart has been requested
    IF ethercat_request_restart THEN
       Ethercat_Master.xRestart := TRUE;      // Rising Edge triggers the restart
       ethercat_request_restart := FALSE;
    ELSE
       Ethercat_Master.xRestart := FALSE;      // Reset to make it possible to restart the bus again
    END_IF
    // Invoke EtherCAT-Master-Program
    Ethercat_Master();
    // Check if ready / Check for errors
    IF Ethercat_Master.xConfigFinished THEN
       ethercat_ready             := TRUE;
       Ethercat_Master.xRestart    := FALSE;
    ELSE
       ethercat_ready := FALSE;
    END_IF
    IF Ethercat_Master.xError THEN
       ethercat_error := TRUE;
       ethercat_ready := FALSE;
    ELSE
       ethercat_error := FALSE;
    END_IF
    // SDO-Communication
    IF ethercat_ready THEN 
       
       // Multi-Read
       IF multiRead.active THEN
          // Reset Error-Flag
          multiRead.error   := FALSE;   
       
          // Read SDO-Parameter
          ReadAccess(xExecute := TRUE, uiDevice:= 1001, usiCom := 1, wIndex:=16#2300, bySubindex := 16#00, 
                   udiTimeOut := 500, pBuffer := ADR(byteArr), szSize := SIZEOF(byteArr), xCompleteAccess := TRUE, eError => etcError );
          
          IF ReadAccess.xDone THEN
             ReadAccess(xExecute := FALSE);
             multiRead.active    := FALSE;
          ELSIF ReadAccess.xError THEN
             ReadAccess(xExecute := FALSE);
             multiRead.error      := TRUE;
             multiRead.active    := FALSE;
          END_IF
       END_IF
    END_IF
    

    CODESYS Version: V3.5 SP13 + (64-bit)

    I appreciate your responses

     
  • Omar Ampyx - 2018-09-07

    Hi Pysin,

    According to the Codesys help in case of ETC_CO_FIRST_ERROR, the error cause is stored in the blocks output 'udiSdoAbort', did you check that?

    Gr, Omar

     
  • Pysin - 2018-09-07

    Hi Omar, thank you for your quick response. I have checked the error code in 'udiSdoAbort'. The value is 0x06010000 which means, according to the communication manual from Faulhaber, that the access to the specified object is not supported. For me it looks like the device just doesn't support the complete access feature.

     

Log in to post a comment.