TI E2E support forums
TI E2E support forums
  • User
  • Site
  • Search
  • User
  • E2E™ design support >
  • Forums
    • Amplifiers
    • API solutions
    • Audio
    • Clock & timing
    • Data converters
    • DLP® products
    • Interface
    • Isolation
    • Logic
    • Microcontrollers
    • Motor drivers
    • Power management
    • Processors
    • RF & microwave
    • Sensors
    • Site support
    • Switches & multiplexers
    • Tools
    • Wireless connectivity
    • Archived forums
    • Archived groups
  • Technical articles
  • TI training
    • Tech days
    • Online training
    • Live events
    • Power Supply Design Seminar
  • Getting started
  • 简体中文
  • More
  • Cancel
Processors

Processors

Processors forum

  • Mentions
  • Tags
  • More
  • Cancel
  • Ask a related question
    What is a related question?
    A related question is a question created from another question. When the related question is created, it will be automatically linked to the original question.
  • Ask a new question
  • Ask a new question
  • Cancel
  • State Resolved
  • Locked Locked
  • Replies 16 replies
  • Answers 1 answer
  • Subscribers 100 subscribers
  • Views 1920 views
  • Users 0 members are here
  • PCM1753
Support feedback
Options
  • Tags
  • More
  • Cancel
Options
  • Share
  • More
  • Cancel
Related

This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

McASP Transmit in OMAPL138

Prathibha Kadur
Prathibha Kadur
Prodigy 200 points

Other Parts Discussed in Thread: OMAPL138, PCM1753, SYSBIOS, TLV320AIC3106

Hi,

I am using McASP port in OMAPL138 to transmit 24-bit data to 2 DACs (PCM1753) on AXR8 and AXR15. I am using CCS Version: 5.4.0.00091, and it is NON-OS development.

I have made changes to McASP example in “quickStartOMAPL1x_rCSL” library, to just use Tx section and generate Tx clocks for our custom board. I have programmed these clocks for our requirement, cpu clock=375 MHz, McASP clock = 187.5 MHz.and DAC fs=192k.

I am trying to look at these signals on an oscilloscope. I see all the clocks (ACLKX, AHCLKX and AFSX) fine. I am generating McASP event interrupt fine (XDATA enabled). I see the data in AXR8 and AXR15 buffers. But I don’t see the data in oscilloscope. I have tested those pins for any hardware issues by configuring them as GPIOs and sending data on them and they work fine.

I am using TDM transfer mode.

Here are the changes I made in the initialization.

       /*Transmit Format Unit */

       //For I2S, MSB First, Left aligned, XATDLY=1

       CSL_FINST(mcaspRegs->XFMT, MCASP_XFMT_XDATDLY,  1BIT);       

       CSL_FINST(mcaspRegs->XFMT, MCASP_XFMT_XRVRS,    MSBFIRST);

       CSL_FINST(mcaspRegs->XFMT, MCASP_XFMT_XPAD,     ZERO);

       //CSL_FINST(mcaspRegs->XFMT, MCASP_XFMT_XSSZ,   32BITS);

       CSL_FINST(mcaspRegs->XFMT, MCASP_XFMT_XSSZ,     24BITS);

       CSL_FINS(mcaspRegs->XFMT, MCASP_XFMT_XPBIT,     0);

       CSL_FINST(mcaspRegs->XFMT, MCASP_XFMT_XROT,     NONE);

       CSL_FINST(mcaspRegs->XFMT, MCASP_XFMT_XBUSEL,   VBUS);

      

       /*Transmit Frame Sync Control Register */

      

//Frame Sync is configured for I2S (2-slot TDM (I2S mode) to 32-slot TDM)

       CSL_FINST(mcaspRegs->AFSXCTL, MCASP_AFSXCTL_XMOD, I2S);              //=2

 

       //Frame Sync Length is Word (=1)

       CSL_FINST(mcaspRegs->AFSXCTL, MCASP_AFSXCTL_FXWID, WORD);

 

       //Transmit frame sync generation select bit.

       //Frame Sync is internally generated by XCLK (=1)

       CSL_FINST(mcaspRegs->AFSXCTL, MCASP_AFSXCTL_FSXM, INTERNAL);

 

       //Transmit frame sync polarity select bit.

       //Falling Edge indicates beginning of new word (=1)

       CSL_FINST(mcaspRegs->AFSXCTL, MCASP_AFSXCTL_FSXP, FALLINGEDGE);

 

 

              //Active Slots 0/1 for I2S

       CSL_FINST(mcaspRegs->XTDM, MCASP_XTDM_XTDMS1,  ACTIVE);

       CSL_FINST(mcaspRegs->XTDM, MCASP_XTDM_XTDMS0,  ACTIVE);

 

       CSL_FINST(mcaspRegs->XINTCTL, MCASP_XINTCTL_XDATA,   ENABLE);

 

       //Configure Serializer 8, 15 to be Transmit Serializers

       CSL_FINST(mcaspRegs->SRCTL8, MCASP_SRCTL8_SRMOD, XMT);

       CSL_FINST(mcaspRegs->SRCTL15, MCASP_SRCTL15_SRMOD, XMT);

 

//Configure AHCLKX, ACLKX, AFSX, AXR11, AXR12 as McASP Pins vs. GPIO Pins

       CSL_FINST(mcaspRegs->PFUNC, MCASP_PFUNC_AFSX, MCASP);

       CSL_FINST(mcaspRegs->PFUNC, MCASP_PFUNC_AHCLKX, MCASP);

       CSL_FINST(mcaspRegs->PFUNC, MCASP_PFUNC_ACLKX, MCASP);

CSL_FINST(mcaspRegs->PFUNC, MCASP_PFUNC_AXR8, MCASP);

       CSL_FINST(mcaspRegs->PFUNC, MCASP_PFUNC_AXR15, MCASP);

 

       //Configure the AHCLKX, ACLKX, AFSX, AXR11 as Output Pins to send   

       CSL_FINST(mcaspRegs->PDIR, MCASP_PDIR_AFSX, OUTPUT);

       CSL_FINST(mcaspRegs->PDIR, MCASP_PDIR_AHCLKX, OUTPUT);

       CSL_FINST(mcaspRegs->PDIR, MCASP_PDIR_ACLKX, OUTPUT);

       CSL_FINST(mcaspRegs->PDIR, MCASP_PDIR_AXR15, OUTPUT);

       CSL_FINST(mcaspRegs->PDIR, MCASP_PDIR_AXR8, OUTPUT);

 

Rest of the initialization, mcasp_start and ISR are same as in the example.

It would be of great help if someone can advise me. I should be able to see data on these pins on oscilloscope. Am I missing anything in configuration?

Also, if I send data on both pins, I get only 2 interrupts. How do I configure TDM slots to send data on both the pins every time I interrupt?

Many thanks in advance,

Prathibha

 

over 11 years ago
  • Cancel
  • Sivaraj Kuppuraj
    0 Sivaraj Kuppuraj over 11 years ago
    TI__Mastermind 35645 points

    Hi Prathiba,

    Thanks for your post.

    It seems, your configuration seems to be fine, but i doubt, could you please ensure your custom OMAPL138 board schematics to check the corresponding pins to tap McASP0 data through AXR8 & AXR15 buffer serializers to DAC on OMAPl138 board and kindly tap the appropriate test points to probe the data correspondingly in the scope since you confirm that there is data available in AXR8 & AXR15 buffers but not in the scope. You also confirmed that, you have evaluated all pins configured as GPIO and tested by sending data to the same and narrowed down that, you don't see any hardware issues. My only guess, you may be tapping the wrong points on the scope to check for available data on AXR8 & AXR!5 buffers. Please crosscheck the omapl138 board schematics to ensure the corresponding pins to tap McASP0 data through AXR8 & AXR15.

    Also, the rCSL examples are tested under some suitable conditions, i think, it is tested in CCS v4.1.3 and other CGT versions. Please also check the below wiki to evaluate for the test conditions:

    http://processors.wiki.ti.com/index.php/QuickStartOMAPL1x_rCSL#Test_Conditions

    Thanks & regards,

    Sivaraj K

    -------------------------------------------------------------------------------------------------------

    Please click the Verify Answer button on this post if it answers your question

    -------------------------------------------------------------------------------------------------------

    • Cancel
    • Up 0 True Down
    • Cancel
  • Prathibha Kadur
    0 Prathibha Kadur over 11 years ago in reply to Sivaraj Kuppuraj
    Prodigy 200 points

    Hi Sivaraj,

    Thank you for your support.

     

    - I am checking the right test points for AXR8 and AXR15.  When I configured these pins as GPIO, I tested the same pins and I saw data on them.

    - I read the wiki link that you sent and I am sure that these rCSL examples can be run on our board. I have used the same for McBSP0 /1 communication with no problem.

    - My question is whether the data I see in XBUF8 and XBUF15 (registers 0x220 and 0x23c) are going through corresponding serializers?

    - Also if I activate 2 TDM ports w/I2S mode, are they both used by just one AXR pin?

     Please help.

    Thanks again,

    Prathibha

    • Cancel
    • Up 0 True Down
    • Cancel
  • Sivaraj Kuppuraj
    0 Sivaraj Kuppuraj over 11 years ago in reply to Prathibha Kadur
    TI__Mastermind 35645 points

    Hi Prathiba,

    Thanks for your update.

    Yes, the data you see in XBUF8 & XBUF15 should go to the corresponding serializers configured for sure.

    No, it would use two independant AXR pins for 2 TDM ports seperately.

    Thanks & regards,

    Sivaraj K

    ------------------------------------------------------------------------------------------------------

    Please click the Verify Answer button on this post if it answers your question

    -------------------------------------------------------------------------------------------------------

    • Cancel
    • Up 0 True Down
    • Cancel
  • Prathibha Kadur
    0 Prathibha Kadur over 11 years ago in reply to Sivaraj Kuppuraj
    Prodigy 200 points

    Hi Sivaraj,

    - Could you please tell me what I should be doing to see data on these pins configured as MsASP pins?

    - How can I debug this apart from looking at those registers (XBUFs)?

    -  If these pins use 2 ports separately, why do I get only 2 interrupts when I send data on both pins?

    Please help.

    Thank you,

    Prathibha

    • Cancel
    • Up 0 True Down
    • Cancel
  • Sivaraj Kuppuraj
    0 Sivaraj Kuppuraj over 11 years ago in reply to Prathibha Kadur
    TI__Mastermind 35645 points

    Hi,

    Please refer the board schematics and probe the corresponding codec and McASP serializer (AXR) pins to check for the available data on the Tx. and Rx. buffers (McASP's XRBUF). Also, validata the data and interrupts from ADC and DAC to check for the data availability.

    Also, you can debug the code step by step and you can come to a point where the code hangs and check via. McASP registers.

    Thanks & regards,

    Sivaraj K

    ------------------------------------------------------------------------------------------------------

    Please click the Verify Answer button on this post if it answers your question

    -------------------------------------------------------------------------------------------------------

    • Cancel
    • Up 0 True Down
    • Cancel
  • sinan lezgioglu
    0 sinan lezgioglu over 11 years ago in reply to Sivaraj Kuppuraj
    Intellectual 300 points

    Hi Sivaraj.

    Could you please tell Sivaraj to upgrade the same project to SYSBIOS himself and send it to us. This will be our last request. When we tried it we got many errors. Please let us get over this problem.

     

    http://e2e.ti.com/support/dsp/tms320c6000_high_performance_dsps/f/112/p/355942/1252881.asp

    • Cancel
    • Up 0 True Down
    • Cancel
  • Prathibha Kadur
    0 Prathibha Kadur over 11 years ago in reply to Sivaraj Kuppuraj
    Prodigy 200 points

    Hi Sivaraj,

    Again, I am using McASP pins to  transfer clocks and data to 2 DACs. I have checked and rechecked all the initialization steps, board schematics etc quite extensively.

    I am still not able to see data in scope, on AXR8 and AXR15 configured as McASP pins. I can only see clocks ACLKX, AFSX, AHCLKX in scope and data being changed in XBUF8 and XBUF15.

    This has become a bottleneck issue for us and needs to be addressed immediately. If you could please share your email ID, I can send you  the whole source code I am testing.

    Thank you for your support,

    Prathibha

    • Cancel
    • Up 0 True Down
    • Cancel
  • Sivaraj Kuppuraj
    0 Sivaraj Kuppuraj over 11 years ago in reply to Prathibha Kadur
    TI__Mastermind 35645 points

    Hi,

    Thanks for your update.

    I have few clarifications as below:

    First, you need to be sure with your custom board schematics, whether it supports 2 DAC outputs. Even if so, as per the original code of quickstartOMAPL1x_rCSL McASP example, you cannot configure two serializer pins AXR8 & AXR15 as transmit serializers and also, I would recommend you first to configure for 1 transmit serializer to check for 1 DAC output and also, i would insist you to configure the same AXR11 to be transmit serializer and AXR12 to be receive serializer as per original rCSL McASP example code, so that, we could narrow down whether it is the serializer issue or some other.

    Also, I would recommend you to configure XTDM slots 0 & 1 to be active for I2S and likewise, in the Rx. side too, please configure the RTDM slots 0 & 1 to be active and other slots to be inactive in both Tx. & Rx. This is being done just to replicate the same configuration as per the original code and check whether you see the data on the configured Tx. serializer (now, AXR11 to be modified) and correspondingly in 1 DAC output and next, we shall try for the other DAC2 output, if it is applicable as per your custom board.schematics. 

    As a whole, please configure the same Tx. & Rx. serializers (AXR11 as Tx. & AXR12 as Rx.) as per original code and same XTDM & RTDM active slots and try to check whether you are able see the data on the scope on the corresponding Tx. serializer (AXR11). Kindly ensure to configure only one Tx. Serialiser and 1 DAC output for time being and evaluate the McASP registes through debugging the code step by step. With this scenario, kindly provide us the McASP register dump to further investigate on this and to narrow down the cause.

    Also, I would recommend you to enable all transmit McASP interrupt control register as like below, so that, it would trigger the corresponding interrupt flags if any Tx. DMA error, Tx. CLK failure, Tx. underrun or any Tx. Sync error.

    //Enable All Transmit McASP Interrupts
    CSL_FINST(mcaspRegs->XINTCTL, MCASP_XINTCTL_XSTAFRM, ENABLE);
    CSL_FINST(mcaspRegs->XINTCTL, MCASP_XINTCTL_XDATA, ENABLE);
    CSL_FINST(mcaspRegs->XINTCTL, MCASP_XINTCTL_XLAST, ENABLE);
    CSL_FINST(mcaspRegs->XINTCTL, MCASP_XINTCTL_XDMAERR, ENABLE);
    CSL_FINST(mcaspRegs->XINTCTL, MCASP_XINTCTL_XCKFAIL, ENABLE);
    CSL_FINST(mcaspRegs->XINTCTL, MCASP_XINTCTL_XSYNCERR, ENABLE);
    CSL_FINST(mcaspRegs->XINTCTL, MCASP_XINTCTL_XUNDRN, ENABLE);

    In you case, are you enabling FIFO to use DMA triggered data transfer or disabling FIFO for CPU triggerred data transfer? Kindly clarify this too.

    Please try the above recommendation and kindly provide the McASP register dump while you debug the code with the original code configuration scenario, so that, we could sort out the issue to a closer insight which would give more clarity on the root cause of the issue.

    Thanks & regards,

    Sivaraj K

    -------------------------------------------------------------------------------------------------------

    Please click the Verify Answer button on this post if it answers your question

    -------------------------------------------------------------------------------------------------------

    • Cancel
    • Up 0 True Down
    • Cancel
  • Prathibha Kadur
    0 Prathibha Kadur over 11 years ago in reply to Sivaraj Kuppuraj
    Prodigy 200 points

    Hi Sivaraj,

    Thank you for your recommendations. Here is the update.

    First, you need to be sure with your custom board schematics, whether it supports 2 DAC outputs.

    • Yes, I am sure of our schematics, we are using 2 DACs, AXR8 is sending data to one DAC and AXR15 to the other.

    Even if so, as per the original code of quickstartOMAPL1x_rCSL McASP example, you cannot configure two serializer pins AXR8 & AXR15 as transmit serializers.

    • What do we have to do to use 2 pins as transmit serializers?

     

    I would recommend you first to configure for 1 transmit serializer to check for 1 DAC output.

    • That is how I have tested so far.

    I would insist you to configure the same AXR11 to be transmit serializer and AXR12 to be receive serializer as per original rCSL McASP example code, so that, we could narrow down whether it is the serializer issue or some other.

    • I tested that code without making any big changes, i.e. keeping same pins. But I had to make changes to AHCLKX control register to make it as internal, and PDIR register to make that clock as output. I have commented out the following in main.c

           //I2C0Init(); //Init I2C0 to talk to Codec

           //CodecInit();//InitTLV320AIC3106 Regs

    As you know I am running this code on our custom board and I don’t have this codec.

    Also, I would recommend you to configure XTDM slots 0 & 1 to be active for I2S and likewise, in the Rx. side too, please configure the RTDM slots 0 & 1 to be active and other slots to be inactive in both Tx. & Rx. This is being done just to replicate the same configuration as per the original code and check whether you see the data on the configured Tx. serializer (now, AXR11 to be modified) and correspondingly in 1 DAC output and next, we shall try for the other DAC2 output, if it is applicable as per your custom board schematics.

    As a whole, please configure the same Tx. & Rx. serializers (AXR11 as Tx. & AXR12 as Rx.) as per original code and same XTDM & RTDM active slots and try to check whether you are able see the data on the scope on the corresponding Tx. serializer (AXR11). Kindly ensure to configure only one Tx. Serialiser and 1 DAC output for time being and evaluate the McASP registes through debugging the code step by step. With this scenario, kindly provide us the McASP register dump to further investigate on this and to narrow down the cause.

    Also, I would recommend you to enable all transmit McASP interrupt control register as like below, so that, it would trigger the corresponding interrupt flags if any Tx. DMA error, Tx. CLK failure, Tx. underrun or any Tx. Sync error.

    //Enable All Transmit McASP Interrupts
    CSL_FINST(mcaspRegs->XINTCTL, MCASP_XINTCTL_XSTAFRM, ENABLE);
    CSL_FINST(mcaspRegs->XINTCTL, MCASP_XINTCTL_XDATA, ENABLE);
    CSL_FINST(mcaspRegs->XINTCTL, MCASP_XINTCTL_XLAST, ENABLE);
    CSL_FINST(mcaspRegs->XINTCTL, MCASP_XINTCTL_XDMAERR, ENABLE);
    CSL_FINST(mcaspRegs->XINTCTL, MCASP_XINTCTL_XCKFAIL, ENABLE);
    CSL_FINST(mcaspRegs->XINTCTL, MCASP_XINTCTL_XSYNCERR, ENABLE);
    CSL_FINST(mcaspRegs->XINTCTL, MCASP_XINTCTL_XUNDRN, ENABLE);

     

    • I have done these configurations and tested the same.  I get one interrupt for TxData event. The next interrupt goes to XUNDRN and after that the device core hangs.

    In your case, are you enabling FIFO to use DMA triggered data transfer or disabling FIFO for CPU triggerred data transfer? Kindly clarify this too.

    • I am not using DMA or FIFO. I am using CPU interrupt as in the example.

     

    Please try the above recommendation and kindly provide the McASP register dump while you debug the code with the original code configuration scenario, so that, we could sort out the issue to a closer insight which would give more clarity on the root cause of the issue.

    • I have attached source code, McASP register dump (when the 1st interrupt happens) and error message when it hangs.
    • Also I tested running DLB mode for the same pins, by adding the following 3 lines in the initialization.

    CSL_FINST(mcaspRegs->DLBCTL, MCASP_DLBCTL_DLBEN, ENABLE);

    CSL_FINST(mcaspRegs->DLBCTL, MCASP_DLBCTL_ORD, XMTODD); // AXR11, Tx

    CSL_FINST(mcaspRegs->DLBCTL, MCASP_DLBCTL_MODE, XMTCLK);

    I don’t see data on this pin AXR11in the scope for any test.

    I hope I have provided you with enough information to help me out.

    Thanks a lot,

    Prathibha

    Fullscreen 1680.McASP_DUMP.txt Download
    521177 103
    R McASP0DSP_REVID 0x0000000B 0x44300A02
    R McASP0DSP_PFUNC 0x0000000B 0x00000000
    R McASP0DSP_PDIR 0x0000000B 0x1C000800
    R McASP0DSP_PDOUT 0x0000000B 0x00000000
    R McASP0DSP_PDIN 0x0000000B 0xF200F7FB
    R McASP0DSP_PDSET 0x0000000B 0xE600F7FB
    R McASP0DSP_PDCLR 0x0000000B 0x00000000
    R McASP0DSP_GBLCTL 0x0000000B 0x00001F1F
    R McASP0DSP_AMUTE 0x0000000B 0x00000000
    R McASP0DSP_DLBCTL 0x0000000B 0x00000000
    R McASP0DSP_DITCTL 0x0000000B 0x00000000
    R McASP0DSP_RGBLCTL 0x0000000B 0x00001F1F
    R McASP0DSP_RMASK 0x0000000B 0xFFFFFFFF
    R McASP0DSP_RFMT 0x0000000B 0x000180F8
    R McASP0DSP_AFSRCTL 0x0000000B 0x00000113
    R McASP0DSP_ACLKRCTL 0x0000000B 0x000000A0
    R McASP0DSP_AHCLKRCTL 0x0000000B 0x00008000
    R McASP0DSP_RTDM 0x0000000B 0x00000003
    R McASP0DSP_RINTCTL 0x0000000B 0x00000000
    R McASP0DSP_RSTAT 0x0000000B 0x0000017D
    R McASP0DSP_RSLOT 0x0000000B 0x00000000
    R McASP0DSP_RCLKCHK 0x0000000B 0x00000000
    R McASP0DSP_REVTCTL 0x0000000B 0x00000000
    R McASP0DSP_XGBLCTL 0x0000000B 0x00001F1F
    R McASP0DSP_XMASK 0x0000000B 0xFFFFFFFF
    R McASP0DSP_XFMT 0x0000000B 0x000080F8
    R McASP0DSP_AFSXCTL 0x0000000B 0x00000113
    R McASP0DSP_ACLKXCTL 0x0000000B 0x00000027
    R McASP0DSP_AHCLKXCTL 0x0000000B 0x00008000
    R McASP0DSP_XTDM 0x0000000B 0x00000003
    R McASP0DSP_XINTCTL 0x0000000B 0x000000BF
    R McASP0DSP_XSTAT 0x0000000B 0x00000179
    R McASP0DSP_XSLOT 0x0000000B 0x00000001
    R McASP0DSP_XCLKCHK 0x0000000B 0x32322F02
    R McASP0DSP_XEVTCTL 0x0000000B 0x00000000
    R McASP0DSP_DITCSRA0 0x0000000B 0x00000000
    R McASP0DSP_DITCSRA1 0x0000000B 0x00000000
    R McASP0DSP_DITCSRA2 0x0000000B 0x00000000
    R McASP0DSP_DITCSRA3 0x0000000B 0x00000000
    R McASP0DSP_DITCSRA4 0x0000000B 0x00000000
    R McASP0DSP_DITCSRA5 0x0000000B 0x00000000
    R McASP0DSP_DITCSRB0 0x0000000B 0x00000000
    R McASP0DSP_DITCSRB1 0x0000000B 0x00000000
    R McASP0DSP_DITCSRB2 0x0000000B 0x00000000
    R McASP0DSP_DITCSRB3 0x0000000B 0x00000000
    R McASP0DSP_DITCSRB4 0x0000000B 0x00000000
    R McASP0DSP_DITCSRB5 0x0000000B 0x00000000
    R McASP0DSP_DITUDRA0 0x0000000B 0x00000000
    R McASP0DSP_DITUDRA1 0x0000000B 0x00000000
    R McASP0DSP_DITUDRA2 0x0000000B 0x00000000
    R McASP0DSP_DITUDRA3 0x0000000B 0x00000000
    R McASP0DSP_DITUDRA4 0x0000000B 0x00000000
    R McASP0DSP_DITUDRA5 0x0000000B 0x00000000
    R McASP0DSP_DITUDRB0 0x0000000B 0x00000000
    R McASP0DSP_DITUDRB1 0x0000000B 0x00000000
    R McASP0DSP_DITUDRB2 0x0000000B 0x00000000
    R McASP0DSP_DITUDRB3 0x0000000B 0x00000000
    R McASP0DSP_DITUDRB4 0x0000000B 0x00000000
    R McASP0DSP_DITUDRB5 0x0000000B 0x00000000
    R McASP0DSP_SRCTL0 0x0000000B 0x00000000
    R McASP0DSP_SRCTL1 0x0000000B 0x00000000
    R McASP0DSP_SRCTL2 0x0000000B 0x00000000
    R McASP0DSP_SRCTL3 0x0000000B 0x00000000
    R McASP0DSP_SRCTL4 0x0000000B 0x00000000
    R McASP0DSP_SRCTL5 0x0000000B 0x00000000
    R McASP0DSP_SRCTL6 0x0000000B 0x00000000
    R McASP0DSP_SRCTL7 0x0000000B 0x00000000
    R McASP0DSP_SRCTL8 0x0000000B 0x00000000
    R McASP0DSP_SRCTL9 0x0000000B 0x00000000
    R McASP0DSP_SRCTL10 0x0000000B 0x00000000
    R McASP0DSP_SRCTL11 0x0000000B 0x00000011
    R McASP0DSP_SRCTL12 0x0000000B 0x00000022
    R McASP0DSP_SRCTL13 0x0000000B 0x00000000
    R McASP0DSP_SRCTL14 0x0000000B 0x00000000
    R McASP0DSP_SRCTL15 0x0000000B 0x00000000
    R McASP0DSP_XBUF0 0x0000000B 0x00000000
    R McASP0DSP_XBUF1 0x0000000B 0x00000000
    R McASP0DSP_XBUF2 0x0000000B 0x00000000
    R McASP0DSP_XBUF3 0x0000000B 0x00000000
    R McASP0DSP_XBUF4 0x0000000B 0x00000000
    R McASP0DSP_XBUF5 0x0000000B 0x00000000
    R McASP0DSP_XBUF6 0x0000000B 0x00000000
    R McASP0DSP_XBUF7 0x0000000B 0x00000000
    R McASP0DSP_XBUF8 0x0000000B 0x00000000
    R McASP0DSP_XBUF9 0x0000000B 0x00000000
    R McASP0DSP_XBUF10 0x0000000B 0x00000000
    R McASP0DSP_XBUF11 0x0000000B 0x00000000
    R McASP0DSP_XBUF12 0x0000000B 0xFFFFFFFF
    R McASP0DSP_XBUF13 0x0000000B 0x00000000
    R McASP0DSP_XBUF14 0x0000000B 0x00000000
    R McASP0DSP_XBUF15 0x0000000B 0x00000000
    R McASP0DSP_RBUF0 0x0000000B 0x00000000
    R McASP0DSP_RBUF1 0x0000000B 0x00000000
    R McASP0DSP_RBUF2 0x0000000B 0x00000000
    R McASP0DSP_RBUF3 0x0000000B 0x00000000
    R McASP0DSP_RBUF4 0x0000000B 0x00000000
    R McASP0DSP_RBUF5 0x0000000B 0x00000000
    R McASP0DSP_RBUF6 0x0000000B 0x00000000
    R McASP0DSP_RBUF7 0x0000000B 0x00000000
    R McASP0DSP_RBUF8 0x0000000B 0x00000000
    R McASP0DSP_RBUF9 0x0000000B 0x00000000
    R McASP0DSP_RBUF10 0x0000000B 0x00000000
    R McASP0DSP_RBUF11 0x0000000B 0x00000000
    R McASP0DSP_RBUF12 0x0000000B 0xFFFFFFFF
    R McASP0DSP_RBUF13 0x0000000B 0x00000000
    R McASP0DSP_RBUF14 0x0000000B 0x00000000
    R McASP0DSP_RBUF15 0x0000000B 0x00000000
    R McASPFIFO0DSP_REVID 0x0000000B 0x44311100
    R McASPFIFO0DSP_WFIFOCTL 0x0000000B 0x00001004
    R McASPFIFO0DSP_WFIFOSTS 0x0000000B 0x00000000
    R McASPFIFO0DSP_RFIFOCTL 0x0000000B 0x00001004
    R McASPFIFO0DSP_RFIFOSTS 0x0000000B 0x00000000
    
    Fullscreen 3173.McASP_DLB_DUMP.txt Download
    521177 103
    R McASP0DSP_REVID 0x0000000B 0x44300A02
    R McASP0DSP_PFUNC 0x0000000B 0x00000000
    R McASP0DSP_PDIR 0x0000000B 0x1C000800
    R McASP0DSP_PDOUT 0x0000000B 0x00000000
    R McASP0DSP_PDIN 0x0000000B 0xE600F7FB
    R McASP0DSP_PDSET 0x0000000B 0xE600F7FB
    R McASP0DSP_PDCLR 0x0000000B 0x00000000
    R McASP0DSP_GBLCTL 0x0000000B 0x00001F1F
    R McASP0DSP_AMUTE 0x0000000B 0x00000000
    R McASP0DSP_DLBCTL 0x0000000B 0x00000005
    R McASP0DSP_DITCTL 0x0000000B 0x00000000
    R McASP0DSP_RGBLCTL 0x0000000B 0x00001F1F
    R McASP0DSP_RMASK 0x0000000B 0xFFFFFFFF
    R McASP0DSP_RFMT 0x0000000B 0x000180F8
    R McASP0DSP_AFSRCTL 0x0000000B 0x00000113
    R McASP0DSP_ACLKRCTL 0x0000000B 0x000000A0
    R McASP0DSP_AHCLKRCTL 0x0000000B 0x00008000
    R McASP0DSP_RTDM 0x0000000B 0x00000003
    R McASP0DSP_RINTCTL 0x0000000B 0x00000000
    R McASP0DSP_RSTAT 0x0000000B 0x00000175
    R McASP0DSP_RSLOT 0x0000000B 0x00000000
    R McASP0DSP_RCLKCHK 0x0000000B 0x00000000
    R McASP0DSP_REVTCTL 0x0000000B 0x00000000
    R McASP0DSP_XGBLCTL 0x0000000B 0x00001F1F
    R McASP0DSP_XMASK 0x0000000B 0xFFFFFFFF
    R McASP0DSP_XFMT 0x0000000B 0x000080F8
    R McASP0DSP_AFSXCTL 0x0000000B 0x00000113
    R McASP0DSP_ACLKXCTL 0x0000000B 0x00000027
    R McASP0DSP_AHCLKXCTL 0x0000000B 0x00008000
    R McASP0DSP_XTDM 0x0000000B 0x00000003
    R McASP0DSP_XINTCTL 0x0000000B 0x000000BF
    R McASP0DSP_XSTAT 0x0000000B 0x00000179
    R McASP0DSP_XSLOT 0x0000000B 0x00000001
    R McASP0DSP_XCLKCHK 0x0000000B 0x31322F02
    R McASP0DSP_XEVTCTL 0x0000000B 0x00000000
    R McASP0DSP_DITCSRA0 0x0000000B 0x00000000
    R McASP0DSP_DITCSRA1 0x0000000B 0x00000000
    R McASP0DSP_DITCSRA2 0x0000000B 0x00000000
    R McASP0DSP_DITCSRA3 0x0000000B 0x00000000
    R McASP0DSP_DITCSRA4 0x0000000B 0x00000000
    R McASP0DSP_DITCSRA5 0x0000000B 0x00000000
    R McASP0DSP_DITCSRB0 0x0000000B 0x00000000
    R McASP0DSP_DITCSRB1 0x0000000B 0x00000000
    R McASP0DSP_DITCSRB2 0x0000000B 0x00000000
    R McASP0DSP_DITCSRB3 0x0000000B 0x00000000
    R McASP0DSP_DITCSRB4 0x0000000B 0x00000000
    R McASP0DSP_DITCSRB5 0x0000000B 0x00000000
    R McASP0DSP_DITUDRA0 0x0000000B 0x00000000
    R McASP0DSP_DITUDRA1 0x0000000B 0x00000000
    R McASP0DSP_DITUDRA2 0x0000000B 0x00000000
    R McASP0DSP_DITUDRA3 0x0000000B 0x00000000
    R McASP0DSP_DITUDRA4 0x0000000B 0x00000000
    R McASP0DSP_DITUDRA5 0x0000000B 0x00000000
    R McASP0DSP_DITUDRB0 0x0000000B 0x00000000
    R McASP0DSP_DITUDRB1 0x0000000B 0x00000000
    R McASP0DSP_DITUDRB2 0x0000000B 0x00000000
    R McASP0DSP_DITUDRB3 0x0000000B 0x00000000
    R McASP0DSP_DITUDRB4 0x0000000B 0x00000000
    R McASP0DSP_DITUDRB5 0x0000000B 0x00000000
    R McASP0DSP_SRCTL0 0x0000000B 0x00000000
    R McASP0DSP_SRCTL1 0x0000000B 0x00000000
    R McASP0DSP_SRCTL2 0x0000000B 0x00000000
    R McASP0DSP_SRCTL3 0x0000000B 0x00000000
    R McASP0DSP_SRCTL4 0x0000000B 0x00000000
    R McASP0DSP_SRCTL5 0x0000000B 0x00000000
    R McASP0DSP_SRCTL6 0x0000000B 0x00000000
    R McASP0DSP_SRCTL7 0x0000000B 0x00000000
    R McASP0DSP_SRCTL8 0x0000000B 0x00000000
    R McASP0DSP_SRCTL9 0x0000000B 0x00000000
    R McASP0DSP_SRCTL10 0x0000000B 0x00000000
    R McASP0DSP_SRCTL11 0x0000000B 0x00000011
    R McASP0DSP_SRCTL12 0x0000000B 0x00000022
    R McASP0DSP_SRCTL13 0x0000000B 0x00000000
    R McASP0DSP_SRCTL14 0x0000000B 0x00000000
    R McASP0DSP_SRCTL15 0x0000000B 0x00000000
    R McASP0DSP_XBUF0 0x0000000B 0x00000000
    R McASP0DSP_XBUF1 0x0000000B 0x00000000
    R McASP0DSP_XBUF2 0x0000000B 0x00000000
    R McASP0DSP_XBUF3 0x0000000B 0x00000000
    R McASP0DSP_XBUF4 0x0000000B 0x00000000
    R McASP0DSP_XBUF5 0x0000000B 0x00000000
    R McASP0DSP_XBUF6 0x0000000B 0x00000000
    R McASP0DSP_XBUF7 0x0000000B 0x00000000
    R McASP0DSP_XBUF8 0x0000000B 0x00000000
    R McASP0DSP_XBUF9 0x0000000B 0x00000000
    R McASP0DSP_XBUF10 0x0000000B 0x00000000
    R McASP0DSP_XBUF11 0x0000000B 0xFFFFFFFF
    R McASP0DSP_XBUF12 0x0000000B 0xFFFFFFFF
    R McASP0DSP_XBUF13 0x0000000B 0x00000000
    R McASP0DSP_XBUF14 0x0000000B 0x00000000
    R McASP0DSP_XBUF15 0x0000000B 0x00000000
    R McASP0DSP_RBUF0 0x0000000B 0x00000000
    R McASP0DSP_RBUF1 0x0000000B 0x00000000
    R McASP0DSP_RBUF2 0x0000000B 0x00000000
    R McASP0DSP_RBUF3 0x0000000B 0x00000000
    R McASP0DSP_RBUF4 0x0000000B 0x00000000
    R McASP0DSP_RBUF5 0x0000000B 0x00000000
    R McASP0DSP_RBUF6 0x0000000B 0x00000000
    R McASP0DSP_RBUF7 0x0000000B 0x00000000
    R McASP0DSP_RBUF8 0x0000000B 0x00000000
    R McASP0DSP_RBUF9 0x0000000B 0x00000000
    R McASP0DSP_RBUF10 0x0000000B 0x00000000
    R McASP0DSP_RBUF11 0x0000000B 0xFFFFFFFF
    R McASP0DSP_RBUF12 0x0000000B 0xFFFFFFFF
    R McASP0DSP_RBUF13 0x0000000B 0x00000000
    R McASP0DSP_RBUF14 0x0000000B 0x00000000
    R McASP0DSP_RBUF15 0x0000000B 0x00000000
    R McASPFIFO0DSP_REVID 0x0000000B 0x44311100
    R McASPFIFO0DSP_WFIFOCTL 0x0000000B 0x00001004
    R McASPFIFO0DSP_WFIFOSTS 0x0000000B 0x00000000
    R McASPFIFO0DSP_RFIFOCTL 0x0000000B 0x00001004
    R McASPFIFO0DSP_RFIFOSTS 0x0000000B 0x00000000
    
    Fullscreen 2844.error.txt Download
    Trouble Reading Memory Block at 0x1e25028 on Page 0 of Length 0x4:
    (Error -1202 @ 0x1E25028)
    Device core is hung. The debugger will attempt to force the device to a ready state to recover debug control. Your application's state will be corrupt. You should have limited access to memory and registers, but you may need to reset the device to debug further.
    (Emulation package 5.1.73.0
    
    
    
    Fullscreen 0167.mcasp.c Download
    //Project  Name: quickStartOMAPL1x McASP Chip Support Library Example
    //Texas Instruments Device Platform: Logic Product Development OMAP-L138 Experimentor Kit
    //Copywrite (c) 2011 Texas Instruments Incroporated
    
    /*===============================================================*/
    /****************************LICENSE *****************************/
    /*===============================================================*/
    /*
     * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
     *
     *  Redistribution and use in source and binary forms, with or without
     *  modification, are permitted provided that the following conditions
     *  are met:
     *
     *    Redistributions of source code must retain the above copyright
     *    notice, this list of conditions and the following disclaimer.
     *
     *    Redistributions in binary form must reproduce the above copyright
     *    notice, this list of conditions and the following disclaimer in the
     *    documentation and/or other materials provided with the
     *    distribution.
     *
     *    Neither the name of Texas Instruments Incorporated nor the names of
     *    its contributors may be used to endorse or promote products derived
     *    from this software without specific prior written permission.
     *
     *  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
     *  "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
     *  LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
     *  A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
     *  OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
     *  SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
     *  LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
     *  DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
     *  THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
     *  (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
     *  OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.*/
    
    
    //*==================================================*/
    //********************Includes *********************/
    //*==================================================*/
    //*Non-DSP/BIOS5 Header Files*/
    #include <ti/pspiom/cslr/tistdtypes.h>	
    #include "mcasp.h"
    
    
    
    //==================================================/
    //***************Function Prototypes ***************/
    //==================================================/
    void McASPInit(void);
    void McASPStart(void);
    void McASPStart(void);
    
    
    
    //==================================================/
    //*********Global Variable Instantiations **********/
    //==================================================/
    
    //McASP0 Control Registers
    CSL_McaspRegsOvly mcaspRegs = (CSL_McaspRegsOvly) CSL_MCASP_0_CTRL_REGS;	//OMAP-L138 McASP Configuration Register Pointer Instance
    
    //McASP AFIFO Control Registers
    CSL_AfifoRegsOvly afifoRegs = (CSL_AfifoRegsOvly) CSL_MCASP_0_FIFO_REGS;
    
    //McASP DMA Port Registers
    CSL_AdataRegsOvly adataRegs = (CSL_AdataRegsOvly) CSL_MCASP_0_DATA_REGS;
    
    
    //==================================================/
    //**********Functions ******************************/
    //* This function is used to initialize the McASP*/
    //==================================================/
    
    //Notes: On Logic 1013527 Baseboard Hardware Mapping
    //  AIC BCLK: connected to M_ACLKX/GPIO[14]
    //  AIC WCLK: connected to M_AFSX/GPIO[12]
    //  AIC DIN:  connected to M_AXR11 (OMAP-L138 Tx)
    //  AIC DOUT  connected to M_AXR12 (OMAP-L138 Rx)
    //  AIC MCLK  connected to M_AHCLKX (connected to 24.576MHz XTAL)
    
    //OMAP-L138 Clocking Configuration
    //AHCLKX -> External
    //ACLKX  -> Internal / -> AHCLK/8
    //AFSX   -> Interal -> Auto Generated by FS Gen.
    
    
    void McASPInit(void)
    {
    	
    /*This function will be called by Main to Initialize the McASP */
    /* Although this configuration can be done completely by hand, we chose to use the 
     * OMAP-L138 Chip Support Library (CSL) because those functions presumably already
     *  work and are tested*/
    
    	
    //Initialize the McASP Registers for use on the LogicPD OMAP-L138 SOM/Baseboard.
    
    /* The following steps are required to properly configure the McASP via the OMAP-L138 McASP User's Guide
    * [1] Reset McASP to default Values by writting GBLCTL = 0
    */ 
    
    
     /* Put McASP in Reset by programming the global control registers */
    	//Keep all Tx Clocks in Reset
    	CSL_FINST(mcaspRegs->GBLCTL, MCASP_GBLCTL_XFRST, RESET);	
    	CSL_FINST(mcaspRegs->GBLCTL, MCASP_GBLCTL_XSMRST, RESET);
    	CSL_FINST(mcaspRegs->GBLCTL, MCASP_GBLCTL_XSRCLR, CLEAR);		
    	CSL_FINST(mcaspRegs->GBLCTL, MCASP_GBLCTL_XHCLKRST, RESET);		
    	CSL_FINST(mcaspRegs->GBLCTL, MCASP_GBLCTL_XCLKRST, RESET);
    	
    	//Keep all Rx Clocks In Reset
    	CSL_FINST(mcaspRegs->GBLCTL, MCASP_GBLCTL_RFRST, RESET);
    	CSL_FINST(mcaspRegs->GBLCTL, MCASP_GBLCTL_RSMRST, RESET);
    	CSL_FINST(mcaspRegs->GBLCTL, MCASP_GBLCTL_RSRCLR, CLEAR);
    	CSL_FINST(mcaspRegs->GBLCTL, MCASP_GBLCTL_RHCLKRST, RESET);
    	CSL_FINST(mcaspRegs->GBLCTL, MCASP_GBLCTL_RCLKRST, RESET);
    
    
    /* [2] Configure the McASP Audio FIFO.
     * 		[a] Write FIFO
     * 			 - If Write FIFO will not be enabled, clear the FIFO Enable Bit
     * 			 - If Write FIFO is enabled, it should not be enabled until all other FIFO 
     *             bits are configured
     * 		[b] Read FIFO
     * 			 - If Read FIFO will not be enabled, clear the FIFO Enable Bit
     * 			 - If Read FIFO is enabled, it should not be enabled until all other FIFO 
     * 
     */
     
     	/* Disable Write FIFO */
     		
     	// For now, both the Rx and Tx AFIFO's will be disabled, because the McASP is the only 
     	//peripheral that is being services by the DSP. If additional peripheral are added in later, 
     	//this may be changed to include both the Rx / Tx FIFO's	
     		
    	//Disable Tx FIFO
    	CSL_FINST(afifoRegs->WFIFOCTL, AFIFO_WFIFOCTL_WENA, DISABLED);
    	
    	//Disable Rx FIFO
    	CSL_FINST(afifoRegs->RFIFOCTL, AFIFO_RFIFOCTL_RENA, DISABLED);
    	
     
     /* [3] Configure all McASP registers except GBLCTRL in the following Order
      * 	[a] Receive Registers: If external clocks are used, they must be running already for proper synchronization
      *         of the global control registers
      * 		
      * 		Note:
      * 		TLV320AIC3106 is simply a slave ADC/DAC the Tx clocks will be synchronized with the Rx clocks. */
      
      
    	/* Recieve Serializer */  	
      	/* 31   30    29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10      9        8      7       6    5     4    3     2     1   0 */                    
    	/*MSb (MSb-1)        --Audio Word--                                          (LSb+1)  LSb    Mask     Mask Mask Mask  Mask  Mask Mask Mask */
      
      
      	/* Recieve Bit Stream Format Register */
    	
    	//Configure the receive bit stream for 32 bit I2S.
    	CSL_FINST(mcaspRegs->RFMT, MCASP_RFMT_RDATDLY, 1BIT);		//Ignore First Bit due to I2S
    	
    	CSL_FINST(mcaspRegs->RFMT, MCASP_RFMT_RRVRS, MSBFIRST);
    	
    	//Pad Unused Bits with value in bit 0
    	CSL_FINST(mcaspRegs->RFMT, MCASP_RFMT_RPAD, ZERO);
    	
    	//32 bit slot size, though only 24 bit word size
    	CSL_FINST(mcaspRegs->RFMT, MCASP_RFMT_RSSZ, 32BITS);
    	
    	
    	//No Rotation needed
    	CSL_FINST(mcaspRegs->RFMT, MCASP_RFMT_RROT, NONE);
    	
    	//Read XRBUF[n] on the Peripheral Configuration Port  (For Now -> May change to the DMA Later)
    	CSL_FINST(mcaspRegs->RFMT, MCASP_RFMT_RBUSEL, VBUS);
      
      
      
      
      
    	/* Recieve Format Unit Bit Mask Register */
    	
    	//Mask Off Unused Bits -> For Now, well leave all unmasked -> May change later.
    	CSL_FINST(mcaspRegs->RMASK, MCASP_RMASK_RMASK31, NOMASK);	//Audio Data MSB	
    	CSL_FINST(mcaspRegs->RMASK, MCASP_RMASK_RMASK30, NOMASK);	//Audio Data MSB-1
    	CSL_FINST(mcaspRegs->RMASK, MCASP_RMASK_RMASK29, NOMASK);   
    	CSL_FINST(mcaspRegs->RMASK, MCASP_RMASK_RMASK28, NOMASK);
    	CSL_FINST(mcaspRegs->RMASK, MCASP_RMASK_RMASK27, NOMASK);
    	CSL_FINST(mcaspRegs->RMASK, MCASP_RMASK_RMASK26, NOMASK);
    	CSL_FINST(mcaspRegs->RMASK, MCASP_RMASK_RMASK25, NOMASK);
    	CSL_FINST(mcaspRegs->RMASK, MCASP_RMASK_RMASK24, NOMASK);
    	CSL_FINST(mcaspRegs->RMASK, MCASP_RMASK_RMASK23, NOMASK);
    	CSL_FINST(mcaspRegs->RMASK, MCASP_RMASK_RMASK22, NOMASK);
    	CSL_FINST(mcaspRegs->RMASK, MCASP_RMASK_RMASK21, NOMASK);
    	CSL_FINST(mcaspRegs->RMASK, MCASP_RMASK_RMASK20, NOMASK);
    	CSL_FINST(mcaspRegs->RMASK, MCASP_RMASK_RMASK19, NOMASK);
    	CSL_FINST(mcaspRegs->RMASK, MCASP_RMASK_RMASK18, NOMASK);
    	CSL_FINST(mcaspRegs->RMASK, MCASP_RMASK_RMASK17, NOMASK);
    	CSL_FINST(mcaspRegs->RMASK, MCASP_RMASK_RMASK16, NOMASK);	//Audio Data Bit LSB (16 bit)
    	CSL_FINST(mcaspRegs->RMASK, MCASP_RMASK_RMASK15, NOMASK);
    	CSL_FINST(mcaspRegs->RMASK, MCASP_RMASK_RMASK14, NOMASK);
    	CSL_FINST(mcaspRegs->RMASK, MCASP_RMASK_RMASK13, NOMASK);
    	CSL_FINST(mcaspRegs->RMASK, MCASP_RMASK_RMASK12, NOMASK);	//Audio Data Bit LSB (20 bit)
    	CSL_FINST(mcaspRegs->RMASK, MCASP_RMASK_RMASK11, NOMASK);
    	CSL_FINST(mcaspRegs->RMASK, MCASP_RMASK_RMASK10, NOMASK);
    	CSL_FINST(mcaspRegs->RMASK, MCASP_RMASK_RMASK9,  NOMASK);		
    	CSL_FINST(mcaspRegs->RMASK, MCASP_RMASK_RMASK8,  NOMASK);	//Audio Data LSB (24 bit)
    	CSL_FINST(mcaspRegs->RMASK, MCASP_RMASK_RMASK7,  NOMASK);		
    	CSL_FINST(mcaspRegs->RMASK, MCASP_RMASK_RMASK6, NOMASK);
    	CSL_FINST(mcaspRegs->RMASK, MCASP_RMASK_RMASK5, NOMASK);
    	CSL_FINST(mcaspRegs->RMASK, MCASP_RMASK_RMASK4, NOMASK);
    	CSL_FINST(mcaspRegs->RMASK, MCASP_RMASK_RMASK3, NOMASK);
    	CSL_FINST(mcaspRegs->RMASK, MCASP_RMASK_RMASK2, NOMASK);
    	CSL_FINST(mcaspRegs->RMASK, MCASP_RMASK_RMASK1, NOMASK);
    	CSL_FINST(mcaspRegs->RMASK, MCASP_RMASK_RMASK0, NOMASK);
    	
    	
    
    	
    
    /* Receive Frame Sync Control Register */
    	
    	//Configure Frame Sync for 2 Channel TDM
    	CSL_FINST(mcaspRegs->AFSRCTL, MCASP_AFSRCTL_RMOD, I2S);
    	//Configure Frame Sync to last length of word
    	CSL_FINST(mcaspRegs->AFSRCTL, MCASP_AFSRCTL_FRWID, WORD);
    	//Configure Frame Sync for internal generation
    	CSL_FINST(mcaspRegs->AFSRCTL, MCASP_AFSRCTL_FSRM, INTERNAL);
    	//Configure Frame Sync that falling edge starts new channel for I2S
    	CSL_FINST(mcaspRegs->AFSRCTL, MCASP_AFSRCTL_FSRP, FALLINGEDGE);
    	
    	
    	
    	/* Receive Bit Clock Control Register */
    	//Sample bit on Rising Edge of ACLKR
    	CSL_FINST(mcaspRegs->ACLKRCTL, MCASP_ACLKRCTL_CLKRP, RISINGEDGE);
    	//Clock Generated by OMAP-L138
    	CSL_FINST(mcaspRegs->ACLKRCTL, MCASP_ACLKRCTL_CLKRM, INTERNAL);
    	CSL_FINS(mcaspRegs->ACLKRCTL, MCASP_ACLKRCTL_CLKRDIV, 0); 			//Irrelvant when ASYNC = 0
    	
    	
    	/*Receive High Frequency Clock Control Register (Master Clock)*/
    		//Irrelvant when ASYNC = 0
    		
    	/*Receive TDM Time Slot Register */
    	//Slots 31-2 Inactive
    	CSL_FINST(mcaspRegs->RTDM, MCASP_RTDM_RTDMS31, INACTIVE);
    	CSL_FINST(mcaspRegs->RTDM, MCASP_RTDM_RTDMS30, INACTIVE);
    	CSL_FINST(mcaspRegs->RTDM, MCASP_RTDM_RTDMS29, INACTIVE);
    	CSL_FINST(mcaspRegs->RTDM, MCASP_RTDM_RTDMS28, INACTIVE);
    	CSL_FINST(mcaspRegs->RTDM, MCASP_RTDM_RTDMS27, INACTIVE);
    	CSL_FINST(mcaspRegs->RTDM, MCASP_RTDM_RTDMS26, INACTIVE);
    	CSL_FINST(mcaspRegs->RTDM, MCASP_RTDM_RTDMS25, INACTIVE);
    	CSL_FINST(mcaspRegs->RTDM, MCASP_RTDM_RTDMS24, INACTIVE);
    	CSL_FINST(mcaspRegs->RTDM, MCASP_RTDM_RTDMS23, INACTIVE);
    	CSL_FINST(mcaspRegs->RTDM, MCASP_RTDM_RTDMS22, INACTIVE);
    	CSL_FINST(mcaspRegs->RTDM, MCASP_RTDM_RTDMS21, INACTIVE);
    	CSL_FINST(mcaspRegs->RTDM, MCASP_RTDM_RTDMS20, INACTIVE);
    	CSL_FINST(mcaspRegs->RTDM, MCASP_RTDM_RTDMS19, INACTIVE);
    	CSL_FINST(mcaspRegs->RTDM, MCASP_RTDM_RTDMS18, INACTIVE);
    	CSL_FINST(mcaspRegs->RTDM, MCASP_RTDM_RTDMS17, INACTIVE);
    	CSL_FINST(mcaspRegs->RTDM, MCASP_RTDM_RTDMS16, INACTIVE);
    	CSL_FINST(mcaspRegs->RTDM, MCASP_RTDM_RTDMS15, INACTIVE);
    	CSL_FINST(mcaspRegs->RTDM, MCASP_RTDM_RTDMS14, INACTIVE);
    	CSL_FINST(mcaspRegs->RTDM, MCASP_RTDM_RTDMS13, INACTIVE);
    	CSL_FINST(mcaspRegs->RTDM, MCASP_RTDM_RTDMS12, INACTIVE);
    	CSL_FINST(mcaspRegs->RTDM, MCASP_RTDM_RTDMS11, INACTIVE);
    	CSL_FINST(mcaspRegs->RTDM, MCASP_RTDM_RTDMS10, INACTIVE);
    	CSL_FINST(mcaspRegs->RTDM, MCASP_RTDM_RTDMS9, INACTIVE);
    	CSL_FINST(mcaspRegs->RTDM, MCASP_RTDM_RTDMS8, INACTIVE);
    	CSL_FINST(mcaspRegs->RTDM, MCASP_RTDM_RTDMS7, INACTIVE);
    	CSL_FINST(mcaspRegs->RTDM, MCASP_RTDM_RTDMS6, INACTIVE);
    	CSL_FINST(mcaspRegs->RTDM, MCASP_RTDM_RTDMS5, INACTIVE);
    	CSL_FINST(mcaspRegs->RTDM, MCASP_RTDM_RTDMS4, INACTIVE);
    	CSL_FINST(mcaspRegs->RTDM, MCASP_RTDM_RTDMS3, INACTIVE);
    	CSL_FINST(mcaspRegs->RTDM, MCASP_RTDM_RTDMS2, INACTIVE);
    	//Slots 0,1 Active for I2S
    	CSL_FINST(mcaspRegs->RTDM, MCASP_RTDM_RTDMS1, ACTIVE);
    	CSL_FINST(mcaspRegs->RTDM, MCASP_RTDM_RTDMS0, ACTIVE);
    	
    	/* Receiver Interrupt Control Register */
    
    	//Disable Start of Frame Interrupt
    	CSL_FINST(mcaspRegs->RINTCTL, MCASP_RINTCTL_RSTAFRM, DISABLE);
    	//Disable Data Read Interrupt
    	CSL_FINST(mcaspRegs->RINTCTL, MCASP_RINTCTL_RDATA, DISABLE);
    	//Disable Recive Last Time Slot Interrupt
    	CSL_FINST(mcaspRegs->RINTCTL, MCASP_RINTCTL_RLAST, DISABLE);
    	//Disable DMA Error Interrupt
    	CSL_FINST(mcaspRegs->RINTCTL, MCASP_RINTCTL_RDMAERR, DISABLE);
    	//Disable Clock Failure Error Interrupt
    	CSL_FINST(mcaspRegs->RINTCTL, MCASP_RINTCTL_RCKFAIL, DISABLE);
    	//Disable Unexpected FrameSync Error Interrupt
    	CSL_FINST(mcaspRegs->RINTCTL, MCASP_RINTCTL_RSYNCERR, DISABLE);
    	//Disable Reciever Overrun Error Interrupt
    	CSL_FINST(mcaspRegs->RINTCTL, MCASP_RINTCTL_ROVRN, DISABLE);
    
    
      	//Recieve Clock Check Control Register
     		//Since Rx Clock is synchronized with Tx Clock, 
     		//No need to configure Rx Clock Check Circuit - because
     		//fail to Tx Clock will propogate in fail to Rx clock
    
    
      /* 	[b] Transmit Registers: If external clocks are used, they must be running already for proper synchronization
      *         of the global control registers */
      
      
      
      	/*Transmit Serializer */
    	
    	//Data Aligment Recieved from DSP -> Echo of McASP Rx
    	/* 31      30    29    28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10   9       8      7     6 5 4 3 2 1 0 */                    
    	/* Delay   MSb (MSb-1)                                                          LSb+1)  LSb  */
    
    	//  ^
    	//  |
    	// (From I2S Protocol)		
    	
    
      	/*Transmit Format Unit Bit Mask Register */
    	//Keep All Bits unmaksed 
    	CSL_FINST(mcaspRegs->XMASK, MCASP_XMASK_XMASK31, NOMASK);		//Audio Data Bit MSB
    	CSL_FINST(mcaspRegs->XMASK, MCASP_XMASK_XMASK30, NOMASK);		//Audio Data Bit MSB-1	
    	CSL_FINST(mcaspRegs->XMASK, MCASP_XMASK_XMASK29, NOMASK);			
    	CSL_FINST(mcaspRegs->XMASK, MCASP_XMASK_XMASK28, NOMASK);
    	CSL_FINST(mcaspRegs->XMASK, MCASP_XMASK_XMASK27, NOMASK);
    	CSL_FINST(mcaspRegs->XMASK, MCASP_XMASK_XMASK26, NOMASK);
    	CSL_FINST(mcaspRegs->XMASK, MCASP_XMASK_XMASK25, NOMASK);
    	CSL_FINST(mcaspRegs->XMASK, MCASP_XMASK_XMASK24, NOMASK);
    	CSL_FINST(mcaspRegs->XMASK, MCASP_XMASK_XMASK23, NOMASK);
    	CSL_FINST(mcaspRegs->XMASK, MCASP_XMASK_XMASK22, NOMASK);
    	CSL_FINST(mcaspRegs->XMASK, MCASP_XMASK_XMASK21, NOMASK);
    	CSL_FINST(mcaspRegs->XMASK, MCASP_XMASK_XMASK20, NOMASK);
    	CSL_FINST(mcaspRegs->XMASK, MCASP_XMASK_XMASK19, NOMASK);
    	CSL_FINST(mcaspRegs->XMASK, MCASP_XMASK_XMASK18, NOMASK);
    	CSL_FINST(mcaspRegs->XMASK, MCASP_XMASK_XMASK17, NOMASK);
    	CSL_FINST(mcaspRegs->XMASK, MCASP_XMASK_XMASK16, NOMASK);		//Audio Data Bit LSB (16 bit)
    	CSL_FINST(mcaspRegs->XMASK, MCASP_XMASK_XMASK15, NOMASK);
    	CSL_FINST(mcaspRegs->XMASK, MCASP_XMASK_XMASK14, NOMASK);
    	CSL_FINST(mcaspRegs->XMASK, MCASP_XMASK_XMASK13, NOMASK);
    	CSL_FINST(mcaspRegs->XMASK, MCASP_XMASK_XMASK12, NOMASK);		//Audio Data Bit LSB (20 bit)
    	CSL_FINST(mcaspRegs->XMASK, MCASP_XMASK_XMASK11, NOMASK);
    	CSL_FINST(mcaspRegs->XMASK, MCASP_XMASK_XMASK10, NOMASK);
    	CSL_FINST(mcaspRegs->XMASK, MCASP_XMASK_XMASK9, NOMASK);		//Audio Data Bit LSB +1 
    	CSL_FINST(mcaspRegs->XMASK, MCASP_XMASK_XMASK8, NOMASK);		//Audio Data Bit LSB (24 bit)	
    	CSL_FINST(mcaspRegs->XMASK, MCASP_XMASK_XMASK7, NOMASK);				
    	CSL_FINST(mcaspRegs->XMASK, MCASP_XMASK_XMASK6, NOMASK);			
    	CSL_FINST(mcaspRegs->XMASK, MCASP_XMASK_XMASK5, NOMASK);
    	CSL_FINST(mcaspRegs->XMASK, MCASP_XMASK_XMASK4, NOMASK);
    	CSL_FINST(mcaspRegs->XMASK, MCASP_XMASK_XMASK3, NOMASK);
    	CSL_FINST(mcaspRegs->XMASK, MCASP_XMASK_XMASK2, NOMASK);
    	CSL_FINST(mcaspRegs->XMASK, MCASP_XMASK_XMASK1, NOMASK);
    	CSL_FINST(mcaspRegs->XMASK, MCASP_XMASK_XMASK0, NOMASK);
    	
    		
    	
    	CSL_FINST(mcaspRegs->XFMT, MCASP_XFMT_XDATDLY,  0BIT);		//For Echo, McASP has already delayed the 1 bit, 
    												//so for a direct copy, do not delay another bit
    	CSL_FINST(mcaspRegs->XFMT, MCASP_XFMT_XRVRS,    MSBFIRST);
    	CSL_FINST(mcaspRegs->XFMT, MCASP_XFMT_XPAD, 	ZERO);
    	CSL_FINST(mcaspRegs->XFMT, MCASP_XFMT_XSSZ, 	32BITS);
    	CSL_FINS(mcaspRegs->XFMT, MCASP_XFMT_XPBIT, 	0);
    	CSL_FINST(mcaspRegs->XFMT, MCASP_XFMT_XROT,	NONE);
    	CSL_FINST(mcaspRegs->XFMT, MCASP_XFMT_XBUSEL, 	VBUS);	
    
    	/*Transmit Frame Sync Control Register */
    		//Frame Sync is configured for I2S
    	CSL_FINST(mcaspRegs->AFSXCTL, MCASP_AFSXCTL_XMOD, I2S);
    		//Frame Sync Length is Word
    	CSL_FINST(mcaspRegs->AFSXCTL, MCASP_AFSXCTL_FXWID, WORD);
    		//Frame Sync is internally generated by XCLK
    	CSL_FINST(mcaspRegs->AFSXCTL, MCASP_AFSXCTL_FSXM, INTERNAL);
    		//Falled Edige indicates beginning of new word
    	CSL_FINST(mcaspRegs->AFSXCTL, MCASP_AFSXCTL_FSXP, FALLINGEDGE);
    	
    	/* Transmit Clock Control Register */
    	
    	/* ACLKX = 3.072MHz = 64Fs = 256Fs/4 */
    	CSL_FINST(mcaspRegs->ACLKXCTL, MCASP_ACLKXCTL_CLKXP, RISINGEDGE);
    	CSL_FINST(mcaspRegs->ACLKXCTL, MCASP_ACLKXCTL_ASYNC, SYNC);				//ACLKR / nACLKX
    	CSL_FINST(mcaspRegs->ACLKXCTL, MCASP_ACLKXCTL_CLKXM, INTERNAL);
    	CSL_FINS(mcaspRegs->ACLKXCTL, MCASP_ACLKXCTL_CLKXDIV, 7);
    	
    	
    	/* Transmit High Frequency Clock Register*/
    	// Generate High Frequency Clock Source Externally from 24.576MHz XTAL
    	//CSL_FINST(mcaspRegs->AHCLKXCTL, MCASP_AHCLKXCTL_HCLKXM, EXTERNAL);
    	CSL_FINST(mcaspRegs->AHCLKXCTL, MCASP_AHCLKXCTL_HCLKXM, INTERNAL); //PK
    	CSL_FINST(mcaspRegs->AHCLKXCTL, MCASP_AHCLKXCTL_HCLKXP, NOTINVERTED);
    	
    	// AHCLKX = 24.576MHz
    	CSL_FINS(mcaspRegs->AHCLKXCTL, MCASP_AHCLKXCTL_HCLKXDIV, 0);
    		
    	
    	
    
    	/* Transmit TDM Time Slot Register */
    	//32-2 should be inactive
    	CSL_FINST(mcaspRegs->XTDM, MCASP_XTDM_XTDMS31, INACTIVE);
    	CSL_FINST(mcaspRegs->XTDM, MCASP_XTDM_XTDMS30, INACTIVE);
    	CSL_FINST(mcaspRegs->XTDM, MCASP_XTDM_XTDMS29, INACTIVE);
    	CSL_FINST(mcaspRegs->XTDM, MCASP_XTDM_XTDMS28, INACTIVE);
    	CSL_FINST(mcaspRegs->XTDM, MCASP_XTDM_XTDMS27, INACTIVE);
    	CSL_FINST(mcaspRegs->XTDM, MCASP_XTDM_XTDMS26, INACTIVE);
    	CSL_FINST(mcaspRegs->XTDM, MCASP_XTDM_XTDMS25, INACTIVE);
    	CSL_FINST(mcaspRegs->XTDM, MCASP_XTDM_XTDMS24, INACTIVE);
    	CSL_FINST(mcaspRegs->XTDM, MCASP_XTDM_XTDMS23, INACTIVE);
    	CSL_FINST(mcaspRegs->XTDM, MCASP_XTDM_XTDMS22, INACTIVE);
    	CSL_FINST(mcaspRegs->XTDM, MCASP_XTDM_XTDMS21, INACTIVE);
    	CSL_FINST(mcaspRegs->XTDM, MCASP_XTDM_XTDMS20, INACTIVE);
    	CSL_FINST(mcaspRegs->XTDM, MCASP_XTDM_XTDMS19, INACTIVE);
    	CSL_FINST(mcaspRegs->XTDM, MCASP_XTDM_XTDMS18, INACTIVE);
    	CSL_FINST(mcaspRegs->XTDM, MCASP_XTDM_XTDMS17, INACTIVE);
    	CSL_FINST(mcaspRegs->XTDM, MCASP_XTDM_XTDMS16, INACTIVE);
    	CSL_FINST(mcaspRegs->XTDM, MCASP_XTDM_XTDMS15, INACTIVE);
    	CSL_FINST(mcaspRegs->XTDM, MCASP_XTDM_XTDMS14, INACTIVE);
    	CSL_FINST(mcaspRegs->XTDM, MCASP_XTDM_XTDMS13, INACTIVE);
    	CSL_FINST(mcaspRegs->XTDM, MCASP_XTDM_XTDMS12, INACTIVE);
    	CSL_FINST(mcaspRegs->XTDM, MCASP_XTDM_XTDMS11, INACTIVE);
    	CSL_FINST(mcaspRegs->XTDM, MCASP_XTDM_XTDMS10, INACTIVE);
    	CSL_FINST(mcaspRegs->XTDM, MCASP_XTDM_XTDMS9,  INACTIVE);
    	CSL_FINST(mcaspRegs->XTDM, MCASP_XTDM_XTDMS8,  INACTIVE);
    	CSL_FINST(mcaspRegs->XTDM, MCASP_XTDM_XTDMS7,  INACTIVE);
    	CSL_FINST(mcaspRegs->XTDM, MCASP_XTDM_XTDMS6,  INACTIVE);
    	CSL_FINST(mcaspRegs->XTDM, MCASP_XTDM_XTDMS5,  INACTIVE);
    	CSL_FINST(mcaspRegs->XTDM, MCASP_XTDM_XTDMS4,  INACTIVE);
    	CSL_FINST(mcaspRegs->XTDM, MCASP_XTDM_XTDMS3,  INACTIVE);
    	CSL_FINST(mcaspRegs->XTDM, MCASP_XTDM_XTDMS2,  INACTIVE);
    	//Active Slots 0/1 for I2S
    	CSL_FINST(mcaspRegs->XTDM, MCASP_XTDM_XTDMS1,  ACTIVE);
    	CSL_FINST(mcaspRegs->XTDM, MCASP_XTDM_XTDMS0,  ACTIVE);
    	
    	/*Transmit Interrupt Control Register */
    	//Disable All Transmit McASP Interrupts
    #if 0
    	CSL_FINST(mcaspRegs->XINTCTL, MCASP_XINTCTL_XSTAFRM, DISABLE);
    	CSL_FINST(mcaspRegs->XINTCTL, MCASP_XINTCTL_XDATA,   ENABLE);
    	CSL_FINST(mcaspRegs->XINTCTL, MCASP_XINTCTL_XLAST,   DISABLE);
    	CSL_FINST(mcaspRegs->XINTCTL, MCASP_XINTCTL_XDMAERR, DISABLE);
    	CSL_FINST(mcaspRegs->XINTCTL, MCASP_XINTCTL_XCKFAIL, DISABLE);		
    	CSL_FINST(mcaspRegs->XINTCTL, MCASP_XINTCTL_XSYNCERR, DISABLE);		
    	CSL_FINST(mcaspRegs->XINTCTL, MCASP_XINTCTL_XUNDRN,  DISABLE);		
    #endif
    	CSL_FINST(mcaspRegs->XINTCTL, MCASP_XINTCTL_XSTAFRM, ENABLE);
    	CSL_FINST(mcaspRegs->XINTCTL, MCASP_XINTCTL_XDATA, ENABLE);
    	CSL_FINST(mcaspRegs->XINTCTL, MCASP_XINTCTL_XLAST, ENABLE);
    	CSL_FINST(mcaspRegs->XINTCTL, MCASP_XINTCTL_XDMAERR, ENABLE);
    	CSL_FINST(mcaspRegs->XINTCTL, MCASP_XINTCTL_XCKFAIL, ENABLE);
    	CSL_FINST(mcaspRegs->XINTCTL, MCASP_XINTCTL_XSYNCERR, ENABLE);
    	CSL_FINST(mcaspRegs->XINTCTL, MCASP_XINTCTL_XUNDRN, ENABLE);
    
      
      	//Transmit Clock Check Control Register
      		
    	//Set McASP Clock Zone Post Scaler
    	
    	//Note McASP is driven by SYSCLK2 which is SYSCLK/ which is a divide
    	// by two of the main system clock 300/2 = (150MHz)
    	CSL_FINST(mcaspRegs->XCLKCHK, MCASP_XCLKCHK_XPS, DIVBY4);
    	
    	//Set XMAX Value
    		//Notes: Prescale by 4
    		//150/4 = 37.5 MHz.
    		
    		//37.5MHz /24.576MHz (AUXCLK)  = 1.52587890625
    		//32 Clock Counts * 1.52587890625 = 48.8 McASP System Clock Counts per every 32 AHCLKX
    		//Counts
    		
    		//___________________________________________
    		//32 ACLKs / 24.576MHz = 1.302uSec 
    		
    		//48 Clocks / 37.5 MHz = 1.28 uSec
    		//49 Clocks / 37.5 MHz = 1.306uSec
    		
    		//___________________________________________
    		//Check
    		//1.28 uSec < 1.302uSec < 1.306uSec
    		
    		//Include clock count buffer of 1 CLOCK
    		//So Configure XMIN to be Uint8 47 (0x2F)
    		//   Configure XMAX to be Uint8 50 (0x32)
    	
    	CSL_FINS(mcaspRegs->XCLKCHK, MCASP_XCLKCHK_XMIN, 0x2F);	
    	CSL_FINS(mcaspRegs->XCLKCHK, MCASP_XCLKCHK_XMAX, 0x32);
    
      	
      
      
      /* 
    
      * [c] Serializer Registers */
     		//We only care to configure those for Serialzer 11,12 in this example
     	 
     	 //Configure Serializer 11 to be a Transmit Serializer
      	CSL_FINST(mcaspRegs->SRCTL11, MCASP_SRCTL11_SRMOD, XMT);
      	 //Configure Serializer 13 to be a Transmit Serializer (digital loopback mode)
      	//CSL_FINST(mcaspRegs->SRCTL13, MCASP_SRCTL13_SRMOD, XMT);
      	
      	//Configure Serializer 12 to be a Recieve Serializer
    	CSL_FINST(mcaspRegs->SRCTL12, MCASP_SRCTL12_SRMOD, RCV);
     
     
     /* 	[d] Global Registers: */
     
     		/* PFUNC Register */
    			//Configure AHCLKX, ACLKX, AFSX, AXR11, AXR12 as McASP Pins vs. GPIO Pins
    	CSL_FINST(mcaspRegs->PFUNC, MCASP_PFUNC_AFSX, MCASP);
    	CSL_FINST(mcaspRegs->PFUNC, MCASP_PFUNC_AHCLKX, MCASP);
    	CSL_FINST(mcaspRegs->PFUNC, MCASP_PFUNC_ACLKX, MCASP);
    	CSL_FINST(mcaspRegs->PFUNC, MCASP_PFUNC_AXR11, MCASP);
    	CSL_FINST(mcaspRegs->PFUNC, MCASP_PFUNC_AXR12, MCASP);	
    
    
    		/* PDIR Register */
    		//Configure the AHCLKX, ACLKX, AFSX, AXR11 as Output Pins to send Clocks/Data from TLV320AIC3106
    	CSL_FINST(mcaspRegs->PDIR, MCASP_PDIR_AFSX, OUTPUT);
    	//CSL_FINST(mcaspRegs->PDIR, MCASP_PDIR_AHCLKX, INPUT);
    	CSL_FINST(mcaspRegs->PDIR, MCASP_PDIR_AHCLKX, OUTPUT);// PK
    	CSL_FINST(mcaspRegs->PDIR, MCASP_PDIR_ACLKX, OUTPUT);
    	CSL_FINST(mcaspRegs->PDIR, MCASP_PDIR_AXR11, OUTPUT);
    
    	
    	//Configure AXR11 as Input to Get Data from TLV320AIC3106
    	CSL_FINST(mcaspRegs->PDIR, MCASP_PDIR_AFSR, INPUT);
    	CSL_FINST(mcaspRegs->PDIR, MCASP_PDIR_AHCLKR, INPUT);
    	CSL_FINST(mcaspRegs->PDIR, MCASP_PDIR_ACLKR, INPUT);
    	CSL_FINST(mcaspRegs->PDIR, MCASP_PDIR_AXR12, INPUT);
    
    /* Digital Interface Tranmistter Control Regiser */
    
    	//Disable DIT Portion of McASP
    	CSL_FINST(mcaspRegs->DITCTL, MCASP_DITCTL_DITEN, DISABLE);
    	
    /* Digital Loopback Control Register*/
    
    	//Configure Digital Loopback
    	CSL_FINST(mcaspRegs->DLBCTL, MCASP_DLBCTL_DLBEN, DISABLE);
    	//CSL_FINST(mcaspRegs->DLBCTL, MCASP_DLBCTL_DLBEN, ENABLE);
    	CSL_FINST(mcaspRegs->DLBCTL, MCASP_DLBCTL_ORD, XMTODD); // AXR11, Tx
    	//CSL_FINST(mcaspRegs->DLBCTL, MCASP_DLBCTL_MODE, XMTCLK); // PK
    
    
    	
    
    	/* AMUTE Register */
    
    /* The stat of this register doesn't matter on the OMAP-L138 baseboard
     * because the AMUTE pin is not connected to the TLV320AIC3106 Device */
     
    	//Configure AMUTE Pin to drive when any Error Occurs
    	CSL_FINST(mcaspRegs->AMUTE, MCASP_AMUTE_XDMAERR, DISABLE);
    	CSL_FINST(mcaspRegs->AMUTE, MCASP_AMUTE_RDMAERR, DISABLE);
    	CSL_FINST(mcaspRegs->AMUTE, MCASP_AMUTE_XCKFAIL, DISABLE);
    	CSL_FINST(mcaspRegs->AMUTE, MCASP_AMUTE_RCKFAIL, DISABLE);
    	CSL_FINST(mcaspRegs->AMUTE, MCASP_AMUTE_XUNDRN, DISABLE);
    	CSL_FINST(mcaspRegs->AMUTE, MCASP_AMUTE_ROVRN, DISABLE);
    	CSL_FINST(mcaspRegs->AMUTE, MCASP_AMUTE_XUNDRN, DISABLE);
    	CSL_FINST(mcaspRegs->AMUTE, MCASP_AMUTE_ROVRN, DISABLE);
    	
    	//Disable AMUTEIN Pin to isolate from LogicPD HW status
    	CSL_FINST(mcaspRegs->AMUTE, MCASP_AMUTE_INSTAT, INACTIVE);
    	
    	//Disable Drive on AMUTEOUT when AMUTEIN error is active
    	CSL_FINST(mcaspRegs->AMUTE, MCASP_AMUTE_INEN, DISABLE);
    	
    	//Configure AMUTE Input Logic Level to High
    	CSL_FINST(mcaspRegs->AMUTE, MCASP_AMUTE_INPOL, ACTHIGH);
    	//Disable AMUTE PIN
    	CSL_FINST(mcaspRegs->AMUTE, MCASP_AMUTE_MUTEN, DISABLE);
    	
    	
    	/* Steps 4-11 Continued in McASPStart(); */
    
    return;
    }
    
    void McASPStart(void){
    	
    
     	/* [4] Start the respective High Frequency Serial Clocks
     	 * 		[a] Take the respective High Frequency Clocks out of reset
     	 *		[b] Read back from GBLTRL to ensure the bits to which you wrote are sucessfully latch in GBLCTL before you proceed
     	 */
     	 	if(CSL_FEXT(mcaspRegs->GBLCTL, MCASP_GBLCTL_XHCLKRST)!=CSL_MCASP_GBLCTL_XHCLKRST_ACTIVE){
     	 		
     	 		 //Start Transmit High Frequency clock if not active
     			 CSL_FINST(mcaspRegs->XGBLCTL, MCASP_XGBLCTL_XHCLKRST, ACTIVE);
     			 
     			//Stall until GBLCTL reads back to ensure it was latched by the logic
     	 		while(CSL_FEXT(mcaspRegs->GBLCTL, MCASP_GBLCTL_XHCLKRST)!=CSL_MCASP_GBLCTL_XHCLKRST_ACTIVE);	
    
     	 	}
    
     	 	
     	 	 if(CSL_FEXT(mcaspRegs->GBLCTL, MCASP_GBLCTL_RHCLKRST)!=CSL_MCASP_GBLCTL_RHCLKRST_ACTIVE){
     
     			//Start Recieve High Frequency clock
     	 	  	CSL_FINST(mcaspRegs->RGBLCTL, MCASP_RGBLCTL_RHCLKRST, ACTIVE);
     	 	  	 
     	 	  	 //Stall until GBLCTL reads back to ensure it was latched by the logic
     	 		while(CSL_FEXT(mcaspRegs->GBLCTL, MCASP_GBLCTL_RHCLKRST)!=CSL_MCASP_GBLCTL_RHCLKRST_ACTIVE);
     	 	}
    
     	 
     	 /* [5] Start the respective serial clocks
     	  * 		[a] Take the respective internal serial clock dividers out of reset
     	  * 		[b] Read by from GBLCTL to ensure the bits to which you wrote are succesfully latched*/
     	  
    		if(CSL_FEXT(mcaspRegs->GBLCTL, MCASP_GBLCTL_XCLKRST)!=CSL_MCASP_GBLCTL_XCLKRST_ACTIVE){
     	 		
      		 	//Start Transmit High Frequency clock if not active
     		 	CSL_FINST(mcaspRegs->XGBLCTL, MCASP_XGBLCTL_XCLKRST, ACTIVE);
     			 
     			//Stall until GBLCTL reads back to ensure it was latched by the logic
     	 		while(CSL_FEXT(mcaspRegs->GBLCTL, MCASP_GBLCTL_XCLKRST)!=CSL_MCASP_GBLCTL_XCLKRST_ACTIVE);
     	 	}
    
     	 	 if(CSL_FEXT(mcaspRegs->GBLCTL, MCASP_GBLCTL_RCLKRST)!=CSL_MCASP_GBLCTL_RCLKRST_ACTIVE){
     
     			//Start Recieve Serial Clock
     	 		CSL_FINST(mcaspRegs->RGBLCTL, MCASP_RGBLCTL_RCLKRST, ACTIVE);
     	 	  	 
     	 	  	 //Stall until GBLCTL reads back to ensure it was latched by the logic
     	 		while(CSL_FEXT(mcaspRegs->GBLCTL, MCASP_GBLCTL_RCLKRST)!=CSL_MCASP_GBLCTL_RCLKRST_ACTIVE);
     	 	}
    
     	 	/* [6] Set Up data acquistion as required 
     	 	 * 		[a] If DMA is used to service the McASP, set up the data Acquisition as desired and start 
     	 	 *          the DMA
     	 	 * 		[b] If CPU interrupt is used to service the McASP, enable the transmit/recieve interrupt
     	 	 *          as required
     	 	 *      [c] If CPU pooling is used to service the McASP, no action is required in this step
     	 	 */
     	 	 
     	 	 	//For now we use CPU polling -> so no action is required
     	 	 	
     	 	 /* [7] Activate Serializers
     	 	  * 	[a] Before starting, clear the Tx/Rx Status registers by writting FFFF to them*/
     	 	
     	 	  	
     	 	  
     	 	  	mcaspRegs->XSTAT = 0x0000FFFF;
     	 	  	mcaspRegs->RSTAT = 0x0000FFFF;
     
     	 	  	
     	 	/*  	[b] Take the Serializers out of Reset
     	 	 * [c] Read back from GBLCTL to ensure the bits are latched  */  	
     	 	 
     	 	if(CSL_FEXT(mcaspRegs->GBLCTL, MCASP_GBLCTL_XSRCLR)!=CSL_MCASP_GBLCTL_XSRCLR_ACTIVE){
     
     			//Start Recieve Serial Clock
     	 		CSL_FINST(mcaspRegs->XGBLCTL, MCASP_XGBLCTL_XSRCLR, ACTIVE);
     	 	  	 
     	 	  	// Stall until GBLCTL reads back to ensure it was latched by the logic
     	 		while(CSL_FEXT(mcaspRegs->GBLCTL, MCASP_GBLCTL_XSRCLR)!=CSL_MCASP_GBLCTL_XSRCLR_ACTIVE);
     	 	} 
     	 	
     	  	if(CSL_FEXT(mcaspRegs->GBLCTL, MCASP_GBLCTL_RSRCLR)!=CSL_MCASP_GBLCTL_RSRCLR_ACTIVE){
     
     			//Start Recieve Serial Clock
     	 		CSL_FINST(mcaspRegs->RGBLCTL, MCASP_RGBLCTL_RSRCLR, ACTIVE);
     	 	  	 
     	 	  	// Stall until GBLCTL reads back to ensure it was latched by the logic
     	 		while(CSL_FEXT(mcaspRegs->GBLCTL, MCASP_GBLCTL_RSRCLR)!=CSL_MCASP_GBLCTL_RSRCLR_ACTIVE);
     	 	} 	 	  
     
     	 	 
    		/* [8] Verify that Tx Buffers are services. 
    		 * 		[a] If DMA is used to service the McASP, the DMA auto services the McASP upon
    		 * 			recieving AXEVT. Before proceeding, you should verify that the XDATA in XSTAT is clear
    		 *   		to zero, indicating that the Tx buffers are already services by the DMA 
    		 * 
    		 *		[b] If CPU interrupt is used to service the McASP, ISRs is entered upon the AXINT interrupt.
    		 *    		The interrupt service routing should service the XBUF registers. Before proceeding, clear
    		 * 			the XDATA bit in the XSTAT
    		 * 
    		 * 		[c] If CPU Pooling is used to service the McASP, the XBUF Registers should be written to in this
    		 * 			step */
    
     	  	//mcaspRegs->XSTAT=0x00000020;  //b. XDATA bit is cleared by writing 1 to that bit
    		 
    		 	//Write Dummy Value of 0x00000000u to the XBUF11 (Tx Serializer)
    
    		 
    		 if(CSL_FEXT(mcaspRegs->XSTAT, MCASP_XSTAT_XDATA)==CSL_MCASP_XSTAT_XDATA_YES){
    		 	mcaspRegs->XBUF11 = 0xAAAAAAAAu;
    		 	//mcaspRegs->XBUF13 = 0x5555555Au;
    		 }
    		
    
    		 	
    		 
    	
    
     /*[9] Release the State Machines from Reset */
     
     	 	if(CSL_FEXT(mcaspRegs->GBLCTL, MCASP_GBLCTL_XSMRST)!=CSL_MCASP_GBLCTL_XSMRST_ACTIVE){
     
     			//Start Recieve Serial Clock
     	 		CSL_FINST(mcaspRegs->XGBLCTL, MCASP_XGBLCTL_XSMRST, ACTIVE);
     	 	  	 
     	 	  	// Stall until GBLCTL reads back to ensure it was latched by the logic
     	 		while(CSL_FEXT(mcaspRegs->GBLCTL, MCASP_GBLCTL_XSMRST)!=CSL_MCASP_GBLCTL_XSMRST_ACTIVE);
     	 	}
     	 	
     	 	if(CSL_FEXT(mcaspRegs->GBLCTL, MCASP_GBLCTL_RSMRST)!=CSL_MCASP_GBLCTL_RSMRST_ACTIVE){
     
     			//Start Recieve Serial Clock
     	 		CSL_FINST(mcaspRegs->RGBLCTL, MCASP_RGBLCTL_RSMRST, ACTIVE);
     	 	  	 
     	 	  	// Stall until GBLCTL reads back to ensure it was latched by the logic
     	 		while(CSL_FEXT(mcaspRegs->GBLCTL, MCASP_GBLCTL_RSMRST)!=CSL_MCASP_GBLCTL_RSMRST_ACTIVE);
     	 	}
     
     
    
    
    
    
    /* [10]. Release frame sync generators from reset. Note that it is necessary to release the internal frame sync
    generators from reset, even if an external frame sync is being used, because the frame sync error
    detection logic is built into the frame sync generator.
    	a. Take the respective frame sync generator(s) out of reset by setting the RFRST bit for the receiver,
    		and/or the XFRST bit for the transmitter in GBLCTL. All other bits in GBLCTL should be left at the
    		previous state. 
    	b. Read back from GBLCTL to ensure the bit(s) to which you wrote are successfully latched in
    		GBLCTL before you proceed. */
    
    
    
     	 if(CSL_FEXT(mcaspRegs->GBLCTL, MCASP_GBLCTL_XFRST)!=CSL_MCASP_GBLCTL_XFRST_ACTIVE){
      			//Start Recieve Serial Clock
      		CSL_FINST(mcaspRegs->XGBLCTL, MCASP_XGBLCTL_XFRST, ACTIVE);
      	  	 
      	  	 //Stall until GBLCTL reads back to ensure it was latched by the logic
      		while(CSL_FEXT(mcaspRegs->GBLCTL, MCASP_GBLCTL_XFRST)!=CSL_MCASP_GBLCTL_XFRST_ACTIVE);
      	}
      	
      	if(CSL_FEXT(mcaspRegs->GBLCTL, MCASP_GBLCTL_RFRST)!=CSL_MCASP_GBLCTL_RFRST_ACTIVE){
      			//Start Recieve Serial Clock
      		CSL_FINST(mcaspRegs->RGBLCTL, MCASP_RGBLCTL_RFRST, ACTIVE);
      	  	 
      	  	 //Stall until GBLCTL reads back to ensure it was latched by the logic
      		while(CSL_FEXT(mcaspRegs->GBLCTL, MCASP_GBLCTL_RFRST)!=CSL_MCASP_GBLCTL_RFRST_ACTIVE);
      	}
    
    		
    
    
    
    
    
    
    /* [11]. Upon the first frame sync signal, McASP transfers begin. The McASP synchronizes to an edge on the
    frame sync pin, not the level on the frame sync pin. This makes it easy to release the state machine
    and frame sync generators from reset.
    a. For example, if you configure the McASP for a rising edge transmit frame sync, then you do not
    need to wait for a low level on the frame sync pin
    
    */	
    	
    
    	
    	
    
    	return;	
    }
    
    void McASPStop(void){
    
    	/* This function should be used to stop clocks in the reverse order
    	 * from McASPStart */
    	 
    	return;	
    }
    
    void McASPEcho(void){
    	/* This function is used to wait until a McASP Event comes in, 
    	 * read the data and directly write it back out to the Codec */
    	 
    	 //Notes McASP Interrupts are still masked here so nothing should
    	 //interrupt the CPU
    	 
    	 //RSYNC error is expected right away, but shouldn't occur after first event
    	   		//because the clock references are internal and stable
      
     	return;
    }
    
    void McASPRestart(){
    	
    	if(mcaspRegs->GBLCTL == 0x00000000){
    		
    		McASPInit();
    		McASPStart();
    	}
    	
    	
    }
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    Fullscreen 4667.dspmm.c Download
    //Project  Name: quickStartOMAPL1x McASP Chip Support Library Example
    //Texas Instruments Device Platform: Logic Product Development OMAP-L138 Experimentor Kit
    //Copywrite (c) 2011 Texas Instruments Incroporated
    
    
    /*===============================================================*/
    /****************************LICENSE *****************************/
    /*===============================================================*/
    /*
     * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
     *
     *  Redistribution and use in source and binary forms, with or without
     *  modification, are permitted provided that the following conditions
     *  are met:
     *
     *    Redistributions of source code must retain the above copyright
     *    notice, this list of conditions and the following disclaimer.
     *
     *    Redistributions in binary form must reproduce the above copyright
     *    notice, this list of conditions and the following disclaimer in the
     *    documentation and/or other materials provided with the
     *    distribution.
     *
     *    Neither the name of Texas Instruments Incorporated nor the names of
     *    its contributors may be used to endorse or promote products derived
     *    from this software without specific prior written permission.
     *
     *  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
     *  "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
     *  LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
     *  A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
     *  OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
     *  SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
     *  LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
     *  DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
     *  THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
     *  (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
     *  OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.*/
     
     
     
     /*===============================================================*/
    /***************************INCLUDES *****************************/
    /*===============================================================*/ 
    #include "dspmm.h"
    #include "mcasp.h"
    
    
    Uint8 TxClockFail = 0x00;
    Uint8 TxDMAFail = 0x00;
    Uint8 TxFrameFail = 0x00;
    Uint8 TxUnderFail = 0x00;
    
    
    
    CSL_DspintcRegsOvly dspintcRegs = (CSL_DspintcRegsOvly) 	CSL_INTC_0_REGS;
    //CSL_IdmaRegsOvly 	dspdmaRegs 	= (CSL_IdmaRegsOvly)   	CSL_IDMA_0_REGS;
    //Uint32Ovly 			dsppdnRegs 	= (Uint32Ovly) 		DSPPDC_BASE_ADDRESS;
    CSL_CacheRegsOvly 	dspcache 	= (CSL_CacheRegsOvly) 	CSL_CACHE_0_REGS;
    
    
    void DSPMMInit(void){
    	
    	DSPPowerdownInit();					//Initialize DSP Power
    	DSPInit();							//Initialize DSP Control Registers
    	DSPCacheInit();						//Initialize DSP Cache Controllers
    	DSPIntCtrlInit();					//Initialize DSP Interrupt Controller
    }
    
    
    
    void DSPPowerdownInit (void)
    {
    	//Leave C674x MegaModule Power Down alone since it defaults to enabled.
    }
    
    
    //Configure DSP Core
    void DSPInit(void){
    	
    /* === Addressing Mode Register ===*/
    	   CSL_FINST(AMR, CHIP_AMR_BK0, RESETVAL);
    	   CSL_FINST(AMR, CHIP_AMR_BK1, RESETVAL);
    	   CSL_FINST(AMR, CHIP_AMR_B7MODE, LINEAR);
    	   CSL_FINST(AMR, CHIP_AMR_B6MODE, LINEAR);
    	   CSL_FINST(AMR, CHIP_AMR_B5MODE, LINEAR);
    	   CSL_FINST(AMR, CHIP_AMR_B4MODE, LINEAR);
    	   CSL_FINST(AMR, CHIP_AMR_A7MODE, LINEAR);
    	   CSL_FINST(AMR, CHIP_AMR_A6MODE, LINEAR);
    	   CSL_FINST(AMR, CHIP_AMR_A5MODE, LINEAR);
    	   CSL_FINST(AMR, CHIP_AMR_A4MODE, LINEAR);
    
    /* === Control Status Reigster === */
    //CSR;
    	
    		CSL_FINST(CSR, CHIP_CSR_PWRD, RESETVAL);		//Keep C674 Powered Up
    		CSL_FINST(CSR, CHIP_CSR_EN, LITTLE );			//Configure as Little Endian
    		CSL_FINST(CSR, CHIP_CSR_GIE, DISABLE );			//Disable Global Interrupts
    	
    /* === Interrupt Flag Reigster === */
    //IFR;
    		/* Keep Default */ 
    
    /* === Interrupt SET Reigster === */
    //ISR;
    		/* Keep Default */ 
    		
    /* === Interrupt Clear Reigster === */
    //ICR;
    
    		//Apparently can cant write to ICR here?
    //		CSL_FINST(ICR, CHIP_ICR_IC15, CLR );					//Clear Interrupts 15-4
    //		CSL_FINST(ICR, CHIP_ICR_IC14, CLR );
    //		CSL_FINST(ICR, CHIP_ICR_IC13, CLR );
    //		CSL_FINST(ICR, CHIP_ICR_IC12, CLR );
    //		CSL_FINST(ICR, CHIP_ICR_IC11, CLR );
    //		CSL_FINST(ICR, CHIP_ICR_IC10, CLR );
    //		CSL_FINST(ICR, CHIP_ICR_IC9,  CLR );
    //		CSL_FINST(ICR, CHIP_ICR_IC8,  CLR );
    //		CSL_FINST(ICR, CHIP_ICR_IC7,  CLR );
    //		CSL_FINST(ICR, CHIP_ICR_IC6,  CLR );
    //		CSL_FINST(ICR, CHIP_ICR_IC5,  CLR );
    //		CSL_FINST(ICR, CHIP_ICR_IC4,  CLR );
    
    /* === Interrupt Enable Reigster === */
    //IER;
    		//Enable Non-Maskable
    		CSL_FINST(IER, CHIP_IER_NMI, ENABLE );
    	
    		
    		CSL_FINST(IER, CHIP_IER_IE04, ENABLE );				//Enable Interrupt 4 for McASP
    		CSL_FINST(IER, CHIP_IER_IE05, DISABLE );			//Disable Interrupt 5
    		CSL_FINST(IER, CHIP_IER_IE06, DISABLE );			//Disable Interrupt 6
    		CSL_FINST(IER, CHIP_IER_IE07, DISABLE );			//Disable Interrupt 7
    		CSL_FINST(IER, CHIP_IER_IE08, DISABLE );			//Disable Interrupt 8
    		CSL_FINST(IER, CHIP_IER_IE09, DISABLE );			//Disable Interrupt 9
    		CSL_FINST(IER, CHIP_IER_IE10, DISABLE );			//Disable Interrupt 10
    		CSL_FINST(IER, CHIP_IER_IE11, DISABLE );			//Disable Interrupt 11
    		CSL_FINST(IER, CHIP_IER_IE12, DISABLE );			//Disable Interrupt 12
    		CSL_FINST(IER, CHIP_IER_IE13, DISABLE );			//Disable Interrupt 13
    		CSL_FINST(IER, CHIP_IER_IE14, DISABLE );			//Disable Interrupt 14
    		CSL_FINST(IER, CHIP_IER_IE15, DISABLE );			//Disable Interrupt 15
    
    /* === Interrupt Service Table Reigster === */
    //ISTP;
    		/* Keep Default */ 
    
    /* === Non-Maskable Interrupt Return Pointer Reigster === */
    //IRP;
    		/* Overwritten by DSP during Maskable ISR */
    
    /* === Non-Maskable Interrupt Return Pointer Reigster === */
    //NRP;
    		/* Overwritten by DSP during Non-Maskable ISR */
    	
    }
    
    
    //Configure DSP Cache Controllers
    void DSPCacheInit(void)
    {
    
    /* === Configure Level 1 Program Cache ===*/
    
    /* === Configure Level 1 Data Cache ===*/
    
    /* === Configure Level 2 Cache ===*/
    
    
    
    
    }
    
    
    //Configure DSP Interrupt Controller
    void DSPIntCtrlInit (void)
    {
    
    	//Configure the Interrupt Controller for the following Map
    	//  Reset -> Reset
    	//  McASP -> CPUINT4
    	//  All Others Unused
    
    /* ===Event Combiner ===*/
    	//Event Combiner is not used because we simply don't need it.
    	//However we should mask off all the events for good measure.
    	
    	dspintcRegs->EVTMASK[0] = (Uint32) (0xFFFFFFFFu);
    	dspintcRegs->EVTMASK[1] = (Uint32) (0xFFFFFFFFu);
    	dspintcRegs->EVTMASK[2] = (Uint32) (0xFFFFFFFFu);
    	dspintcRegs->EVTMASK[3] = (Uint32) (0xFFFFFFFFu);
    	
    	
    /* ===Interrupt Selector ===*/	
    		//MCASP Interrupt will be send to CPU Interrupt # 4 (highest priority of available interrupts
    		CSL_FINS(dspintcRegs->INTMUX1, DSPINTC_INTMUX1_INTSEL4, CSL_INTC_EVENTID_MCASP0INT);
    		//All Other Interrupts will be disabled in the CPU
    
    
    /* ===Exception Combiner ===*/
    	//By default all the event inputs to the Exception Register as Masked off - so nothing to do here since
    	//we don't want system events to interrupt McASP ISR
    
    /* ===Advanced Event Generator Mux ===*/
    	//Leave as Default
    
    
    
    	//Change the Interrupt Service Table Pointer from ROM to RAM address 
    	ISTP = (unsigned int) DSPintcVectorTable;
    
    }
    
    
    
    //Non-Maskable Interrupt Service Routine
    interrupt void NMI_ISR(void){
    	asm(" B B3");			//Branch to Return Pointer Register
    	asm(" NOP 5");
    }
    
    //Maskable Interrupt #4 Service Routine
    interrupt void INT4_ISR(void){
    	
    
    	Uint32 xstat_in;
    	Uint32 rstat_in;
    
    
    	/* Interrupt Service Routine used for Combined Rx/Tx Interrupts from  McASP */
    	
    	/* If more than one interrupt request becomes active in the same cycle, a single interrupt
    	 * request is generated on the McASP porrt. Subsequent interrupt requests that become active 
    	 * while the first interrupt request is outstanding do not immediatly generate a new request
    	 * pulse on the McASP Interrupt Port
    	 * 
    	 * The Transmit interrupt is serviced with the CPU writtein to XSTAT. If any interrupt requests
    	 * are active after the write, a new request is generated on the McASP tx Interrupt port*/
    	
    	
    	//Disable Global Interrupts
    	_disable_interrupts();	
    
    	//Capture Snapshot of XSTAT /RSTAT at entry of ISR as these value will potentially change during the ISR
    	xstat_in = mcaspRegs->XSTAT;
    	rstat_in = mcaspRegs->RSTAT;
    
    
    	/*=========================================*/
    	/********* Tx/Rx Error Interrupts *********/
    	/*=========================================*/
    
    	if( (xstat_in & 0x00000100) | (rstat_in & 0x00000100) )       {
    		//At least one error occured on the McASP, and we need to handle - possible reset McASP
    		
    	/**** XCLKFAIL ****/
    		if( (xstat_in & 0x00000004) && (mcaspRegs->XINTCTL & 0x00000004) ){
    			
    			//XCLK Failed
    			//This portion of the ISR should always get entered once per McASP Start/Restart, 
    			//thus it is the first thing we check.
    			
    			//This interrupt is expected just after McASP Reset release.
    			//This should be architected so that if that the McASP Times out after certain number of clock errors
    			
    			if(!TxClockFail){
    				//If first slot this error occurs	
    				TxClockFail++;					//Increment Counter
    				mcaspRegs->XSTAT = 0x00000004;		//Clear Status Bit
    			}
    			else{
    				//This is at least the 2nd time around for the clock to fail, thus
    				//we should take some action
    				
    				//Mask off all other Interrupts except Tx Clock and timeout
    				TxClockFail++;		//Increment Clock Fail Count
    									
    				if(TxClockFail >=0x02){
    					
    					
    					
    					//Assume clock is wacked, signal for McASP Restart in Main Idle Loop
    					mcaspRegs->GBLCTL =  0x00000000;
    					
    					//Mask Off all Interrupts to the DSP Interrupt Controller to guarantee
    					//idle loop will run at least once.
    					mcaspRegs->RINTCTL = 0x00000000;
    					mcaspRegs->XINTCTL = 0x00000000;
    					
    				}	
    			}
    		}
    		/**** XUNDRN ******/
    		if( (xstat_in & 0x00000001) && (mcaspRegs->XINTCTL & 0x00000001) ){
    			//Serializer Underrun occured - > Data is set out on the Tx Serializer - so we must reset the McASP	
    			
    			//Under runs are only check once per time slot, and remains set until the DSP explicitly writes a 1
    			//to the XUNDRN bit to clear the underun condition.
    			//	[a] In DIT mode, a pair of BMC zeros is shifted out when an underrun occurs.
    			//	[b] In TDM mode, a long stream of zeros are shifted out causing, the DAC's to 
    			//	    mute. To Recover, reset the McASP and start again with the proper Initialization
    		
    			
    			// Stop McASP frame synch gen, serializers, state machines, then mask off all interrupts
    			//to guarantee that idle loop will reset McASP.
    			
    						
    			//We missed transfering data to XBUF11, so something is catastophically wrong with our code
    				mcaspRegs->GBLCTL =  0x00000000;
    					
    			//Mask Off all Interrupts to the DSP Interrupt Controller to guarantee
    			//idle loop will run at least once.
    				mcaspRegs->RINTCTL = 0x00000000;
    				mcaspRegs->XINTCTL = 0x00000000;
    			
    			//Clear the error
    			mcaspRegs->XSTAT = 0x00000001;
    					
    		}
    
    		/******Unexpected SOF *******/
    		if( (xstat_in & 0x00000002) && (mcaspRegs->XINTCTL & 0x00000002) ){
    			//Unexpected Tx Framesync -> If we have the McASP Rx/Tx Configured identially, shouldn't occur	
    			//See McASP User Guide for instruction of how to handle.
    			
    			//In TMD mode -> this shouldn't happen unless the external XTAL goes bad, which 
    			//will cause a XCLK Fail error as well.
    			
    			//Frame Sync is no longer sync'd -> Restart McASP
    			mcaspRegs->GBLCTL =  0x00000000;
    					
    			//Mask Off all Interrupts to the DSP Interrupt Controller to guarantee
    			//idle loop will run at least once.
    				mcaspRegs->RINTCTL = 0x00000000;
    				mcaspRegs->XINTCTL = 0x00000000;
    		
    			//Clear the error
    			mcaspRegs->XSTAT = 0x00000002;
    		}
    		/*******XDMAERROR ***/
    		if(  (xstat_in & 0x00000080) && (mcaspRegs->XINTCTL & 0x00000008)    ) {
    			//McASP Transmit DMA Error Occured
    			
    			//Occurs when DMA writes more words to the DMA port than it should.
    			//Not using DMA -> so this is a don't care for now
    				
    			//DMA's are not in use, and this interrupt is disabled -> to abort if code gets here
    				mcaspRegs->GBLCTL =  0x00000000;
    					
    			//Mask Off all Interrupts to the DSP Interrupt Controller to guarantee
    			//idle loop will run at least once.
    				mcaspRegs->RINTCTL = 0x00000000;
    				mcaspRegs->XINTCTL = 0x00000000;
    
    			//Clear the Error
    			mcaspRegs->XSTAT = 0x00000080;
    		}	
    	}	
    	else{
    	//Check for previous detected error flags that need to be cleared
    		if(TxClockFail || TxDMAFail || TxFrameFail || TxUnderFail){
    			//Assume Clock has stabilized
    			if(TxClockFail){
    				TxClockFail = 0x00;					//Clear Clock Fail Flag
    				
    			}
    			if(TxDMAFail){
    				TxDMAFail = 0x00;
    				
    			}
    			if(TxFrameFail){
    				TxFrameFail = 0x00;
    			
    			}
    			if(TxUnderFail){
    				TxUnderFail = 0x00;
    			}
    		
    			//Restore Interrupts
    		}
    	}
    	
    	
    	/*=========================================*/
    	/********* Tx Non-Error Interrupts *********/
    	/*=========================================*/
    	
    
    /* Tx Start of Frame */
    	if( (xstat_in & 0x00000040) && (mcaspRegs->XINTCTL & 0x00000080)){
    		//Start of Frame Interrupt Received
    		
    		//Disabled
    		mcaspRegs->XSTAT = 0x00000040;			//Clear Flag	
    	}
    
    	
    	
    /* Tx Data */
    	if( (xstat_in & 0x00000020) && (mcaspRegs->XINTCTL & 0x00000020) ){
    		//Tx Buffer is hungry for data
    		 
    		//Check to make sure RDATA buffer contains new data from XRSR12
    		if((((rstat_in & 0x00000020) == 0x00000020) && ((rstat_in & 0x00000001) == 0x00000000 ))){
    			mcaspRegs->XBUF11 = (Uint32) mcaspRegs->RBUF12;	
    			//mcaspRegs->XBUF11 = (Uint32) 0x7FFFFFFF;
    
    
    		}
    		else{
    			//RDATA is not new -> Transfer Zero's onto the bus for this Slot
    			mcaspRegs->XBUF11 = 0x00000000u;	
    		}
    	
    		mcaspRegs->XSTAT = 0x00000020;			//Clear Flag
    	}
    	
    
    /* Tx XLAST */
    	//Disabled as this would cause an interrupt every other frame
    
    	
    /* Tx TDM Slot */
    	//Disabled as this would cause an interrupt every other frame
    	
    	
    	/*=========================================*/
    	/********* Rx Non-Error Interrupts *********/
    	/*=========================================*/
    
    	
    /* Rx Start of Frame */
    	//Disabled since Rx SOF is synchonrized with Tx SOF
    
    /* Rx Data */
    	//Disabled due to synchronization of Rx/Tx
    
    /* Tx RLAST */
    	//Disabled due to synchronization of Rx/Tx
    
    /* Rx TDM Slot */
    	//Disabled due to synchronization of Rx/Tx		
    
    
    
    	//Re-Enable Global Interrupts
    	_enable_interrupts();	
    	
    	
    
    
    
    }
    
    //Maskable Interrupt #5 Service Routine
    interrupt void INT5_ISR(void){
    	asm(" B B3");			//Branch to Return Pointer Register
    	asm(" NOP 5");	
    }
    
    //Maskable Interrupt #6 Service Routine
    interrupt void INT6_ISR(void){
    	asm(" B B3");			//Branch to Return Pointer Register
    	asm(" NOP 5");	
    }
    
    //Maskable Interrupt #7 Service Routine
    interrupt void INT7_ISR(void){
    	asm(" B B3");			//Branch to Return Pointer Register
    	asm(" NOP 5");	
    }
    
    //Maskable Interrupt #8 Service Routine
    interrupt void INT8_ISR(void){
    	asm(" B B3");			//Branch to Return Pointer Register
    	asm(" NOP 5");	
    }
    
    //Maskable Interrupt #9 Service Routine
    interrupt void INT9_ISR(void){
    	asm(" B B3");			//Branch to Return Pointer Register
    	asm(" NOP 5");
    }
    
    //Maskable Interrupt #10 Service Routine
    interrupt void INT10_ISR(void){
    	asm(" B B3");			//Branch to Return Pointer Register
    	asm(" NOP 5");	
    }
    
    //Maskable Interrupt #11 Service Routine
    interrupt void INT11_ISR(void){
    	asm(" B B3");			//Branch to Return Pointer Register
    	asm(" NOP 5");	
    }
    
    //Maskable Interrupt #12 Service Routine
    interrupt void INT12_ISR(void){
    	asm(" B B3");			//Branch to Return Pointer Register
    	asm(" NOP 5");
    }
    
    //Maskable Interrupt #13 Service Routine
    interrupt void INT13_ISR(void){
    	asm(" B B3");			//Branch to Return Pointer Register
    	asm(" NOP 5");	
    }
    
    //Maskable Interrupt #14 Service Routine
    interrupt void INT14_ISR(void){
    	asm(" B B3");			//Branch to Return Pointer Register
    	asm(" NOP 5");
    }
    
    //Maskable Interrupt #15 Service Routine
    interrupt void INT15_ISR(void){
    	asm(" B B3");			//Branch to Return Pointer Register
    	asm(" NOP 5");
    }
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    

    • Cancel
    • Up 0 True Down
    • Cancel
  • Sivaraj Kuppuraj
    0 Sivaraj Kuppuraj over 11 years ago in reply to Prathibha Kadur
    TI__Mastermind 35645 points

    Hi,

    Thanks for your update.

    In my opinion, as per quickstartOMAPL1x_rCSL McASP example, you cannot configure two serializer pins AXR8 & AXR15 as transmit serializers simulataneously. Are you able to succeed audio output with 1 serializer & 1 DAC output?

    With out any changes in the original code of quickstartOMAPL1x_rCSL McASP example, using AXR11 as Tx. and AXR12 as Rx. serialiser, you execute the code "as-is" with your omapl138 based custom board, are you able to succeed in this scenario? If not, you have to check the stereo audio codec data manual for appropriate codec register configuration support for 2 DAC outputs because, some of the multi-channel DACs expects the samples for all the channels to be received over single serializers. To support these DACs, you have to check the appropriate codec data sheet to configure for 2 DAC outputs with 1 serializer and configure the same accordingly in your code and try it.

    Kindly ensure the above points and let try the same.

    Thanks & regards,
    Sivaraj K

    -------------------------------------------------------------------------------------------------------

    Please click the Verify Answer button on this post if it answers your question

    -------------------------------------------------------------------------------------------------------

     

    • Cancel
    • Up 0 True Down
    • Cancel
  • Prathibha Kadur
    0 Prathibha Kadur over 11 years ago in reply to Sivaraj Kuppuraj
    Prodigy 200 points

    Hi Sivaraj,

    In my opinion, as per quickstartOMAPL1x_rCSL McASP example, you cannot configure two serializer pins AXR8 & AXR15 as transmit serializers simultaneously. Are you able to succeed audio output with 1 serializer & 1 DAC output?

    • I have already stated that I am using this example as a reference code for our application which is NOT audio application. I am not using Audio Codec. I am only transmitting on ACLKX, AFSX, AHCLKX , XBUF8 and XBUF15 pins. So I can’t make AHCLKX as input pin and hence external. It won’t even pass latching tests if I run the code as is because I am running on our custom board. So the answer is NO, I did not see any data on AXR11 pin with my changes as mentioned in my previous post.
    • We are using 2 DACs to control Laser and TECs in our application.

    It would be of great help if you can test this code in DLB mode and also test 2 transmit pins simultaneously  for the same.

    Thank you,

    Prathibha

    • Cancel
    • Up 0 True Down
    • Cancel
  • Lee Felsenstein
    0 Lee Felsenstein over 11 years ago in reply to Prathibha Kadur
    Prodigy 150 points

    I am the hardware designer on this project and have been working closely with Ms. Kadur - we have checked every bit of every register involved in the initialization and all of the hardware. We have come to the point where the project (development of an instrument) is being materially delayed.

    Your responses do not seem to indicate more than a familiarity with one evaluation configuration, with one audio output channel and one receive channel. I should like to request that we be referred to someone with a theoretical familiarity with the product, especially in a multi-channel output configuration.


    As it stands, this thread seems to be going in circles. Let us break out of this - there is a lot at stake here.

    Yours,

    Lee Felsenstein

    • Cancel
    • Up 0 True Down
    • Cancel
  • Lee Felsenstein
    0 Lee Felsenstein over 11 years ago in reply to Lee Felsenstein
    Prodigy 150 points

    Ms. Kadur and I have simplified the code significantly without solving the problem. Attached is source code using polled CPU access that 1) writes a word to the XRBUF, then (2) enters a while loop testing the XDATA bit (5) on the XSTAT register and writing to the XRBUF. The code does not exit the loop, and CC does not indicate a write to the XRBUF unless the Read initialization has been performed. In neither case is any data transmitted on bit AX15  (we have confirmed that it the correct functional bit by driving it as a GPIO bit).

    We would very much like to know what is happening here. Please let us know if the code behaves the same way in other systems, and whether we can do anything to obtain a valid output on AXR15.

    Fullscreen 8228.mcaspTx.c Download
    
    //*==================================================*/
    //********************Includes *********************/
    //*==================================================*/
    //*Non-DSP/BIOS5 Header Files*/
    #include <ti/pspiom/cslr/tistdtypes.h>
    #include "mcasp.h"
    
    //==================================================/
    //***************Function Prototypes ***************/
    //==================================================/
    void McASPInit(void);
    void McASPStart(void);
    void McASPTx(void);
    extern void Delay(volatile unsigned int delay);
    //==================================================/
    //*********Global Variable Instantiations **********/
    //==================================================/
    
    //McASP0 Control Registers
    CSL_McaspRegsOvly mcaspRegs = (CSL_McaspRegsOvly) CSL_MCASP_0_CTRL_REGS;	//OMAP-L138 McASP Configuration Register Pointer Instance
    
    //McASP AFIFO Control Registers
    CSL_AfifoRegsOvly afifoRegs = (CSL_AfifoRegsOvly) CSL_MCASP_0_FIFO_REGS;
    
    //McASP DMA Port Registers
    CSL_AdataRegsOvly adataRegs = (CSL_AdataRegsOvly) CSL_MCASP_0_DATA_REGS;
    
    
    //==================================================/
    //**********Functions ******************************/
    //* This function is used to initialize the McASP*/
    //==================================================/
    
    
    //OMAP-L138 Clocking Configuration
    //AHCLKX -> Internal
    //ACLKX  -> Internal / -> AHCLK/8
    //AFSX   -> Interal -> Auto Generated by FS Gen.
    
    
    void McASPInit(void)
    {
    
    /*This function will be called by Main to Initialize the McASP */
    /* Although this configuration can be done completely by hand, we chose to use the
     * OMAP-L138 Chip Support Library (CSL) because those functions presumably already
     *  work and are tested*/
    
    
    //Initialize the McASP Registers for use on the ESP board.
    
    /* The following steps are required to properly configure the McASP via the OMAP-L138 McASP User's Guide
    * [1] Reset McASP to default Values by writing GBLCTL = 0
    */
    
    
     /* Put McASP in Reset by programming the global control registers */
    	//Keep all Tx Clocks in Reset
    	CSL_FINST(mcaspRegs->GBLCTL, MCASP_GBLCTL_XFRST, RESET);
    	CSL_FINST(mcaspRegs->GBLCTL, MCASP_GBLCTL_XSMRST, RESET);
    	CSL_FINST(mcaspRegs->GBLCTL, MCASP_GBLCTL_XSRCLR, CLEAR);
    	CSL_FINST(mcaspRegs->GBLCTL, MCASP_GBLCTL_XHCLKRST, RESET);
    	CSL_FINST(mcaspRegs->GBLCTL, MCASP_GBLCTL_XCLKRST, RESET);
    
    	//Keep all Rx Clocks In Reset
    	CSL_FINST(mcaspRegs->GBLCTL, MCASP_GBLCTL_RFRST, RESET);
    	CSL_FINST(mcaspRegs->GBLCTL, MCASP_GBLCTL_RSMRST, RESET);
    	CSL_FINST(mcaspRegs->GBLCTL, MCASP_GBLCTL_RSRCLR, CLEAR);
    	CSL_FINST(mcaspRegs->GBLCTL, MCASP_GBLCTL_RHCLKRST, RESET);
    	CSL_FINST(mcaspRegs->GBLCTL, MCASP_GBLCTL_RCLKRST, RESET);
    
    
    /* [2] Configure the McASP Audio FIFO.
     * 		[a] Write FIFO
     * 			 - If Write FIFO will not be enabled, clear the FIFO Enable Bit
     * 			 - If Write FIFO is enabled, it should not be enabled until all other FIFO
     *             bits are configured
     * 		[b] Read FIFO
     * 			 - If Read FIFO will not be enabled, clear the FIFO Enable Bit
     * 			 - If Read FIFO is enabled, it should not be enabled until all other FIFO
     *
     */
    
     	/* Disable Write FIFO */
    
     	// For now, both the Rx and Tx AFIFO's will be disabled, because the McASP is the only
     	//peripheral that is being services by the DSP. If additional peripheral are added in later,
     	//this may be changed to include both the Rx / Tx FIFO's
    
    	//Disable Tx FIFO
    	CSL_FINST(afifoRegs->WFIFOCTL, AFIFO_WFIFOCTL_WENA, DISABLED);
    
    	//Disable Rx FIFO
    	CSL_FINST(afifoRegs->RFIFOCTL, AFIFO_RFIFOCTL_RENA, DISABLED);
    
    
     /* [3] Configure all McASP registers except GBLCTRL in the following Order
      * 	[a] Receive Registers: If external clocks are used, they must be running already for proper synchronization
      *         of the global control registers
      *
      * 		Note:
      * 		TLV320AIC3106 is simply a slave ADC/DAC the Tx clocks will be synchronized with the Rx clocks. */
    
    
    	/* Recieve Serializer */
      	/* 31   30    29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10      9        8      7       6    5     4    3     2     1   0 */
    	/*MSb (MSb-1)        --Audio Word--                                          (LSb+1)  LSb    Mask     Mask Mask Mask  Mask  Mask Mask Mask */
    
    	/* Recieve Format Unit Bit Mask Register */
    #if 0
    	//Mask Off Unused Bits -> For Now, well leave all unmasked -> May change later.
    	CSL_FINST(mcaspRegs->RMASK, MCASP_RMASK_RMASK31, NOMASK);	//Audio Data MSB
    	CSL_FINST(mcaspRegs->RMASK, MCASP_RMASK_RMASK30, NOMASK);	//Audio Data MSB-1
    	CSL_FINST(mcaspRegs->RMASK, MCASP_RMASK_RMASK29, NOMASK);
    	CSL_FINST(mcaspRegs->RMASK, MCASP_RMASK_RMASK28, NOMASK);
    	CSL_FINST(mcaspRegs->RMASK, MCASP_RMASK_RMASK27, NOMASK);
    	CSL_FINST(mcaspRegs->RMASK, MCASP_RMASK_RMASK26, NOMASK);
    	CSL_FINST(mcaspRegs->RMASK, MCASP_RMASK_RMASK25, NOMASK);
    	CSL_FINST(mcaspRegs->RMASK, MCASP_RMASK_RMASK24, NOMASK);
    	CSL_FINST(mcaspRegs->RMASK, MCASP_RMASK_RMASK23, NOMASK);
    	CSL_FINST(mcaspRegs->RMASK, MCASP_RMASK_RMASK22, NOMASK);
    	CSL_FINST(mcaspRegs->RMASK, MCASP_RMASK_RMASK21, NOMASK);
    	CSL_FINST(mcaspRegs->RMASK, MCASP_RMASK_RMASK20, NOMASK);
    	CSL_FINST(mcaspRegs->RMASK, MCASP_RMASK_RMASK19, NOMASK);
    	CSL_FINST(mcaspRegs->RMASK, MCASP_RMASK_RMASK18, NOMASK);
    	CSL_FINST(mcaspRegs->RMASK, MCASP_RMASK_RMASK17, NOMASK);
    	CSL_FINST(mcaspRegs->RMASK, MCASP_RMASK_RMASK16, NOMASK);	//Audio Data Bit LSB (16 bit)
    	CSL_FINST(mcaspRegs->RMASK, MCASP_RMASK_RMASK15, NOMASK);
    	CSL_FINST(mcaspRegs->RMASK, MCASP_RMASK_RMASK14, NOMASK);
    	CSL_FINST(mcaspRegs->RMASK, MCASP_RMASK_RMASK13, NOMASK);
    	CSL_FINST(mcaspRegs->RMASK, MCASP_RMASK_RMASK12, NOMASK);	//Audio Data Bit LSB (20 bit)
    	CSL_FINST(mcaspRegs->RMASK, MCASP_RMASK_RMASK11, NOMASK);
    	CSL_FINST(mcaspRegs->RMASK, MCASP_RMASK_RMASK10, NOMASK);
    	CSL_FINST(mcaspRegs->RMASK, MCASP_RMASK_RMASK9,  NOMASK);
    	CSL_FINST(mcaspRegs->RMASK, MCASP_RMASK_RMASK8,  NOMASK);	//Audio Data LSB (24 bit)
    	CSL_FINST(mcaspRegs->RMASK, MCASP_RMASK_RMASK7,  NOMASK);
    	CSL_FINST(mcaspRegs->RMASK, MCASP_RMASK_RMASK6, NOMASK);
    	CSL_FINST(mcaspRegs->RMASK, MCASP_RMASK_RMASK5, NOMASK);
    	CSL_FINST(mcaspRegs->RMASK, MCASP_RMASK_RMASK4, NOMASK);
    	CSL_FINST(mcaspRegs->RMASK, MCASP_RMASK_RMASK3, NOMASK);
    	CSL_FINST(mcaspRegs->RMASK, MCASP_RMASK_RMASK2, NOMASK);
    	CSL_FINST(mcaspRegs->RMASK, MCASP_RMASK_RMASK1, NOMASK);
    	CSL_FINST(mcaspRegs->RMASK, MCASP_RMASK_RMASK0, NOMASK);
    
    
      	/* Recieve Bit Stream Format Register */
    
    	//Configure the receive bit stream for 32 bit I2S.
    	CSL_FINST(mcaspRegs->RFMT, MCASP_RFMT_RDATDLY, 1BIT);		//Ignore First Bit due to I2S
    
    	CSL_FINST(mcaspRegs->RFMT, MCASP_RFMT_RRVRS, MSBFIRST);
    
    	//Pad Unused Bits with value in bit 0
    	CSL_FINST(mcaspRegs->RFMT, MCASP_RFMT_RPAD, ZERO);
    
    	//32 bit slot size, though only 24 bit word size
    	//CSL_FINST(mcaspRegs->RFMT, MCASP_RFMT_RSSZ, 32BITS);
    	CSL_FINST(mcaspRegs->RFMT, MCASP_RFMT_RSSZ, 24BITS);
    
    
    	//No Rotation needed
    	CSL_FINST(mcaspRegs->RFMT, MCASP_RFMT_RROT, NONE);
    
    	//Read XRBUF[n] on the Peripheral Configuration Port  (For Now -> May change to the DMA Later)
    	CSL_FINST(mcaspRegs->RFMT, MCASP_RFMT_RBUSEL, VBUS);
    
    
    
    /* Receive Frame Sync Control Register */
    
    	//Configure Frame Sync for 2 Channel TDM
    	CSL_FINST(mcaspRegs->AFSRCTL, MCASP_AFSRCTL_RMOD, I2S);
    	//Configure Frame Sync to last length of word
    	CSL_FINST(mcaspRegs->AFSRCTL, MCASP_AFSRCTL_FRWID, WORD);
    	//Configure Frame Sync for internal generation
    	CSL_FINST(mcaspRegs->AFSRCTL, MCASP_AFSRCTL_FSRM, INTERNAL);
    	//Configure Frame Sync that falling edge starts new channel for I2S
    	CSL_FINST(mcaspRegs->AFSRCTL, MCASP_AFSRCTL_FSRP, FALLINGEDGE);
    
    
    
    	/* Receive Bit Clock Control Register */
    	//Sample bit on Rising Edge of ACLKR
    	CSL_FINST(mcaspRegs->ACLKRCTL, MCASP_ACLKRCTL_CLKRP, RISINGEDGE);
    	//Clock Generated by OMAP-L138
    	CSL_FINST(mcaspRegs->ACLKRCTL, MCASP_ACLKRCTL_CLKRM, INTERNAL);
    	CSL_FINS(mcaspRegs->ACLKRCTL, MCASP_ACLKRCTL_CLKRDIV, 0); 			//Irrelvant when ASYNC = 0
    
    
    	/*Receive High Frequency Clock Control Register (Master Clock)*/
    		//Irrelvant when ASYNC = 0
    
    	   /*
    	     * Receive Clock Check Control Register (RCLKCHK)
    	     *  3         2         1
    	     * 10987654321098765432109876543210
    	     * 00000000........................ RCNT      ; R, receive clock count value
    	     * ........00000000................ RMAX      ; RW, receive clock max boundary
    	     * ................00000000........ RMIN      ; RW, receive clock min boundary
    	     * ........................~~~~.... RESVD
    	     * ............................0000 RPS       ; RW, 0 = McASP system clock divide by 1
    	     */
    	mcaspRegs->RCLKCHK = 0x00000000;
    
    
    
    	/*Receive TDM Time Slot Register */
    	//Slots 31-2 Inactive
    	CSL_FINST(mcaspRegs->RTDM, MCASP_RTDM_RTDMS31, INACTIVE);
    	CSL_FINST(mcaspRegs->RTDM, MCASP_RTDM_RTDMS30, INACTIVE);
    	CSL_FINST(mcaspRegs->RTDM, MCASP_RTDM_RTDMS29, INACTIVE);
    	CSL_FINST(mcaspRegs->RTDM, MCASP_RTDM_RTDMS28, INACTIVE);
    	CSL_FINST(mcaspRegs->RTDM, MCASP_RTDM_RTDMS27, INACTIVE);
    	CSL_FINST(mcaspRegs->RTDM, MCASP_RTDM_RTDMS26, INACTIVE);
    	CSL_FINST(mcaspRegs->RTDM, MCASP_RTDM_RTDMS25, INACTIVE);
    	CSL_FINST(mcaspRegs->RTDM, MCASP_RTDM_RTDMS24, INACTIVE);
    	CSL_FINST(mcaspRegs->RTDM, MCASP_RTDM_RTDMS23, INACTIVE);
    	CSL_FINST(mcaspRegs->RTDM, MCASP_RTDM_RTDMS22, INACTIVE);
    	CSL_FINST(mcaspRegs->RTDM, MCASP_RTDM_RTDMS21, INACTIVE);
    	CSL_FINST(mcaspRegs->RTDM, MCASP_RTDM_RTDMS20, INACTIVE);
    	CSL_FINST(mcaspRegs->RTDM, MCASP_RTDM_RTDMS19, INACTIVE);
    	CSL_FINST(mcaspRegs->RTDM, MCASP_RTDM_RTDMS18, INACTIVE);
    	CSL_FINST(mcaspRegs->RTDM, MCASP_RTDM_RTDMS17, INACTIVE);
    	CSL_FINST(mcaspRegs->RTDM, MCASP_RTDM_RTDMS16, INACTIVE);
    	CSL_FINST(mcaspRegs->RTDM, MCASP_RTDM_RTDMS15, INACTIVE);
    	CSL_FINST(mcaspRegs->RTDM, MCASP_RTDM_RTDMS14, INACTIVE);
    	CSL_FINST(mcaspRegs->RTDM, MCASP_RTDM_RTDMS13, INACTIVE);
    	CSL_FINST(mcaspRegs->RTDM, MCASP_RTDM_RTDMS12, INACTIVE);
    	CSL_FINST(mcaspRegs->RTDM, MCASP_RTDM_RTDMS11, INACTIVE);
    	CSL_FINST(mcaspRegs->RTDM, MCASP_RTDM_RTDMS10, INACTIVE);
    	CSL_FINST(mcaspRegs->RTDM, MCASP_RTDM_RTDMS9, INACTIVE);
    	CSL_FINST(mcaspRegs->RTDM, MCASP_RTDM_RTDMS8, INACTIVE);
    	CSL_FINST(mcaspRegs->RTDM, MCASP_RTDM_RTDMS7, INACTIVE);
    	CSL_FINST(mcaspRegs->RTDM, MCASP_RTDM_RTDMS6, INACTIVE);
    	CSL_FINST(mcaspRegs->RTDM, MCASP_RTDM_RTDMS5, INACTIVE);
    	CSL_FINST(mcaspRegs->RTDM, MCASP_RTDM_RTDMS4, INACTIVE);
    	CSL_FINST(mcaspRegs->RTDM, MCASP_RTDM_RTDMS3, INACTIVE);
    	CSL_FINST(mcaspRegs->RTDM, MCASP_RTDM_RTDMS2, INACTIVE);
    	//Slots 0,1 Active for I2S
    	CSL_FINST(mcaspRegs->RTDM, MCASP_RTDM_RTDMS1, ACTIVE);
    	CSL_FINST(mcaspRegs->RTDM, MCASP_RTDM_RTDMS0, ACTIVE);
    
    	/* Receiver Interrupt Control Register */
    
    	//Disable Start of Frame Interrupt
    	CSL_FINST(mcaspRegs->RINTCTL, MCASP_RINTCTL_RSTAFRM, DISABLE);
    	//Disable Data Read Interrupt
    	CSL_FINST(mcaspRegs->RINTCTL, MCASP_RINTCTL_RDATA, DISABLE);
    	//Disable Recive Last Time Slot Interrupt
    	CSL_FINST(mcaspRegs->RINTCTL, MCASP_RINTCTL_RLAST, DISABLE);
    	//Disable DMA Error Interrupt
    	CSL_FINST(mcaspRegs->RINTCTL, MCASP_RINTCTL_RDMAERR, DISABLE);
    	//Disable Clock Failure Error Interrupt
    	CSL_FINST(mcaspRegs->RINTCTL, MCASP_RINTCTL_RCKFAIL, DISABLE);
    	//Disable Unexpected FrameSync Error Interrupt
    	CSL_FINST(mcaspRegs->RINTCTL, MCASP_RINTCTL_RSYNCERR, DISABLE);
    	//Disable Reciever Overrun Error Interrupt
    	CSL_FINST(mcaspRegs->RINTCTL, MCASP_RINTCTL_ROVRN, DISABLE);
    
    
      	//Recieve Clock Check Control Register
     		//Since Rx Clock is synchronized with Tx Clock,
     		//No need to configure Rx Clock Check Circuit - because
     		//fail to Tx Clock will propogate in fail to Rx clock
    
    #endif
      /* 	[b] Transmit Registers: If external clocks are used, they must be running already for proper synchronization
      *         of the global control registers */
    
    
    
      	/* Recieve Serializer */
    
    	//Data Aligment Recieved from DSP -> Echo of McASP Rx
    	/* 31      30    29    28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10   9       8      7     6 5 4 3 2 1 0 */
    	/* Delay   MSb (MSb-1)                                                          LSb+1)  LSb  */
    
    	//  ^
    	//  |
    	// (From I2S Protocol)
    
      	/*Transmit Format Unit Bit Mask Register */
    	//Keep All Bits unmaksed
    #if 0
    	CSL_FINST(mcaspRegs->XMASK, MCASP_XMASK_XMASK31, NOMASK);		//Audio Data Bit MSB
    	CSL_FINST(mcaspRegs->XMASK, MCASP_XMASK_XMASK30, NOMASK);		//Audio Data Bit MSB-1
    	CSL_FINST(mcaspRegs->XMASK, MCASP_XMASK_XMASK29, NOMASK);
    	CSL_FINST(mcaspRegs->XMASK, MCASP_XMASK_XMASK28, NOMASK);
    	CSL_FINST(mcaspRegs->XMASK, MCASP_XMASK_XMASK27, NOMASK);
    	CSL_FINST(mcaspRegs->XMASK, MCASP_XMASK_XMASK26, NOMASK);
    	CSL_FINST(mcaspRegs->XMASK, MCASP_XMASK_XMASK25, NOMASK);
    	CSL_FINST(mcaspRegs->XMASK, MCASP_XMASK_XMASK24, NOMASK);
    #endif
    	// It does not matter
    	// Masking 8-MSB bits for 24-bit data
    	// We get the same data even if they are not masked
    	CSL_FINST(mcaspRegs->XMASK, MCASP_XMASK_XMASK31, MASK);		//Audio Data Bit MSB
    	CSL_FINST(mcaspRegs->XMASK, MCASP_XMASK_XMASK30, MASK);		//Audio Data Bit MSB-1
    	CSL_FINST(mcaspRegs->XMASK, MCASP_XMASK_XMASK29, MASK);
    	CSL_FINST(mcaspRegs->XMASK, MCASP_XMASK_XMASK28, MASK);
    	CSL_FINST(mcaspRegs->XMASK, MCASP_XMASK_XMASK27, MASK);
    	CSL_FINST(mcaspRegs->XMASK, MCASP_XMASK_XMASK26, MASK);
    	CSL_FINST(mcaspRegs->XMASK, MCASP_XMASK_XMASK25, MASK);
    	CSL_FINST(mcaspRegs->XMASK, MCASP_XMASK_XMASK24, MASK);
    
    	CSL_FINST(mcaspRegs->XMASK, MCASP_XMASK_XMASK23, NOMASK);
    	CSL_FINST(mcaspRegs->XMASK, MCASP_XMASK_XMASK22, NOMASK);
    	CSL_FINST(mcaspRegs->XMASK, MCASP_XMASK_XMASK21, NOMASK);
    	CSL_FINST(mcaspRegs->XMASK, MCASP_XMASK_XMASK20, NOMASK);
    	CSL_FINST(mcaspRegs->XMASK, MCASP_XMASK_XMASK19, NOMASK);
    	CSL_FINST(mcaspRegs->XMASK, MCASP_XMASK_XMASK18, NOMASK);
    	CSL_FINST(mcaspRegs->XMASK, MCASP_XMASK_XMASK17, NOMASK);
    	CSL_FINST(mcaspRegs->XMASK, MCASP_XMASK_XMASK16, NOMASK);		//Audio Data Bit LSB (16 bit)
    	CSL_FINST(mcaspRegs->XMASK, MCASP_XMASK_XMASK15, NOMASK);
    	CSL_FINST(mcaspRegs->XMASK, MCASP_XMASK_XMASK14, NOMASK);
    	CSL_FINST(mcaspRegs->XMASK, MCASP_XMASK_XMASK13, NOMASK);
    	CSL_FINST(mcaspRegs->XMASK, MCASP_XMASK_XMASK12, NOMASK);		//Audio Data Bit LSB (20 bit)
    	CSL_FINST(mcaspRegs->XMASK, MCASP_XMASK_XMASK11, NOMASK);
    	CSL_FINST(mcaspRegs->XMASK, MCASP_XMASK_XMASK10, NOMASK);
    	CSL_FINST(mcaspRegs->XMASK, MCASP_XMASK_XMASK9, NOMASK);		//Audio Data Bit LSB +1
    	CSL_FINST(mcaspRegs->XMASK, MCASP_XMASK_XMASK8, NOMASK);		//Audio Data Bit LSB (24 bit)
    
    
    	CSL_FINST(mcaspRegs->XMASK, MCASP_XMASK_XMASK7, NOMASK);
    	CSL_FINST(mcaspRegs->XMASK, MCASP_XMASK_XMASK6, NOMASK);
    	CSL_FINST(mcaspRegs->XMASK, MCASP_XMASK_XMASK5, NOMASK);
    	CSL_FINST(mcaspRegs->XMASK, MCASP_XMASK_XMASK4, NOMASK);
    	CSL_FINST(mcaspRegs->XMASK, MCASP_XMASK_XMASK3, NOMASK);
    	CSL_FINST(mcaspRegs->XMASK, MCASP_XMASK_XMASK2, NOMASK);
    	CSL_FINST(mcaspRegs->XMASK, MCASP_XMASK_XMASK1, NOMASK);
    	CSL_FINST(mcaspRegs->XMASK, MCASP_XMASK_XMASK0, NOMASK);
    
    
    	CSL_FINST(mcaspRegs->XFMT, MCASP_XFMT_XDATDLY,  1BIT);		//For I2S, MSB First, Left aligned, XATDLY=1
    
    	//CSL_FINST(mcaspRegs->XFMT, MCASP_XFMT_XDATDLY,  0BIT);		//For Echo, McASP has already delayed the 1 bit,
    																	//so for a direct copy, do not delay another bit
    	CSL_FINST(mcaspRegs->XFMT, MCASP_XFMT_XRVRS,    MSBFIRST);
    	CSL_FINST(mcaspRegs->XFMT, MCASP_XFMT_XPAD, 	ZERO);
    	//CSL_FINST(mcaspRegs->XFMT, MCASP_XFMT_XSSZ, 	32BITS);
    	CSL_FINST(mcaspRegs->XFMT, MCASP_XFMT_XSSZ, 	24BITS); //PK
    	CSL_FINS(mcaspRegs->XFMT, MCASP_XFMT_XPBIT, 	0);
    	CSL_FINST(mcaspRegs->XFMT, MCASP_XFMT_XROT,	NONE);
    	CSL_FINST(mcaspRegs->XFMT, MCASP_XFMT_XBUSEL, 	VBUS);//=1 for peripheral config bus
    	//CSL_FINST(mcaspRegs->XFMT, MCASP_XFMT_XBUSEL, 	VBUSP);//for DMA,=0
    
    
    
    	/*Transmit Frame Sync Control Register */
    	// This is all we can do to configure AFSX
    
    	// Transmit frame sync mode select bits.
    	//Frame Sync is configured for I2S (2-slot TDM (I2S mode) to 32-slot TDM)
    	CSL_FINST(mcaspRegs->AFSXCTL, MCASP_AFSXCTL_XMOD, I2S);		//=2
    
    	//Transmit frame sync width select bit indicates the width of the transmit frame sync (AFSX) during
    	//its active period.
    	//Frame Sync Length is Word (=1)
    	CSL_FINST(mcaspRegs->AFSXCTL, MCASP_AFSXCTL_FXWID, WORD);
    
    	//Transmit frame sync generation select bit.
    	//Frame Sync is internally generated by XCLK (=1)
    	CSL_FINST(mcaspRegs->AFSXCTL, MCASP_AFSXCTL_FSXM, INTERNAL);
    
    	//Transmit frame sync polarity select bit.
    	//Falling Edge indicates beginning of new word (=1)
    	CSL_FINST(mcaspRegs->AFSXCTL, MCASP_AFSXCTL_FSXP, FALLINGEDGE);
    
    
    	/* Transmit Clock Control Register */
    
    	//Transmit bit stream clock polarity select bit.
    	//Rising edge. External receiver samples data on the falling edge of the serial clock, so the transmitter
    	// must shift data out on the rising edge of the serial clock. (=0)
    	CSL_FINST(mcaspRegs->ACLKXCTL, MCASP_ACLKXCTL_CLKXP, RISINGEDGE);
    
    	//Transmit/receive operation asynchronous enable bit.
    	// Synchronous. Transmit clock and frame sync provides the source for both the transmit and receive (=0)
    	//sections. Note that in this mode, the receive bit clock is an inverted version of the transmit bit clock.
    	CSL_FINST(mcaspRegs->ACLKXCTL, MCASP_ACLKXCTL_ASYNC, ASYNC);				//ACLKR / nACLKX
    
    	//Transmit bit clock source bit.
    	// Internal transmit clock source from output of programmable bit clock divider (=1)
    	CSL_FINST(mcaspRegs->ACLKXCTL, MCASP_ACLKXCTL_CLKXM, INTERNAL);
    
    	//Transmit bit clock divide ratio bits determine the divide-down ratio from AHCLKX to ACLKX.
    	// This ratio decides Fs
    	// for Fs=192k, AHCLKX=128*Fs, ACLKX=48*Fs, AHCLKX/ACLKX=2.666(2)
    	CSL_FINS(mcaspRegs->ACLKXCTL, MCASP_ACLKXCTL_CLKXDIV, 1);
    
    
    	/* Transmit High Frequency Clock Register*/
    	// Generate High Frequency Clock Source Externally from 25 MHz XTAL (AUXCLK)
    	//Transmit high-frequency clock source bit.
    	CSL_FINST(mcaspRegs->AHCLKXCTL, MCASP_AHCLKXCTL_HCLKXM, INTERNAL);
    
    	//Transmit bitstream high-frequency clock polarity select bit.
    	//Not inverted. AHCLKX is not inverted before programmable bit clock divider. (=0)
    	CSL_FINST(mcaspRegs->AHCLKXCTL, MCASP_AHCLKXCTL_HCLKXP, NOTINVERTED);
    
    	// AUXCLK = 25MHz
    	//Transmit high-frequency clock divide ratio bits determine the divide-down ratio from AUXCLK to
    	//AHCLKX.; 0 Divide-by-1
    	// for Fs=192k, AHCLKX=128*Fs, ACLKX=48*Fs, AUXCLK/AHCLKX=1
    	CSL_FINS(mcaspRegs->AHCLKXCTL, MCASP_AHCLKXCTL_HCLKXDIV, 0);
    
    
    
    	/* Transmit TDM Time Slot Register */
    	//32-2 should be inactive
    	CSL_FINST(mcaspRegs->XTDM, MCASP_XTDM_XTDMS31, INACTIVE);
    	CSL_FINST(mcaspRegs->XTDM, MCASP_XTDM_XTDMS30, INACTIVE);
    	CSL_FINST(mcaspRegs->XTDM, MCASP_XTDM_XTDMS29, INACTIVE);
    	CSL_FINST(mcaspRegs->XTDM, MCASP_XTDM_XTDMS28, INACTIVE);
    	CSL_FINST(mcaspRegs->XTDM, MCASP_XTDM_XTDMS27, INACTIVE);
    	CSL_FINST(mcaspRegs->XTDM, MCASP_XTDM_XTDMS26, INACTIVE);
    	CSL_FINST(mcaspRegs->XTDM, MCASP_XTDM_XTDMS25, INACTIVE);
    	CSL_FINST(mcaspRegs->XTDM, MCASP_XTDM_XTDMS24, INACTIVE);
    	CSL_FINST(mcaspRegs->XTDM, MCASP_XTDM_XTDMS23, INACTIVE);
    	CSL_FINST(mcaspRegs->XTDM, MCASP_XTDM_XTDMS22, INACTIVE);
    	CSL_FINST(mcaspRegs->XTDM, MCASP_XTDM_XTDMS21, INACTIVE);
    	CSL_FINST(mcaspRegs->XTDM, MCASP_XTDM_XTDMS20, INACTIVE);
    	CSL_FINST(mcaspRegs->XTDM, MCASP_XTDM_XTDMS19, INACTIVE);
    	CSL_FINST(mcaspRegs->XTDM, MCASP_XTDM_XTDMS18, INACTIVE);
    	CSL_FINST(mcaspRegs->XTDM, MCASP_XTDM_XTDMS17, INACTIVE);
    	CSL_FINST(mcaspRegs->XTDM, MCASP_XTDM_XTDMS16, INACTIVE);
    	CSL_FINST(mcaspRegs->XTDM, MCASP_XTDM_XTDMS15, INACTIVE);
    	CSL_FINST(mcaspRegs->XTDM, MCASP_XTDM_XTDMS14, INACTIVE);
    	CSL_FINST(mcaspRegs->XTDM, MCASP_XTDM_XTDMS13, INACTIVE);
    	CSL_FINST(mcaspRegs->XTDM, MCASP_XTDM_XTDMS12, INACTIVE);
    	CSL_FINST(mcaspRegs->XTDM, MCASP_XTDM_XTDMS11, INACTIVE);
    	CSL_FINST(mcaspRegs->XTDM, MCASP_XTDM_XTDMS10, INACTIVE);
    	CSL_FINST(mcaspRegs->XTDM, MCASP_XTDM_XTDMS9,  INACTIVE);
    	CSL_FINST(mcaspRegs->XTDM, MCASP_XTDM_XTDMS8,  INACTIVE);
    	CSL_FINST(mcaspRegs->XTDM, MCASP_XTDM_XTDMS7,  INACTIVE);
    	CSL_FINST(mcaspRegs->XTDM, MCASP_XTDM_XTDMS6,  INACTIVE);
    	CSL_FINST(mcaspRegs->XTDM, MCASP_XTDM_XTDMS5,  INACTIVE);
    	CSL_FINST(mcaspRegs->XTDM, MCASP_XTDM_XTDMS4,  INACTIVE);
    	CSL_FINST(mcaspRegs->XTDM, MCASP_XTDM_XTDMS3,  INACTIVE);
    	CSL_FINST(mcaspRegs->XTDM, MCASP_XTDM_XTDMS2,  INACTIVE);
    	//Active Slots 0/1 for I2S
    	CSL_FINST(mcaspRegs->XTDM, MCASP_XTDM_XTDMS1,  ACTIVE);
    	CSL_FINST(mcaspRegs->XTDM, MCASP_XTDM_XTDMS0,  ACTIVE);
    
    
    	/*Transmit Interrupt Control Register */
    
    	//Disable All Transmit McASP Interrupts
    	CSL_FINST(mcaspRegs->XINTCTL, MCASP_XINTCTL_XSTAFRM, DISABLE);
    	CSL_FINST(mcaspRegs->XINTCTL, MCASP_XINTCTL_XDATA,   DISABLE);
    	CSL_FINST(mcaspRegs->XINTCTL, MCASP_XINTCTL_XLAST,   DISABLE);
    	CSL_FINST(mcaspRegs->XINTCTL, MCASP_XINTCTL_XDMAERR, DISABLE);
    	CSL_FINST(mcaspRegs->XINTCTL, MCASP_XINTCTL_XCKFAIL, DISABLE);
    	CSL_FINST(mcaspRegs->XINTCTL, MCASP_XINTCTL_XSYNCERR, DISABLE);
    	CSL_FINST(mcaspRegs->XINTCTL, MCASP_XINTCTL_XUNDRN,  DISABLE);
    
        /*
         * Setup the Xmit clock check register
         */
    
    
        //Transmit Clock Check Control Register
    
    	//Set McASP Clock Zone Post Scaler
    
    	//Note McASP is driven by SYSCLK2 = (375/2=187.5MHz)
    	CSL_FINST(mcaspRegs->XCLKCHK, MCASP_XCLKCHK_XPS, DIVBY4); //XPS=2
    
    	//Set XMAX Value
    	//Notes: Prescale by 4
    	//187.5/4 = 46.875 MHz.
    
    	//46.875MHz /25MHz (AUXCLK)  = 1.875
    	//24 Clock Counts * 1.875 = 45 McASP System Clock Counts per every 24 AHCLKX
    
    
    	//___________________________________________
    	//24 ACLKs / 25MHz = 0.96uSec
    
    	//44 Clocks / 46.875 MHz = 0.94uSec
    	//46 Clocks / 46.875 MHz = 0.98uSec
    
    	//___________________________________________
    	//Check
    	//0.94 uSec < 0.96uSec < 0.98uSec
    
    	//Include clock count buffer of 1 CLOCK
    	//So Configure XMIN to be Uint8 44 (0x2C)
    	//   Configure XMAX to be Uint8 46 (0x2E)
    
    	CSL_FINS(mcaspRegs->XCLKCHK, MCASP_XCLKCHK_XMIN, 0x2C);
    	CSL_FINS(mcaspRegs->XCLKCHK, MCASP_XCLKCHK_XMAX, 0x2E);
    
    
    
      /*
    
      * [c] Serializer Registers */
    
    	//Configure Serializer 8, 15 to be Transmit Serializers
      	mcaspRegs->SRCTL8 = 0x0000001D;
      	mcaspRegs->SRCTL15 = 0x0000001D;
      	//mcaspRegs->SRCTL8 = 0x00000019;
      	//mcaspRegs->SRCTL15 = 0x00000019;
    
     /* 	[d] Global Registers: */
    
     		/* PFUNC Register */
    	//Configure AHCLKX, ACLKX, AFSX, AXR8, AXR15 as McASP Pins or GPIO Pins
    	CSL_FINST(mcaspRegs->PFUNC, MCASP_PFUNC_AFSX, MCASP);
    	CSL_FINST(mcaspRegs->PFUNC, MCASP_PFUNC_AHCLKX, MCASP);
    	CSL_FINST(mcaspRegs->PFUNC, MCASP_PFUNC_ACLKX, MCASP);
    
    	CSL_FINST(mcaspRegs->PFUNC, MCASP_PFUNC_AXR8, MCASP);
    	CSL_FINST(mcaspRegs->PFUNC, MCASP_PFUNC_AXR15, MCASP);
    
    
    	// PDIR Register
    	//Configure the AHCLKX, ACLKX, AFSX, AXR8 and AXR15 as Output Pins
    
    	CSL_FINST(mcaspRegs->PDIR, MCASP_PDIR_AFSX, OUTPUT);
    	CSL_FINST(mcaspRegs->PDIR, MCASP_PDIR_AHCLKX, OUTPUT);
    	CSL_FINST(mcaspRegs->PDIR, MCASP_PDIR_ACLKX, OUTPUT);
    	CSL_FINST(mcaspRegs->PDIR, MCASP_PDIR_AXR15, OUTPUT);
    	CSL_FINST(mcaspRegs->PDIR, MCASP_PDIR_AXR8, OUTPUT);
    
    /* Digital Interface Tranmistter Control Regiser */
    
    	//Disable DIT Portion of McASP
    	CSL_FINST(mcaspRegs->DITCTL, MCASP_DITCTL_DITEN, DISABLE);
    
    /* Digital Loopback Control Register*/
    
    	//Configure Digital Loopback
    	CSL_FINST(mcaspRegs->DLBCTL, MCASP_DLBCTL_DLBEN, DISABLE);
    	CSL_FINST(mcaspRegs->DLBCTL, MCASP_DLBCTL_ORD, XMTODD);
    
    
    
    
    	/* AMUTE Register */
    
    /* The stat of this register doesn't matter on the OMAP-L138 baseboard
     * because the AMUTE pin is not connected to the TLV320AIC3106 Device */
    
    	//Configure AMUTE Pin to drive when any Error Occurs
    	CSL_FINST(mcaspRegs->AMUTE, MCASP_AMUTE_XDMAERR, DISABLE);
    	CSL_FINST(mcaspRegs->AMUTE, MCASP_AMUTE_RDMAERR, DISABLE);
    	CSL_FINST(mcaspRegs->AMUTE, MCASP_AMUTE_XCKFAIL, DISABLE);
    	CSL_FINST(mcaspRegs->AMUTE, MCASP_AMUTE_RCKFAIL, DISABLE);
    	CSL_FINST(mcaspRegs->AMUTE, MCASP_AMUTE_XUNDRN, DISABLE);
    	CSL_FINST(mcaspRegs->AMUTE, MCASP_AMUTE_ROVRN, DISABLE);
    	CSL_FINST(mcaspRegs->AMUTE, MCASP_AMUTE_XUNDRN, DISABLE);
    	CSL_FINST(mcaspRegs->AMUTE, MCASP_AMUTE_ROVRN, DISABLE);
    
    	//Disable AMUTEIN Pin to isolate from LogicPD HW status
    	CSL_FINST(mcaspRegs->AMUTE, MCASP_AMUTE_INSTAT, INACTIVE);
    
    	//Disable Drive on AMUTEOUT when AMUTEIN error is active
    	CSL_FINST(mcaspRegs->AMUTE, MCASP_AMUTE_INEN, DISABLE);
    
    	//Configure AMUTE Input Logic Level to High
    	CSL_FINST(mcaspRegs->AMUTE, MCASP_AMUTE_INPOL, ACTHIGH);
    	//Disable AMUTE PIN
    	CSL_FINST(mcaspRegs->AMUTE, MCASP_AMUTE_MUTEN, DISABLE);
    
    
    	/* Steps 4-11 Continued in McASPStart(); */
    
    return;
    }
    
    void McASPStart(void){
    
    
     	/* [4] Start the respective High Frequency Serial Clocks
     	 * 		[a] Take the respective High Frequency Clocks out of reset
     	 *		[b] Read back from GBLTRL to ensure the bits to which you wrote are sucessfully latch in GBLCTL before you proceed
     	 */
     	 	if(CSL_FEXT(mcaspRegs->GBLCTL, MCASP_GBLCTL_XHCLKRST)!=CSL_MCASP_GBLCTL_XHCLKRST_ACTIVE){
    
     	 		 //Start Transmit High Frequency clock if not active
     			 CSL_FINST(mcaspRegs->XGBLCTL, MCASP_XGBLCTL_XHCLKRST, ACTIVE);
    
     			//Stall until GBLCTL reads back to ensure it was latched by the logic
     	 		while(CSL_FEXT(mcaspRegs->GBLCTL, MCASP_GBLCTL_XHCLKRST)!=CSL_MCASP_GBLCTL_XHCLKRST_ACTIVE);
    
     	 	}
    
    #if 0
     	 	 if(CSL_FEXT(mcaspRegs->GBLCTL, MCASP_GBLCTL_RHCLKRST)!=CSL_MCASP_GBLCTL_RHCLKRST_ACTIVE){
    
     			//Start Recieve High Frequency clock
     	 	  	CSL_FINST(mcaspRegs->RGBLCTL, MCASP_RGBLCTL_RHCLKRST, ACTIVE);
    
     	 	  	 //Stall until GBLCTL reads back to ensure it was latched by the logic
     	 		while(CSL_FEXT(mcaspRegs->GBLCTL, MCASP_GBLCTL_RHCLKRST)!=CSL_MCASP_GBLCTL_RHCLKRST_ACTIVE);
     	 	}
    #endif
    
     	 /* [5] Start the respective serial clocks
     	  * 		[a] Take the respective internal serial clock dividers out of reset
     	  * 		[b] Read by from GBLCTL to ensure the bits to which you wrote are succesfully latched*/
    
    		if(CSL_FEXT(mcaspRegs->GBLCTL, MCASP_GBLCTL_XCLKRST)!=CSL_MCASP_GBLCTL_XCLKRST_ACTIVE){
    
      		 	//Start Transmit High Frequency clock if not active
     		 	CSL_FINST(mcaspRegs->XGBLCTL, MCASP_XGBLCTL_XCLKRST, ACTIVE);
    
     			//Stall until GBLCTL reads back to ensure it was latched by the logic
     	 		while(CSL_FEXT(mcaspRegs->GBLCTL, MCASP_GBLCTL_XCLKRST)!=CSL_MCASP_GBLCTL_XCLKRST_ACTIVE);
     	 	}
    #if 0
     	 	 if(CSL_FEXT(mcaspRegs->GBLCTL, MCASP_GBLCTL_RCLKRST)!=CSL_MCASP_GBLCTL_RCLKRST_ACTIVE){
    
     			//Start Recieve Serial Clock
     	 		CSL_FINST(mcaspRegs->RGBLCTL, MCASP_RGBLCTL_RCLKRST, ACTIVE);
    
     	 	  	 //Stall until GBLCTL reads back to ensure it was latched by the logic
     	 		while(CSL_FEXT(mcaspRegs->GBLCTL, MCASP_GBLCTL_RCLKRST)!=CSL_MCASP_GBLCTL_RCLKRST_ACTIVE);
     	 	}
    #endif
     	 	/* [6] Set Up data acquistion as required
     	 	 * 		[a] If DMA is used to service the McASP, set up the data Acquisition as desired and start
     	 	 *          the DMA
     	 	 * 		[b] If CPU interrupt is used to service the McASP, enable the transmit/recieve interrupt
     	 	 *          as required
     	 	 *      [c] If CPU pooling is used to service the McASP, no action is required in this step
     	 	 */
    
     	 	 	//For now we use CPU polling -> so no action is required
    
     	 	 /* [7] Activate Serializers
     	 	  * 	[a] Before starting, clear the Tx/Rx Status registers by writting FFFF to them*/
    
    
    
     	 	  	mcaspRegs->XSTAT = 0x0000FFFF;
     	 	  	//mcaspRegs->RSTAT = 0x0000FFFF;
    
    
     	 	/*  	[b] Take the Serializers out of Reset
     	 	 * [c] Read back from GBLCTL to ensure the bits are latched  */
    
     	 	if(CSL_FEXT(mcaspRegs->GBLCTL, MCASP_GBLCTL_XSRCLR)!=CSL_MCASP_GBLCTL_XSRCLR_ACTIVE){
    
     			//Start Recieve Serial Clock
     	 		CSL_FINST(mcaspRegs->XGBLCTL, MCASP_XGBLCTL_XSRCLR, ACTIVE);
    
     	 	  	// Stall until GBLCTL reads back to ensure it was latched by the logic
     	 		while(CSL_FEXT(mcaspRegs->GBLCTL, MCASP_GBLCTL_XSRCLR)!=CSL_MCASP_GBLCTL_XSRCLR_ACTIVE);
     	 	}
    #if 0
     	  	if(CSL_FEXT(mcaspRegs->GBLCTL, MCASP_GBLCTL_RSRCLR)!=CSL_MCASP_GBLCTL_RSRCLR_ACTIVE){
    
     			//Start Recieve Serial Clock
     	 		CSL_FINST(mcaspRegs->RGBLCTL, MCASP_RGBLCTL_RSRCLR, ACTIVE);
    
     	 	  	// Stall until GBLCTL reads back to ensure it was latched by the logic
     	 		while(CSL_FEXT(mcaspRegs->GBLCTL, MCASP_GBLCTL_RSRCLR)!=CSL_MCASP_GBLCTL_RSRCLR_ACTIVE);
     	 	}
    #endif
    
    		/* [8] Verify that Tx Buffers are services.
    		 * 		[a] If DMA is used to service the McASP, the DMA auto services the McASP upon
    		 * 			recieving AXEVT. Before proceeding, you should verify that the XDATA in XSTAT is clear
    		 *   		to zero, indicating that the Tx buffers are already services by the DMA
    		 *
    		 *		[b] If CPU interrupt is used to service the McASP, ISRs is entered upon the AXINT interrupt.
    		 *    		The interrupt service routing should service the XBUF registers. Before proceeding, clear
    		 * 			the XDATA bit in the XSTAT
    		 *
    		 * 		[c] If CPU Pooling is used to service the McASP, the XBUF Registers should be written to in this
    		 * 			step */
    
    
    		 	//Write Dummy Value to the XBUF15 (Tx Serializer)
    
    
    		 if(CSL_FEXT(mcaspRegs->XSTAT, MCASP_XSTAT_XDATA)==CSL_MCASP_XSTAT_XDATA_YES){
    		 	mcaspRegs->XBUF15 = 0x555555u;
    		 }
    
    
    
     /*[9] Release the State Machines from Reset */
    
     	 	if(CSL_FEXT(mcaspRegs->GBLCTL, MCASP_GBLCTL_XSMRST)!=CSL_MCASP_GBLCTL_XSMRST_ACTIVE){
    
     			//Start Transmit Serial Clock
     	 		CSL_FINST(mcaspRegs->XGBLCTL, MCASP_XGBLCTL_XSMRST, ACTIVE);
    
     	 	  	// Stall until GBLCTL reads back to ensure it was latched by the logic
     	 		while(CSL_FEXT(mcaspRegs->GBLCTL, MCASP_GBLCTL_XSMRST)!=CSL_MCASP_GBLCTL_XSMRST_ACTIVE);
     	 	}
    #if 0
     	 	if(CSL_FEXT(mcaspRegs->GBLCTL, MCASP_GBLCTL_RSMRST)!=CSL_MCASP_GBLCTL_RSMRST_ACTIVE){
    
     			//Start Recieve Serial Clock
     	 		CSL_FINST(mcaspRegs->RGBLCTL, MCASP_RGBLCTL_RSMRST, ACTIVE);
    
     	 	  	// Stall until GBLCTL reads back to ensure it was latched by the logic
     	 		while(CSL_FEXT(mcaspRegs->GBLCTL, MCASP_GBLCTL_RSMRST)!=CSL_MCASP_GBLCTL_RSMRST_ACTIVE);
     	 	}
    #endif
    
    
    
    
    /* [10]. Release frame sync generators from reset. Note that it is necessary to release the internal frame sync
    generators from reset, even if an external frame sync is being used, because the frame sync error
    detection logic is built into the frame sync generator.
    	a. Take the respective frame sync generator(s) out of reset by setting the RFRST bit for the receiver,
    		and/or the XFRST bit for the transmitter in GBLCTL. All other bits in GBLCTL should be left at the
    		previous state.
    	b. Read back from GBLCTL to ensure the bit(s) to which you wrote are successfully latched in
    		GBLCTL before you proceed. */
    
    
    
     	 if(CSL_FEXT(mcaspRegs->GBLCTL, MCASP_GBLCTL_XFRST)!=CSL_MCASP_GBLCTL_XFRST_ACTIVE){
      			//Start Recieve Serial Clock
      		CSL_FINST(mcaspRegs->XGBLCTL, MCASP_XGBLCTL_XFRST, ACTIVE);
    
      	  	 //Stall until GBLCTL reads back to ensure it was latched by the logic
      		while(CSL_FEXT(mcaspRegs->GBLCTL, MCASP_GBLCTL_XFRST)!=CSL_MCASP_GBLCTL_XFRST_ACTIVE);
      	}
    #if 0
      	if(CSL_FEXT(mcaspRegs->GBLCTL, MCASP_GBLCTL_RFRST)!=CSL_MCASP_GBLCTL_RFRST_ACTIVE){
      			//Start Recieve Serial Clock
      		CSL_FINST(mcaspRegs->RGBLCTL, MCASP_RGBLCTL_RFRST, ACTIVE);
    
      	  	 //Stall until GBLCTL reads back to ensure it was latched by the logic
      		while(CSL_FEXT(mcaspRegs->GBLCTL, MCASP_GBLCTL_RFRST)!=CSL_MCASP_GBLCTL_RFRST_ACTIVE);
      	}
    #endif
    
    
    
    
    
    
    
    
    /* [11]. Upon the first frame sync signal, McASP transfers begin. The McASP synchronizes to an edge on the
    frame sync pin, not the level on the frame sync pin. This makes it easy to release the state machine
    and frame sync generators from reset.
    a. For example, if you configure the McASP for a rising edge transmit frame sync, then you do not
    need to wait for a low level on the frame sync pin
    
    */
    
    
    
    	return;
    }
    // This routine is called from main, in a while(1) loop
    // This is a simple CPU polling routine to check the data on AXR15 pin
    void McASPTx(){
    
     	if(mcaspRegs->XSTAT & 0x00000020){
    	 	mcaspRegs->XBUF15 = 0x333333u;
    	 	mcaspRegs->XSTAT = 0x00000020;
     	}
    }
    
    void McASPStop(void){
    
    	/* This function should be used to stop clocks in the reverse order
    	 * from McASPStart */
    
    	return;
    }
    
    void McASPEcho(void){
    	/* This function is used to wait until a McASP Event comes in,
    	 * read the data and directly write it back out to the Codec */
    
    	 //Notes McASP Interrupts are still masked here so nothing should
    	 //interrupt the CPU
    
    	 //RSYNC error is expected right away, but shouldn't occur after first event
    	   		//because the clock references are internal and stable
    
     	return;
    }
    
    void McASPRestart(){
    
    	if(mcaspRegs->GBLCTL == 0x00000000){
    
    		McASPInit();
    		McASPStart();
    	}
    
    
    }
    
    
    
    
    
    
    

    • Cancel
    • Up 0 True Down
    • Cancel
  • Sivaraj Kuppuraj
    0 Sivaraj Kuppuraj over 11 years ago in reply to Lee Felsenstein
    TI__Mastermind 35645 points

    Hi,

    Thanks for your data.

    I think, in your case, XRBUF is not loaded with desired data since the previous data in Tx. buffer should be cleared and it should indicate a sign, that it should be ready through XRDY bit 4 in SRCTRLn register. In your case, there is no symptom of clearing the while condition as below:

    // Stall until GBLCTL reads back to ensure it was latched by the logic
    while(CSL_FEXT(mcaspRegs->GBLCTL, MCASP_GBLCTL_XSRCLR)!=CSL_MCASP_GBLCTL_XSRCLR_ACTIVE);

    The above condition stalls that, XSRCLR in GBLCTL is not switching from 0 to 1 to indicate an empty transmitter which is ready to receive new data signing through XRDY bit 4 in SRCTRLn and this is not happening in the while loop and the condition is failing to do so, which indicates that, always data is being written to the Tx. buffer and XBUF contains previous data which is not being shifted to XRSR and the data is not cleared. So, the XSRCLR bit is always 0 which indicates all transmit serializers are not being active and it is in cleared state.

    I would recommend you to debug the code step by step and evaluate  why the XSRCLR bit of GBLCTL and XRDY bit of SRCTL register are not switching to the desired state and why the previous data of XRBUF is not cleared, thereby, it prevents loading new data by not switching XRDY bit of SRCLR from 0 to 1 to indicate a empty Tx. buffer to load new data.

    Kindly ensure pinmux register configuration for the appropriate McASP Tx. serializers AXR8 & AXR15 to be active.

    Thanks & regards,

    Sivaraj K

    -------------------------------------------------------------------------------------------------------

    Please click the Verify Answer button on this post if it answers your question

    -------------------------------------------------------------------------------------------------------

    • Cancel
    • Up 0 True Down
    • Cancel
  • Lee Felsenstein
    0 Lee Felsenstein over 11 years ago in reply to Sivaraj Kuppuraj
    Prodigy 150 points

    The system is working now, but not for any of the reasons mentionedin your last posting.

    We found that the DISMOD field (3:2) in the SRCTLn register had to be set to 0h (we had set it to 3h and had tried 2h) in order to allow serializer operation. We thought that this was in inconsequential setting, as the description states that the bits are effective only during an "inactive TDM slot" (we had none) "or when the serializer is inactive" (which it certainly was). There is no mention that this field setting can render the serializer inactive.

    Perhaps someone at TI could look into this.

    No other changes were necessary to the code, both in polling mode and interrupt mode. We did have to adjust the word rotation and the delay in order to align our data propery, and the system produces outputs on both AX15 and AX8.

    We manufacture industrial safety sensors, which will never be a high-volume business, so our usage projections are in the range of 5000 anually. This apparently does not place us into a category worthy of a high level of support (we have been attempting to discover how we could pay for support from TI - so far without success). Of course, these words are directed to someone well above your level, and I hope that they make it that far.

    Please look at the documentation and experiement to verify my assertion - you might benefit from reporting an insufficiency in the manual.

    This will close this question.

    Regards,

    Lee Felsenstein and Prathibha Kadur

    • Cancel
    • Up 0 True Down
    • Cancel
  • Sivaraj Kuppuraj
    0 Sivaraj Kuppuraj over 11 years ago in reply to Lee Felsenstein
    TI__Mastermind 35645 points

    Hi,

    Thanks for your notification in capturing the gaps in the documentation and letting us know.We apprreciate your efforts on the same.

    We are glad that your system works now.

    We will try to evaluate your concern on the documentation.

    Thanks & regards,

    Sivaraj K

    • Cancel
    • Up 0 True Down
    • Cancel