Menu

Time-stamp protocol

abh10
2019-06-26
2019-07-02
  • abh10

    abh10 - 2019-06-26

    I am using CANopenNode in NMT Master mode with great success on RPi Linux. There are two slave nodes on the bus and I need to set the time on these by time-stamp broadcast. The Time-stamp protocol isn't implemented in CANopenNode and I am looking for some help/guidance on how to do that. Thank you in advance.

     
    • Martin Wagner

      Martin Wagner - 2019-07-01

      There are two ways:

      hacky one:

      1. see CANopen.c CO_sendNmtcommand()
      2. CANopen.c add check in " Verify features from CO_OD" table
      3. CANopen.c add your OIDs to "Indexes for CANopenNode message objects" table, adjust accordingly
      4. Init and worker are up to you

      proper one:

      1. create new CO_timestamp.c / .h
      2. implement your functions based on other file (I think CO_SYNC is a good small example)
      3. CANopen.h #include "CO_timestamp.h". This should only be necessary there!
      4. CANopen.c add check in " Verify features from CO_OD" table
      5. CANopen.c add your OIDs to "Indexes for CANopenNode message objects" table, adjust accordingly
      6. CANopen.c add your object to static object (somewhere after static CO_CANmodule_t COO_CANmodule;)
      7. CANopen.c add your object to dynamic object allocation (somewhere after / Initialize CANopen object /) in CO_new().
      8. CANopen.c place your init and worker next to the other objects init and workers.

      Hope that helps

       

      Last edit: Martin Wagner 2019-07-01
  • abh10

    abh10 - 2019-07-02

    Martin,
    Thanks a lot for your comment.
    I need to look deeper into the code to understand how this works.
    One thing though: I am using the libedssharp eds-editor to set up my OD.
    As far as I can see, it doesn't support adding a feature flag for Time-Stamp producer, so I will need to add this manually(?)
    I was wondering, if I only need to be a Time-Stamp producer and not a Time-stamp consumer, do I need to worry about OIDs, OD entry 1012 etc? -After all, I just need to send a single CAN frame with a fixed known CAN_ID and 6 databytes. So, I wonder if there is an even more hacky way to do this by calling CO_CANsend in stack/socketCAN/CO_driver.c directly?

     
    • Martin Wagner

      Martin Wagner - 2019-07-02

      As far as I can see, it doesn't support adding a feature flag for Time-Stamp producer, so I will need to add this manually(?)

      Yes.

      I was wondering, if I only need to be a Time-Stamp producer and not a Time-stamp consumer, do I need to worry about OIDs, OD entry 1012 etc

      I don't know the timestamp protocol or assigned OD entries.

      even more hacky way

      you need to add a tx buffer to the CAN driver so you can use CO_CANsend()

      even even more hacky way...

      yes you can just send it using socketCAN.

       

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.