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.

Configure the McBSP Channel params to use LLD EDMA3 for sorting the inputdata in a buffer

Other Parts Discussed in Thread: ADS8558

I have a ADC hooked up to the McBSP. The ADC is a 6 channel 12 bit (send 16 bit added with zerros)

The stream is like (1 frame): A0 A1 B0 B1 C0 C1 D0 D1 E0 E1 F0 F1 (12 x 8 bits)
This gives me a buffer like:
A0 A1
B0 B1
...
F0 F1

This works but I want a buffer like:
A0 A1
A0 A1
A0 A1
...
A0 A1
B0 B1
....
B0 B1
C0 C1
...
F0 F1

My code for this looks like:

Mcbsp_DataConfig mcbspChanConfig;
Mcbsp_McrSetup mcbspMultiChanCtrl;
Mcbsp_ClkSetup mcbspClkConfig;
Mcbsp_ChanParams mcbspChanparam;

 

int16_t RxBuf[2][85];

// Data setup for the Tx/Rx sections
mcbspChanConfig.phaseNum = Mcbsp_Phase_SINGLE;
mcbspChanConfig.wrdLen1 = Mcbsp_WordLength_16;
// => aCnt = 2
mcbspChanConfig.wrdLen2 = Mcbsp_WordLength_16; // => aCnt = 2
mcbspChanConfig.frmLen1 = ELEMENTS_PER_FRAME;  // = 6  
mcbspChanConfig.frmLen2 = 0; // => bCnt = frmLen1 + frmLen2 = 6

mcbspChanConfig.frmSyncIgn = Mcbsp_FrmSync_DETECT;
mcbspChanConfig.dataDelay = Mcbsp_DataDelay_2_BIT;
mcbspChanConfig.compandSel = Mcbsp_Compand_OFF_MSB_FIRST;
mcbspChanConfig.bitReversal = Mcbsp_BitReversal_DISABLE;
mcbspChanConfig.intMode = Mcbsp_IntMode_ON_SYNCERR;
mcbspChanConfig.rjust = Mcbsp_RxJust_RZF;
mcbspChanConfig.dxState = Mcbsp_DxEna_ON;

 

// Multi channel setup
mcbspMultiChanCtrl.multiChanMode = Mcbsp_McmMode_ALL_CHAN_ENABLED_UNMASKED;
mcbspMultiChanCtrl.partitionSelA = Mcbsp_PartitionMode_CHAN_0_15;
mcbspMultiChanCtrl.partitionSelB = Mcbsp_PartitionMode_CHAN_16_31;
mcbspMultiChanCtrl.partitionMode = Mcbsp_PartitionMode_2;

 

 

// Clock setup for the Rx/Tx section
mcbspClkConfig.frmSyncMode = Mcbsp_FsClkMode_INTERNAL;
mcbspClkConfig.samplingRate = 7000;
mcbspClkConfig.clkMode = Mcbsp_TxRxClkMode_INTERNAL;
mcbspClkConfig.frmSyncPolarity = Mcbsp_FsPol_ACTIVE_HIGH;
mcbspClkConfig.clkPolarity = Mcbsp_ClkPol_RISING_EDGE;

 

 

 

// Channel setup
mcbspChanparam.wordWidth = Mcbsp_WordLength_16;
mcbspChanparam.userLoopJobBuffer =
NULL// I HAVE TRIED: pAdcXyzIf->RxBuf[0]; // needed to use cCnt
mcbspChanparam.userLoopJobLength = 0;       //I HAVE TRIED: 85; // cCnt = loopJobLength / aCnt
mcbspChanparam.gblCbk = ErrCallback;
mcbspChanparam.edmaHandle = hEdma[0];
mcbspChanparam.edmaEventQue = 1;
mcbspChanparam.hwiNumber = 9;
mcbspChanparam.dataFormat = Mcbsp_BufferFormat_MULTISLOT_NON_INTERLEAVED; 
// WAS: Mcbsp_BufferFormat_1SLOT; RO
mcbspChanparam.enableHwFifo = TRUE;
mcbspChanparam.chanConfig = &mcbspChanConfig;
mcbspChanparam.clkSetup = &mcbspClkConfig;
mcbspChanparam.multiChanCtrl = &mcbspMultiChanCtrl;
mcbspChanparam.chanEnableMask[0] = 0;
mcbspChanparam.chanEnableMask[1] = 0;
mcbspChanparam.chanEnableMask[2] = 0;
mcbspChanparam.chanEnableMask[3] = 0;

 

 

 

// From the user-device create a DIO adapter
dioParams.name = "/McBsp0";
dioParams.chanParams = &mcbspChanparam;

 

 

 

// DIO attributes
dioAttrs.devid = NULL;
dioAttrs.params = &dioParams;
dioAttrs.type = DEV_SIOTYPE;
dioAttrs.devp =
NULL;

 

 ......

What am I doing wrong?
I can't find any documentation how to set th A count, B count and C count when using the McBSP PSP-driver that uses the EDMA3.

 

 

  • Can nobody help me with this?

  • Is there nobody at TI who can/will help me???

  • Royke,

    I apologize for the lack of response.  However, I suspect you may have posted your question to the wrong forum, so this is probably part of the problem.

    Are you using DSP/BIOS? If so, what version?  Can you provide the details of your hardware and software setup ?  Once I know this, I can help get your question  posted in the correct place.

     

    Steve

  • Hi Steve,

     Thanks for responding on my message. We are using DSP/Bios 5.41.07.24
    A ADC (TI ADS8558) is hooked up to de input ports of the McBSP0. (12bits->reads16bits 6 channel)
    The data is placed into the memory (my buffers) by EDMA and I get a interrupt when the buffers are full. This works ok, but the alignment of the data is not the way I want it.
    It is like

    ch1                                            ch1
    ch2                                            ch1
    ch3                                            ......
    ch4                                            ch1
    ch5        But I want like:          ch2
    ch6                                            ch2
    ch1                                            .......
    ch2                                             ch3
    .....                                              ......
    ch5
    ch6 

    From my training in Dallas "C6000 Embedded Design Workshop Using BIOS" I know how to configure the EDMA to do this, But I am not configuring the EDMA the McBSP driver does it for me. 

    So how can I order the data like I want? 

     

  • Royke,

    Unfortunately, I'm not familiar enough with the EDMA3 to answer your question.  I've requested that this thread get moved to the PSP Drivers - EDMA forums. The EDMA team should know more about this issue as well as how to solve it.

    Regards,

    Steve

  • Royke,

    The PSP drivers are designed to move data from the serial streaming McBSP port into a linear buffer in memory.They were not written to provide robust flexibility of channel sorting, but to make it easy for you to receive a serial stream.

    The easiest way to do the channel sorting will be to sort the data after it has been given to the application in a buffer. This will require a second step which will add latency, but if you can do some other processing or preparation while the copy is taking place, it might not hurt performance very much.

    As you know, with the McBSP and EDMA3 it is possible to do what you are asking. But the possibilities are very wide as to how different people might want to do their channel sorting. For example, many people would want the L/R channels separated, also, such as A0 A0 A0 ... A1 A1 A1 ... B0 B0 B0 ... B1 B1 B1 ....

    There may be limitations forced by the hardware such that all McBSP reads must be 32 bits wide. This is true for the McASP, but I have not heard if it is true for McBSP also. If it is, then the driver must index carefully to get the data into a simple packed input buffer. Sometimes this is done with a 2-stage operation, but different driver developers may choose different methods. I mention this only because it could be a part of the inner workings of the driver that are abstracted for your convenience, but this might make it much harder to add the flexibility you are looking for.

    I am absolutely not a PSP expert, so we can hope that someone comes forward to tell you how wrong I am. I recommend, though, that you move forward with the channel sorting after getting the linear buffer from the PSP.

    Regards,
    RandyP

  • Hi Randy,

    This is the way I do it now, and while I am sorting the data I'm applying the first filtering. But because of what I learned on the training I though it must be possible (and hoped) to let the EDMA do this.

    Regards,

    Roy

  • Roy,

    Are you using a DMA or QDMA channel for the data sorting or doing it with the CPU while you read and write the unsorted data?

    RandyP

  • I am doing it with CPU power in a TSK for now. Also applying the first filtering in that task.

  • I'm still waiting for a reply from someone from the EDMA team.

    Please advice me.

    Thanks

    Royke

  • Hi Roy,

    I am from the BIOS PSP team and McBSP driver does not support data sorting as part of the driver EDMA implementation.

    So if you need any help, then someone from the EDMA team can help you.

    Thanks and Regards,

    Sandeep K

  • Roy,

    I am sure you have already considered your options:

    • write your own McBSP driver (fastest performance, largest software effort)
    • continue having the DSP code sort while filtering (slowest performance, smallest software effort)
    • add a QDMA call to do the channel sorting before accessing the data (good performance, medium software effort)

    It would be worthwhile to at least try the QDMA call, just to see if it will give you a significant performance improvement. Depending on your algorithms and the number of times you access the data, it could be a big improvement or it might not.

    If you have questions implementing the QDMA method, let us know. The fastest EDMA3 LLD method will be the one that writes a struct of config values rather than writing the separate Src, then Dst, then Opt function.

    Regards,
    RandyP

  • Roy,

    When you are doing the data sorting manually, if the CPU operation is required anyway then you get the data sorting for free. But if that is an extra step for the DSP to do, then it would be a good recommendation that you try a QDMA or DMA channel to do the data sorting after the unsorted data has been delivered by the PSP driver. This is not as ideal as having the PSP driver do it, but we had to choose to make the driver simple and straight-forward.

    Please let us know if we can help with the QDMA channel setup.

    Regards,
    RandyP

  • Hi Randy,

    Thanks for responding. Like I said, we need to filter the signal also and do some calculations with it. Here for we need CPU power. The only challenge we have is to do this all before the next set of data (ping pong buffer) stands ready to be processed. We are not doing all the filtering right yet, so it can become a challenge to do this in this time. If we need any help with this than we will contact TI.

    Regards,
    Roy