Home > Forum > Controllers SlimLine e Netsyst (LogicLab) > Information on CAN Bus management
- This topic has 9 replies, 3 participants and was last updated 4 years, 10 months ago da Sergio Bertana.
-
AuthorPost
-
September 6, 2013 at 9: 50 am #35409RubenParticipant
Hello, I need more detailed information on the CAN bus of the Slimline. I have read the programming manual but I cannot fully understand.
SYSCANMESSAGE.MsgID: What does FF: Bit 31 mean?
SysCANTSetMode: Filter and Mask refer to the message ID? Logic between them? Are these Rx and Tx filters?
SysCANRxMsg: In the example, Mask is 16 # 3FFFFFFF. For 29 bits shouldn't it be 16 # 1FFFFFFF? ID in the example is 16 # 00000000. This only allows Rxing of packages with SYSCANMESSAGE.MsgID 16 # 00000000 not all packages. It's true ?
Do you have more detailed documentation?
What is the execution time of SysCANTxMsg () and SysCANRxMsg ()?
The CAN bus controller and that of the Freescale MX257?September 10, 2013 at 9: 06 am #37760Sergio BertanaAdministrator ForumI try to clarify how the CAN Bus works on SlimLine, let's start by saying that the CAN 1 controller in the ARM controller is used as a CAN controller (Allego abstract datasheet). The bit 31 (FF) of SYSCANMESSAGE.MsgID indicates whether the message has an identifier to 11 bit or to 29 bit.
To use the CAN it is necessary to initialize it by defining the speed and the filters, typically it is set to receive all messages SysCANSetMode(CAN_500KBIT, 16#00000000, 16#00000000);
CAN message reception
Messages are received in interrupt and stored in the receive buffer (32 messages up to 8 bytes of data each). The user program with the function SysCANRxMsg(Mask, ID, ADR(Msg)); it extracts the desired message from the buffer and stores it in the variable msg. It is necessary to execute the function until the reception buffer is completely empty, managing all the messages received. The execution time of the function is a few us but in order not to lose messages it must be executed cyclically in a time less than the buffer filling time (32 messages).CAN message transmission
The messages are loaded into the transmission buffer (32 messages up to 8 bytes of data each) with the function SysCANTxMsg(ADR(Msg)); the messages are then transmitted interrupted by the system.June 15, 2019 at 6: 12 am #48173RuboxParticipantI have doubts about the use of CAN communication, I have an extended RS485 CPU (so it doesn't manage CAN, right?) And a PCB126C130 expansion module which has CAN / RS485 fieldbus characteristics.
Can I use the expansion module to read values using CAN?
How is everything managed? In the CAN read / write functions I don't see a sort of module address on which to do readings and writes: is it something automatically managed by the CPU?
Thanks for the help you will want to give me.
June 15, 2019 at 6: 21 am #48178Sergio BertanaAdministrator ForumThe CPU module with RS485 port cannot manage the CAN, the space on the CPU module is reduced so we have shared the space between RS485 and CAN, we must choose the desired version.
On the PCB126C130 expansion module there is an RS232 port that can be used by program the access is exactly the same as that of the ports on the CPU module using the FB SysSerialPort, defining the definition in the COM field PCOMx.y where x is the address of the module and with y the port number on the form in your case the 0 number.
June 15, 2019 at 6: 47 am #48191RuboxParticipantHello, thanks for the reply: I had never found how to address the serial port of the modules. So I can use the P1 connector on the expansion module.
To use the P12 connector of that module for CAN communications how can I do, always if it is feasible?
June 15, 2019 at 6: 50 am #48194Sergio BertanaAdministrator ForumYes the RS232 serial port can be used, but the module you have (Model PCB126C130) having 1 as the first number after level C, it is a module with only RS232, the 3 number indicates 10 analog input channels.
In fact in your module the P12 connector is not mounted.
June 15, 2019 at 8: 02 am #48198RuboxParticipantEmh ... (is there the face that buries itself?): These are the questions that one asks when he does not have the hardware at hand, but only what the customer tells you he has read about the features.
I was in doubt whether to access the system that comes out with CAN and RS232… and I have removed all doubts 🙂
Before asking any more questions as an idiot, I will read the documentation twice, I promise!
Thanks and good job
June 15, 2019 at 8: 04 am #48202Sergio BertanaAdministrator ForumCustomer questions are always useful… a question can give useful answers to better understand how the system works.
June 17, 2019 at 6: 06 am #48208RuboxParticipantSo I allow myself another question, assuming that the CAN I have never used. I read something on the net to understand something more.
If I had an expansion module with the CAN port, and connected to it a system that communicates on CAN, is it correct that in the FBs there is no "addressing" of the CAN port? It should be some kind of "TCP" that sends the data packet over the CAN ports and waits for the response, right?
However I should still have the main CPU that manages the CAN protocol, otherwise I wouldn't be able to read anything anyway?
June 17, 2019 at 6: 14 am #48225Sergio BertanaAdministrator ForumAt present the only way to manage the CAN bus is to have the CAN version of the CPU module, (Council MPS054B200). If you look at the IEC61131-3 Programming Manual, you'll find directions on how to use the features SysCANTxMsg e SysCANRxMsg.
A CAN message is made up of a unique identifier at 11 or 29 bits and a data frame that can reach a maximum of 8 bytes. All devices in the network are both master and slave, each transmitted message is received by all systems in the network that filter it with the desired ID.
-
AuthorPost
- You must be logged in to reply to this topic.