Link Search Menu Expand Document

SD Card GFX Audio Player Application on Curiosity PIC32MZ EF 2.0 Development Board

Download


Description:

The demonstration application creates an audio player that reads audio files (.WAV format only) from an SD card mounted on the click interface. The audio is played through the CODEC placed on the X32 header interface. It also provides feature to switch to the next track on the media.

The sdcard_player application plays .wav files from the SD Card. The SD Card driver uses the SPI driver to interact with the SD Card. The application uses the File System Service to read/write data on the SD Card. The audio data read from the SD card is decoded by passing it to the WAV decoder. The decoded output is saved in the output buffers 1 and 2 which are used in ping pong manner. The output buffers 1 and 2 are submitted to the Codec driver for playing. The Codec is configured for 16-bit data and 48 kHz sampling frequency. The Codec driver sends the audio data to the AK4954 Codec using the I2S driver, which in turn uses DMA to transfer the audio data. The Codec driver uses the I2C driver to send commands to the AK4954 Codec.

The application displays audio track from the SD card. It also provides volume increase/decrease scroll bar, Play/Pause button, Next Track button, Previous Track button.

Modules/Technology Used:

  • Peripheral Modules
    • Core Timer
    • DMA
  • Driver Modules
    • I2S driver
    • SDSPI driver
    • AK4954 Codec driver
  • System Service Libraries
    • File System
  • WAV Audio decoder

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/pic32mzef_c2_ak4954

Because Microchip regularly update tools, occasionally issue(s) could be discovered while using the newer versions of the tools. If the project doesn’t seem to work and version incompatibility is suspected, It is recommended to double-check and use the same versions that the project was tested with. To download original version of MPLAB Harmony v3 packages, refer to document How to Use the MPLAB Harmony v3 Project Manifest Feature

Setup:

  • Mount the microSD click board on the mikro bus 1 interface (J301, J302) on Curiosity PIC32MZ EF 2.0 Development Board
  • Insert a micro SD card into the microSD click board card slot. Ensure that the SD card contains WAV audio files
  • Mount the PIC32 Audio Codec Daughter Card - AK4954 on X32 HEADER 2 on Curiosity PIC32MZ EF 2.0 Development Board
  • Connect speaker or headphone to the headphone out (HP OUT) connector (Yellow colour) on top of the PIC32 Audio Codec Daughter Card - AK4954
  • Attach the 565 LCD Adapter Graphics Card to the GFX Connector on the Curiosity PIC32MZ EF 2.0 Development Board
  • Connect the ribbon cable from the High-Performance 4.3” WQVGA Display module to the ribbon connector on the 565 LCD Adapter Graphics Card.
  • Power the Curiosity PIC32MZ EF 2.0 Development Board from a Host PC through a Type-A male to micro-B USB cable connected to Micro-B port (J700)

Programming hex file:

The pre-built hex file can be programmed by following the below steps.

Steps to program the hex file

  • Open MPLAB X IDE
  • Close all existing projects in IDE, if any project is opened.
  • Go to File -> Import -> Hex/ELF File
  • In the “Import Image File” window, Step 1 - Create Prebuilt Project, Click the “Browse” button to select the prebuilt hex file.
  • Select Device has “PIC32MZ2048EFM144”
  • Ensure the proper tool is selected under “Hardware Tool”
  • Click on Next button
  • In the “Import Image File” window, Step 2 - Select Project Name and Folder, select appropriate project name and folder
  • Click on Finish button
  • In MPLAB X IDE, click on “Make and Program Device” Button. The device gets programmed in sometime
  • Follow the steps in “Running the Demo” section below

Programming/Debugging Application Project:

  • Open the project (sdcard_player\firmware\pic32mz_ef_curiosity_v2.X) in MPLAB X IDE
  • Ensure “Curiosity/Starter Kits (PKOB4)” is selected as hardware tool to program/debug the application
  • Build the code and program the device by clicking on the “make and program” button in MPLAB X IDE tool bar
  • Follow the steps in “Running the Demo” section below

Running the Demo:

Revision:

  • v1.6.0 - Added Graphics support, regenerated and tested application.
  • v1.5.0 - Removed MHC support, Regenerated and tested application.
  • v1.4.0 - Added MCC support, Regenerated and tested application.
  • v1.3.0 - Regenerated and tested application.
  • v1.2.0 - Regenerated and tested application
  • v1.1.0 - Regenerated and tested the demo application
  • v1.0.0 - Released demo application


Copyright © 2020 Microchip Technology.