2015-09-18 02:39 PM
2015-09-19 01:26 AM
Hi.
I do that initialization using STM32CubeMX software. There you have a graphical interface to select all those things (number of conv., ranks, priorities,...). Then Cube automatically generates C code with all initialization. Then you write your code between ''User code begin'' and ''User code end'' comments. Whenever you want to change anything within your confuguration, you simply go to CubeMX, make a chenge and generate a new code. But anything that was written between mentioned comments will stay as it was - your code will stay untouched.Now, there are always some bugs with code generated by Cube. Let say, I use on F3 part two ADCs. On each I have 2 differential channels and one (third) single-ended channel. For ADC1 code from Cube is OK, but for ADC2 it configures Channel 1 as differential (which is OK) and both Channel 2 and 3 as single-ended (only 3 should be single-ended). So you have to be careful with a code from a Cube.I think Cube is OK when you want just to try something, because you have your initialization code done in seconds. But for something serious I think you should write this on your own. But you can always look how Cube make something and you can help your self with that.Otherwise, ''rank'' means consecutive number of conversions on particular ADC.2015-09-20 01:21 AM
Thanks - I hadn't thought of using cubeMX as ''inspiration'' when hand modifying/writing code, that works well.
I think another reason people can't totally rely on cube is that some of the option boxes in some of the dialogs are a bit cryptic unless you are an expert. That why its a pity you can open up an example project in cubeMX and see how the GUI was configured to generate the init code. The cube as inspiration approach, is the next best thing.