Hello,
I'm involved in the development of a CodeSys application where the external devices are interfaced by means of a Can bus communication; I'm in charge of the application layer development for a protocol very similar to the SAE J1939 one but with several customized messages. Our objective for this project is to rely on the CodeSys "3S_CanDrv.lib" library for the low level communication primitive (Initialization, Bus handshake, Read/Write message, ...) while we have to write the management code for the data contained in the messages by directly accessing the Rx/Tx buffers. I need to develop the code from scratch without chance to use third party libraries.
I successfully set a CAN communication channel between the PLC where CodeSys runs (master) and the device to be controlled (slave) and I'm able to read good data in the 3S_CanDrv.lib pCanRxBuffer Global Variable.
Anyway I'm stuck on a little problem. It seems that the 3S_CanDrv.lib is set to manage 11bits CanID while I need to manage 29bits CanID.
Just to better explain, if I send from the client the CanID 0x18FF4400 what I get in the pMessageRx.dwID is 0x0000063F.
Can anyone tell me how to set the 3S_CanDrv to handle 29bits CanID (Can 2.0B)?
The can driver documentation is really poor and I didn't find any solution after an hard search over internet.
Thank you, Domenico
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
After an hard fight I discovered that the problem was due to a bug in the communication stack library. The CAN chip manufacturer issued an updated interface library that the PLC manufacturer linked in the firmware and now everything works like a charm!
At the end the problem was in the device and not in the CodeSys development system.
Regards D
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hello,
I'm involved in the development of a CodeSys application where the external devices are interfaced by means of a Can bus communication; I'm in charge of the application layer development for a protocol very similar to the SAE J1939 one but with several customized messages. Our objective for this project is to rely on the CodeSys "3S_CanDrv.lib" library for the low level communication primitive (Initialization, Bus handshake, Read/Write message, ...) while we have to write the management code for the data contained in the messages by directly accessing the Rx/Tx buffers. I need to develop the code from scratch without chance to use third party libraries.
I successfully set a CAN communication channel between the PLC where CodeSys runs (master) and the device to be controlled (slave) and I'm able to read good data in the 3S_CanDrv.lib pCanRxBuffer Global Variable.
Anyway I'm stuck on a little problem. It seems that the 3S_CanDrv.lib is set to manage 11bits CanID while I need to manage 29bits CanID.
Just to better explain, if I send from the client the CanID 0x18FF4400 what I get in the pMessageRx.dwID is 0x0000063F.
Can anyone tell me how to set the 3S_CanDrv to handle 29bits CanID (Can 2.0B)?
The can driver documentation is really poor and I didn't find any solution after an hard search over internet.
Thank you, Domenico
After an hard fight I discovered that the problem was due to a bug in the communication stack library. The CAN chip manufacturer issued an updated interface library that the PLC manufacturer linked in the firmware and now everything works like a charm!
At the end the problem was in the device and not in the CodeSys development system.
Regards D