cancel
Showing results for 
Search instead for 
Did you mean: 

SBSFU: Memory Fault while using USB High Speed Peripheral in SBSFU in STM32F730

JYeh.9
Associate III

Hi,

I am now trying to make my own SBSFU project to receive the firmware from the USB HS interface instead of the UART interface.

However, the USB related code caused the memory fault exception.

I've extended the size of MPU protection to 512KB with full access from address PERIPH_BASE(0x40000000UL) to cover the USB_OTG_HS_PERIPH_BASE(0x40040000UL).

But it doesn't solve the memory fault issue.

#define SFU_PROTECT_MPU_PERIPH_1_RGNV  MPU_REGION_NUMBER0
#define SFU_PROTECT_MPU_PERIPH_1_START PERIPH_BASE         /*!< Peripheral memory area */
#define SFU_PROTECT_MPU_PERIPH_1_SIZE  MPU_REGION_SIZE_512KB//MPU_REGION_SIZE_128KB
#define SFU_PROTECT_MPU_PERIPH_1_SREG  0x00U               /*!< All subregions activated */
#define SFU_PROTECT_MPU_PERIPH_1_PERM  MPU_REGION_FULL_ACCESS
#define SFU_PROTECT_MPU_PERIPH_1_EXECV MPU_INSTRUCTION_ACCESS_DISABLE
#define SFU_PROTECT_MPU_PERIPH_1_TEXV  MPU_TEX_LEVEL0
#define SFU_PROTECT_MPU_PERIPH_1_B     MPU_ACCESS_BUFFERABLE
#define SFU_PROTECT_MPU_PERIPH_1_C     MPU_ACCESS_NOT_CACHEABLE

With debugger step over checking, the following initialization of the USB HS interface didn't triggered the memory fault.

if(USBD_Init(&USBD_Device, &HID_Desc, 0) == USBD_OK){
  USBD_RegisterClass(&USBD_Device, USBD_KX_CLASS);
  USBD_Start(&USBD_Device);
}

It seems that the memory fault was triggered by the interrupt service routine: ​HAL_PCD_IRQHandler() and the USB data exchange in the USB emulation process.

Could somebody kindly help?

Thanks a lot

1 REPLY 1
Jocelyn RICARD
ST Employee

Hello,

just a guess: you also have USB registers mapped at 0x50000000, so using ARM_MPU_REGION_SIZE_512MB may help

Best regards

Jocelyn