cancel
Showing results for 
Search instead for 
Did you mean: 

hard fault in USB CDC host

Mr. AK
Associate III

I"m using my Nucelo-H745ZI-Q board with HAL for USB with CDC. I'm hitting the hard fault at the host project from the USBH_CDC_Transmit() function. On debuggin, I can see that the phost (USBH_HandleTypeDef type) ->ActiveClass->pData has no valid data.

And the "phost->pclass[0]->ClassCode == phost->device.CfgDesc.Itf_Desc[0].bInterfaceClass"

is failing. On checking the structure values, Left side , it is CDC class value 2 while on the right side at the device side it is zero.

Also before this line, in the USBH_Init() function, we are setting the phost->ActiveClass = NULL.

Similarly, in the USBH_process function, the execution is going into only one cases of the

switch (phost->gState) , i.e., HOST_IDLE , which is initialized by default. So the USBH_process is essentially not gettind executed.

On briefing :

  1. The three functions; USBH_Init(), USBH_RegisterClass() & USBH_Start() are doing all the basic set-ups but not setting the gState. This is affecting the USBH_Process() fn.
  2. On checking the USBH_CDC_Transmit(), the ActiveClass of phost is not matching with that of the device of the phost.

Whenever I try to force change this by adding my code, it is resulting in other mismatch error.

Please tell me where I'm doing it wrong. Expecting for a reply soon.

0 REPLIES 0