2.2.2 Application Demo on CAN Protocol (CAN-FD) with LCD on SAMA5D29 Curiosity Development Board
Description
The demonstration of this application showcases a user interface for a vehicle dashboard, integrated with CAN-FD. The dashboard features a gauge that displays the engine's RPM (revolutions per minute) and the vehicle's speed. The metrics, which are acquired through CAN-FD, are graphically displayed on the Legato dashboard. Upon reception of data on CAN-FD, the Blue LED will flash.
Key Highlights of SAMA5D29 Curiosity Development Board
- External Non-Volatile Memories like QSPI, SD, and micro-SD card interfaces.
- Additional sensors can be interfaced using click boards through an on-board mikroBUS connector.
- Two mechanical programmable buttons.
- One User Input Switch and one RGB LED.
- UART, USB, CAN, Ethernet, Audio and JTAG.
- LCD and ISC camera.
- Raspberry pi connectors.
Modules/Technology Used
- Peripheral Modules
- Maxtouch Controller Interface
- LCDC display driver
- TWIHS0
- TC0
- UART0
- MCAN0
Hardware Used
- SAMA5D29 Curiosity development board
- High-Performance WVGA LCD Display Module with maXTouch ® Technology
- ATA6563 mikroBUS click board
- Ribbon Cable - awm 20624 cable 80c 60v vw-1
- PCAN-USB opto-decoupled - IPEH-002022
- PCAN-CABLE-2 - IPEK-003001
- Micro-SD Card
Software/Tools Used
This project has been verified to work with the following versions of software tools:
Refer Project Manifest present in harmony-manifest-success.yml present in harmony-manifest-success.yml under the project folder firmware/src/config/sam_a5d29_cu to know the MPLAB® X IDE, MCC, libraries version.
Hardware Setup
- A modification to the hardware is necessary for the MCAN0 communication interface on the SAMA5D29 Curiosity Development Board. Follow the steps outlined in the Hardware Modifications to enable MCAN communications section.
- Plug the ATA6563 mikroBUS click 1 board to J19 (mikroBUS 1) of the SAMA5D29 Curiosity Development Board.
- Connect the ribbon cable from the display to the J23 connector of the SAMA5D29 Curiosity Development Board.
- Connect the PCAN Cable between the ATA6563 mikroBUS Click on D9 connector and PCAN USB on D9 connector.
- Remove/Open the jumper from J10 to disable QSPI boot and J14 to disable ETHERNET.
- Power up the board by connecting the powered USB type-C cable to the USB port J1 on the SAMA5D29 curiosity development board.
- Connect USB-TTL cable to J28 (UART DEBUG).
- Connect external JTAG debugger at
J27 (JTAG connector).
PCAN-View Configuration:
- Download the PCAN-view and install it in PC.
- Open PCAN-view then Connect window will appear.
- Navigate to the CAN Setup tab and
configure it as illustrated in the below image.
- Navigate to the Acceptance filter tab and configure it as illustrated in the
below image. Once done, click OK to complete the connection setup.
- Create a new message to transmit
from PCAN. Click on the mail icon to compose new transmit message.
- Start the CAN-FD Communication.
Programming/Debugging Application Project on MPLAB® X IDE
- Open the project (sama5d29_curiosity_dev_board/sama5d29_cu_legato_db_mcan/firmware/legato_db_mcan_sam_a5d29_cu_tm5000.X) in MPLAB® X IDE.
- Right click on the project and
click Properties. For Connected Hardware Tool -> select
connected external hardware debugger, for Compiler Toolchain -> select
XC32 and click Apply.
- From J-Link , in Option categories choose Communication and for
JTAG Method, select 4-wire JTAG.
- Select Bootstrap for Categories
and select the Use Bootstrap checkbox. For bootstrap file, select
the at91bootstrap elf file from
reference_apps_sam_mpu\apps\sama5d29_curiosity_dev_board\sama5d29_curiosity_lcd_can_fd\firmware\sama5d29_cu.X.
Click on Apply and OK.
- Clean and build the project. The user should see a message on the output console that the project was successfully built.
- Debug the code by clicking on the Debug button in MPLAB® X IDE tool bar.
- Run the application by clicking Run button in MPLAB® X IDE tool bar.
- Open the Terminal application (Ex.: Tera term) on the computer.
- Connect to the DEBUG/J-link Virtual COM port and configure the serial settings
as follows:
- Baud Rate : 115200
- Data : 8 Bits
- Parity : None
- Stop : 1 Bit
- Flow Control : None
If the steps are executed in this sequence, the final output in the consoles and LCD will be as below:
- Transmit the data from PCAN to MCAN0. Upon each receipt of CAN-FD data, the blue
LED will intermittently blink to indicate successful reception.
Running the Pre-built Harmony Application from macro-SD Card
The pre-built application bin file can be programmed by following the below steps:
- Take a micro-SD Card formatted with FAT32 file system.
- Copy the boot.bin and harmony.bin files from this reference_apps_sam_mpu\apps\sama5d29_curiosity_dev_board\sama5d29_curiosity_lcd_can_fd\hex to the micro-SD card using the PC.
- Insert the macro-SD card to J6 on the SAMA5D29 Curiosity development board.
- Perform a reset by pressing RESET button on the SAMA5D29 Curiosity Development Board.
- Transmit the data from PCAN to
MCAN0. Upon each receipt of CAN-FD data, the blue LED will intermittently blink
and Gauge movement can be observed accordingly on the legato dashboard in the
LCD display.
Comments
- This application demo builds and
works by following the instructions above in Running the Demo section. If
the user needs to enhance/customize this application demo, should use the MPLAB
Harmony v3 Software framework. Refer links below to setup and build the
applications using MPLAB Harmony.
- How to Setup MPLAB Harmony v3 Software Development Framework
- How to Build an Application by Adding a New PLIB, Driver, or Middleware to an Existing MPLAB Harmony v3 Project
- SAMA5D2 Series Boot Process
- MPLAB® Harmony v3 is also configurable through MPLAB® Code Configurator (MCC). Refer to the below links for specific instructions to use MPLAB® Harmony v3 with MCC.
- Microchip Graphics Composer
- Click Here for more graphics demos
- How to Set up the Tools Required to Get Started with MPLAB® Harmony v3 and MCC
- MPLAB® Harmony v3 Graphics Example Applications at MPLAB® Discover
- Getting Started with Graphics on SAM9X60 Curiosity Development Board Video