cancel
Showing results for 
Search instead for 
Did you mean: 

Question about pUserData field on HAL

dimercur
Associate II

I am developing in C++ on a STM32U5, with HAL and was trying to figure how to embed interrupt handling in a class.

So I've questioned ChatGPT and DeepSeek for a solution and both gave an answer using pUserData field for storing object reference.
pUserData is a field provided by any handler (like UART_HandleTypeDef) and ... I do not have such field with my version of HAL that CubeIDE used for building my project.

I've pinpointed that problem to DeepSeek that gave me this answer:

Okay, the user mentioned that the HAL handlers don't have a pUserData field. Hmm, I need to recall which STM32 HAL versions include that. Oh right, older versions might not have it, especially before HAL introduced the MSP layer with user data pointers.

So, is there a version of HAL with that field ? My version of HAL seems not so old (and U5 family is rather new), so how much recent should be HAL version to have this field ? Or both AI are totally dumb ?

10 REPLIES 10

> I am dealing with handle, like one created out of UART_HandleTypeDef. So, is there any version of HAL where such data structure defines a pUserData field ? 

Still no.

If you feel a post has answered your question, please click "Accept as Solution".