Information Center for ARM

Example description

  
I2S_AUDIO  How to use the Audio features with I2S peripheral
  
Example Description 

This example provides basic implementation of audio features.
It allows to play an audio file through the I2S peripheral and using the external
codec implemented on the STM322xG-EVAL board.

In this example the I2S input clock, provided by a dedicated PLL (PLLI2S),  is
configured to have an audio sampling frequency at 48 KHz with Master clock enabled.

This example uses an audio codec driver which consists of three independent layers:
 - Codec Hardware layer: which controls and communicates with the audio codec 
   (CS43L22) implemented on the evaluation board.
 - MAL (Media Access Layer): which controls and interfaces with storage media 
   storing or providing the audio file/stream.
 - The high layer: which implements overall control and interfacing API allowing
   to perform basic audio operations (Init, Play, Pause, Resume, Stop, Volume 
   control and audio file pointer management)
  
In this example the audio file is stored in the internal flash memory (Stereo, 
16-bit, 48 KHz). The analog output device is automatically detected (Speaker or 
Headphone) when the Headphone is plugged/unplugged in/from the audio jack of the 
evaluation board. The example also manages information display and control interface
through push buttons: 
 - When the application is Playing audio file:
     + Key   : Pause
     + Tamper: Volume UP
     + Wakeup: Volume DOWN
 - When the application is Paused:
     + Key   : Play
     + Tamper: Switch output target to Headphone
     + Wakeup: Switch output target to Speaker

This example plays the audio file stored in internal flash memory and replay it
when it reach end of file. But it can be tailored to used different media storage
devices; SDCard (through SDIO), external Memory (through FSMC) ...) or to play 
in streaming mode (ie. from USB port in device or host mode). In this case, Circular
DMA mode should be preferred (by enabling the define AUDIO_MAL_MODE_CIRCULAR in
stm322xg_eval_audio_codec.h file).  

List of Known Limitations and more detailed user notes are provided in file 
stm322xg_eval_audio_codec.c   (under Utilities\STM32_EVAL\STM322xG_EVAL)

The provided sample audio file (stored in internal flash memory) is extracted from:
 - Title: artofgardens-instr 
 - Artist/Composer: Dan O'Connor
 - Creative Commons license: Attribution 3.0 United States
   Please read the license following this link:
   http://creativecommons.org/licenses/by/3.0/us/

Directory contents 

  - I2S/Audio/system_stm32f2xx.c   STM32F2xx system clock configuration file
  - I2S/Audio/stm32f2xx_conf.h    Library Configuration file
  - I2S/Audio/stm32f2xx_it.c      Interrupt handlers
  - I2S/Audio/stm32f2xx_it.h      Interrupt handlers header file
  - I2S/Audio/main.c              Main program
  - I2S/Audio/audio_sample.c      Audio Sample file (in tab format)

	  The "system_stm32f2xx.c" is generated by an automatic clock configuration 
      tool and can be easily customized to your own configuration. 
      To select different clock setup, use the "STM32F2xx_Clock_Configuration_V1.0.0.xls" tool. 

Hardware and Software environment 

  - This example runs only on STM32F2xx Devices Revision B and Revision Y. 
  
  - This example has been tested with STM322xG-EVAL RevB (with no additional
    hardware), and can be easily tailored to any other development board.

  - STM322xG-EVAL Set-up 
    - Make sure the jumper JP16 is in position 2<->3