I have the following situation. I have a master (consumer) and a slave (producer), the slave has to be between nodes 1-127, in this case the slave is in the node 125.
I'm trying to syncronize both of them, for that, after some research I found about the heartbeat function.
I'm prety new to CANopen, so I've tried changing values in the master.dcf
file. If you know about CANopen you will know that there are several parameters that are the same for everybody, so you can configure them in the way you need. In this case I've modified the 1017h (Producer heartbeat time) parameter by changing the DefaultValue
to 1000 ms so every second I get a heartbeat from the producer (slave). Here you can see the master.dcf
where I made the change:
[1017]
ParameterName=Producer heartbeat time
DataType=0x0006
AccessType=rw
DefaultValue=1000
My problem is making the same with the master (consumer). For this, in the master.dcf
the parameter 1016h
(Consumer heartbeat time) is suposed to function the same way as the 1017h
but I don't know what to change in here in order to get a hearbeat from the master every second. Here is the 1016h
in the master.dcf
:
[1016]
ParameterName=Consumer heartbeat time
ObjectType=0x08
DataType=0x0007
AccessType=rw
CompactSubObj=127
[1016Value]
NrOfEntries=0
As mentioned, I've tried modifying the value of NrOfEntries
, but I don't think this is somthing relevant to my case, so I left it as it was (NrOfEntries = 0
).
I've also tried with other two parameters: 1006h
and 1007h
.
[1006]
ParameterName=Communication cycle period
DataType=0x0007
AccessType=rw
DefaultValue=0
[1007]
ParameterName=Synchronous window length
DataType=0x0007
AccessType=rw
DefaultValue=0
Both of them have a starting value of 0, and I've tried changing them to 1 but I still can't get to see the hearbeat of the slave.
To see what happens in CAN I'm using candump can0
in a terminal and I can see every message of the comunication, in the next image you can see a part of the comunication:
As you can see in the image, the line can0 701 [1] 05
is the line of the producers heartbeat that appears every second, as configured. The other lines are for CAN initialization (NMT messages) and valve opening and clossing.
In case someone thinks it's important. As a master I'm using a NVIDIA Xavier and as an slave I have a CR2041 ifm module, to where I've connected some valves to be controlled. The comunication happens when I execute the application that controls the valves.
If you need more information to help me ask for it without problems.