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.

MSP432E401Y: USB HOST MSC incorrect DMA handling

Part Number: MSP432E401Y
Other Parts Discussed in Thread: MSP-EXP432E401Y

Hello Support team,

I am developing portable optical drive (CD-ROM) controller and identified MSP432E401Y microcintroller as suitable for needed tasks.

Currently I am using MSP-EXP432E401Y LaunchPad as development platform plus recent MSP432 SDK (simplelink_msp432e4_sdk_3_40_01_02).

My development is based on provided no-rtos USBHMSC demo (C:\ti\simplelink_msp432e4_sdk_3_40_01_02\examples\nortos\MSP_EXP432E401Y\usblib\usbhostmsc).

The demo itself works fine with USB Flashdrive attached to to the LaunchPad.

Unfortunately this demo uses very limited set of SCSI commands and buffer sizes for managing the USB Flashdrive, so I've added needed additional SCSI commands for CD-ROM support and hit another problem - the DMA is not handling properly receiving ednpoint (so far TX endpoint does not encountering problems).

In USB Flashdrive demo, read buffersizes are usually multiple of 64 bytes (endpoint chunk size) and all DMA transfers copying full 64-bytes packets. In CD-ROM use case there are plenty of buffers that are bigger than 64 bytes, but not multiple of 64 bytes. When try to read such buffer size, the DMA transfer never ends... :(

I did some deeper dive into DMA setting/handling code in SDK and I am seeing that implementation is not done according slau723 documentation (processor TRM). In such cases the DMA is set correctly in MODE1 and number of chunks are properly rounded to cover the last partial chunk. The problem is that the TRM says that this last partial chunk must be handled in special way, but the USB stack code in SDK do not have such handling implemented... or at least I am still unable to find it during my debugging. In result, all chunks except the last partial one are properly copied into destination buffer and USB state machine is hanging in endless check for DMA end event that never happen.

If I round-up read request sizes to become multiple of 64 bytes, I am able to read needed data, but this is just ugly hack that may not workaround all such cases.

On top of this, there are cases when I am trying to read more than needed data chunk (to workaround DMA issue) and the first byte in receive buffer is overwritten with "0". The receive buffer is filled sequentially at portions of 64 bytes and the first byte seems to get overwritten (corrupted) at the end of the transfer. This again indicates to incorrect DMA state machine handling in SDK USB driver.

I've spent already few days debugging this problem and trying to fix the driver code, but there are few different state machines that handling USB stack and DMA transfers and I am still do not have the full picture of interactions (interrupts, states, flags, events...)  and can not identify the right place to insert dedicated handling of the last incomplete DMA chunk handling.

Searching Internet for similar problems does not gave me any results, so may be I am the first one that trying to use SDK USB library to read data chunks non-multiple of 64 bytes... and this is pretty standard case for CD-ROM.

Can you confirm my observations? If so, is there plan to fix SDK USB drivers for proper DMA handling according slau723?

... or may be to point me another example(s) or USB library or workaround that can be used as reference in my project?

Best Regards,

Dobromir Denchev

  • Hi,

    We will look into it and get back to you ASAP. Please bear with us.

    Thanks,

    PM

  • Hello PM,

    Is there any progress with this problem investigation?

    Can you confirm my observations? If so, is there plan to fix SDK USB drivers for proper DMA handling according slau723 or may be to point me another example(s) or USB library or workaround that can be used as reference in my project?

    Best Regards,

    Dobromir Denchev

  • Hello PM,

    What is the latest status of this problem investigation?

    Can you confirm my observations? If so, is there plan to fix SDK USB drivers for proper DMA handling according slau723 or may be to point me another example(s) or USB library or workaround that can be used as reference in my project?

    Best Regards,

    Dobromir Denchev

  • Hello PM,

    This is the 4th week without any reply on this topic.

    Is there any chance to get any update on reported problem?

    Best Regards,

    Dobromir Denchev

  • Dobromir,

    Apologies for the late response. I was unable to find you on outlook. Please shoot me an email and let's take the discussion there.

    BR,

    Seong

  • Hello Seong,

    My XID account was recently suspended, so tomorrow (once reach the office) will contact you from non-TI mail account to continue with this investigation.

    Best Regards,

    Dobromir Denchev

  • Dobromir,

    Our expert explained that we do not recommend the USB DMA on these parts, so unfortunately, we are unable to provide any support for this particular issue.

    I will be closing this thread. Please start a new one for any other queries.

    Thanks and best regards,

    Seong

  • Hello Seong,

    Your answer really confusing me... Do you mean that all USB data transfers have to be done by CPU instead of DMA?

    This is the first processor that I am seeing to have such limitation. In the same time the TRM clearly describes how the DMA have to be used in case of partial transfers, just provided by TI examples do not follow TRM description.

    If it is not recommended to use DMA for USB data handling, can you provide me with recommended configuration for USB MSC HOST example to try it?

    Best Regards,

    Dobromir Denchev

  • Dobromir,

    As you may know, the MSP432E401 and the TM4C are the same silicon, and I came across this thread that shows similar issues. 

    We also don't have an example, so again, I recommend not using it. 

    BR,

    Seong

  • Hello Seong,

    USB2.0 implementation without using DMA is a disaster for the CPU.

    The DMA behaves pretty well in TI USB MSC example with the only remark that all transfers in this example are multiple of 64 bytes (endpoint size).

    the DMA HW itself is designed to handle also transfers with total length non-multiple of desired chunk size, i.e. the last chunk will have less bytes than the others. This is described in many places in TRM.

    Reported problem is not with DMA reliability, missing events or any other corruption, but with missing implementation of described in TRM mechanism for handling such transfers.

    As the other people stating on the threads that you are referring above, the state machines that are implemented in TI USB MSC example are too "interlaced" with each other and there is no state diagram that to help to identify the right place to add missing DMA management code piece.

    Analyzing in details these state machines without proper description will take a lot of time and effort, so I hoped to get some directions from TI how to add missing SW handling... rather than advice "do not use DMA at all"...

    You mentioned that the same DMA IP is used across different processors, so may be in some of their examples there is already added proper DMA handling according TRM description...

    If there is no plan TI to update MSP432 SDK with proper DMA handling, at least may reuse some code excerpts from other SDKs or to give some state diagrams or directions where to add DMA fixes.

    Best Regards,

    Dobromir Denchev

**Attention** This is a public forum