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

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

  1. 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.
  2. Plug the ATA6563 mikroBUS click 1 board to J19 (mikroBUS 1) of the SAMA5D29 Curiosity Development Board.
  3. Connect the ribbon cable from the display to the J23 connector of the SAMA5D29 Curiosity Development Board.
  4. Connect the PCAN Cable between the ATA6563 mikroBUS Click on D9 connector and PCAN USB on D9 connector.
  5. Remove/Open the jumper from J10 to disable QSPI boot and J14 to disable ETHERNET.
  6. Power up the board by connecting the powered USB type-C cable to the USB port J1 on the SAMA5D29 curiosity development board.
  7. Connect USB-TTL cable to J28 (UART DEBUG).
  8. 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:

Steps to program the bin file on macro-SD card:
  • 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.
Steps to run the bin file from macro-SD card:
  • 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