cancel
Showing results for 
Search instead for 
Did you mean: 

stm32f769 OTG DMA HS peripheral mode locks up on input xfer > 1KB

TCoop.1
Associate II

I have an STM32F769NI discovery board. I am using USB in HS mode, OTG, in peripheral mode, CDC class. The goal is to move > 10MB/sec to a host while having enough time to concurrently bring in about that same amount of data over two SPI interfaces. Packet size is 512; transfer size wants to be as large as possible (64KB or more if possible). All works fine in non-dma mode (except for the data rate). When OTG DMA is enabled, transfers greater than 1024 bytes do not complete. Specifically, they are started, but (1) there is no xfer complete interrupt; (2) the size register is nonzero, indicating more data to be transferred, (3) the DMA register for the endpoint appears to show the original start address + the full length of the transfer (rounded up to the next longword boundary), and (4) no interrupts are pending. With non-DMA access, arbitrary lengths work fine (up to 16KB tested). The behavior and stopping point are the same whether the host is a Linux desktop through a USB hub or directly connected to a windows laptop.

The following log shows a successful 1K transfer, followed by an unsuccessful 1025 byte transfer. After the 1K transfer, I display USB registers of interest, where the DMA address (see the log for the initial values) implies complete but the size register implies another packet is needed.

The log shows xfers from SDRAM, though the behaviour is the same whether the xfer is from SRAM or SDRAM (though SRAM is much faster).

Any guidance would be appreciated. I can obtain more register values or more detailed logging information if needed. Thanks.

Logged Info with 1uS timestamps:

>> Last of several 1K xfers in rapid succession:

00:17.592548: USB xmit: ep129, 0xc0689240, len 1024, dma 1

00:17.592558: EP1 IN xfer size 0x00100400

00:17.592564: EP enable IN 1 CNAK

00:17.592684: IRQ: ep1 in, 00000001 (XFRC)

00:17.592697: USB xmit: ep1, 0x00000000, len 0, dma 1

00:17.592704: EP enable IN 1 CNAK

00:17.592776: IRQ: ep1 in, 00000001 (XFRC)

00:17.592783: CDC_Itf_TxDone ep 1

>> Start of transfer having length 1025. DMA addr 0xc0689240

43:02.274240: USB xmit: ep129, 0xc0689240, len 1025, dma 1

43:02.274250: EP1 IN xfer size 0x00180401

43:02.274256: EP enable IN 1 CNAK

>> no further activity; no xfer complete interrupt

> usbr (USB reg dump)

USB Registers:

   000 GOTGTCL ctl and status    0x030d0000

   004 GOTGINT interrupt reg     0x00100000

   008 GAHBCFG ahb cfg reg       0x0000002b

   00c GUSBCFG usb cfg reg       0x40002410

   010 GRSTCTL reset reg         0x80000400

   014 GINTSTS core int reg      0x04c08428

   018 GINTMSK int mask reg      0xc03c3804

   01c GRXSTSR rx stat/debug     0x01e60001

   024 GRXFSIZ rx FIFO size      0x00000200

   038 GCCFG   gen core cfg      0x00200000

   03c CID     core ID reg       0x00002100

Device Regs

   800 DCFG    device cfg        0x08200770

   804 DCTL    device ctl        0x00000000

   808 DSTS    device status     0x00283100

   810 DIEPMSK in endpt int msk  0x0000000b

   814 DOEPMSK out endpt int msk 0x0000202b

   818 DAINT   all endpt int     0x00000000

   81c DAINTMSK all endpt int msk 0x00030007

   834 DIEPEMPM in ep FIFO mpty   0x00000000

   838 DEACHINT each ep int reg   0x00000000

   83c ..MSK   each ep int msk   0x00000000

EP0:           In          Out

  DxEPCTL   0x00208000   0x80028000

  DxEPINT   0x000020d0   0x00000050

  DxEPTSIZ  0x00000000   0x60080018

  DxEPDMA   0x20202020   0x2000dd5c

  DTXFSTS   0x00000080   0x0000017u

EP1:           In          Out

  DxEPCTL   0x80488200   0x80098200

  DxEPINT   0x00002090   0x00000000

  DxEPTSIZ  0x00080000   0x00080200  << size suggests 1 more packet

  DxEPDMA   0xc0689644   0x2000a5a0  << DMA addr -> end of xfer

  DTXFSTS   0x00000174   0x00000080

  DIEPTXFs  0x01740280                << tx fifo size looks correct

EP2:           In          Out

  DxEPCTL   0x008c8008   0x00000000

  DxEPINT   0x00002010   0x00000000

  DxEPTSIZ  0x00000000   0x00000000

  DxEPDMA   0x20202020   0xb24e7820

  DTXFSTS   0x00000000   0x00000080

  DIEPTXFs  0x00000000

EP3: not active

EP4: not active

EP5: not active

EP6: not active

EP7: not active

EP8: not active

0 REPLIES 0