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.

Problems changing the codec (3204) sample rate on the ezDsp5515

I have been trying to change the codec (aic3204) sample rate to 96 ksps.  I started with the AIC3204 loopback test program and changed:

  • In the PLL configuration, J.D to 7.6800
  • In the ADC configuration, the MADC to 3, the NADC to 5 and the AOSR to 64 and the ADC processing block to PRB_R7
  • In the DAC configuration, the MDAC to 5, the NDAC to 3 and the DOSR to 64 and the DAC processing block to PRB_P7

When I run the test the output sounds right (i.e. a 1 kHz input produces a 1 kHz output).  However when I halt the debugger and look at the samples they correspond to a 2 kHz tone at 96 kbps.  It also takes 1 s for the DSP to collect 48000 samples.  i.e. the DSP is not seeing a 96 kbps sample rate, but a 48 kbps sample rate.

I have added code to check the registers and they are all set to the values I intended to program.

I'd be very grateful for any help.

Peter

 

  • Hi,

    Which is the I2S master?

    Regards,

    Hyun

  • I've found the problem and its samples being lost on the interface.  At 48000 ksps the unoptimised software loop of the example code keeps up, but at 96000 kbps it struggles.

    I had added a printf every second and this also seems to have an effect on the acquisition in the next second (as if the printf merely queues a string for transfer, which takes place later).

    Time to start changing the example code to use the DMA.

  • Hey Peter,

    I am also interested in changing the example code to use DMA. Did you manage to achieve this?

    Thanks

    James

  • James,

    Lets see if I can get the upload right.  The attached files consist of my work in acq.c, acq.h, error.c and error.h.  The remaining files are from the CCS directories:

    • "...\ccsv4\emulation\boards\usbstk5515_v1\tests\USB_Stick_Sample\inc" (the register_xyz.h headers)
    • "...\ccsv4\emulation\boards\usbstk5515_v1\include" (the usbstk5515_i2c.h header)

    Use as follows:

        static Int16 samples[4096];
        ACQ_Config();
        while (1)
        {
            ACQ_Start(samples, sizeof(samples)/sizeof(samples[0]));
            ACQ_Wait();
            // Do something with the data
        }

    Caveat - I extracted these files from a larger project in which they work correctly.  I cannot test them as a a separate project (I'm short of time), but I'm 95 % certain it should be OK.

    Peter

    Edit note added:

    MikeH spotted the use of a reserved value in configuring the source address mode.  Although it works, mode 3 is reserved so it would be best to use mode 2.  i.e. In line 108 and 119 of acq.c replace 0x00C0 with 0x0080.

  • Hey Peter,

    Thank you very much for that! I'll give it a go over the weekend and let you know how it goes. Really appreciated!

    Thanks!

    James

  • Hey Peter,

    I gave it a go - however it seems to error out because my samples[] array is not in the DARAM. Sorry to sound like a noob but how can I force that array to be in DARAM?

    Cheers

    James

  • James,

    I guess you're finding that my ERROR_Fatal() function is being called.

    Unfortunately I don't really know how to force a variable into DARAM

    I'm using the linker command file from the "...\ccsv4\emulation\boards\usbstk5515_v1\tests\aic3204" directory and when I defined the samples array as being static it ended up in DARAM.  The following line is in the file:

    "   .bss      >> DARAM0|SARAM0|SARAM1  /* Global & static vars        */"

    I would guess that this tells the linker to place statics in DARAM or SARAM.  If the order implies a priority it may be that your DARAM is already full.

    Peter



  • Hey Peter,

    I got it working in the end, many thanks for your help!

    Cheers

    James