The CAN module, which is an integral part of the 24x / 240x family, is a CAN controller designed as a 16-bit peripheral that supports the 2.0B standard. A block diagram showing its basic architecture can be found in Figure 1.
Figure No.1 Block diagram of TMS320x240x CAN module
The CAN module achieves two-wire communication with the CAN transceiver via the CANTX and CANRX pins on one side. On the other hand, the CPU accesses the control and status registers, as well as the specific memory space (so-called Mailbox RAM) of the CAN module.
Mailboxes are located in a 48-word RAM portion. Mailbox RAM contains messages that have just been received, ie messages intended for sending are entered. Mailboxes 0 and 1 are receiving, while 4 and 5 are transmitting; mailboxes 2 and 3 are configurable and can be used for sending or receiving.
Each of the six mailboxes contains four 16-bit registers that can hold a maximum of 8 bytes of data, two 16-bit identifier registers, and several control registers. Within the two identifier registers, in addition to the 29-bit identifier itself, there are three bits that define the length of the identifier, the use of the local mask, and the auto-answer mode (AAM bit) required to automatically respond to a data request.
The CAN module sends or receives data using the data message type whose format is shown in Figure 2. Upon receipt of a new message, the identifier of the message itself is first compared with the identifiers of the receiving mailboxes, and if these match, the message is accepted. Setting the local mask allows certain bits of the mailbox identifier to be masked and not participate in the comparison with the corresponding bits of the incoming message identifier. Of course, the local mask can only be set for receiving mailboxes.
Figure No.2 Data message format
Receiving messages with a data request can only be done via mailboxes 0, 1, 2 and 3. If a message arrives in which the RTR bit is set, the CAN module compares the identifiers of these mailboxes with the identifier of the incoming message. Mailbox identifiers are compared starting with mailbox number 3 below. In case the identifiers match, the further search is completed. Depending on whether the identified mailbox is receiving or transmitting, as well as whether the AAM bit is set, the following situations are possible:
1. If the called mailbox is configured to send (note that these can only be configurable mailboxes 2 and 3), and the AAM flag is set, the current content of that mailbox is automatically sent.
2. If the called mailbox is configured as a transmitter, and the AAM bit is not set, the accepted message with the data request will be ignored, ie there will be no response to the message, nor any signal to the CPU that such a message was received.
3. If the called mailbox is configured as a receive, it receives the message and signals the CPU via the RCR bit from the receive control register. The response to this data request now depends entirely on the decision of the CPU.
When the CPU wants to send a data request, this is accomplished with configurable mailboxes 2 and 3. Namely, one of them is first configured as a receiving mailbox. Thus configured mailbox is able to send a message with a request for data. The expected data is received in the same mailbox.
The two status registers provide information on the functioning of the entire peripheral system (GSR), ie the type of error that has occurred (Error Status Register (ESR)). The ESR shows only the first error that occurred, that is, subsequent errors do not change its content. The CAN module has two error counters, one for the send mode and the receive mode whose contents are available to the CPU.
The control registers of the CAN module enable the configuration of mailboxes by means of which they are switched on or off, control the transmitting or receiving functions, determining the transmission speed and managing interruptions. There are two types of interrupt requests between the CAN module and the PIE controller: one is initiated by a change in the state of a mailbox, and the other due to an observed error. Both types can use high and low priority levels. The following activities initiate a break:
- the message was successfully received or sent;
- sending message interrupted;
- CPU failed to enter send message;
- wake-up condition;
- the old message has been overwritten by the new message;
- The CAN module is disabled to send messages (Bus-off state);
- CAN module is passive (Error Passive);
- one or both error counters have a value equal to or greater than 96;
Maxim MAX3225cpp is an RS-232 driver  in charge of the asynchronous serial connection of the system to the peripherals. The maximum communication speed is 1 Mb / s. Raising the signal to the RS-232 level is achieved by a so-called voltage pump, which is realized in the form of four capacitors of the order of 0.1µF. The circuit automatically enters a low-power state when the RS-232 cable is disconnected or if the transmission circuits of the attached peripherals are inactive, or if the UART that drives the transmitters is inactive for more than 30 seconds using the AutoShutdown Plus application. The circuit is reactivated at a new valid transition at any transmitter or receiver input. The circuit is housed in a standard DIP 20 housing.
The PCA82C250 is the interface between the CAN controller and the physical bus. The primary use is in industrial applications that use speeds from 40 kbps to 1 Mbps. It has protection against short circuit to positive and negative voltage, protection against thermal overload which controls that the temperature of the connection does not exceed 165ºC. The circuit requires a 5V power supply, and its input circuit for receiving data from the CAN controller (pin TXD) expects a voltage of 5V for the logic unit, while its output circuit for sending data to the CAN controller provides a voltage of 5V for the logic unit. In both cases, the logic zero corresponds to a voltage level of 0V.
The PCA82C250 is packaged in a very small eight-pin SMD case labeled SO-8 (Small Outline package). Its dimensions are 4x5mm.
Source: Automatika.rs by www.automatika.rs.
*The article has been translated based on the content of Automatika.rs by www.automatika.rs. If there is any problem regarding the content, copyright, please leave a report below the article. We will try to process as quickly as possible to protect the rights of the author. Thank you very much!
*We just want readers to access information more quickly and easily with other multilingual content, instead of information only available in a certain language.
*We always respect the copyright of the content of the author and always include the original link of the source article.If the author disagrees, just leave the report below the article, the article will be edited or deleted at the request of the author. Thanks very much! Best regards!