2.3.2 Snake Game Application on SAM9X60 Curiosity Development Board + High-Performance WVGA LCD Display Module with maXTouch Technology using Microchip Graphics Composer

Download

Description

This demonstration represents the classic snake game wherein the player maneuvers the snake and tries to eat the mice (food), which eventually grows the length of the snake. The player needs to protect the snake from hitting the boundary.

The application uses the Legato Graphics library to implement the user interface on SAM9X60 Curiosity Development board. The template of each screen is made using the Microchip Graphics Composer, while the snake is created using rectangle widgets used inside a double chained list. Player can change the direction of the snake by swiping left, right, up, and down on the maXTouch® display.

Key Highlights of SAM9X60 Curiosity Development Board

  • LCD Interface.
  • External Non-Volatile Memories like NAND, SD, and MicroSD 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 and CAN Interfaces.
  • Raspberry pi connectors.

Modules/Technology Used

Peripheral Modules:

  • Maxtouch Controller Interface
  • LCDC display driver
  • Flexcom (TWI/I2C)
  • TC0

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 under the project folder firmware/src/config/default to know the MPLAB® X IDE, MCC, libraries version.

Setup

  • Connect the ribbon cable from the display to the J13 connector of the SAM9X60 Curiosity Development Board.
  • Power up the board by connecting the powered USB cable to the USB port J1 on the SAM9X60 curiosity development board.
  • Connect external J32 debugger at J12.

Programming/Debugging Application Project on MPLAB® X IDE

  1. Open the project (sam9x60_curiosity_dev_board/sam9x60_cu_snake_game/firmware/sam9x60_cu.X) in MPLAB® X IDE.
  2. 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.
  3. From J-Link, in Option categories choose Communication and for JTAG Method, select 4-wire JTAG.
  4. Select Bootstrap for Categories and select the Use Bootstrap checkbox. For bootstrap file, select the at91bootstrap elf file from the project directory. Click on Apply and OK.
  5. Clean and build the project. The user should see a message on the output console that the project was successfully built.
  6. Debug the code by clicking on the Debug button in MPLAB® X IDE tool bar.
  7. Run the application by clicking Run button in MPLAB® X IDE tool bar.
  8. A splash screen should appear followed by the Menu screen.
  9. Select the level from the menu screen by touching the level button on the display.
  10. Swipe left, right, up or down on the display to change the snake direction in order to reach the food.
  11. By pressing the User Switch user can go back to the Menu.

Running the Pre-built Harmony Application from SD Card

The pre-built application bin file can be programmed by following the below steps:

Steps to program the bin file on SD card:

  1. Take a micro-SD Card formatted with FAT32 file system.
  2. Copy the boot.bin and harmony.bin files from sam9x60_cu_snake_game/hex folder to the micro-SD card using the PC.
  3. Insert the SD card to J3 on the SAM9X60 Curiosity development board.

Steps to run the bin file from SD card:

  1. Perform a reset by pressing RESET button on the SAM9X60 Curiosity Development Board.
  2. After the board powers up, a splash screen should appear followed by the Menu screen.
  3. Select the level from the menu screen by touching the level button on the display.
  4. Swipe left, right, up or down on the display to change the snake direction in order to reach the food.
  5. By pressing the User Switch user can go back to the Menu.

Comments

This application demo builds and works out of box 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.