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.

DM8148 SPI inter-byte delay problems

Hi

I have modified the stock omap2_mcspi.c driver for the DM8148 to enable EDMA transfers using the fifo.

The DM8148 is still configured as a single channel master in receive only mode, with a word length of 8 bits and is effectively just reading data from the slave device, no data ever flows in the other direction.

My requirement is to send data at 30Mb/s over this link at 48MHz clock frequency which means a utilisation of about 62.5% but I'm seeing an unusual delay between bytes transferred even when using the fifo.

The attached images are taken from the scope

The CS is yellow

The SCLK is blue

The MISO is magenta

The first shows part of a transfer at 48MHz showing a delay of 194ns between each 8 bit transfer which in turn takes 167ns, so each byte takes 167+194 = 361ns to transfer with only 46% (167/361*100%) utilisation i.e. 48*0.46 = 22Mb/s

The first shows part of a transfer at 24MHz showing a delay of 186ns between each 8 bit transfer which in turn takes 333ns, so each byte takes 333+186 = 419ns to transfer with only 79.5% (333/419*100%) utilisation i.e. 24*0.795 = 19Mb/s

As you can see, doubling the clock speed gives a minimal increase in useable SPI bandwidth due to the large delay between bytes.

I considered changing the word length and using turbo mode but the other side of the link only supports 8 bit transfers (although it fully supports back to back transfers i.e. no gaps between bytes) but as luck would have it the 32bit data comes out at the DM8148 side in the wrong endianess and I don't have the cpu power available to continually byte swap 30Mb/s of data :-(

So I guess my questions are this

1. Is this normal or can I get rid of it some how?

2. Is there anything I can do to get the DM8148 to do back to back reads in 8 bit mode?

3. Is there any way to get the EDMA to do the byte swapping for free if I chose the 32 bit route?

4. Anything?

 

Thanks in advance

Robert McGowan

 

 

 

  • Hi Robert,

    Are you using EZSDK 5.05.02.00 / PSP 04.04.00.01?

    You can have a look in the below links, might be in help:

    http://processors.wiki.ti.com/index.php/TI81XX_PSP_McSPI_Driver_User_Guide

    http://processors.wiki.ti.com/index.php/AM_McSpi

    http://processors.wiki.ti.com/index.php/TI81XX_PSP_EDMA_Driver_User_Guide

    Best regards,
    Pavel

  • Pavel Botev said:

    Hi Robert,

    Are you using EZSDK 5.05.02.00 / PSP 04.04.00.01?

    Yes

     

    Pavel Botev said:

    You can have a look in the below links, might be in help:

    http://processors.wiki.ti.com/index.php/TI81XX_PSP_McSPI_Driver_User_Guide

    http://processors.wiki.ti.com/index.php/AM_McSpi

    http://processors.wiki.ti.com/index.php/TI81XX_PSP_EDMA_Driver_User_Guide

    Best regards,
    Pavel

     
    Thanks for that, I'm familiar with all of those links and the EDMA and SPI sections in the TRM.
     
    Could you possibly answer some of the specific questions I have asked?
     
    Regards
    Robert
     
     
  • Robert,

    I have checked this with our McSPI HW team, this is the feedback:

    The hardware itself supports up to 48MHz. However, there are two “speeds” we are concerned with. The actual speed of the bus, which can run up to 48MHz, and the average speed over multiple receives. From the scope shots, we see the gaps in between transfers, which decreases the average speed of transfers. Chances are these “gaps” are caused by:

    1)      Software overhead

    a.  Even in low level programming, there will be some intrinsic delay related to the RX buffer, the fifo, the DMA, the ISR.       
                   The DMA doesn’t trigger until the SPI is empty, it takes a few cycles from the interrupt flag to occur before the CPU runs the first line of the ISR code, etc. 
    b.      In his case he seems to be using drivers, which normally are even more abstracted.  I can’t comment on what exactly is going on behind the scenes – the software may just wait for the RX empty flag is set before another receive or other conditions may also need to be met.
    2)      OS Scheduling
    a.       His hardware isn’t entirely dedicated to SPI, if he has some sort of OS that is in charge of scheduling, SPI interrupts may not have the highest priority so they may not be taken care of right away.
    b.      Having an operating system always adds latency, and a 70% efficiency is normal.


    If he wants to increase the speed, then he will need to pull away the abstraction layers and try accessing the IP directly.

    Regards,
    Pavel

  • We use DM8168. We have added EDMA support to omap2_mcspi.

    Now I try to use FIFO mode for duplex transmission.

    I am not shure how to setup the shared FIFO buffer for RX and TX in duplex mode.

    Have You got EDMA with FIFO mode running ?