Menu

Auto Assign node-ID and broadcast address

Babanz
2017-03-15
2017-03-15
  • Babanz

    Babanz - 2017-03-15

    Hello !

    First i would thank you for your work wich is really helpful.

    I started working on canopen and i'm interested in the CANopenStack, and i'm searching a way to auto assign node-id dynamicaly, i thought about using the broadcast address "0" but i got in the example the error: 107 "unsupported node", is there anyway to auto asseign node-id ? did you find a way to discover new CAN slaves connected to the network ?

    Another point, i tried :
    ./canopencomm [1] 4 read 0x100b 0 i16 which should be NODE-ID object but i get error [1] ERROR: 0x06020000 - Object does not exist.
    Regards.

     

    Last edit: Babanz 2017-03-15
  • Janez

    Janez - 2017-03-15

    Hello,

    CANopen LSS is for automatic baud-rate detection and for node-id assignment. See https://www.can-cia.org/cn/can-knowledge/canopen/lss/ It is not implemented in CANopenNode.

    In general, each node transmits heartbeat, which can be used to detect node-id (for some custom solution.)
    0x100b is not implemented, it is not in CiA 301 standard.

    regards,
    Janez

     
  • Babanz

    Babanz - 2017-03-15

    Janez,

    Thanks for your answer.

    But what about the broadcast 0 ? it is in the CiA 301 11.4.1.1.

    Regards.

     
  • Janez

    Janez - 2017-03-16

    Hi,

    0x100b seems to be in older release of standard. I don't know, what you mean by broadcast 0.

     
  • Babanz

    Babanz - 2017-03-16

    hey,

    Excuse me, that wasn't really clear, so i was talking about the node-ID 0 which is used for broadcast purpose, but nevermind i just used it with the wrong command the broadcast address is operational.

    So as i see canopen doesn't have a mean to change the node-ID, i tried writing on the 0x2101 after putting it in the preop stat, but still the slaves answers its old node-id.

     

    Last edit: Babanz 2017-03-16
  • Janez

    Janez - 2017-03-16

    Hi,

    You can change node-id, then save parameters (0x1010) and reset node or communication.

     
  • Babanz

    Babanz - 2017-03-16

    Hi ! Thanks for your answers !

    Well i'm writing to the 0x2101 the new node-ID but the reset comm is not doing its work the slave is restarted but the parameters are not changed. i tested it with both the change of the node-ID and the change of the heartbeat interval, when i execute the:
    "./canopencomm [node] reset comm"
    There's no changes (the stored parameters are not used).
    Steps :
    1_ Heartbeat intervall 2sec.
    2_ change heartbeat intervall to 10sec
    3_ save changes.
    4_ change heartbeat intervall back to 2sec
    4_ reset communication
    5_Heartbeat intervall is still 2sec when it should be the 10sec stored.
    To save parameters i used the command in the tutorial "./canopencomm 4 w 0x1010 1 u32 0x65766173"
    for the node reset it closes the slaves and to execute it again we have to indicate the node-id so the stored parameters are not used.

    Am i mistaken somewhere ?

    Regards.

     
  • Janez

    Janez - 2017-03-16

    Storing is not implemented on all microcontrollers. Which one do you use?

     
  • Babanz

    Babanz - 2017-03-17

    I'm using CANopenStack, i'm on linux directly in my pc.

    The probleme is not the storing but the reset communication since when i reset the comm the parameters are not reseted.

    the storing is working just fine.

    just to be sure to change the node ID i have to send an nmt preoperationnal then a write command to the 0x2101 with the new node-ID, store the parameters and then reset the comm right?

     

    Last edit: Babanz 2017-03-17
  • Janez

    Janez - 2017-03-20

    Hi,

    Variable for Node-id (0x2101) is not used by CANopenSocket. It is there, but is actually not used, because it is set by program arguments. (see file canopend/src/main.c, variable nodeId).

    However, it is not very practical, especcially in your case. So I put OD_CANNodeID back into operation.
    Line 146 in main.c is now

        int nodeId = OD_CANNodeID;      /* Use value from Object Dictionary or set to 1..127 by arguments */
    

    It should work now. After change of 2101 and reset communication, new node-id should be active.
    Please pull the git and tell if it works.

     
  • Babanz

    Babanz - 2017-03-20

    Hello !

    Well, i've already made this change, but the problem is that the communication can't be reset, changes after i send the reset comm command there's only 2 printed msg telling me that the slave's comm has been reseted and it is now running but the parameters are still the same.

    I tested this with the node-id and the heartbeat intervall in the 0x1017 changed them and reseted the communication without storing the parameters, the heartbeat should have returned to the initial value, but it didn't happen.

    the node-id is always set by program arguments.
    Edit: The node ID when not given in the program parameters is not set by the 0x2101 (or it is set with a weiredvalue i get this message :
    /canopend - starting CANopen device with Node ID 32(0x20), count=12 ...
    and in the candump :
    vcan0 720 [1] 05
    while in the 0x2101 i have 0x08

    Regards,

     

    Last edit: Babanz 2017-03-20
  • Babanz

    Babanz - 2017-03-21

    Hello !

    I confirme it is working ! Thanks.

    i'm goona work soon on a Cortex-m0 so i'll need to use the STM32, just to know what should i add in that folder ?

    Regards.

     
  • Mladen Knezic

    Mladen Knezic - 2017-05-16

    Hi all,

    I am trying to figure out how to store/restore parameters on dsPIC33 uC. Can you please tell me whether store/restore functionallity is supported for this uC?

    Regards,

    Mladen

     
  • Janez

    Janez - 2017-05-20

    It is not implemented for dsPIC33. It should be something very similar as for PIC30.

     

Log in to post a comment.