2016-07-21 11:32 AM
Hi.
When I send data out via USB, the program goes to HardFault. I found out that this happens when the function below is executed:USBD_StatusTypeDef USBD_LL_SOF(USBD_HandleTypeDef *pdev)
{
if(pdev->dev_state == USBD_STATE_CONFIGURED)
{
if(pdev->pClass->SOF != NULL)
{
pdev->pClass->SOF(pdev);
}
}
return USBD_OK;
}
This function is defined in usbd_core.c file. Has anyone an idea what could go wrong here?
Thanks
2016-07-21 12:10 PM
Wouldn't it suggest thatpdev->pClass is NULL or at an inaccessible memory location? Or perhaps thatpdev->pClass->SOF isn't valid?
USBD_StatusTypeDef USBD_LL_SOF(USBD_HandleTypeDef *pdev)
{
if(pdev->dev_state == USBD_STATE_CONFIGURED)
{
if((pdev->pClass != NULL) && (pdev->pClass->SOF != NULL))
{
pdev->pClass->SOF(pdev);
}
}
return USBD_OK;
}
What does the Hard Fault state of the processor suggest is the problem?
2016-07-21 10:51 PM
Hi Clive.
When Fault occurs. IBUSERR bit is set in CFSR register. The fault occurs when this
pdev->pClass->SOF(pdev);
is executed. The SOF is not NULL at that moment. If you look to the attached picture, you can see the exact instruction where it faults. This is when BLX is executed.
________________ Attachments : Capture.JPG : https://st--c.eu10.content.force.com/sfc/dist/version/download/?oid=00Db0000000YtG6&ids=0680X000006HtlX&d=%2Fa%2F0X0000000aWe%2FeEM7N61haXZXhzL3Qn7iw.gdKFfxUKXICAa3M7cflhw&asPdf=false2016-07-22 04:19 AM