Processor SDK RTOS MCASP

From Texas Instruments Wiki
Jump to: navigation, search

View source for Processor SDK RTOS MCASP ← Processor SDK RTOS MCASP You do not have permission to edit this page, for the following reason:

The action you have requested is limited to users in one of the groups: Users, Approvers, ControlGroup.

You can view and copy the source of this page:



RTOS Software Developer Guide MCASP



Overview

User Interface

Application

Debug

Introduction

The multichannel audio serial port (McASP) functions as a general-purpose audio serial port optimized for the needs of multichannel audio applications. The McASP is useful for time-division multiplexed (TDM) stream, Inter-Integrated Sound (I2S) protocols, and intercomponent digital audio interface transmission (DIT).The multichannel buffered serial port (McASP) peripheral allows direct interface to other TI DSPs, codecs, and other devices in a system. The following sub sections explain the hardware (McASP peripheral) and software context of the McASP LLD.

The device driver exposes a set of well-defined APIs which are used by the application layer to send and receive data via the McASP peripheral. The driver also exposes a set of well-defined OS abstraction APIs which are used to ensure that the driver is OS independent and portable. The McASP driver uses the CSL McASP register layer for all McASP MMR access. The McASP driver also interfaces with the EDMA3 library to be able to transfer data to and from McASP peripheral and data memory.

Driver Configuration

The McASP driver provides a sample implementation sequence which initializes the MCASP IP block. The McASP Device initialization API is implemented as a sample prototype:

void McaspDevice_init (void)

The function initializes all the instance specific information like base address of instance CFG registers, FIFO address for the instance, TX and RX CPU event numbers, TX and RX EDMA event numbers etc.

For details about individual fields of this structure, see the Doxygen help by opening PDK_INSTALL_DIR\Packages\ti\drv\mcasp\docs\doxygen\html\index.html.

 int32_t Mcasp_socGetInitCfg(uint32_t index, Mcasp_HwInfo *cfg)

The function obtains the soc configuration parameters such as interrupt numbers, mux configuration parameters etc.

 int32_t Mcasp_socSetInitCfg(uint32_t index, const Mcasp_HwInfo *cfg)

The function set the soc configuration parameters such as interrupt numbers, mux configuration parameters etc.

APIs

Refer to below API files:

#include <ti/drv/mcasp/mcasp_drv.h>
#include <ti/drv/mcasp/soc/mcasp_soc.h>

McASP Buffer formats

The McASP driver provides various buffer formats for sending the data to/from the audio device. The differences between these formats arise from the way the audio samples are collected from various serializers and their timeslots and arranged in the system's memory. This way the application can choose to run audio processing algorithms over the data without the need for re-arranging those data every frame. The buffer format is provided in the Mcasp_ChanParams.dataFormat in the form of Mcasp_BufferFormat defined in mcasp_drv.h The below section provides an overview of the various formats. In the explanatory diagrams in each section, McASP controller recieves samples in frame intervals denoted by t1,t2..tn. The McASP driver collects these and arranges those samples in the memory in various formats in to the host's System memory. We have chosen 32 bit samples and 32-bit word addresses throughout for simplicity.

Mcasp_BufferFormat_1SER_1SLOT

This is applicable if only one serializer and one timeslot is used. The samples are ordered in the order they received or sent.

1SLOT 1SER.PNG

Mcasp_BufferFormat_1SER_MULTISLOT_INTERLEAVED

This is applicable if multiple slots are used with one serializer. The samples from the different timeslots are stored interleaved in the memory as below. Different timeslots' samples are denoted by different colors and are labelled t1,t2..tn according to the time they arrive at the serializer.

1SER MULTISLOT INTERLEAVED.PNG

Mcasp_BufferFormat_1SER_MULTISLOT_NON_INTERLEAVED

This is applicable if multiple slots are used with one serializer. The samples from the different timeslots are grouped together on the basis of the timeslot and stored in the memory as shown below. Different timeslots' samples are denoted by different colors and are labelled t1,t2..tn according to the time they arrive at the serializer.

1SER MULTISLOT NON INTERLEAVED.PNG

NOTE: if the non-interleaved format is used, the Mcasp_ChanParams-> hwFifoEventDMARatio must be set to 1.

Mcasp_BufferFormat_MULTISER_1SLOT_SER_INTERLEAVED

This is applicable if multiple serializers are used with one time slot is used for each of the serializers. The samples from the different serializers are stored in the memory in interleaved fashion as shown below Different serializers' samples are denoted by different colors and are labelled S1,S2..Sn according to the time they arrive at the serializer.

1SER MULTISER 1SLOT SER INTERLEAVED 2.PNG


Mcasp_BufferFormat_MULTISER_1SLOT_SER_NON_INTERLEAVED

This is applicable if multiple serializers are used with one timeslots each per serializer. The samples from the different timeslots are grouped together on the basis of the serializer and stored in the memory as shown below Different serializers' samples are denoted by different colors and are labelled S1,S2..Sn according to the time they arrive at the serializer.

1SER MULTISER 1SLOT SER NON INTERLEAVED.PNG

Mcasp_BufferFormat_MULTISER_MULTISLOT_SEMI_INTERLEAVED_1

This is applicable if multiple serializers are used and each serializer containing multiple timeslots. The samples are stored in the memory interleaved based on serializer and timeslots as shown below. In this example, there are 3 serializers and 2 timeslots per serializers whose samples are noted by Ln (left) and Rn (right). Different serializers' samples are denoted by different colors.

700px

Mcasp_BufferFormat_MULTISER_MULTISLOT_SEMI_INTERLEAVED_2

This is applicable if multiple serializers are used and each serializer containing multiple timeslots. The samples are grouped based on the serializer and within one serializer, the timeslots are interleaved as shown below. In this example, there are 3 serializers and 2 timeslots per serializers whose samples are noted by Ln (left) and Rn (right).Different serializers' samples are denoted by different colors.

1SER MULTISER MULTISLOT SEMI INTERLEAVED 2.PNG

NOTE: if the non-interleaved format is used, the Mcasp_ChanParams-> hwFifoEventDMARatio must be set to 1.

Mcasp WordBits Selection

With all the frame formats explained above, there is an option to choose which bits to pack from the 32-bit serializer data obtained from/to the McASP serializer, when the word size is less than the slot size. This option is exercised by setting the Mcasp_chanParams->wordBitsSelect to Mcasp_wordBitsSelect_LSB/Mcasp_wordBitsSelect_MSB.

If the default Mcasp_wordBitsSelect_LSB option is selected, the LSBs are packed in to the system memory.

Below is an example of word size = 16bits and slot size = 32 bits and the Mcasp_wordBitsSelect_LSB option is used. On the receiving side, the serializer holds the 32 bit data whose LSB 16 bits are picked up and packed in to the system memory. The MSB 16 bits are ignored.

WordSelect LSB.PNG

If the Mcasp_wordBitsSelect_MSB option is used, the serializer's MSB-16bits are packed in to the system memory. The LSBs are ignored.

WordSelect MSB.PNG


Example

Name
Description
Expected Results
AIC31 Stereo loopback

Example demonstrating sample McASP loopback . Reference example for developers

Audio sent in to the EVM being played out via the stereo output of the EVM

Device loopback

Example demonstrating sample McASP device loopback . Reference example for developers

Digital ramp pattern sent to McASP and getting looped back internally using device loopback

AudioEQ example

Example demonstrating stereo audio equalization using using biquad filters . Reference design for developers. TI Design Guide: TIDEP0069

Three band Equalization of stereo channel using biquad filters with gain control using serial console inputs

Introduction

The sample application demonstrates the use of the MCASP driver for audio playback. The application uses McASP LLD, and programs the AIC codec on the EVM to send and receive the audio input. The audio received from the AIC codec is loop back-ed at the application and sent back to the AIC codec via MCASP LLD.

Audio test setup

Please ensure the below before running the demo

  1. Connect the EVM’s stereo audio input to the PC’s stereo audio output
  2. Connect the EVM’s stereo audio output to powered speakers. Please make sure the amplification on the speakers is high enough for the audio output to be heard

Building and running the Example

  1. Run pdkProjectCreate to create the MCASP_Audio_<evm>_<device>ExampleProject
  2. Load the project on to CCS and build the same.
  3. Build the example
  4. Load the MCASP_Audio_<evm>_<device>ExampleProject
  5. Run the example

Testing the example

  1. Play an audio file on the PC.
  2. You should be able to hear the same audio on the speakers connected to the EVM. It is the PC’s audio output which is loop backed at the EVM’s MCASP example outputted to the speakers.

NOTE: Please make sure the speakers’ output volume is high enough for the audio to be audible.

Additional References

Document Location
API Reference Manual $(TI_PDK_INSTALL_DIR)\packages\ti\drv\mcasp\docs\doxygen\html\index.html
Release Notes $(TI_PDK_INSTALL_DIR)\packages\ti\drv\mcasp\docs\ReleaseNotes_MCASP_LLD.pdf
Software design Specification $(TI_PDK_INSTALL_DIR)\packages\ti\drv\mcasp\docs\MCASP_LLD_SDS.pdf


Templates used on this page:

Return to Processor SDK RTOS MCASP.

Navigation menu Log inRequest accountPageDiscussionReadView sourceView history

Search Go Main Page All pages All categories Recent changes Random page Help Toolbox What links here Related changes Special pages Page information This page has been accessed 927 times. Privacy policyAbout Texas Instruments WikiDisclaimersTerms of UseCreative Commons Attribution-ShareAlike Powered by MediaWiki


Moved to http://processors.wiki.ti.com/index.php/Processor_SDK_RTOS_MCASP