stm32-rs icon indicating copy to clipboard operation
stm32-rs copied to clipboard

Buggy SVD files for STM32F4 USB OTG peripherals

Open FLamparski opened this issue 5 years ago • 4 comments

I was trying to do some USB OTG programming. However it looks like not all relevant registers are exposed in this crate, or at least they are mislabelled, owing to some dodgy SVD files. For instance, FS_DIEPTXF0 appears to be missing from the crate but it looks like it might appear under the name FS_GNPTXFSIZ. This might not be the only inconsistency, if I come across any more I'll report them here as well.

Reading the STM32F446xx reference manual I'd expect FS_DIEPTXF0 to appear in the otg_fs_device module, and FS_HNPTXFSIZ in otg_fs_host. That they have the same offset in the OTG register block and its usage merely depends on the mode in which the core operates - device or host - is a question left to the designers of that peripheral.

FLamparski avatar Jan 02 '20 11:01 FLamparski

FS_DIEPTXF4 and FS_DIEPTXF5 appear to be missing completely; only FS_DIEPTXF{1,2,3} are exposed and their doc comments are wrong:

          <name>FS_DIEPTXF1</name>
          <displayName>FS_DIEPTXF1</displayName>
          <description>OTG_FS device IN endpoint transmit FIFO size
          register (OTG_FS_DIEPTXF2)</description>

From the manual:

image

(RM0390 pp 1143)

FLamparski avatar Jan 02 '20 11:01 FLamparski

FS_GRXSTSP_Device - OTG receive status read and pop register - is missing from the SVD. Only FS_GRXSTSR_Device is present, and that one does not pop the RX FIFO.

image

(RM0390 pp 1132)

FLamparski avatar Jan 02 '20 12:01 FLamparski

There are more bugs. I have fixed those which i found in https://github.com/stm32-rs/stm32-rs/pull/697, and there are probably even more.

Should we close this issue though?

Windfisch avatar Feb 07 '22 01:02 Windfisch