cancel
Showing results for 
Search instead for 
Did you mean: 

USBX DFU crashes dereferencing a NULL pointer

DmitryR
Associate III

Good day all,

 

USBX crashes at line 171 of the file ux_dcd_stm32_initialize_complete.c, as the dcd structure is not initialized at this point. I have tried this on two different MCUs, U575 and H753. In concert, on the H753 the code generator does not generate the call to MX_USBX_Device_Init() and in both cases the call to HAL_PCD_Start() is not generated as well, so this functionality will not work out of the box either. I suppose that I should insert some more calls for initialization, does anyone have idea?

 

Regards,

Dmitry

4 REPLIES 4
FBL
ST Employee

Hi @DmitryR 

First, would you attach IOC file to reproduce for H753?

Second, do you confirm this line is failing https://github.com/STMicroelectronics/x-cube-azrtos-h7/blob/3e4c2f475bd18eaaec0c74b2719c9e9e19f7d66e/Middlewares/ST/usbx/common/usbx_stm32_device_controllers/ux_dcd_stm32_initialize_complete.c#L171C1-L172C1

Which board are you using?

To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.


DmitryR
Associate III

Hi @FBL ,

 

yes, exactly this string. I use STM32H753I-EVAL2 and NUCLEO-U575ZI-Q.

 

Regards,

Dmitry

FBL
ST Employee

Hi @DmitryR 

MX_USBX_Device_Init() is called in app_usbx_device.c

Second, USBX doesn't use HAL_PCD_Start(). Check this article How to implement USBX in standalone mode - STMicroelectronics Community

To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.


DmitryR
Associate III

@FBL ,

 

What you are writing here contradicts to what is written after the link. This document states to add both MX_USBX_Device_Init() and HAL_PCD_Start(). In any case it describes only one particular case. For example I use USB_FS and not USB_HS and not in OTG mode. Because of this all references to HS and OTG do not work for me. OK, I have just omitted usb_otg.h and corrected HS to FS. By the way, the code generator for U575 generates the call to MX_USBX_Device_Init(). It is simply terrible that the same functionality is generated differently in different bundles. 

 

But it still does not work because the function _ux_device_stack_class_register() returns an error. In concert, if I add add one anther class as it intended to be (storage class) it returns error even earlier, at ux_device_stack_initialize().

 

It is interesting if you understand that all this makes the code generator virtually unusable? The main use of the code generator is a quick success, a work "out of the box". Your engineers were too lazy to program it to the end and the fact that the last 10% of the code generation must be done manually destroys all the benefit. It makes you to write an additional documentation and to answer tons of questions here. And it still does not work. 

 

Regards,

Dmitry