2020-12-15 8:14 AM
Hello,
I am working with this board using STM32CubeIDE version 1.5.0. I would like to use the USART6 or UART7 peripheral. When I configure the UART 7 or USART6 peripherals from the .ioc file and generate the code I believe that the code generator should include a section to configure these peripherals in the MX_GPIO_Init function in main.c.
I believe that there should be some code generated that would include something like:
GPIO_InitStruct.Alternate = GPIO_AF8_UART7;
and a few other lines of code. After configuring these peripherals in the .ioc file however, the corresponding code does not appear in the MX_GPIO_Init function in main.c. I could add the code manually but the problem would be that an .ioc changes would overwrite this code I believe. Am I doing something wrong? I've attached the project file.
Thanks.
2020-12-15 8:42 AM
Looking into this a bit more CUBEIDE appears to generate the MX_GPIO_Init code when UART7 or USART6 are in disabled mode but does not generate the UART handle and the UART_Init code. When the peripherals are enabled, it appears to generate the UART handle and the UART_Init code but not the corresponding MX_GPIO_Init code.
I added the missing code to the MX_GPIO_Init function and I can confirm that UART7 works as a result.
2020-12-30 6:12 AM
Hi @SHarr.2 ,
The IP GPIO Configuration is generated under stm32f7xx_hal_msp.c file, in your case in the void HAL_UART_MspInit(UART_HandleTypeDef* huart) function.
You can check it and you will find the "GPIO_InitStruct.Alternate = GPIO_AF8_UART7;" well generated.
When your question is answered, please close this topic by choosing Select as Best. This will help other users find that answer faster.
Thanks, Khouloud
We’re moving the ST Community to a new platform to give you a better and more reliable community experience.