AnsweredAssumed Answered

STM32F302xC is in wrong section in “stm32f3xx_hal_pcd_ex.c” file

Question asked by ln.thierry on Dec 1, 2015
Latest reply on Dec 8, 2015 by ln.thierry
Hi, I use the STM32F3xx_HAL_Driver : Version V1.1.1 / 19-June-2015.
I use STM32F302RCT6 and STM32F303RCT6 devices and the USB device doesn’t work because the definitions of these MCU don’t match with the documentation ( RM0316 and RM0365).
Note: Info on RM0313 Rev4 page 807 table 105 is incomplete.
I’ve found some incorrect definitions on “stm32f3xx_hal_pcd_ex.c” file:
STM32F302xC is in wrong section, the MCU has the same USB_FS than STM32F303xC !
Line 148 :
#if defined(STM32F303xC)                         || \
    defined(STM32F303x8) || defined(STM32F334x8) || \
    defined(STM32F301x8)                         || \
    defined(STM32F373xC) || defined(STM32F378xx)
line 204:
#if defined(STM32F302xE) || defined(STM32F303xE) || \
    defined(STM32F302xC)                         || \           <---- wrong section for this MCU !
PCD_WritePMA, PCD_ReadPMA functions depend on access scheme type, so I decided to re-write these functions to select automatically the right access method. To identify this method, I write a known symbol on USB PMA buffer base address + 2.
On 1x16bits/word devices, this symbol can't be written and the read bytes are always set to zero.
On 2x16bits/word devices, the read bytes match with the symbol.
To optimize the access, I use DMA to transfer PMA buffer to (or from) the USB user buffer.
I attach the modified files with this post!