cancel
Showing results for 
Search instead for 
Did you mean: 

How mix EVAL6470H-DISC example design code (IAR) with STM32CubeMX generated code

FF1
Associate III

Dear All,

I've loaded inside IAR the example design that came with this board after installing the stsw-spin004 library.

Now I've to add to this board an external rotary encoder, so I'll use the TIM4 because related pins are not used inside this board.

I've generated the Timer example design and opened the design inside the IAR IDE.

Now my trouble is how to integrate the two code in order to keep all working.

It is some official guide or references about this stuff?

Thank and regards.

Fabio

2 REPLIES 2

>>It is some official guide or references about this stuff?

No, it is more of an embedded programming porting task. ST uses a couple of different programming paradigms, and they're not easily interchangeable.

CubeMX generates rather obfuscated HAL code.

I'd suggest reviewing your TIM code with respect to the HAL examples under the CubeF1 trees for the TIM, and then write or port the code into your demo app.

With a better understanding of the HAL you might be able to cherry-pick the code in the CubeMX output that is salient.

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

Thank @Community member​ 

actually I'm exploring the example program concerning the EVAL6470H-DISC board, what I try to understand now is what type of standard/convention is used in this design example to work with the peripherals.

After some test I've discovered that from STM32CubeMX I can export design in HAL or LL, comparing the code generated from STM32CubeMX, only for set the TIM4 timer to work in encoder mode (x4), to the other code used into the EVAL6470H-DISC example seems to me that neither HAL or LL driver are used, so I'm searching some info about this point, but is rather difficult found a way, do you have some suggest?

My purpose is found a viable way to update the original demo code provided with the evaluation board in order to integrate it with the usage of the TIM4 in encoder mode so I'll we able (I hope) to drive the stepper in a synchro way to the pulse supplied by the external encoder.

Thank for your time, any further help will be very appreciated!

Best regards