Skip to main content
MSuhe
Associate III
May 9, 2019
Solved

STM32L476: OTG_FS: IN endpoint FIFOx transmit RAM start address is word address or byte address aligned to 32-bit memory location

  • May 9, 2019
  • 6 replies
  • 2195 views

Can someone please clarify if the IN endpoint FIFOx transmit RAM start address part of OTG_DIEPTXFx register should be "word address" or "byte address aligned to 32-bit boundary".

We are currently treating this as "word address", inline with what STM32CubeMx does and also libopencm3 USB stack. But, we are having some issues with FIFO corruption and suspect IN endpoint FIFOx transmit RAM start address is not "word address" as it is not explicitly specified as word address anywhere else in reference manual.

I have also attached the snapshot of the register description from STM32L476 reference manual can someone please confirm what is correct?

This topic has been closed for replies.
Best answer by waclawek.jan

> If the addresses are totally invalid, shouldn't it just crash or fail to communicate of IN endpoint 1 ?

I don't know how does the HW behave when you misconfigure it. It may quite well simply ignore the highermost bits. That would make your EP0 Rx buffer to be at word address 0x000, the same as the Tx buffer. If Rx and Tx don't overlap in time - which is often the case for EP0 - then the FIFO buffers can overlap and everything would seemingly work.

> Your statement is valid for STM32F411 OTG_FS as well ?

Yes, it's the same Synopsys DWC2 OTG IP. There are subtle differences as different versions of the IP are used, but this is a major feature so it's the same.

JW

6 replies

waclawek.jan
Super User
May 9, 2019

Every FIFO-related value in the OTG registers is in 32-bit words, i.e. the address is word address (byte address / 4).

  

JW

MSuhe
MSuheAuthor
Associate III
May 9, 2019

Thanks for your response. Your statement is valid for STM32F411 OTG_FS as well ?

MSuhe
MSuheAuthor
Associate III
May 9, 2019

Hi Jan,

Can you please share your inputs to above queries.

Regards,

Suhel

waclawek.jan
waclawek.janBest answer
Super User
May 9, 2019

> If the addresses are totally invalid, shouldn't it just crash or fail to communicate of IN endpoint 1 ?

I don't know how does the HW behave when you misconfigure it. It may quite well simply ignore the highermost bits. That would make your EP0 Rx buffer to be at word address 0x000, the same as the Tx buffer. If Rx and Tx don't overlap in time - which is often the case for EP0 - then the FIFO buffers can overlap and everything would seemingly work.

> Your statement is valid for STM32F411 OTG_FS as well ?

Yes, it's the same Synopsys DWC2 OTG IP. There are subtle differences as different versions of the IP are used, but this is a major feature so it's the same.

JW

MSuhe
MSuheAuthor
Associate III
May 9, 2019

Thanks a lot for your inputs.