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.

AM6442: McSPI DMA mode

Genius 3186 points

Part Number: AM6442
Other Parts Discussed in Thread: SYSCONFIG

Hi

May I have question about McSPI DMA mode?

--

Q1 : the MCU+SDK sample "mcspi_loopback_dma",

I think this program is use DMA to transfer memory(gMcspiTxBuffer) to TX buffer, RX buffer to memory(gMcspiRxBuffer).

but I think it seems not set UDMA.

Is there anything UDMA setting in API?

Or DMA mode is autoatically transfer FIFO to memory?

--

Q2 : 

In TRM McSPI,

I could find only DMA request, not find detail of DMA mode.

Is the DMA mode means "use DMA request"?

And this DMA request is signal to UDMA?

--

Q3 :

Is there any test/report of McSPI's RXbuffer read time?

My customer want to know the read time of 64 byte using DMA.

Thanks,

GR

  • Hi GR,

    Please allow us sometime to get back to this thread.

    Thanks,

    Vaibhav

  • Hi Kumar,

    Thanks for your supportiong.

    I am glad that you let me know if there is any information.

    Best regards,

    GR

  • Hi GR,

    Apologies in delayed responses as I was occupied in some high priority task.

    Please expect responses in a day and thank you for your patience.

    Thanks,

    Vaibhav

  • Hi GR,

    I have noted your query.

    As far as UDMA is concerned, its is configured via the SysConfig tool. More details about it can be discovered in the files generated by the SysConfig tool.

    I am attaching here few snippets which will help direct you in right direction.

    Please tell me if this helps.

    Thanks for your patience.

    Regards,

    Vaibhav

  • Hi vaibhav,

    Thanks for your information.

    I understand about UDMA.

    And Is there any information about McSPI RXbuffer read time?

    Q3 :

    Is there any test/report of McSPI's RXbuffer read time?

    My customer want to know the read time of 64 byte using DMA.

    Or the buffer is allocated in MSRAM?

    If correct, we could read few CPU clock?

    In linker command file

    Best regards,

    GR

  • Hi GR,

    For latency, I have measurement of the MCSPI transfer API. Please find it below.

    In case you need some specific latency please let me know, I would be happy to provide the same.

    To check if a particular buffer is in MSRAM or not you can simply go and open up the memory allocation tool in CCS. From here onwards you can check where the buffer is allocated in one of the sections of the MSRAM. Given below is a snapshot of where you can find the memory allocation tool option and the window when it opens.

    I hope this helps, thanks for your patience.

    Regards,

    Vaibhav

  • Hi Vaibhav,

    Thanks for your supporting.

    And sorry to late reply.

    In case you need some specific latency please let me know, I would be happy to provide the same.

    Thank you.

    I show that I want to know specific latency.

    To check if a particular buffer is in MSRAM or not you can simply go and open up the memory allocation tool in CCS. From here onwards you can check where the buffer is allocated in one of the sections of the MSRAM. Given below is a snapshot of where you can find the memory allocation tool option and the window when it opens.

    In MCU+SDK spi roopback (R5F) project,

    there is no pull down buttun in MSRAM.

    Is there setting I should do?

    Best regards,

    GR

  • Hi GR,

    I have taken note of your concerns.

    Please expect responses in few business days.

    Thanks for your patience.

    Regards,

    Vaibhav

  • Hi GR,

    Please expect responses within a day.

    Thanks for your patience.

    Regards,

    Vaibhav

  • Hi GR,

    I show that I want to know specific latency.

    Okay I will compute the latency for receiving 8 bit data for one time.

    In MCU+SDK spi roopback (R5F) project,

    there is no pull down buttun in MSRAM.

    Is there setting I should do?

    I believe there is no additional setting required. This is interesting, I will double check at my end as well.

    So turns out that it should show.

    Can you please click on the small icon on the top panel titled as "Expand ALL"

    Tell me if this also fails to work for you.

    Other steps I would like you to try is restarting CCS and closing and reopening the memory allocation tool.

    Looking forward to your response on this.

    Meanwhile I will start computing latency as mentioned above in sometime.

    Regards,

    Vaibhav

  • Hi Vaibhav,

    Okay I will compute the latency for receiving 8 bit data for one time.

    Thank you. I will wait.

    Can you please click on the small icon on the top panel titled as "Expand ALL"

    Tell me if this also fails to work for you.

    Other steps I would like you to try is restarting CCS and closing and reopening the memory allocation tool.

    Looking forward to your response on this.

    I could not see inside of MSRAM by push "Expand ALL"

    I tried re-inport CCS project from MCU+SDK (v9.01), but not works.

    Best regards,

    GR 

  • Hi GR,

    Since you are seeing that the dropdown is not coming, I will try to recreate this by using the same CCS version and MCU PLUS SDK for AM64x.

    I think CCS 12.5 and MCU PLUS SDK 9.1 should do.

    Please allow me a day to recreate this.

    Please expect responses within a day.

    Thanks for your patience.

    Regards,

    Vaibhav

  • Hi GR,

    I have recreated the issue, and I am also not able to see the dropdown option/expand all also does not work for MSRAM.

    Just a heads up this issue does not persists in MCU PLUS SDK AM64x version 9.0 and below. It is only seen in 9.1 and above.

    I have raised a JIRA for this and will update here as we proceed to fix this.

    Workaround

    Alternatively, I would like you to look at this file called "mcspi_loopback.Debug.map".

    It is present under Debug/

    Once you have opened this file, you will be able to see where the allocation happens, for example if I want to see where gMcspiTxBuffer

    is allocated, then I can simply do a search and figure out the same.

    Please look at the below attached screenshot for an example.

    I hope this explanation helps you out.

    I am onto computing latency as promised earlier.

    Thanks for your patience.

    Regards,

    Vaibhav

  • Hi Vaibhav,

    Thanks for your information.

    I will check .map file.

    I am onto computing latency as promised earlier.

    Thank you.

    I will be waiting.

    Best regards,

    GR

  • Hi GR,

    Earlier I had interfaced an external sensor via MCSPI, so I am going to read a byte from it, get the latency and update here within a day.

    Regards,

    Vaibhav

  • Hi GR,

    I have come up with latency calculations for reading 1 byte or 8 bits of data.

    Basically the read operation as requested by you.

    So the latency has an interesting number.

    Since microseconds computation was very broad hence I computed the cycles or more formally the CPU Clock cycles.

    Please check the attached screenshot. 

    Turns out for the very first 8 bits read, the cpu clock cycles is about 218 every single time, but for the rest of the 8 bit reads it is showing an average of 168 cpu clock cycles.



    For your more information,

    To compute the time (in microseconds) the formula is as simple as = CPU CLOCK CYCLES * (1 / frequency of core)

    In this case, I am using the R5F core, hence the time in microseconds =  168 * (1 / 800) = 0.21 microseconds on average

    And for the very first read it is 218 cpu clock cycles or 0.2725 microseconds.




    Here is the part in code where it reads the 8 bits of data. This API is available under mcu_plus_sdk_AM64X_path > source > drivers > mcspi > v0 > mcspi_v0.c


    static inline uint8_t *MCSPI_fifoRead8(uint32_t  baseAddr,
                                    uint32_t  chNum,
                                    uint8_t  *bufPtr,
                                    uint32_t  transferLength,
                                    uint32_t  dataWidthBitMask)
    {
        uint32_t        i, rxData;
        uint32_t cycleCountBefore, cycleCountAfter, cpuCycles; // added for latency compute
    
        /* Read the data from RX FIFO for 8-bit transfer */
        for(i = 0; i < transferLength; i++)
        {
            CycleCounterP_reset();  // added for latency compute
            cycleCountBefore = CycleCounterP_getCount32(); // added for latency compute
    
            rxData = MCSPI_readRxDataReg(baseAddr, chNum);
    
            cycleCountAfter = CycleCounterP_getCount32(); // added for latency compute
            if(cycleCountAfter > cycleCountBefore) // added for latency compute
            {
                cpuCycles = cycleCountAfter - cycleCountBefore; // added for latency compute
            }
            else
            {
                cpuCycles = (0xFFFFFFFFU - cycleCountBefore) + cycleCountAfter; // added for latency compute
            }
    
            printf("Total number of cycles for reading 8 bits is: %d \r\n", cpuCycles); // added for latency compute
    
            rxData &= dataWidthBitMask;         /* Clear unused bits */
            *bufPtr++ = (uint8_t) rxData;
        }
    
        return (bufPtr);
    }




    Happy to help you Slight smile

    Regards,

    Vaibhav

  • Hi Vaibhav,

    Thank you very much!

    I understand it.

    Best regards,

    GR