SWEN 563
STM32 CubeMX
SWEN 563 STM32 CubeMX Aux Development Tools Parametric searching - - PowerPoint PPT Presentation
SWEN 563 STM32 CubeMX Aux Development Tools Parametric searching vendor lists for peripherals/ footprints / memory / cpu types / etc gives only half the story of what resources are available It pays to check out the whole ecosystem
STM32 CubeMX
gives only half the story of what resources are available
with an architecture / platform / vendor choice. Not just the data sheets.
(web based IDE:energia, Low power simulation, capacitive sensing setup software etc..)
Most vendors supply a “Pin configuration Tool” or similar.
Corollary to development:
configuration tool is like C - a higher level language that abstracts away the details of what’s going on under the hood, freeing the programmer to think at a more conceptual level.
development or sample boards. TI: PinMUX tool; Microchip: Harmony, Freescale: MCUXpresso; Renesas: Smart Configurator;
STM32CubeMX is a graphical tool that allows a very easy configuration of STM32 microcontrollers and the generation of the corresponding initialization C code through a step-by-step process.
constraints
○ A project tree template for you to use with your tool chain ○ C code (.c and .h) files generated that contain the code needed to configure and initialize the controller the way you set it up in the tool. Including main.c
group for verification of the layout or board design. Common for errors between electrical and firmware to crop up, unless documentation goes back and forth well.
STM HAL / Low Level Driver User Manual: UM1884
1
Select a Part or board
Determine where you want to start? Don’t forget to consider the chips physical footprint. If the design is already setup and a board profile exists - it may be easier to start with a fully defined board and delete the sections that do not apply to your design or implementation
Setup Clocks
Setup the clocking system for the device. Most peripherals will require configuration here - NOTE the clock prescale dividers for the peripherals (timers)? Look familiar? Some devices (USB for example) require specific clocking configurations or they won’t function 2
Setup Pins
Clicking on individual Pins Allows you to select their primary function from all available functions. This shows you in a much better way what pin can do what function. Also give your pins MEANINGFUL names for their function 3
Setup Peripherals
Starting with SystemCore GPIO section. You can setup PIN physical details. Select and enable the additional peripheral devices you wish to use. And configure the parameters for each peripheral of interest. 4
Generate Code
First: In project Manager make sure that the Project type is set for Keil and the names and directories make sense. Next: Generate Code will produce a complete project that configures and initializes your defined peripherals, and can launch the IDE. 5
designated areas (between matching BEGIN / END comment lines)
generated by the tool, and green code by the programmer. Both sections get compiled into the app.
interact with HTML.
By keeping to your code to designated sections only
skeleton without losing any work you may have
control etc...) /* Initialize all configured peripherals */ MX_GPIO_Init(); MX_DMA_Init(); MX_USART2_UART_Init(); MX_TIM2_Init(); /* USER CODE BEGIN 2 */ sprintf((char *)transmitBuffer,"Hello World!\r\n"); HAL_UART_Transmit_IT(&huart2, transmitBuffer, 32); HAL_GPIO_WritePin(LD_G_GPIO_Port, LD_G_Pin, GPIO_PIN_SET); HAL_TIM_IC_Start_DMA(&htim2, TIM_CHANNEL_1, (uint32_t*) captures, 2); /* USER CODE END 2 */