Microchip | The Embedded Control Solutions Company Register Login
Browse All
Microchip Technology
 305 Code Snippets

CE117 - Using the DMA with DCI peripheral for I2S driver-1

Microchip Technology

The dsPIC® Digital Signal Controllers feature a Data Converter Interface (DCI or Codec Interface) peripheral module on-chip. This code is useful to interface the dsPIC with high-resolution codecs, A/D and D/A converters that stream data into the dsPIC or out from the dsPIC device.

About this Code Example

The dsPIC® Digital Signal Controllers feature a Data Converter Interface (DCI or Codec Interface) peripheral module on-chip.
This module is useful to interface the dsPIC with high-resolution codecs, A/D and D/A converters that stream data into the
dsPIC or out from the dsPIC device.
The attached code example has file named i2SDrv.c. This file contains functions to intialize the DCI peripheral and
DMA channels as well as Interrupt handlers for the Dma channels.DMACH0 is configured to transfer data from DMARAM address to
to peripheral address.DMACH1 is configured to transfer data from peripheral address to DMARAM address in Continuous Ping-Pong
modes.The DCI module is set up for Master mode of operation in which it provides the Frame Sync signal on the COFS pin,as well
as the bit clock on the CSCK pin.The DCI module is initialized for interfaceing to a 64*Fs I2S Codec.The frame sync signal has
a frequency of 48KHz,while the bit clock has a frequency of 64*48000=3MHz, as shown below:


                                  FIGURE 1
           _______________________________
          |                               |                               |
COFS:     |                               |_______________________________|
       _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _
CSCK:_| |_| |_| |_| |_| |_| |_| |_| |_| |_| |_| |_| |_| |_| |_| |_| |_| |_|
          |<--------Left Channel Data---->|<----Right Channel Data------->|
          |<---------32 bits------------->|<---------32 bits------------->|
          |<---TXBUF0---->|<----TXBUF1--->|<---TXBUF2---->|<----TXBUF3--->|
          |<---RXBUF0---->|<----RXBUF1--->|<---RXBUF2---->|<----RXBUF3--->|
          |<--TimeSlot0-->|<--TimeSlot1-->|<--TimeSlot0-->|<--TimeSlot1-->|
          |<--------------------1/Fs = 20.8 microseconds----------------->|

The code in the main function calls the initialization routine for the DCI and DMA module and then waits in a while(1) loop.
 From this point on the DCI interrupts transmit data out on the CSDO pin and read data in from the CSDI pin.

Categories

Release History

  • Jul 22, 2011

    Version: 1.0.0

    First upload to ECS

Download Contact the Developer

*Required Fields

  • Current Version:1.0.0
  • Created:Jul 22, 2011
  • Updated:Feb 26, 2015
  • Downloads:3350
  • MPLAB Version:
  • C Compiler:
  • Development Tools:
  • Supported Devices:Supported Devices: dsPIC33F MPLAB IDE: Latest Version Compiler: MPLAB C Compiler for PIC24 MCUs and dsPIC DSCs Development Tools: dsPICDEM1.1+ board with dsPIC33FJ256GP710 controller

Corporate News

Resources

Stay Connected

Stay up to date with the latest news from Microchip Technology.