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 DM6467 Audio output jerky

The setup has a TW2835 codec interfaced with McASP of DM6467.
The codec has been tested for a loopback and it works fine.
But when recorded and played back via McASP, the audio output is jerky, i.e.it plays-stops-plays-stops-...continuously. The input comes from a microphone being spoken into on a windows machine. A windows application takes care of sending it to the TW2835 - DM6467 setup. On DM6467, a linux application takes care of the record and playback.
The register settings on McASP:

GBL CTL  : 00000000                  PFUNC  : 00000000
PDIR   : 08000002                        AMUTE  : 00000000
DLB CTL  : 00000000                  DIT CTL : 00000000

RXMASK   : ffffffff                            RX FMT  : 00018070
RX FMCTL  : 00000111               ACLKRCTL: 00000080
AHCLKR CTL  : 0000805d         RX TDM  : 00000003
EVTR CTL : 00000000                RX STAT : 00000000
RXTDM SLOT  : 00000000         RXCLKCHK: 00ff0000
REVTCTL  : 00000000 

TX MASK  : ffffffff                            TX FMT  : 00018070
TX FMCTL  : 00000111               ACLKXCTL: 00000040
AHCLKXTL  : 00008000             TXTDM  : 00000003
EVTX CTL : 00000000                TX STATL: 00000008
TX TDMSLOT  : 0000017f          TXCLKCHK: 00ff0000

SRCTL0  : 00000002
SRCTL1  : 00000011

Using external clocks and frame syncs, from the codec. Clock and frame sync waveforms are fine. The audio output waveform, captured for the jerky intervals it does play for, looks like a half-sine clipped off. TW2835 handles only mono audio.
It would be great if anybody could help me out here.

  • Be care for the XROT in XFMT, you should do below configuration depend you own slot size:

    u32 fmt = 0;
    u32 mask, rotate;

    switch (channel_size) {
    case DAVINCI_AUDIO_WORD_8:
    fmt = 0x03;
    rotate = 6;
    mask = 0x000000ff;
    break;

    case DAVINCI_AUDIO_WORD_12:
    fmt = 0x05;
    rotate = 5;
    mask = 0x00000fff;
    break;

    case DAVINCI_AUDIO_WORD_16:
    fmt = 0x07;
    rotate = 4;
    mask = 0x0000ffff;
    break;

    case DAVINCI_AUDIO_WORD_20:
    fmt = 0x09;
    rotate = 3;
    mask = 0x000fffff;
    break;

    case DAVINCI_AUDIO_WORD_24:
    fmt = 0x0B;
    rotate = 2;
    mask = 0x00ffffff;
    break;

    case DAVINCI_AUDIO_WORD_28:
    fmt = 0x0D;
    rotate = 1;
    mask = 0x0fffffff;
    break;

    case DAVINCI_AUDIO_WORD_32:
    fmt = 0x0F;
    rotate = 0;
    mask = 0xffffffff;
    break;

    default:
    return -EINVAL;
    }

    mcasp_mod_bits(dev->base + DAVINCI_MCASP_RXFMT_REG,
    RXSSZ(fmt), RXSSZ(0x0F));
    mcasp_mod_bits(dev->base + DAVINCI_MCASP_TXFMT_REG,
    TXSSZ(fmt), TXSSZ(0x0F));
    mcasp_mod_bits(dev->base + DAVINCI_MCASP_TXFMT_REG, TXROT(rotate),
    TXROT(7));
    mcasp_mod_bits(dev->base + DAVINCI_MCASP_RXFMT_REG, RXROT(rotate),
    RXROT(7));
    mcasp_set_reg(dev->base + DAVINCI_MCASP_TXMASK_REG, mask);
    mcasp_set_reg(dev->base + DAVINCI_MCASP_RXMASK_REG, mask);