2015-11-30 01:22 AM
in file : STM32Cube_FW_F3_V1.3.0\Middlewares\ST\STM32_USB_Device_Library\Core\Src\usbd_ctlreq.c
Lines : 340, 345, 403:
case
USB_DESC_TYPE_CONFIGURATION:
if
(pdev->
dev_speed
==
USBD_SPEED_HIGH
)
{
pbuf = (uint8_t *)pdev->
pClass
->
GetHSConfigDescriptor
(&len);
pbuf[1] = USB_DESC_TYPE_CONFIGURATION;
}
else
{
pbuf = (uint8_t *)pdev->
pClass
->
GetFSConfigDescriptor
(&len);
pbuf[1] = USB_DESC_TYPE_CONFIGURATION;
}
break
;
…
if
(pdev->
dev_speed
==
USBD_SPEED_HIGH
)
{
pbuf = (uint8_t *)pdev->
pClass
->
GetOtherSpeedConfigDescriptor
(&len);
pbuf[1] = USB_DESC_TYPE_OTHER_SPEED_CONFIGURATION;
break
;
}
When, I define my descriptor directly in FLASH memory with const statement, an hard fault occurs because the instruction below attempts to write on a read only memory.
pbuf[1] = something_is_not_recommanded_here;
Why ST does this? The USB descriptors have been already set with right values.