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.

McBSP many words frame data transfer

Hi every body,


I am trying to initialize the Mcbsp as spi master to transfer a data frame consist of many words, the data transfer works fine when the frame length is one word.

I am using the internal clock generator and the internal frame sync generator ( I tried DX2XSR as well as FSG).

when I try to initialize the frame length higher than one word, then I get a data bit shifting. This shifting is caused by stopping the clock for one period of the sample rate generator clock after each word.

I read some posts in your forum regarding this problem, but I didn't found a suitable solution expect transferring the data word wise. ( this is not adequate solution for my project)

My Question is:

Is it possible to transfer a frame consisting of many words without the bit shifting?

Why the sample rate generator clock stops after each word inside one frame? could it be fixed by the McBSP initialization?

Thank you in advanced

Moneer

  • Hi Moneer,

    Thanks for your post.

    As you haven't mentioned your device name. i am assuming it as C6748, correct me if i am wrong.

    when I try to initialize the frame length higher than one word, then I get a data bit shifting. This shifting is caused by stopping the clock for one period of the sample rate generator clock after each word.

    Why you are stopping clock in between a single-transition after each word ?

    Please refer section 24.2.5.3.8 of C6748 TRM "Stopping Clocks".
    • The SPI™ CLKSTP mode where clocks are stopped between single-element transfers. This mode is not supported on this device.


    Is it possible to transfer a frame consisting of many words without the bit shifting?

    Yes , it is possible to transfer many words without bit shifting.
  • Hi Arvind,

    Many thanks for your fast answer.

    I am using C6713B device for my project.
    I configured the McBSP as SPI master using the internal sample rate generator.

    I want to transmit a frame consist of 128 elements with element length of 16 bits.

    I don't stop the clock manually between the elements. The clock stops between the single element transfer automatically.

    Is there any McBSP-Registers configuration which could force the clk to stop between the element-transfer?

    So I read the following post and what I understood from it, a transfer of a frame consist of many elements through the SPI is not possible. correct me if i am wrong!!

    e2e.ti.com/.../418715

    Could you confirm my interpretation of the above post please.

    Best regards
    Moneer Shatat
  • Hi Moneer,

    Here are some suggestions to give you .
    1. Firstly verify you have done McBSP Initialization for SPI Mode, for that you can refer section 9.3 of spru580g (McBSP Reference Guide).
    2. Also check section 9.1 McBSP Operation as SPI Master.
    3. Check for error conditions. Enable XSYNCERR bit in SPCR.

    Apologies for the my confusion.
    Yes, your interpretation of the above post is correct.
  • Hi Arvind,


    Thank you for your quick replay,


    My McBSP initialization is based on the McBSP Reference Guide (spru580g).

    As I mentioned I am able to transmit the data but element wise (XFRLEN1=0). The failure occurs by transferring more than one element per frame XFRLEN1>0.

    I configure the McBSP as SPI master to transfer 4 16-bits elements data package using the EDMA. The XFRLEN1=3, XWDLEN1=16, the FSX is generated by FSG. The value of all elements is 0x8002.

    I observed the signals of FSX, CLKX, and the DX  on the scope and found out, that one clock cycle is missed up the second element. That means the first word will be correct transmitted and the following element are shifted 1 bit to left. the shifting is caused by missing the first clock cycle.

    I added a pictures of the scope measurement I did. (FSX:Yellow;  Green: CLKX;   Blue: DX)

    How do you can see the first clk cycle up the 2 element is missed.

    Yes, your interpretation of the above post is correct.


    This means it is definitely not possible to transmit more than one word "element" inside a frame using the McBSP SPI mode.

    Is this behavior normal for all C67xx devices or is it a specific malfunction of the C6713B?

    Thank you in advanced

    Moneer Shatat

  • Hi Arvind,

    It seems that the transmitter CLKSTP mode in SPCR-Register (actually adjusted to NODELAY) causes the missing CLKX cycle by the elements after the first element.

    Adjusting the CLKSTP mode to DELAY solves the missing CLKX cycle. The CLKX runs properly and I am able to transmit a frame consisting of many elements using the EDMA.

    I can't clear this behavior of the CLKX. It runs properly when CLKSTP mode is adjusted to DELAY and doesn't run properly when CLKSTP adjust to NODELAY.

    do you have an explanation for this behavior?

    best regards
    Moneer Shatat