ST STM32F103 Series Application Note
ST STM32F103 Series Application Note

ST STM32F103 Series Application Note

Implementing the adpcm algorithm in high-density microcontrollers
Hide thumbs Also See for STM32F103 Series:

Advertisement

AN2931
Application note
Implementing the ADPCM algorithm
in high-density STM32F103xx microcontrollers
Introduction
This application note describes the ADPCM audio firmware codec, and provides a
demonstration firmware showing how to play ADPCM files using the high-density
2
STM32F103xx I
S feature with an external DAC.
This application note is based on "AN2739: How to use the high-density STM32F103xx
2
microcontroller to play audio files with an external I
S audio codec". The features linked to
2
the SPI, I
S and the external DAC will be skipped here because they are already explained
in AN2739. It is therefore highly recommended to refer to AN2739 to fully understand this
application note.
April 2009
Doc ID 15349 Rev 2
1/15
www.st.com

Advertisement

Table of Contents
loading
Need help?

Need help?

Do you have a question about the STM32F103 Series and is the answer not in the manual?

Questions and answers

Summary of Contents for ST STM32F103 Series

  • Page 1 S and the external DAC will be skipped here because they are already explained in AN2739. It is therefore highly recommended to refer to AN2739 to fully understand this application note. April 2009 Doc ID 15349 Rev 2 1/15 www.st.com...
  • Page 2: Table Of Contents

    Contents AN2931 Contents ADPCM algorithm ......... . . 5 General overview .
  • Page 3 AN2931 List of tables List of tables Table 1. ADPCM algorithm functions ..........6 Table 2.
  • Page 4 List of figures AN2931 List of figures Figure 1. ADPCM file generator ............8 Figure 2.
  • Page 5: Adpcm Algorithm

    AN2931 ADPCM algorithm ADPCM algorithm General overview Adaptive differential pulse-code modulation, or simply ADPCM, is an audio algorithm for waveform coding, which consists in predicting the current signal value from previous values, and transmitting only the difference between the real and the predicted value. In plain pulse-code modulation (PCM), the real or actual signal value is transmitted.
  • Page 6: Adpcm Algorithm Functions

    ADPCM algorithm AN2931 ADPCM algorithm functions Table 1 describes the ADPCM functions. Table 1. ADPCM algorithm functions Function name Description Encodes a 16-bit PCM sample into a 4-bit ADPCM sample. ADPCM_Encode Decodes a 4-bit ADPCM sample into a 16-bit PCM sample. ADPCM_Decode 1.3.1 ADPCM_Encode function...
  • Page 7: Table 3. Adpcm_Decode Function

    AN2931 ADPCM algorithm Table 3. ADPCM_Decode function Function name ADPCM_Decode Prototype int16_t ADPCM_Decode(uint8_t code); Behavior description Decodes a 4-bit ADPCM sample into a 16-bit PCM sample Code: an 8-bit data item whose 4 LSBs contain the encoded ADPCM Input parameter sample Output parameter None...
  • Page 8: Implementation Example

    PCM file into the ADPCM format using a PC software (This software is called muse.exe, and was developed by ST. It implements the same ADPCM algorithm encoder as the one that runs on STM32F103xx performance line devices. muse.exe is...
  • Page 9: Adpcm File Loading

    AN2931 Implementation example If you run the Muse.exe program and press the Source File Browse button, the File Selection dialog appears, prompting you to select a WAV source file. As mentioned before, the WAV file should meet the following requirements: ●...
  • Page 10: Figure 2. Dfu File Manager

    Implementation example AN2931 Figure 2. DFU File Manager The NOR Flash memory is mapped on the FSMC interface from address 0x6400 0000, which is the start address of the ADPCM file storage area. So, you have to set the address of the .dfu image to 0x6400 0000 (see Figure 3).
  • Page 11: Adpcm File Playing

    AN2931 Implementation example Figure 4. DfuSe software Select the NOR Flash memory as target, then click on the Choose button located in the Upgrade or Verify Action area to select your ADPCM DFU image. Finally, click on Upgrade to perform the download. ADPCM file playing At this point, you have succeeded in loading the ADPCM file into the NOR Flash memory.
  • Page 12 Implementation example AN2931 Note that to rewind and forward through the audio file, you have to use the joystick buttons as follows: ● push the joystick to the right to forward ● push the joystick to the left to rewind 12/15 Doc ID 15349 Rev 2...
  • Page 13: Conclusion

    AN2931 Conclusion Conclusion This application note describes how to implement the IMA ADPCM firmware audio codec dedicated to STM32F103xx devices. It also provides an example of use that consists in decoding an ADPCM-encoded audio stream stored in a Flash memory, and playing back the decoded samples.
  • Page 14: Revision History

    Revision history AN2931 Revision history Table 4. Document revision history Date Revision Changes 04-Mar-2009 Initial release. In code, u8 and s16 updated to uint8_t and int16_t, 30-Apr-2009 respectively. 14/15 Doc ID 15349 Rev 2...
  • Page 15 No license, express or implied, by estoppel or otherwise, to any intellectual property rights is granted under this document. If any part of this document refers to any third party products or services it shall not be deemed a license grant by ST for the use of such third party products or services, or any intellectual property contained therein or considered as a warranty covering the use in any manner whatsoever of such third party products or services or any intellectual property contained therein.

Table of Contents