CANopenNode
CANopenNode copied to clipboard
producer heartbeat datalength DLC is zero
In CO_NMT_Heartbeat.c, Line: 241, the heartbeat is send.
The current state is copied, but the DLC is left at 0.
shouldnt that be a DLC of 1 ?
Ok, so anytime CANsend() is called, the DLC is always 0. CANsend has to go through the Tx bufferlist to look for hte matching ID and get the DLC from there. hmm
ok sorry for the messup.
The Datalength is encoded in the message ID. so DLC=(ID>>12)&0xfL;
The DLC member of the buffer-struct is not used!!
DLC is configured via CO_CANtxBufferInit(). It is not necessary to configure DLC each time, when sending CAN message.
* Send CAN message.
*
* @param CANmodule This object.
* @param buffer Pointer to transmit buffer, returned by CO_CANtxBufferInit().
* Data bytes must be written in buffer before function call.
*
* @return #CO_ReturnError_t: CO_ERROR_NO, CO_ERROR_TX_OVERFLOW or
* CO_ERROR_TX_PDO_WINDOW (Synchronous TPDO is outside window).
*/
CO_ReturnError_t CO_CANsend(CO_CANmodule_t *CANmodule, CO_CANtx_t *buffer);
The DLC member of the buffer-struct is not used!!
It depends on driver implementation.
Ok, CANsend() supplys a pointer to the used TXarray entry that shall be send. It has updated the data.
i use the SAMV71 CAN device which has a special way to set the ID and DLC stuff, therefore need seperation.
But no problem it works now. Thanks for assistance ;)