How does it work?
MCP2517FD Click as its foundation uses the MCP2517FD and ATA6563, an external CAN FD controller with an SPI interface and a high-speed CAN transceiver from Microchip. The ATA6563, a low-level physical layer IC (PHY), provides a physical connection with the CAN bus itself, while the CAN controller MCP2517FD represents an interface between the MCU and the PHY. The role of the CAN controller is to provide arbitration, message framing, message validation, error detection, message filtering, and more. Among all other tasks, it offers formatted CAN data for the application layer, running on the host MCU.
A high-speed CAN transceiver, the ATA6563, provides a physical connection with the CAN bus. It allows communication speed up to 5Mbps, and supports Normal and Standby operational modes. Normal mode is engaged when the STBY pin, routed on the AN pin of the mikroBUS™ socket, is at the logic low level, while the TXD pin is held to a high logic level. While in the Normal mode, the data can be transmitted and received via the CAN H/L bus lines.
The mode selection can be made by positioning the SMD jumper labeled as STBY to an appropriate position marked as STBY or ON. In Standby mode, if the STBY jumper is set to the STBY position, the user has the option of activating the Standby mode in two ways, where the selection is made by positioning the SMD jumper labeled as STBY SEL to an appropriate position marked as STBY or INT0. This way, the Standby mode can be activated via STBY pin from the mikroBUS™ socket or by the MCP2517FD interrupt signal IN0 (the IN0 pin can also be used to alert the MCU about the TX events).
The MCP2517FD communicates with MCU using the SPI interface. In addition, the user can connect the external TX/RX signals to the CAN FD transceiver and CAN bus signals directly through the onboard headers on the right and left sides of the board. This Click board™ comes equipped with the standard DB-9 connector, making interfacing with the CAN bus simple and easy.
In addition, this Click board™ also uses several pins of the mikroBUS™ socket. The CLKO pin from the MCP2517FD routed to the PWM pin of the mikroBUS™ socket can be used to provide the clock output for the host MCU. It is derived from the input clock generated by the onboard chip oscillators, where the onboard SMD jumpers allow frequency selection between 20MHz and 40MHz. Besides, it also uses two interrupt pins, INT and INT1 routed to the INT and RX pins of the mikroBUS™ socket, respectively. While the INT pin is always an interrupt pin, used to alert the MCU of the enabled interrupt event, the INT1 pin alert the MCU about the RX events (if these interrupts are enabled).
This Click board™ can operate with both 3.3V and 5V logic voltage levels selected via the VIO SEL jumper. This way, it is allowed for both 3.3V and 5V capable MCUs to use the communication lines properly. However, the Click board™ comes equipped with a library containing easy-to-use functions and an example code that can be used, as a reference, for further development.
Specifications
Type
CAN,CAN FD
Applications
Can be used for developing a wide range of automotive diagnostic applications, even on MCUs that don’t support CAN interface
On-board modules
MCP2517FD – external CAN FD controller with an SPI interface from Microchip
ATA6563 – high-speed CAN transceiver from Microchip
Key Features
Expands the existing MCU with the reliable and robust CAN connectivity option, support for both CAN 2.0B and CAN FD frames, high speed CAN communication up to 5 Mbps, integrated DE-9 connector, oscillator selection, and more
Interface
GPIO,PWM,SPI
Feature
No ClickID
Compatibility
mikroBUS™
Click board size
L (57.15 x 25.4 mm)
Input Voltage
3.3V or 5V
Pinout diagram
This table shows how the pinout on MCP2517FD click corresponds to the pinout on the mikroBUS™ socket (the latter shown in the two middle columns).
Onboard settings and indicators
Label | Name | Default | Description |
---|---|---|---|
LD1 | PWR | – | Power LED Indicator |
JP1-JP2 | – | Right | External Crystal Selection 20MHz/40MHz: Left position 20MHz, Right position 40MHz |
JP3 | VIO SEL | Left | Logic Level Voltage Selection 3V3/5V: Left position 3V3, Right position 5V |
JP4 | STBY | Right | Operational Mode Selection STBY/ON: Left position STBY, Right position ON |
JP5 | STBY SEL | Left | Standby Mode Control Selection STBY/INT0: Left position STBY, Right position INT0 |
J1 | – | Unpopulated | External RXCAN/TXCAN Header |
J2 | – | Unpopulated | External CANH/CANL Header |
MCP2517FD Click electrical specifications
Description | Min | Typ | Max | Unit |
---|---|---|---|---|
Supply Voltage | 3.3 | – | 5 | V |
Data Rate | – | – | 5 | Mbps |
Operating Temperature Range | -40 | +25 | +120 | °C |
Software Support
We provide a library for the MCP2517FD Click on our LibStock page, as well as a demo application (example), developed using MikroElektronika compilers. The demo can run on all the main MikroElektronika development boards.
Library Description
Library offers a choice to exchange messages with the other device by using CAN communication. Library also offers a choice to access a control, status and RAM registers of the device. For more details check documentation.
Key functions:
void MCP2517FD_transmitMessage( uint8_t numDataBytes, uint8_t *transmitFlag, uint8_t *dataIn )
– Transmits the desired message and checks is message successfully sent.void MCP2517FD_receiveMessage( uint8_t *receiveFlag, uint8_t *dataOut )
– Receives the message and checks is message successfully received.int8_t MCP2517FD_Configure(T_MCP2517FD_id index, T_MCP2517FD_cfg* config)
– CAN Control register configuration.int8_t MCP2517FD_ConfigureObjectReset(T_MCP2517FD_cfg* config)
– Reset Configure object to reset values.
Examples description
The application is composed of three sections :
- System Initialization – Initializes peripherals and pins.
- Application Initialization – Initializes SPI interface and performs the device configuration to work properly.
- Application Task – (code snippet) – Always checks is a new message in FIFO ready for receiving and when is message ready, receives a message from the other device. Also in this example we can send the desired message via CAN communication to the other device. We can choose a message to be sent by sending the determined command to the UART. In this example the command can be number from 1 to 7.
void applicationTask() { if (UART_Rdy_Ptr()) { rxDat = UART_Rd_Ptr(); chPtr = &txd[0]; switch (rxDat) { case '1' : { _strcpy( chPtr, &txtMessage1[0] ); MCP2517FD_transmitMessage( 5, &checkFlag, &txd[0] ); if (checkFlag == 1) { mikrobus_logWrite( "Message Sent", _LOG_LINE ); } break; } case '2' : { _strcpy( chPtr, &txtMessage2[0] ); MCP2517FD_transmitMessage( 7, &checkFlag, &txd[0] ); if (checkFlag == 1) { mikrobus_logWrite( "Message Sent", _LOG_LINE ); } break; } case '3' : { _strcpy( chPtr, &txtMessage3[0] ); MCP2517FD_transmitMessage( 2, &checkFlag, &txd[0] ); if (checkFlag == 1) { mikrobus_logWrite( "Message Sent", _LOG_LINE ); } break; } case '4' : { _strcpy( chPtr, &txtMessage4[0] ); MCP2517FD_transmitMessage( 4, &checkFlag, &txd[0] ); if (checkFlag == 1) { mikrobus_logWrite( "Message Sent", _LOG_LINE ); } break; } case '5' : { _strcpy( chPtr, &txtMessage5[0] ); MCP2517FD_transmitMessage( 3, &checkFlag, &txd[0] ); if (checkFlag == 1) { mikrobus_logWrite( "Message Sent", _LOG_LINE ); } break; } case '6' : { _strcpy( chPtr, &txtMessage6[0] ); MCP2517FD_transmitMessage( 3, &checkFlag, &txd[0] ); if (checkFlag == 1) { mikrobus_logWrite( "Message Sent", _LOG_LINE ); } break; } case '7' : { _strcpy( chPtr, &txtMessage7[0] ); MCP2517FD_transmitMessage( 7, &checkFlag, &txd[0] ); if (checkFlag == 1) { mikrobus_logWrite( "Message Sent", _LOG_LINE ); } break; } default : { break; } } } MCP2517FD_receiveMessage( &checkFlag, &rxd[0] ); if (checkFlag == 1) { chPtr = &rxd[0]; mikrobus_logWrite( "Received Message : ", _LOG_TEXT ); mikrobus_logWrite( chPtr, _LOG_LINE ); } }
The full application code, and ready to use projects can be found on our LibStock page.
Other mikroE Libraries used in the example:
- SPI
- UART
Additional notes and informations
Depending on the development board you are using, you may need USB UART click, USB UART 2 click or RS232 click to connect to your PC, for development systems with no UART to USB interface available on the board. The terminal available in all MikroElektronika compilers, or any other terminal application of your choice, can be used to read the message.
mikroSDK
This Click board™ is supported with mikroSDK – MikroElektronika Software Development Kit. To ensure proper operation of mikroSDK compliant Click board™ demo applications, mikroSDK should be downloaded from the LibStock and installed for the compiler you are using.
For more information about mikroSDK, visit the official page.