CANopen master; slaves that go to pre-op

chab
2013-01-27
2013-02-06
  • chab - 2013-01-27

    This is a general CANopen master question.

    In my CANopen network, a slave goes to pre-operational sometimes. And it's heartbeat status changes accordingly.
    Currently, the CANopen master does NOT reset / re-init that slave.
    Should the CANopen master do a reset / re-init of the slave?

    Regards,
    Edwin.

    CoDeSys V3.5
    CANopen Manager V3.4

     
  • TimvH

    TimvH - 2013-01-27

    If the master is configured to detect heartbeat errors and the slave doesn't send them anymore, the master will change the status of the node (internal status) and try to connect to it again. When it finds the node, it will configure it again (default setting) and bring it to operational mode again.

    What you should check is:
    - Your heartbeat settings => Does the master detect it => is the time set correctly to detect errors?
    - Add Function blocks to your application to detect the status of the node (does this change when your situation happens?). With this function block you can detect whether the node is in pre-operational state.

     
  • chab - 2013-02-04

    Thank you for your suggestions.

    The master detects that the slave is in pre-op and in the CoDeSys GUI, the slave has a orange / red icon.
    The slave keeps transmitting it's heartbeat (with status 0x7f = pre-op).

    The question is:
    Should the CANopen master re-init a slave that is in pre-op state?

     
  • spfeif - 2013-02-04

    Should the Master Re-Init is based on the configuration of the Node and CAN master.

    Since it appears you are using V3 here are a few thing to look at:

    1. You can have the Master set to START ALL nodes which means that after configuring all the nodes at startup of each device the Master will send a global start all nodes command instead of starting each one individually.

    2. Look at the bottom of the NODE configuration under the CAN master you will see check boxes for Check Vendor ID, Check Product Number , Check Revision Number , If any of those are checked then the CANopen Master stack will read these OD entries first and if they don't match with the value read from the node and the value in the eds file then it will not configure and start the node. Try unchecking all of them.

    3. Can I assume you have more than one Node on this network? If so I would find out why only one of them is going from Op to Pre-Op. Do you have a CAN monitor? One thing to check as well is if this node was on another network and configured a different way, Like Node Guarding enabled, and then you took it to another network ( the one currently using V3) CoDeSys may not configure it correctly since it doesn't write all the SDO of the entire Node. It will only right a few of them and only ones that have changed from the EDS default. So what I am getting at is try a Node Reset OD 1011 then put it back on your network. You may have old setting enabled like both Nodeguarding and Heartbeat enabled at the same time.

    4. Also you should as suggested below set your hearbeat time out of the node (heartbeat consumer) to at least 1.5 times the Heartbeat rate of the Master. Also if you changed the Master ID you need to change the heartbeat consumer Node ID of the Node as well other wise it will remain defaulted to 127. Press the button to "Change the Heartbeat Consumer Properties". I'm assuming you might be consuming the Masters heartbeat and not another nodes heartbeat.

     
  • chab - 2013-02-06
    1. I think, I cannot use START ALL nodes, because I have optional CANopen devices in the network.
    2. Yes, we check the Vendor ID. And that is matching with the eds file.
    3. We have more than 20 CANopen slaves in the network.
      The manufacturer of the device that is going to pre-op, is investigating the issue currently.
      At start up, the master initializes the slave with the mapping and comm. parameters only. And that is OK according to the manufacturer of the slave.
    4. I checked the heartbeat settings (150%). And that is OK.

    Again, thank you for your help.

    Still the question remains: Should a CANopen master, re-init a CANopen slave that is in pre-op state?

    Regards,
    Edwin.

     
  • chab - 2013-02-06

    I think a CANopen master should supply the possibility to reset slaves that are 'not operational'. So the master can re-init the slave and get it operational.
    CoDeSys V3.5 / CANopen Manager V3.4 does not supply such functionality, I think.

    As a work-around, I'll make an application that (like TimvH suggested):
    - Cia405.GET_STATE of slaves.
    - Check if it is 'not operational' for some time e.g. 30 seconds.
    - Reset a slave that is 'not operational' for some time, with Cia405.NMT.

    Did somebody make such application, in ST, already?

     
  • TimvH

    TimvH - 2013-02-06

    Personally I don't think the Master should just bring it into operational state. There must be something wrong with the slave when it suddenly goes into pre-operational state without reason. Normally this never happens. If it is caused by a reset (or something similar) it should stop sending heartbeats for some time for the Master to detect this. This is the normal error handling mechanism which the master can handle.

    In you case I think the work-around is the only solution.

    Below you can find some code which you could use as example. I just created it based on experience, but didn't test it, which means there could be some errors in the code, but I hope it helps.

    PROGRAM PLC_PRG
    VAR
       getStateNode1: CIA405.GET_STATE;
       tonNotOpNode1: TON;
       nmtNode1: CIA405.NMT;
    END_VAR
    
    getStateNode1(
       NETWORK:= 1, 
       ENABLE:= NOT(getStateNode1.CONFIRM) AND (getSTateNode1.ERROR = CIA405.CANOPEN_KERNEL_ERROR.CANOPEN_KERNEL_NO_ERROR),
       TIMEOUT:= 1000, 
       CONFIRM=> , 
       ERROR=> ,
       DEVICE:= 1, 
       STATE=> );
       
    tonNotOpNode1(IN:= getStateNode1.STATE <> CIA405.DEVICE_STATE.OPERATIONAL, PT:= T#30S, Q=> , ET=> );
    nmtNode1(
       NETWORK:= 1, 
       ENABLE:= tonNotOpNode1.Q, 
       TIMEOUT:= 1000, 
       CONFIRM=> , 
       ERROR=> , 
       DEVICE:= 1, 
       STATE:= );
       
    
     

Log in to post a comment.