cancel
Showing results for 
Search instead for 
Did you mean: 

STM32F411RE Problems

martin239955
Associate II
Posted on August 16, 2015 at 20:22

Hello,

I try to send a message out via uart, every time I press a button. The init of uart works, because there I send the first message, but if I would do that in the main it brakes every time in the HAL_GPIO_INIT(...).

Here you find my complete project: 

https://www.dropbox.com/sh/83720kxybf8x6vy/AAA5IBzTlU1vZplmTeblV5ZTa?dl=0

The second question: I init the gpios for the uart in the gpioInit() function, but I would do that in the void HAL_UART_MspInit(UART_HandleTypeDef *huart). But when I do that it doesn't work. Why?

Why I have to include the complete ''stm32f4xx_hal.h'' and not only the ''stm32f4xx_hal_usart.h2''?

I hope someone can help me with this questions. 🙂
3 REPLIES 3
Amel NASRI
ST Employee
Posted on August 18, 2015 at 11:47

Hi marmsoler.martin,

The init of uart works, because there I send the first message, but if I would do that in the main it brakes every time in the HAL_GPIO_INIT(...).

How exactly? Do you have a HardFault? Did you tried to debug your project?

The second question: I init the gpios for the uart in the gpioInit() function, but I would do that in the void HAL_UART_MspInit(UART_HandleTypeDef *huart). But when I do that it doesn't work. Why?

You may start with a project that you generate using CubeMX. It will initiate the used peripheral and needed GPIOs. Then you can add your processing functions for data transfer.

Why I have to include the complete ''stm32f4xx_hal.h'' and not only the ''stm32f4xx_hal_usart.h2''

stm32f4xx_hal.h is the header file associated to stm32f4xx_hal.c that contains the common functions used in HAL projects. 

-Mayla-

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.

martin239955
Associate II
Posted on August 23, 2015 at 10:38

The first problem I solved, I gave as argument a false value.

You may start with a project that you generate using CubeMX. It will initiate the used peripheral and needed GPIOs. Then you can add your processing functions for data transfer.

 

No I made with eclipse a stm32f4xx project, not for a specific board. There was any gpio initilised

stm32f4xx_hal.h is the header file associated to stm32f4xx_hal.c that contains the common functions used in HAL projects.

 

But for what I need the stm32f4xx_hal_tim.h? Are these header files useless?

Posted on August 23, 2015 at 11:13

The scheme adopted here is to use some defines, and conf.h type arrangement at a project level, to pull into all the needed/unneeded include files, using a single #include at the project file level. This unified approach while taxing the compiler with a little more, and sometimes pointless, work does save us from having to cherry pick individual include files to make specific parts of the project build. Some compilers deal with this using pre-compiled header, and the linkers are usually pretty good a jettisoning dead-code, often down to the function level with the right settings.

The include files are also fashioned to prevent multiple inclusion. C++ compilers get really grumpy about redefinition.

I'd guess I'd review some of the project templates to understand the mechanics.

Tips, buy me a coffee, or three.. PayPal Venmo Up vote any posts that you find helpful, it shows what's working..