Example:

In a project (created with SoftMotion version 4.12.0.0 Add-on) the SoftMotion Function Block f.e.g: SMC_ChangeGearingRatio is called from any arbitrary Task.
This was working without problems.

When updating to SoftMotion version 4.13.0.0 the error "SMC_FB_CALLED_FROM_WRONG_TASK" will be shown.

Questions: 

  • Why is there now an error displayed, when old projects could be compiled and downloaded without errors?
  • Does the FB have to be called from a specific Task with the new SoftMotion version?
  • Is the call from any arbitrary Task (under older SoftMotion versions like 4.12.0.0) an error in the project/process flow, and should this be corrected retroactively?

Assessment and Explanation

Function Blocks that use an axis or axis groups, may only be called from the respective Bus-Task!
Up to SoftMotion version 4.13.0.0, this was not controlled, so that errors could occur in applications that were difficult to track and understand.

Therefore, with the new version, we have included an error to directly point out this problem.


The problem explained with the above given example:

  • Let's assume a project has a SingleCore CPU with 2 Tasks.
  • The first task is the bus task with a high priority (in this Task, the AXIS_REF_SM3 is called implicitly).
  • The second Task has a lower priority than the first and calls the block SMC_ChangeGearingRatio.
  • The Task with the higher priority can interrupt the Task with the lower priority.
  • SMC_ChangeGearingRatio accesses several values of the AXIS_REF_SM3 axis.
  • If the input variables SMC_ChangeGearingRatio.dwRatioTechUnitsDenom or SMC_ChangeGearingRatio.iRatioTechUnitsNum are changed, the following axis values are written, for example:

  • Assuming now that SMC_ChangeGearingRatio is executed, and writes the axis values listed above.
  • Then the second Task can be interrupted in the middle of processing SMC_ChangeGearingRatio by the bus Task.
    • For example, the variables AXIS_REF_SM3.fScalefactor and AXIS_REF_SM3.fFactorVel have already been updated, but the others still have the old value!

  • Then, AXIS_REF_SM3, which is now called in the bus task, works with both new and old values!
  • This is therefore an inconsistent state, which can lead to undefined errors!

Recommendation

To prevent these inconsistent states, all blocks that work with axes or axis groups must be called from the respective bus task.

We therefore recommend that you adapt your application accordingly.

This also means, with knowledge of the possible problems/misbehavior, it is recommended to upgrade applications of existing projects under the old SoftMotion versions appropriately!



See also....


  • No labels