cancel
Showing results for 
Search instead for 
Did you mean: 

Combining Firmware Examples

GreenGuy
Senior III
Posted on August 16, 2016 at 02:09

I have the example projects compiling, loading, and running from the F4xx firmware repository and it works perfectly.  I am using the lwip from project > application and wish to add control over a PWM output.  I took example code from the TIMOUPUT example after compiling and running as a stand-alone project and it works great.  Very easy to follow.  However when I move the init code into the lwip project the TIM3 outputs are not working.  I moved everything into main to start with just like it sits in the TIMOUTPUT example and watched during debug to see that the TIM3 registers are not changing from the default power up state after the HAL init call.  The only thing that I can see different between the two projects prior to the TIM3 init code is the startup_stm32f429xx.s files have slightly different heap and stack sizes.  Has anyone tried merging example code with success or has anyone run into trouble and fixed it.  I am stuck. 

2 REPLIES 2
michaelkotthaus9
Associate II
Posted on August 16, 2016 at 09:57

Watch out, that the initialization order is correct. For example: the clock of a peripheral unit must be initialized before any register is set.

Also, if you combine example code, the second initialization code can overwrite the inititalization code of the first...

GreenGuy
Senior III
Posted on August 18, 2016 at 02:16

Solved!

I was able to create a cubemx project using the nucleo board template matching my board and then adding files from the LwIP project (carefully!) and resolving differences between the example applications and the code from cubeMX HAL implementations.  So now I am able to combine the LwIP with a timer example and change PWM parameters from a webpage.  The problem for the most part is due to the fact that the repository examples were not derived from cubeMX generation.