AnsweredAssumed Answered

STM32F series peripheral syntax

Question asked by Vincet.Jay on Dec 19, 2016
Latest reply on Dec 20, 2016 by Clive One


I need to come up to speed quickly on the STM32F4 series processors. I have been in embedded development for a number of years and have experience with Renesas, PowerPC, and PIC32 processors, etc and now I need to know about ST processors.


I hope I am not asking seriously stupid question but I really would like to find some simple sample code for GPIO, ADC, timers, etc. I have looked through the ST site and I am sure I missed something but I feel like instead of sipping I am being drowned by a fire hose. I am setting up the device using STM32Cube but I really would like some example code for the peripherals I listed above and others. I looked in the programmer's manual thinking it would list commands and syntax for setting up GPIOs, etc but found nothing.


I have found some snippets of code here and there but some of it is confusing. For instance the following line is supposed to OR-IN GPIOB pin 6 as an output  but the shift looks wrong to me, looks like 12 instead of 6 bits.

GBIOP->MODER |= 0x01 << (2*6);      //Set pin 6 as digital out.


So where does one find syntax for setting up peripherals?


Sorry to come off as such a noob, but that is how this old gray haired engineer feels right now.