cancel
Showing results for 
Search instead for 
Did you mean: 

Where to find documentation on GPIO_InitTypeDef ?

jefazo92
Associate III

Hi everyone,

I am student who is new to STM32. I am trying to understand how to program the MCU and noticed GPIO_InitTypeDef data type. I went into the reference manual but did not find anything about it. Is there a document including all the functions a user can apply to the STM32 (and hopefully find information on GPIO_InitTypeDef) ? Thank you in advance.

17 REPLIES 17

Oh. How did you manage link to the inidividual post?

Jan

@Community member​  Thank you for your reply. Where can I find more information about this ? Did you find this information in the STM32G4 HAL doc ? Or did you know this from previous experience with microcontrollers ?

Using the link in the notification email when someone replied to it.​

I see, thanks.

Jan

> Where can I find more information about this ? Did you find this information in the STM32G4 HAL doc ?

> Or did you know this from previous experience with microcontrollers ?

As I've said, this is general C, so the source is any C textbook. Primary source is the C standard, e.g. C99, 6.7.8 Initialization #21:

If there are fewer initializers in a brace-enclosed list than there are elements or members

of an aggregate, or fewer characters in a string literal used to initialize an array of known

size than there are elements in the array, the remainder of the aggregate shall be

initialized implicitly the same as objects that have static storage duration.

The need for a safe initializer for the struct is underpinned by the fact that uninitialized local init-structs were perhaps the most common problem with the ST "libraries" encountered on this forum in the past, before CubeMX started to generate this ={0} initializer.

SPL provided initialization functions for the structs, and its usage was written in SPL's manual, but nobody read it. Eg. in a randomly chosen https://www.st.com/content/ccc/resource/technical/document/user_manual/59/2d/ab/ad/f8/29/49/d6/DM00023896.pdf/files/DM00023896.pdf/jcr:content/translations/en.DM00023896.pdf chapter 2.3 Peripheral initialization and configuration :

[...] Configure only a few members of the structure: in this case modify the

PPP_InitStructure variable that has been already filled by a call to the

PPP_StructInit(..) function. This ensures that the other members of the

PPP_InitStructure variable are initialized to the appropriate values (in most cases

their default values).

But even SPL strived to keep the "safe values to be zero" unwritten rule, as that increased the chance that even if the user did not fill in the whole init-struct, as long as it was global, it was zeroed by the rules of C.

Cube continued this practice and then as I've said CubeMX included the explicit initializer, but I'm not sure it's documented anywhere.

As you've might have guessed, I don't use any of these "libraries".

JW

Thank you for your reply @berendi​ and everyone else for your comments and support, I was looking at the docs (reference manual) provided in "Sofware and Tools" for the NUCLEO-G474RE but the HAL document was not included there. It is really frustating that not all documents are included in one same section (this goes for all MCUs) making the user to search endlessly until the document is found in another section not specific to the MCU being used.

Right clicks on the data types don´t highlight them automatically... Try a left click first and then a right click afterwards. Maybe that helps...

/Charly