Differences
This shows you the differences between two versions of the page.
| Both sides previous revisionPrevious revision | |||
| pmod:pmodcan:reference-manual [2022/09/13 17:47] – changed forum.digilentinc.com to forum.digilent.com jeff.greenberg_ni.com | pmod:pmodcan:reference-manual [2022/10/04 11:38] (current) – external edit 127.0.0.1 | ||
|---|---|---|---|
| Line 1: | Line 1: | ||
| + | ====== Pmod CAN Reference Manual ====== | ||
| + | |||
| + | The Digilent Pmod CAN (Revision B) is a CAN 2.0B controller with an integrated transceiver. The embedded [[https:// | ||
| + | |||
| + | {{Digilent Image Gallery | ||
| + | | image = {{: | ||
| + | | image = {{: | ||
| + | | image = {{: | ||
| + | | image = {{: | ||
| + | | image = {{: | ||
| + | }} | ||
| + | |||
| + | |||
| + | == Download This Reference Manual == | ||
| + | * {{ : | ||
| + | |||
| + | ---- | ||
| + | |||
| + | |||
| + | ====== Features ====== | ||
| + | * Standalone CAN 2.0B controller with an integrated CAN transceiver | ||
| + | * Compatible with ISO-11898-1, | ||
| + | * Suitable for automotive applications | ||
| + | * Up to 1 Mb/s operation | ||
| + | * Up to 10 MHz SPI clock speed | ||
| + | * 3 Transmit buffers with prioritization and abort feature | ||
| + | * 2 Receive buffers | ||
| + | * 6 Filters and 2 masks with optional filtering on the first two data bytes | ||
| + | * Interrupt output pin | ||
| + | * Standard DB9 connector for a secure connection | ||
| + | * Suitable for 12 V and 24 V systems | ||
| + | * Small PCB size for flexible designs 1.4 in x 1.8 in (3.6 cm x 4.6 cm) | ||
| + | * 12-pin Pmod connector with SPI interface | ||
| + | * Follows the Digilent {{/ | ||
| + | |||
| + | |||
| + | |||
| + | ====== Specifications ====== | ||
| + | ^ Parameter | ||
| + | | Power Supply Voltage (Vcc) | ||
| + | | High-Level Input Voltage (RxCAN) | ||
| + | | Low-Level Input Voltage (RxCAN) | ||
| + | | High-Level Output Voltage (TxCAN) | ||
| + | | Low-Level Output Voltage (TxCAN) | ||
| + | | Bit Frequency | ||
| + | ^ Transmitter | ||
| + | | Recessive Bus Output Voltage (CANH & CANL) | 2.0 | 0.5 Vcc | 3.0 | V | | ||
| + | | Dominant Output Voltage (CANH) | ||
| + | | Dominant Output Voltage (CANL) | ||
| + | | Dominant Differential Output Voltage | ||
| + | ^ Receiver | ||
| + | | Recessive Differential Input Voltage (normal mode) | -1.0 | - | +0.5 | V | | ||
| + | | Dominant Differential Input Voltage (normal mode) | 0.9 | - | Vcc | | ||
| + | ^ Parameter | ||
| + | | Standby Current | ||
| + | |||
| + | ---- | ||
| + | |||
| + | |||
| + | ===== Pinout Table Diagram ===== | ||
| + | |||
| + | |||
| + | ^ Header J2 | ||
| + | ^ Pin ^ Signal | ||
| + | | 1 | CS | Chip Select | ||
| + | | 2 | MOSI | Master-Out-Slave-In | ||
| + | | 3 | MISO | Master-In-Slave-Out | ||
| + | | 4 | SCK | Serial Clock | 10 | Rx1BF | Receive Buffer 0 Full Interrupt | ||
| + | | 5 | GND | Power Supply Ground | ||
| + | | 6 | VCC | Power Supply (3.3V) | ||
| + | |||
| + | ===== Physical Dimensions ===== | ||
| + | The pins on the pin header are spaced 100 mil apart. The PCB is 1.8 inches long on the sides parallel to the pins on the pin header and 1.4 inches long on the sides perpendicular to the pin header. | ||
| + | ---- | ||
| + | |||
| + | ====== Functional Description ====== | ||
| + | |||
| + | The Pmod CAN utilizes the [[https:// | ||
| + | |||
| + | |||
| + | ===== Serial Communication ===== | ||
| + | |||
| + | The Pmod CAN communicates with the host board via the [[learn/ | ||
| + | |||
| + | Nine SPI instructions are available to read the status of the receiver, load a transmit buffer, modify bits in a register and more. Most of the instruction commands are single byte instructions followed by an address byte. More information is available in the [[pmod: | ||
| + | |||
| + | |||
| + | |||
| + | |||
| + | ===== Register Details ===== | ||
| + | |||
| + | ==== CANINTE ==== | ||
| + | |||
| + | The CANINTE register (page 51) enables the generation of interrupts on [[pmod: | ||
| + | |||
| + | ^ CANINTE 0x2B ||||| | ||
| + | ^Bit Name ^Bit Number | ||
| + | |MERRE | ||
| + | |WAKIE | ||
| + | |ERRIE | ||
| + | |TX2IE | ||
| + | |TX1IE | ||
| + | |TX0IE | ||
| + | |RX1IE | ||
| + | |RX0IE | ||
| + | |||
| + | ¹ -- This is the default value on power-up or reset | ||
| + | |||
| + | |||
| + | ==== CANINTF ==== | ||
| + | The CANINTF register (page 52) holds the flags of all the interrupts that are enabled through the CANINTE register. If an interrupt flag is set, it must be cleared by the system board to reset the interrupt condition. | ||
| + | |||
| + | ^ CANINTF 0x2C ||||| | ||
| + | ^Bit Name ^Bit Number | ||
| + | |MERRF | ||
| + | |WAKIF | ||
| + | |ERRIF | ||
| + | |TX2IF | ||
| + | |TX1IF | ||
| + | |TX0IF | ||
| + | |RX1IF | ||
| + | |RX0IF | ||
| + | |||
| + | ¹ -- This is the default value on power-up or reset | ||
| + | |||
| + | |||
| + | ==== CANSTAT ==== | ||
| + | |||
| + | The CANSTAT register (page 54) provides the status of the CAN controller and the source of the interrupt flag. | ||
| + | |||
| + | ^ CANSTAT 0xXE ||||| | ||
| + | ^Bit Name ^Bit Number | ||
| + | |OPMOD2 | ||
| + | |OPMOD1 | ||
| + | |OPMOD0 | ||
| + | |-- |[4] |Unimplemented | ||
| + | |ICOD2 | ||
| + | |ICOD1 | ||
| + | |ICOD0 | ||
| + | |-- |[0] |Unimplemented | ||
| + | |||
| + | ¹ − This is the default value on power-up or reset | ||
| + | |||
| + | |||
| + | === Operation Mode Bit Table === | ||
| + | ^ Operation Mode Bit Table ^^ | ||
| + | ^ Bit values for Operation Mode bits 2,1,0 ^ Mode ^ | ||
| + | | 0,0,0 | Device is in Normal Operation Mode | | ||
| + | | 0,0,1 | Device is in Sleep Mode | | ||
| + | | 0,1,0 | Device is in Loopback Mode | | ||
| + | | 0,1,1 | Device is in Listen-Only Mode | | ||
| + | | 1,0,0 | Device is in Configuration Mode | | ||
| + | |||
| + | |||
| + | === Interrupt Flag Code Bit Table === | ||
| + | ^ Interrupt Flag Table ^^ | ||
| + | ^ Bit values for Interrupt Flag bits 2,1,0 ^ Interrupt | ||
| + | | 0,0,0 | No Interrupt | ||
| + | | 0,0,1 | Error Interrupt | ||
| + | | 0,1,0 | Wake-up Interrupt | ||
| + | | 0,1,1 | TBX0 Interrupt | ||
| + | | 1,0,0 | TBX1 Interrupt | ||
| + | | 1,0,1 | TBX2 Interrupt | ||
| + | | 1,1,0 | RBX0 Interrupt | ||
| + | | 1,1,1 | RBX1 Interrupt | ||
| + | |||
| + | |||
| + | ===== Quick Start ===== | ||
| + | |||
| + | Here is the series of SPI commands to set up, transmit, and receive data on the Pmod CAN: | ||
| + | |||
| + | --> Setup# | ||
| + | |||
| + | - Set CAN control mode to configuration | ||
| + | - Send modify register SPI command (0x05) | ||
| + | - Send the address of the control MCP_CANCTRL (0x0F) | ||
| + | - Send a mask to get things prepared (0x80) | ||
| + | - Send the command to place the module in config mode (0x80) | ||
| + | - Set config rate and clock for CAN | ||
| + | - Send a write SPI command (0x02) | ||
| + | - Send the address of the register to modify followed by the value to set | ||
| + | - Three registers are manipulated in this way with a variety of settings; for more details see Section 4.4 (page 47) in the [[https:// | ||
| + | - CNF1 (0x2A) set to 0x41 | ||
| + | - CNF2 (0x29) set to 0xFB | ||
| + | - CNF3 (0x28) set to 0x86 | ||
| + | - Initiate can buffer filters and registers | ||
| + | - Set the receive filters to either standard or extended identifiers | ||
| + | - For all standard inputs and in the demo code, set registers 0x00 through 0x0B, registers 0x10 through 0x1B, and registers 0x20 through 0x27 to a value of 0x00. The transmit register flags and settings are also all cleared by setting registers 0x30 through 0x3D, 0x40 through 0x4D, and registers 0x50 through 0x5D to a value of 0x00. This can be done for each register by performing the following steps: | ||
| + | - Send a write SPI command (0x02) | ||
| + | - Send the register address of interest | ||
| + | - Send the value to be written (0x00) | ||
| + | - Set the CAN mode for any message type | ||
| + | - Send modify register SPI command (0x05) | ||
| + | - Send the address of the control RXB0CNTRL (0x60) | ||
| + | - Send a mask to get things prepared (0x64) | ||
| + | - Send the actual command to accept any message type (0x60) | ||
| + | - Set CAN control mode to normal mode | ||
| + | - Send modify register SPI command (0x05) | ||
| + | - Send the address of the control MCP_CANCTRL (0x0F) | ||
| + | - Send a mask to get things prepared (0x80) | ||
| + | - Send the actual command to put in config mode (0x00) | ||
| + | |||
| + | < | ||
| + | |||
| + | --> Receive# | ||
| + | - Send the Read Status SPI command (0xA0) to see if any flags have been set. The Pmod will respond with a single byte detailing a number of flags status as follows: | ||
| + | * Bit 7* (MSB) is TX2IF Transmit Buffer 2 Empty interrupt Flag bit (bit 4 in CANINTF (0x2C)), must be cleared by system to be reset | ||
| + | * Bit 6 is TXREQ Message Transmit request bit (bit 3 in TXB2CTRL register 0x50) auto cleared on message sent | ||
| + | * Bit 5* is TX1IF Transmit Buffer 1 Empty interrupt Flag bit (bit 3 in CANINTF (0x2C)), must be cleared by system to be reset | ||
| + | * Bit 4 is TXREQ Message Transmit request bit (bit 3 in TXB1CTRL register 0x40) auto cleared on message sent | ||
| + | * Bit 3* is TX0IF Transmit Buffer 0 Empty interrupt Flag bit (bit 2 in CANINTF (0x2C)), must be cleared by system to be reset | ||
| + | * Bit 2 is TXREQ Message Transmit request bit (bit 3 in TXB0CTRL register 0x30) auto cleared on message sent | ||
| + | * Bit 1* is RX1IF Receive Buffer 1 Empty interrupt Flag bit (bit 1 in CANINTF (0x2C)), must be cleared by system to be reset | ||
| + | * Bit 0* (LSB) is RX0IF Receive Buffer 0 Empty interrupt Flag bit (bit 0 in CANINTF (0x2C)), must be cleared by system to be reset | ||
| + | * *-These interrupt flags are disabled by default in the CAN Interrupt Enable register (address 0x2B) | ||
| + | - If a receive buffer has data in it, determine the length of the message through the four LSBs of the associated DLC register for the receive buffer (0x65 for RXB0DLC and 0x75 for RXB1DLC) | ||
| + | - Reset the interrupt flag that was triggered by clearing bit 0 (RX0IF) or bit 1 (RX1IF) as appropriate in the CANINTF (0x2C) register after reading the data. | ||
| + | |||
| + | <-- | ||
| + | |||
| + | --> Transmit# | ||
| + | - Load data through a Load TX Buffer SPI command. 6 different starting locations are available | ||
| + | * Transmit Buffer 0 starting at the standard identifier high register (0x31) -- 0x40 | ||
| + | * Transmit Buffer 0 starting at the data byte register (0x36) -- 0x41 | ||
| + | * Transmit Buffer 1 starting at the standard identifier high register (ox41) -- 0x42 | ||
| + | * Transmit Buffer 1 starting at the data byte register (0x46) -- 0x43 | ||
| + | * Transmit Buffer 2 starting at the standard identifier high register (ox51) -- 0x44 | ||
| + | * Transmit Buffer 2 starting at the data byte register (0x56) -- 0x45 | ||
| + | - Send a Request-To-Send SPI command for one or more of the three registers of interest | ||
| + | * Transmit buffer 0 (TXB0) uses 0x81 | ||
| + | * Transmit buffer 1 (TXB1) uses 0x82 | ||
| + | * Transmit buffer 2 (TXB2) uses 0x84 | ||
| + | * Multiple transmit buffers can be simultaneously primed by OR'ing the SPI commands | ||
| + | * Note that this command does not actually initiate a message transmission. The MCP25625 still internally goes through arbitration on the bus line and only transmits the message when the bus is available. | ||
| + | - Upon completion, the bit set to indicate to the controller that a message is ready to be transmitted will be cleared and an interrupt will be generated if the TXnIE bit in the CANINTE register is set. | ||
| + | |||
| + | <-- | ||
| + | |||
| + | ===== Application Information ===== | ||
| + | |||
| + | The CAN protocol uses two communication lines, CANH and CANL, to enable communication between multiple CAN transceivers called nodes. The two bus lines are actively driven to produce a differential voltage greater than 1.5 V, resulting in the Dominant transmission state. CAN transceivers will interpret a dominant transmission as a logic low state. A logic high state is created by neither bus driving their lines so that they idle at approximately the same voltage, typically Vcc/2 as biased by the common mode transceiver. This state is a Recessive transmission and typically has a differential voltage of less than ±100 mV. | ||
| + | |||
| + | Similar to [[learn/ | ||
| + | |||
| + | Timing diagrams from page 58 of the [[https:// | ||
| + | |||
| + | {{ : | ||
| + | |||
| + | {{ : | ||
| + | |||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Additional Information ====== | ||
| + | |||
| + | The schematics of the %%Pmod CAN%% are available {{reference: | ||
| + | |||
| + | Example code demonstrating how to get information from the %%Pmod CAN%% can be found on its Resource Center [[pmod: | ||
| + | |||
| + | If you have any questions or comments about the %%Pmod CAN%%, feel free to post them under the appropriate section (" | ||
| + | |||
| + | |||
| + | {{tag> | ||

