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.

RTOS/66AK2G02: Use McASP driver for circular buffer

Part Number: 66AK2G02
Other Parts Discussed in Thread: AUDK2G

Tool/software: TI-RTOS

I downloaded CCS and PDK and installed in the default directories:
C:\ti\bios_6_46_01_38
C:\ti\ccsv6\         [CCS  Version: 6.1.3.00034]
C:\ti\edma3_lld_2_12_02_26
C:\ti\pdk_k2g_1_0_4
C:\ti\processor_sdk_rtos_k2g_3_02_00_05
C:\ti\xdctools_3_32_01_22_core

 

The example code, MCASP_Audio_evmK2G_armExampleProject, delivered for McASP driver is using McASP2 single TX/RX port. It utilizes APIs in the following orders

Edma3init(.) // Not an API but call two EDMA3 APIs: EDMA3_DRV_create(.) and EDMA3_DRV_open(.)

mcaspBindDev(.)

mcaspCreateChan(.) // call EDMA3 API: EDMA3_DRV_requestChannel(.)

mcaspSubmitChan(.) // call EDMA3_DRV_linkChannel(.) and EDMA3_DRV_enableTransfer(.)

I was able to get the audio loopback with on-board AIC31 codec when running the example code on EVMK2G board. But the example is different from my case. Since I need to support more than 6 ports I use McASP0 instead of McASP2.

 

Q1: I would like to know how to utilize the McASP APIs to configure a circular buffer in PaRAM for EDMA3 to support total 8 McASP0 AXR ports [McASP0_AXR0:AXR7] for MCASP_READ.

Refer to the Technical Reference Manual, spruhy8e, 10.4.4.3 the PaRam configuration for EDMA peripheral servicing in continuous operation. Correct me if I am wrong. I think the order of EDMA3 APIs would be the following:

EDMA3_DRV_requestChannel (hEdma, &ChId1, NULL, 1, NULL, NULL);

EDMA3_DRV_requestChannel (hEdma, &ChId2, NULL, 1, NULL, NULL);

EDMA3_DRV_setPaRAM(hEdma, chId1, &paramSet1);

EDMA3_DRV_setPaRAM(hEdma, chId2, &paramSet2);

         EDMA3_DRV_linkChannel (hEdma, ChId1, ChId2);

       //  paramSet1 and paramSet2 are the same except the Link Address of paramSet1 points to paramSet2. The Link Address of paramSet2 points to paramSet2 itself.

          EDMA3_DRV_enableTransfer (hEdma, chId1, EDMA3_DRV_TRIG_MODE_EVENT)

 

But the EDMA3_DRV_requestChannel(.) and EDMA3_DRV_linkChannel(.) are separated in McASP APIs: mcaspCreateChan(.) and mcaspSubmitChan(.). The EDMA3_DRV_linkChannel(.) and EDMA3_DRV_enableTransfer(.) are in the same API mcaspSubmitChan(.). Can I change the Link Address of paramSet1 after EDMA3 Transfer is enabled? How to utilize the McASP APIs directly to setup EDMA3 for circular buffering?

I modified EDMA3_RM_InstanceInitConfig sampleInstInitConfig[NUM_EDMA3_INSTANCES][EDMA3_MAX_REGIONS] in C:\ti\edma3_lld_2_12_02_26\packages\ti\sdo\edma3\drv\sample\src\platforms\sample_tci66ak2g02_cfg.c in order to use McASP0. Is there any place I can change to achieve my goal?

Q2: There is an external signal, let’s call it myEvent, neither synchronize to McASP frame-sync nor with a constant period . Whenever myEvent occurs I need to know the index for the last written sample in the circular buffer so I can extract the block of samples from all 8 channels for further process. It seems I need to access PaRAM to read the destination address or the counter to know the write index in circular buffer. But EDMA3 is also updating PaRAM. Is there any way I can get the index of the last written sample from circular buffer? Thanks.

  • Joshua,

    There is a 8 channel (4 serializer) Analog IO loopback test using MCASP0 and MCASP1 in the Processor SDK RTOS. This example uses the AUDK2G audio daughter card for IO. the example can be found under :
    pdk_k2g_1_0_4\packages\ti\addon\audk2g\test\analog\loopback

    Documentation:
    processors.wiki.ti.com/.../Processor_SDK_RTOS_AUDK2G_AddOn

    the size of the TXBUF And RXBUF needs to be setup as per the number of serializer being used and the EDMA configuration to move the data to the buffer is configured by the MCASP LLD. Please review that example and let us know if that is what you were looking for

    Regards,
    Rahul

  • From the audk2g example, the values of mcaspRxChanParam in mcasp_cfg.c
    and the difference of the EDMA3_RM_InstanceInitConfig sampleInstInitConfig[NUM_EDMA3_INSTANCES][EDMA3_MAX_REGIONS]
    between delivered EDMA3 driver
    C:\ti\edma3_lld_2_12_02_26\packages\ti\sdo\edma3\drv\sample\src\platforms\sample_tci66ak2g02_cfg.c
    and audk2g example
    C:\ti\pdk_k2g_1_0_4\packages\ti\addon\audk2g\test\analog\loopback\src\sample_k2g_cfg.c
    really help to understand how to setup for McASP0/1 multiple ports.
    But it doesn't solve my two questions.

  • Rahul,

    DO you have any update to my questions?
    Q1. Us McASP APIs to create circular buffer.
    Q2. Read the index which points to the place of last written sample in the circular buffer whenever there is external event occurs.